@squiz/generic-browser-lib 1.63.1-alpha.7 → 1.65.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/CHANGELOG.md +13 -0
- package/lib/Icons/Generics/ArrowDown.d.ts +1 -1
- package/lib/Icons/Generics/ArrowRight.d.ts +1 -1
- package/lib/Icons/Generics/Back.d.ts +1 -1
- package/lib/Icons/Generics/Close.d.ts +1 -1
- package/lib/Icons/Generics/Empty.d.ts +1 -1
- package/lib/Icons/Generics/Error.d.ts +1 -1
- package/lib/Icons/Generics/ResourceSelect.d.ts +1 -1
- package/lib/Icons/Generics/Retry.d.ts +1 -1
- package/lib/Icons/Generics/Root.d.ts +1 -1
- package/lib/Icons/Generics/Selected.d.ts +1 -1
- package/lib/Icons/Icon.d.ts +17 -2
- package/lib/Icons/MatrixResources/Audio.d.ts +1 -1
- package/lib/Icons/MatrixResources/Excel.d.ts +1 -1
- package/lib/Icons/MatrixResources/Folder.d.ts +1 -1
- package/lib/Icons/MatrixResources/GenericFile.d.ts +1 -1
- package/lib/Icons/MatrixResources/Image.d.ts +1 -1
- package/lib/Icons/MatrixResources/MatrixResourceMap.d.ts +2 -1
- package/lib/Icons/MatrixResources/MatrixResourceMap.js +1 -0
- package/lib/Icons/MatrixResources/Page.d.ts +1 -1
- package/lib/Icons/MatrixResources/PageContent.d.ts +15 -0
- package/lib/Icons/MatrixResources/PageContent.js +31 -0
- package/lib/Icons/MatrixResources/Pdf.d.ts +1 -1
- package/lib/Icons/MatrixResources/Powerpoint.d.ts +1 -1
- package/lib/Icons/MatrixResources/Site.d.ts +1 -1
- package/lib/Icons/MatrixResources/Video.d.ts +1 -1
- package/lib/Icons/MatrixResources/Word.d.ts +1 -1
- package/lib/Icons/MatrixResources/index.d.ts +1 -0
- package/lib/Icons/MatrixResources/index.js +3 -1
- package/lib/Modal/Modal.d.ts +1 -1
- package/lib/Modal/ModalOpeningButton.d.ts +1 -1
- package/lib/Modal/ModalTrigger.d.ts +1 -1
- package/lib/PreviewPanel/PreviewModal.d.ts +2 -2
- package/lib/PreviewPanel/PreviewPanel.d.ts +1 -1
- package/lib/ResetButton/ResetButton.d.ts +2 -1
- package/lib/ResourceItem/ResourceItem.d.ts +2 -2
- package/lib/ResourceState/ResourceState.d.ts +2 -1
- package/lib/Skeleton/List/SkeletonList.d.ts +2 -1
- package/lib/Skeleton/ListItem/SkeletonListItem.d.ts +2 -1
- package/package.json +8 -5
- package/src/Icons/Icon.stories.tsx +6 -0
- package/src/Icons/MatrixResources/MatrixResourceMap.ts +2 -1
- package/src/Icons/MatrixResources/PageContent.tsx +36 -0
- package/src/Icons/MatrixResources/index.tsx +1 -0
package/CHANGELOG.md
ADDED
package/lib/Icons/Icon.d.ts
CHANGED
@@ -18,7 +18,22 @@ export declare const iconSources: {
|
|
18
18
|
folder: typeof import("./MatrixResources").Folder;
|
19
19
|
generic_file: typeof import("./MatrixResources").GenericFile;
|
20
20
|
image: typeof import("./MatrixResources").Image;
|
21
|
-
|
21
|
+
page_content: typeof import("./MatrixResources").PageContent;
|
22
|
+
page_standard: typeof import("./MatrixResources").Page; /**
|
23
|
+
* Renders an icon based on the resource source and the icon name
|
24
|
+
* @param {{resourceSource?: ResourceSources; icon?: IconOptions; props: React.HTMLAttributes<HTMLOrSVGElement>}} props - The props for the Icon component
|
25
|
+
* @returns {React.FunctionComponent} - The icon component
|
26
|
+
* @example
|
27
|
+
* <Icon />
|
28
|
+
* @example
|
29
|
+
* <Icon resourceSource="generic" icon="generic_file" />
|
30
|
+
* @example
|
31
|
+
* <Icon resourceSource="matrix" icon="page" />
|
32
|
+
* @example
|
33
|
+
* <Icon resourceSource="matrix" icon="page" height={24} width={24} />
|
34
|
+
* @example
|
35
|
+
* <Icon resourceSource="matrix" icon="page" className="custom-class" />
|
36
|
+
*/
|
22
37
|
pdf_file: typeof import("./MatrixResources").Pdf;
|
23
38
|
powerpoint_doc: typeof import("./MatrixResources").Powerpoint;
|
24
39
|
site: typeof import("./MatrixResources").Site;
|
@@ -49,4 +64,4 @@ export declare function Icon({ resourceSource, icon, componentIcon, isDecorative
|
|
49
64
|
resourceSource?: ResourceSources;
|
50
65
|
isDecorative?: boolean;
|
51
66
|
componentIcon?: React.ReactNode | undefined;
|
52
|
-
} & React.HTMLAttributes<HTMLElement> & React.SVGAttributes<SVGElement>): JSX.Element;
|
67
|
+
} & React.HTMLAttributes<HTMLElement> & React.SVGAttributes<SVGElement>): React.JSX.Element;
|
@@ -1,10 +1,11 @@
|
|
1
|
-
import { Audio, Excel, Folder, GenericFile, Image, Page, Pdf, Powerpoint, Site, Video, Word } from '.';
|
1
|
+
import { Audio, Excel, Folder, GenericFile, Image, Page, PageContent, Pdf, Powerpoint, Site, Video, Word } from '.';
|
2
2
|
declare const MatrixResourceMap: {
|
3
3
|
audio_file: typeof Audio;
|
4
4
|
excel_doc: typeof Excel;
|
5
5
|
folder: typeof Folder;
|
6
6
|
generic_file: typeof GenericFile;
|
7
7
|
image: typeof Image;
|
8
|
+
page_content: typeof PageContent;
|
8
9
|
page_standard: typeof Page;
|
9
10
|
pdf_file: typeof Pdf;
|
10
11
|
powerpoint_doc: typeof Powerpoint;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
/**
|
3
|
+
* Renders the Page Content icon
|
4
|
+
* @param {React.SVGProps<SVGSVGElement>} props - The props for the component
|
5
|
+
* @returns {JSX.Element} - The component
|
6
|
+
* @example
|
7
|
+
* <PageContent />
|
8
|
+
* @example
|
9
|
+
* <PageContent height={24} width={24} />
|
10
|
+
* @example
|
11
|
+
* <PageContent className="custom-class" />
|
12
|
+
*/
|
13
|
+
export default function PageContent({ isDecorative, ...props }: {
|
14
|
+
isDecorative: boolean;
|
15
|
+
} & React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const react_1 = __importDefault(require("react"));
|
7
|
+
/**
|
8
|
+
* Renders the Page Content icon
|
9
|
+
* @param {React.SVGProps<SVGSVGElement>} props - The props for the component
|
10
|
+
* @returns {JSX.Element} - The component
|
11
|
+
* @example
|
12
|
+
* <PageContent />
|
13
|
+
* @example
|
14
|
+
* <PageContent height={24} width={24} />
|
15
|
+
* @example
|
16
|
+
* <PageContent className="custom-class" />
|
17
|
+
*/
|
18
|
+
function PageContent({ isDecorative, ...props }) {
|
19
|
+
return (react_1.default.createElement("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props },
|
20
|
+
react_1.default.createElement("path", { d: "M20 1.5H4C3.17157 1.5 2.5 2.17157 2.5 3V21C2.5 21.8284 3.17157 22.5 4 22.5H20C20.8284 22.5 21.5 21.8284 21.5 21V3C21.5 2.17157 20.8284 1.5 20 1.5Z", fill: "#CCE9ED", stroke: "#73C0CB" }),
|
21
|
+
react_1.default.createElement("rect", { x: "5", y: "7", width: "3", height: "1", rx: "0.5", fill: "#057E91" }),
|
22
|
+
react_1.default.createElement("rect", { x: "9", y: "7", width: "10", height: "2", rx: "0.5", fill: "#057E91" }),
|
23
|
+
react_1.default.createElement("rect", { x: "9", y: "10", width: "10", height: "2", rx: "0.5", fill: "#057E91" }),
|
24
|
+
react_1.default.createElement("rect", { x: "9", y: "13", width: "10", height: "2", rx: "0.5", fill: "#057E91" }),
|
25
|
+
react_1.default.createElement("rect", { x: "9", y: "16", width: "10", height: "2", rx: "0.5", fill: "#057E91" }),
|
26
|
+
react_1.default.createElement("rect", { x: "5", y: "9", width: "3", height: "1", rx: "0.5", fill: "#057E91" }),
|
27
|
+
react_1.default.createElement("rect", { x: "5", y: "11", width: "3", height: "1", rx: "0.5", fill: "#057E91" }),
|
28
|
+
react_1.default.createElement("rect", { x: "5", y: "13", width: "3", height: "1", rx: "0.5", fill: "#057E91" }),
|
29
|
+
!isDecorative && react_1.default.createElement("title", null, "page content icon")));
|
30
|
+
}
|
31
|
+
exports.default = PageContent;
|
@@ -4,6 +4,7 @@ export { default as Folder } from './Folder';
|
|
4
4
|
export { default as GenericFile } from './GenericFile';
|
5
5
|
export { default as Image } from './Image';
|
6
6
|
export { default as Page } from './Page';
|
7
|
+
export { default as PageContent } from './PageContent';
|
7
8
|
export { default as Pdf } from './Pdf';
|
8
9
|
export { default as Powerpoint } from './Powerpoint';
|
9
10
|
export { default as Site } from './Site';
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Word = exports.Video = exports.Site = exports.Powerpoint = exports.Pdf = exports.Page = exports.Image = exports.GenericFile = exports.Folder = exports.Excel = exports.Audio = void 0;
|
6
|
+
exports.Word = exports.Video = exports.Site = exports.Powerpoint = exports.Pdf = exports.PageContent = exports.Page = exports.Image = exports.GenericFile = exports.Folder = exports.Excel = exports.Audio = void 0;
|
7
7
|
// Export all the icons from the MatrixResources folder
|
8
8
|
var Audio_1 = require("./Audio");
|
9
9
|
Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return __importDefault(Audio_1).default; } });
|
@@ -17,6 +17,8 @@ var Image_1 = require("./Image");
|
|
17
17
|
Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return __importDefault(Image_1).default; } });
|
18
18
|
var Page_1 = require("./Page");
|
19
19
|
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return __importDefault(Page_1).default; } });
|
20
|
+
var PageContent_1 = require("./PageContent");
|
21
|
+
Object.defineProperty(exports, "PageContent", { enumerable: true, get: function () { return __importDefault(PageContent_1).default; } });
|
20
22
|
var Pdf_1 = require("./Pdf");
|
21
23
|
Object.defineProperty(exports, "Pdf", { enumerable: true, get: function () { return __importDefault(Pdf_1).default; } });
|
22
24
|
var Powerpoint_1 = require("./Powerpoint");
|
package/lib/Modal/Modal.d.ts
CHANGED
@@ -8,4 +8,4 @@ export type ModalProps = {
|
|
8
8
|
children: (titleProps: DOMAttributes<FocusableElement>) => React.ReactElement;
|
9
9
|
scope: 'squiz-gb-scope' | 'squiz-cb-scope' | 'squiz-rb-scope';
|
10
10
|
};
|
11
|
-
export declare function Modal({ isDismissable, state, overlayProps, children, scope, ...props }: ModalProps): JSX.Element;
|
11
|
+
export declare function Modal({ isDismissable, state, overlayProps, children, scope, ...props }: ModalProps): React.JSX.Element;
|
@@ -6,5 +6,5 @@ interface ModalOpeningButtonProps extends AriaButtonProps<'button'> {
|
|
6
6
|
isDisabled?: boolean;
|
7
7
|
title?: string;
|
8
8
|
}
|
9
|
-
export declare function ModalOpeningButton({ className, children, title, ...props }: ModalOpeningButtonProps): JSX.Element;
|
9
|
+
export declare function ModalOpeningButton({ className, children, title, ...props }: ModalOpeningButtonProps): React.JSX.Element;
|
10
10
|
export {};
|
@@ -9,4 +9,4 @@ export declare function ModalTrigger({ label, labelClasses, showLabel, container
|
|
9
9
|
isDisabled?: boolean;
|
10
10
|
children: (onClose: () => void, titleProps: DOMAttributes<FocusableElement>) => React.ReactElement;
|
11
11
|
scope: 'squiz-gb-scope' | 'squiz-cb-scope' | 'squiz-rb-scope';
|
12
|
-
}): JSX.Element;
|
12
|
+
}): React.JSX.Element;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ReactNode } from 'react';
|
1
|
+
import React, { ReactNode } from 'react';
|
2
2
|
import { OverlayTriggerState } from 'react-stately';
|
3
3
|
import { DOMAttributes, FocusableElement } from '@react-types/shared';
|
4
4
|
export type PreviewModalProps = {
|
@@ -7,5 +7,5 @@ export type PreviewModalProps = {
|
|
7
7
|
children?: ReactNode;
|
8
8
|
onClose: () => void;
|
9
9
|
};
|
10
|
-
declare function PreviewModal({ state, overlayProps, children, onClose, ...props }: PreviewModalProps): JSX.Element;
|
10
|
+
declare function PreviewModal({ state, overlayProps, children, onClose, ...props }: PreviewModalProps): React.JSX.Element;
|
11
11
|
export default PreviewModal;
|
@@ -11,4 +11,4 @@ export interface PreviewPanelProps {
|
|
11
11
|
ResourceComponent?: React.ElementType;
|
12
12
|
selectionCallback?: (param: any) => void;
|
13
13
|
}
|
14
|
-
export declare const PreviewPanel: ({ resource, previewModalOverlayProps, modalState, onSelect, onClose, ResourceComponent, selectionCallback, }: PreviewPanelProps) => JSX.Element;
|
14
|
+
export declare const PreviewPanel: ({ resource, previewModalOverlayProps, modalState, onSelect, onClose, ResourceComponent, selectionCallback, }: PreviewPanelProps) => React.JSX.Element;
|
@@ -1,5 +1,6 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
export type ResetButtonProps = {
|
2
3
|
onClick: () => void;
|
3
4
|
isDisabled?: boolean;
|
4
5
|
};
|
5
|
-
export declare const ResetButton: ({ onClick, isDisabled }: ResetButtonProps) => JSX.Element;
|
6
|
+
export declare const ResetButton: ({ onClick, isDisabled }: ResetButtonProps) => React.JSX.Element;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ReactElement } from 'react';
|
1
|
+
import React, { ReactElement } from 'react';
|
2
2
|
import { DOMAttributes, FocusableElement } from '@react-types/shared';
|
3
3
|
import { OverlayTriggerState } from 'react-stately';
|
4
4
|
import { ResourceSources } from '../Icons/Icon';
|
@@ -17,5 +17,5 @@ interface ResourceItem<T> {
|
|
17
17
|
iconSource?: ResourceSources;
|
18
18
|
showChevron?: boolean;
|
19
19
|
}
|
20
|
-
declare const ResourceItem: <T>({ item, selected, label, type, childCount, previewModalState, onSelect, onDrillDown, className, allowedTypes, componentIcon, iconSource, showChevron, }: ResourceItem<T>) => JSX.Element;
|
20
|
+
declare const ResourceItem: <T>({ item, selected, label, type, childCount, previewModalState, onSelect, onDrillDown, className, allowedTypes, componentIcon, iconSource, showChevron, }: ResourceItem<T>) => React.JSX.Element;
|
21
21
|
export { ResourceItem };
|
@@ -1,8 +1,9 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
interface ResourceState {
|
2
3
|
state: 'error' | 'empty';
|
3
4
|
message?: string;
|
4
5
|
handleReload?: () => void;
|
5
6
|
showButton?: boolean;
|
6
7
|
}
|
7
|
-
declare const ResourceState: ({ state, message, handleReload, showButton }: ResourceState) => JSX.Element;
|
8
|
+
declare const ResourceState: ({ state, message, handleReload, showButton }: ResourceState) => React.JSX.Element;
|
8
9
|
export { ResourceState };
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
export type SkeletonListProps = {
|
2
3
|
itemCount: number;
|
3
4
|
className?: string;
|
4
5
|
ariaLabel?: string;
|
5
6
|
};
|
6
|
-
export declare const SkeletonList: ({ itemCount, className, ariaLabel }: SkeletonListProps) => JSX.Element;
|
7
|
+
export declare const SkeletonList: ({ itemCount, className, ariaLabel }: SkeletonListProps) => React.JSX.Element;
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
|
+
export declare const SkeletonListItem: () => React.JSX.Element;
|
package/package.json
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/generic-browser-lib",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.65.0",
|
4
4
|
"description": "Package with reusable components used by resource/component browsers",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "lib/index.d.ts",
|
7
|
+
"private": false,
|
8
|
+
"publishConfig": {
|
9
|
+
"access": "public"
|
10
|
+
},
|
7
11
|
"scripts": {
|
8
12
|
"compile": "npm run clean && npm run compile:styles && npm run compile:code",
|
9
13
|
"compile:code": "tsc",
|
@@ -33,8 +37,8 @@
|
|
33
37
|
"@testing-library/react": "14.0.0",
|
34
38
|
"@testing-library/user-event": "14.4.3",
|
35
39
|
"@types/postcss-js": "4.0.0",
|
36
|
-
"@types/react": "18.
|
37
|
-
"@types/react-dom": "18.
|
40
|
+
"@types/react": "^18.2.45",
|
41
|
+
"@types/react-dom": "^18.2.18",
|
38
42
|
"@vitejs/plugin-react-swc": "3.0.0",
|
39
43
|
"autoprefixer": "10.4.14",
|
40
44
|
"esbuild": "0.17.17",
|
@@ -71,6 +75,5 @@
|
|
71
75
|
},
|
72
76
|
"volta": {
|
73
77
|
"node": "18.15.0"
|
74
|
-
}
|
75
|
-
"gitHead": "5ae8c433076d96683b0a98113f0e69f7c0dd0bff"
|
78
|
+
}
|
76
79
|
}
|
@@ -66,6 +66,12 @@ Page.args = {
|
|
66
66
|
resourceSource: 'matrix',
|
67
67
|
};
|
68
68
|
|
69
|
+
export const PageContent = Template.bind({});
|
70
|
+
PageContent.args = {
|
71
|
+
icon: 'page_content',
|
72
|
+
resourceSource: 'matrix',
|
73
|
+
};
|
74
|
+
|
69
75
|
export const Pdf = Template.bind({});
|
70
76
|
Pdf.args = {
|
71
77
|
icon: 'pdf_file',
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Audio, Excel, Folder, GenericFile, Image, Page, Pdf, Powerpoint, Site, Video, Word } from '.';
|
1
|
+
import { Audio, Excel, Folder, GenericFile, Image, Page, PageContent, Pdf, Powerpoint, Site, Video, Word } from '.';
|
2
2
|
|
3
3
|
// Define our map of matrix types to icons
|
4
4
|
const MatrixResourceMap = {
|
@@ -7,6 +7,7 @@ const MatrixResourceMap = {
|
|
7
7
|
folder: Folder,
|
8
8
|
generic_file: GenericFile, // fallback when a type doesn't match.
|
9
9
|
image: Image,
|
10
|
+
page_content: PageContent,
|
10
11
|
page_standard: Page,
|
11
12
|
pdf_file: Pdf,
|
12
13
|
powerpoint_doc: Powerpoint,
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Renders the Page Content icon
|
5
|
+
* @param {React.SVGProps<SVGSVGElement>} props - The props for the component
|
6
|
+
* @returns {JSX.Element} - The component
|
7
|
+
* @example
|
8
|
+
* <PageContent />
|
9
|
+
* @example
|
10
|
+
* <PageContent height={24} width={24} />
|
11
|
+
* @example
|
12
|
+
* <PageContent className="custom-class" />
|
13
|
+
*/
|
14
|
+
export default function PageContent({
|
15
|
+
isDecorative,
|
16
|
+
...props
|
17
|
+
}: { isDecorative: boolean } & React.SVGProps<SVGSVGElement>) {
|
18
|
+
return (
|
19
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
|
20
|
+
<path
|
21
|
+
d="M20 1.5H4C3.17157 1.5 2.5 2.17157 2.5 3V21C2.5 21.8284 3.17157 22.5 4 22.5H20C20.8284 22.5 21.5 21.8284 21.5 21V3C21.5 2.17157 20.8284 1.5 20 1.5Z"
|
22
|
+
fill="#CCE9ED"
|
23
|
+
stroke="#73C0CB"
|
24
|
+
/>
|
25
|
+
<rect x="5" y="7" width="3" height="1" rx="0.5" fill="#057E91" />
|
26
|
+
<rect x="9" y="7" width="10" height="2" rx="0.5" fill="#057E91" />
|
27
|
+
<rect x="9" y="10" width="10" height="2" rx="0.5" fill="#057E91" />
|
28
|
+
<rect x="9" y="13" width="10" height="2" rx="0.5" fill="#057E91" />
|
29
|
+
<rect x="9" y="16" width="10" height="2" rx="0.5" fill="#057E91" />
|
30
|
+
<rect x="5" y="9" width="3" height="1" rx="0.5" fill="#057E91" />
|
31
|
+
<rect x="5" y="11" width="3" height="1" rx="0.5" fill="#057E91" />
|
32
|
+
<rect x="5" y="13" width="3" height="1" rx="0.5" fill="#057E91" />
|
33
|
+
{!isDecorative && <title>page content icon</title>}
|
34
|
+
</svg>
|
35
|
+
);
|
36
|
+
}
|
@@ -5,6 +5,7 @@ export { default as Folder } from './Folder';
|
|
5
5
|
export { default as GenericFile } from './GenericFile';
|
6
6
|
export { default as Image } from './Image';
|
7
7
|
export { default as Page } from './Page';
|
8
|
+
export { default as PageContent } from './PageContent';
|
8
9
|
export { default as Pdf } from './Pdf';
|
9
10
|
export { default as Powerpoint } from './Powerpoint';
|
10
11
|
export { default as Site } from './Site';
|