@squiz/resource-browser 3.1.0-rc.1 → 3.1.0-rc.2
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/CHANGELOG.md +7 -0
- package/lib/MainContainer/MainContainer.js +1 -1
- package/lib/ResourceBrowserInlineButton/InlineLoadingErrorState/InlineLoadingErrorState.js +1 -1
- package/lib/SourceDropdown/SourceDropdown.js +1 -1
- package/lib/index.css +0 -4
- package/package.json +1 -1
- package/src/MainContainer/MainContainer.spec.tsx +10 -1
- package/src/MainContainer/MainContainer.tsx +1 -1
- package/src/ResourceBrowserInlineButton/InlineLoadingErrorState/InlineLoadingErrorState.tsx +1 -1
- package/src/SourceDropdown/SourceDropdown.tsx +1 -1
package/CHANGELOG.md
CHANGED
@@ -46,7 +46,7 @@ function MainContainer({ title, titleAriaProps, allowedTypes, sources, selectedS
|
|
46
46
|
// MainContainer will either render the source list view if no source is set or the plugins UI if a source has been selected
|
47
47
|
return (react_1.default.createElement("div", { className: "relative flex flex-col h-full text-gray-800" },
|
48
48
|
react_1.default.createElement("div", { className: "flex items-center py-3 pl-6 pr-10 min-h-[68px]" },
|
49
|
-
react_1.default.createElement("h2", { ...titleAriaProps, className: "text-xl leading-6 text-gray-800 font-semibold mr-6" }, title),
|
49
|
+
react_1.default.createElement("h2", { ...titleAriaProps, className: "text-xl leading-6 text-gray-800 font-semibold mr-6" }, title?.charAt(0).toUpperCase() + title?.slice(1).toLowerCase()),
|
50
50
|
plugin && selectedSource && (react_1.default.createElement(react_1.default.Fragment, null,
|
51
51
|
plugin.createHeaderPortal && react_1.default.createElement("div", { ref: setHeaderPortalRef, className: "squiz-rb-plugin" }),
|
52
52
|
!plugin.createHeaderPortal && sources.length > 1 && (react_1.default.createElement(SourceDropdownContainer_1.default, { isCollapsed: false, onExpand: () => { } },
|
@@ -10,7 +10,7 @@ const sds_1 = require("@squiz/sds");
|
|
10
10
|
const InlineLoadingErrorState = ({ title, titleAriaProps, onClose, onRetry, isLoading, error }) => {
|
11
11
|
return (react_1.default.createElement("div", { className: "relative flex flex-col h-full text-gray-800" },
|
12
12
|
react_1.default.createElement("div", { className: "flex items-center py-3 pl-6 pr-10 min-h-[68px]" },
|
13
|
-
react_1.default.createElement("h2", { ...titleAriaProps, className: "text-xl leading-6 text-gray-800 font-semibold mr-6" }, title),
|
13
|
+
react_1.default.createElement("h2", { ...titleAriaProps, className: "text-xl leading-6 text-gray-800 font-semibold mr-6" }, title?.charAt(0).toUpperCase() + title?.slice(1).toLowerCase()),
|
14
14
|
react_1.default.createElement("button", { className: "sds-dialog__close", "aria-label": `Close ${title} dialog`, onClick: onClose, tabIndex: 0 },
|
15
15
|
react_1.default.createElement("span", { className: "sr-only" }, `Close ${title} dialog`),
|
16
16
|
react_1.default.createElement(sds_1.SdsIcon, { svg: sds_1.ICON_CLOSE }))),
|
@@ -55,7 +55,7 @@ function SourceDropdown({ sources, selectedSource, onSourceSelect, }) {
|
|
55
55
|
return react_1.default.createElement(react_1.default.Fragment, null);
|
56
56
|
}
|
57
57
|
return (react_1.default.createElement("div", { ...focusWithinProps, ...keyboardProps, className: "relative w-full " },
|
58
|
-
react_1.default.createElement("button", { ref: buttonRef, type: "button", "aria-label": "Source quick select", "aria-expanded": isOpen, "aria-controls": `${uniqueId}-button-menu`, onClick: () => setIsOpen(!isOpen), className: "relative flex items-center p-2 w-full rounded bg-blue-100
|
58
|
+
react_1.default.createElement("button", { ref: buttonRef, type: "button", "aria-label": "Source quick select", "aria-expanded": isOpen, "aria-controls": `${uniqueId}-button-menu`, onClick: () => setIsOpen(!isOpen), className: "relative flex items-center p-2 w-full rounded bg-blue-100" },
|
59
59
|
react_1.default.createElement("span", { className: "sr-only" }, "current source "),
|
60
60
|
react_1.default.createElement("div", { className: "truncate max-w-[200px] text-md font-semibold text-blue-400" }, selectedSource.name),
|
61
61
|
react_1.default.createElement(ArrowDownIcon_1.ArrowDownIcon, { "aria-hidden": true, className: "absolute right-2 fill-blue-300" })),
|
package/lib/index.css
CHANGED
@@ -6318,10 +6318,6 @@
|
|
6318
6318
|
--tw-bg-opacity: 1;
|
6319
6319
|
background-color: rgb(230 241 250 / var(--tw-bg-opacity));
|
6320
6320
|
}
|
6321
|
-
.squiz-rb-scope .hover\:bg-blue-150:hover:not(.squiz-rb-plugin *) {
|
6322
|
-
--tw-bg-opacity: 1;
|
6323
|
-
background-color: rgb(199 223 245 / var(--tw-bg-opacity));
|
6324
|
-
}
|
6325
6321
|
.squiz-rb-scope .hover\:bg-gray-100:hover:not(.squiz-rb-plugin *) {
|
6326
6322
|
--tw-bg-opacity: 1;
|
6327
6323
|
background-color: rgb(245 245 245 / var(--tw-bg-opacity));
|
package/package.json
CHANGED
@@ -56,10 +56,19 @@ describe('MainContainer', () => {
|
|
56
56
|
|
57
57
|
it('should render Environment Selector title', () => {
|
58
58
|
render(<MainContainer {...defaultProps} title="Select MyAsset" />);
|
59
|
-
expect(screen.getByText('Select
|
59
|
+
expect(screen.getByText('Select myasset')).toBeInTheDocument();
|
60
60
|
expect(screen.queryByText('Environment Selector')).not.toBeInTheDocument();
|
61
61
|
});
|
62
62
|
|
63
|
+
it('should render title in Sentence case', () => {
|
64
|
+
const titles = ['Select Asset', 'Select MyAsset', 'another title'];
|
65
|
+
titles.forEach((title) => {
|
66
|
+
render(<MainContainer {...defaultProps} title={title} />);
|
67
|
+
const expectedTitle = title.charAt(0).toUpperCase() + title.slice(1).toLowerCase();
|
68
|
+
expect(screen.getByText(expectedTitle)).toBeInTheDocument();
|
69
|
+
});
|
70
|
+
});
|
71
|
+
|
63
72
|
describe('no source selected', () => {
|
64
73
|
it('should not render source selector dropdown', () => {
|
65
74
|
render(<MainContainer {...defaultProps} />);
|
@@ -65,7 +65,7 @@ function MainContainer({
|
|
65
65
|
<div className="relative flex flex-col h-full text-gray-800">
|
66
66
|
<div className="flex items-center py-3 pl-6 pr-10 min-h-[68px]">
|
67
67
|
<h2 {...titleAriaProps} className="text-xl leading-6 text-gray-800 font-semibold mr-6">
|
68
|
-
{title}
|
68
|
+
{title?.charAt(0).toUpperCase() + title?.slice(1).toLowerCase()}
|
69
69
|
</h2>
|
70
70
|
|
71
71
|
{plugin && selectedSource && (
|
@@ -18,7 +18,7 @@ export const InlineLoadingErrorState = ({ title, titleAriaProps, onClose, onRetr
|
|
18
18
|
<div className="relative flex flex-col h-full text-gray-800">
|
19
19
|
<div className="flex items-center py-3 pl-6 pr-10 min-h-[68px]">
|
20
20
|
<h2 {...titleAriaProps} className="text-xl leading-6 text-gray-800 font-semibold mr-6">
|
21
|
-
{title}
|
21
|
+
{title?.charAt(0).toUpperCase() + title?.slice(1).toLowerCase()}
|
22
22
|
</h2>
|
23
23
|
<button className="sds-dialog__close" aria-label={`Close ${title} dialog`} onClick={onClose} tabIndex={0}>
|
24
24
|
<span className="sr-only">{`Close ${title} dialog`}</span>
|
@@ -54,7 +54,7 @@ export default function SourceDropdown({
|
|
54
54
|
aria-expanded={isOpen}
|
55
55
|
aria-controls={`${uniqueId}-button-menu`}
|
56
56
|
onClick={() => setIsOpen(!isOpen)}
|
57
|
-
className="relative flex items-center p-2 w-full rounded bg-blue-100
|
57
|
+
className="relative flex items-center p-2 w-full rounded bg-blue-100"
|
58
58
|
>
|
59
59
|
<span className="sr-only">current source </span>
|
60
60
|
<div className="truncate max-w-[200px] text-md font-semibold text-blue-400">{selectedSource.name}</div>
|