@squiz/resource-browser 1.32.1-alpha.29 → 1.32.1-alpha.31
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/lib/ResourceItem/ResourceItem.js +7 -6
- package/lib/ResourcePickerContainer/ResourcePickerContainer.js +4 -4
- package/lib/Skeleton/ListItem/SkeletonListItem.js +1 -1
- package/lib/SourceDropdown/SourceDropdown.js +5 -5
- package/lib/Spinner/Spinner.d.ts +1 -1
- package/lib/Spinner/Spinner.js +1 -1
- package/lib/index.css +78 -20
- package/package.json +3 -3
- package/src/ResourceItem/ResourceItem.tsx +9 -7
- package/src/ResourcePickerContainer/ResourcePickerContainer.tsx +4 -4
- package/src/Skeleton/ListItem/SkeletonListItem.tsx +1 -1
- package/src/Skeleton/_skeleton.scss +15 -0
- package/src/SourceDropdown/SourceDropdown.tsx +5 -7
- package/src/Spinner/Spinner.stories.tsx +1 -1
- package/src/Spinner/Spinner.tsx +2 -2
- package/src/Spinner/_spinner.scss +7 -4
- package/src/index.scss +14 -0
@@ -11,16 +11,17 @@ const ResourceItem = ({ item, selected, label, type, childCount, previewModalSta
|
|
11
11
|
const { triggerProps, overlayProps } = (0, react_aria_1.useOverlayTrigger)({ type: 'dialog' }, previewModalState);
|
12
12
|
const isDisabled = allowedTypes !== undefined && !allowedTypes.includes(type);
|
13
13
|
const title = isDisabled ? "You can't select this item" : label;
|
14
|
-
return (react_1.default.createElement("li", { className: `flex items-stretch p-1 bg-white border border-grey-200 ${className}` },
|
14
|
+
return (react_1.default.createElement("li", { className: `flex items-stretch p-1 bg-white border border-grey-200 min-h-[64px] ${className}` },
|
15
15
|
react_1.default.createElement(ModalOpeningButton_1.default, { type: "button", ...triggerProps, isDisabled: isDisabled, onPress: () => onSelect(item, overlayProps), className: `
|
16
|
-
relative grow flex items-center
|
16
|
+
relative grow flex items-center px-4 py-2 rounded outline-0 ${selected ? 'bg-blue-100 text-blue-400' : ''} ${childCount > 0 ? 'mr-2' : ''} ${isDisabled ? 'font-normal text-gray-600 cursor-not-allowed' : 'hover:bg-gray-50 focus:bg-gray-50'}
|
17
17
|
`, title: title },
|
18
18
|
react_1.default.createElement(Icon_1.default, { icon: type, resourceSource: "matrix", "aria-label": type, className: `mr-4 shrink-0 ${isDisabled && 'opacity-40'}` }),
|
19
|
-
react_1.default.createElement("span", { className:
|
20
|
-
|
21
|
-
|
19
|
+
react_1.default.createElement("span", { className: `relative flex items-center ${selected ? 'mr-8' : ''}` },
|
20
|
+
react_1.default.createElement("span", { className: "line-clamp-2 text-left break-word" }, label),
|
21
|
+
selected && react_1.default.createElement(Icon_1.default, { icon: 'selected', "aria-label": "selected", className: "absolute -right-8" }))),
|
22
|
+
childCount > 0 && (react_1.default.createElement("button", { type: "button", "aria-label": `Drill down to ${label} children`, onClick: () => onDrillDown(item), className: `relative shrink-0 flex items-center p-4 rounded outline-0 before:w-px before:h-[calc(100%-0.75rem)] before:bg-gray-200 before:absolute before:top-1.5 before:-left-1 hover:bg-gray-50 focus:bg-gray-50` },
|
22
23
|
react_1.default.createElement("span", { className: "ml-auto flex items-center" },
|
23
|
-
react_1.default.createElement("span", { className: "truncate w-
|
24
|
+
react_1.default.createElement("span", { className: "truncate w-14 text-right", title: String(childCount) }, childCount),
|
24
25
|
react_1.default.createElement(Icon_1.default, { icon: 'arrow-right', className: "ml-1" }))))));
|
25
26
|
};
|
26
27
|
exports.default = ResourceItem;
|
@@ -67,15 +67,15 @@ function ResourcePickerContainer({ title, titleAriaProps, allowedTypes, onReques
|
|
67
67
|
(0, react_1.useEffect)(() => {
|
68
68
|
setSelectedResource(null);
|
69
69
|
}, [hierarchy]);
|
70
|
-
return (react_1.default.createElement("div", { className: "relative flex flex-col h-full" },
|
71
|
-
react_1.default.createElement("div", { className: "flex items-center p-
|
70
|
+
return (react_1.default.createElement("div", { className: "relative flex flex-col h-full text-gray-800 antialiased" },
|
71
|
+
react_1.default.createElement("div", { className: "flex items-center p-4.5" },
|
72
72
|
react_1.default.createElement("h2", { ...titleAriaProps, className: "text-xl leading-6 text-gray-800 font-semibold mr-6" }, title),
|
73
|
-
react_1.default.createElement("div", { className: "px-3 border-l border-
|
73
|
+
react_1.default.createElement("div", { className: "px-3 border-l border-gray-300 w-300px" },
|
74
74
|
react_1.default.createElement(SourceDropdown_1.default, { sources: sources, selectedSource: source, isLoading: isSourceLoading, onSourceSelect: handleSourceDrilldown, onRootSelect: handleReturnToRoot })),
|
75
75
|
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" },
|
76
76
|
react_1.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
77
77
|
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" })))),
|
78
|
-
react_1.default.createElement("div", { className: "flex border-t border-
|
78
|
+
react_1.default.createElement("div", { className: "flex border-t border-gray-300 h-[calc(100%-72px)]" },
|
79
79
|
react_1.default.createElement("div", { className: "overflow-y-scroll flex-1 grow-[3] border-r border-gray-300" },
|
80
80
|
react_1.default.createElement("h3", { className: "sr-only" }, "Resource List"),
|
81
81
|
hierarchy.length > 0 && (react_1.default.createElement(ResourceBreadcrumb_1.default, { hierarchy: hierarchy, onBreadcrumbSelect: popUntil, onReturnToRoot: handleReturnToRoot })),
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SkeletonListItem = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
8
|
const SkeletonListItem = () => (react_1.default.createElement("li", { className: "flex items-center p-1 first:mt-0 bg-white border border-b-0 border-grey-200 first:rounded-t-lg last:rounded-b-lg last:border-b" },
|
9
|
-
react_1.default.createElement("div", { className: "grid grid-cols-[24px_1fr_45px] w-full flex items-center p-4 rounded" },
|
9
|
+
react_1.default.createElement("div", { className: "animate-skeleton-pulse grid grid-cols-[24px_1fr_45px] w-full flex items-center p-4 rounded" },
|
10
10
|
react_1.default.createElement("span", { className: "w-6 h-6 bg-gray-200 rounded-full" }),
|
11
11
|
react_1.default.createElement("div", { className: "w-full d-flex flex-col mx-4" },
|
12
12
|
react_1.default.createElement("div", { className: "mb-1 w-3/4 h-2 bg-gray-200 rounded" }),
|
@@ -63,14 +63,14 @@ function SourceDropdown({ sources, selectedSource, isLoading, onRootSelect, onSo
|
|
63
63
|
onRootSelect();
|
64
64
|
};
|
65
65
|
return (react_1.default.createElement("div", { ...focusWithinProps, ...keyboardProps, className: "relative w-72 border border-2 rounded border-gray-300" },
|
66
|
-
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 text-sm font-semibold p-
|
66
|
+
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 text-sm font-semibold p-1.5 w-full" },
|
67
67
|
selectedSource && (react_1.default.createElement(react_1.default.Fragment, null,
|
68
68
|
react_1.default.createElement("span", { className: "sr-only" }, "current source "),
|
69
|
-
react_1.default.createElement(Icon_1.default, { icon: selectedSource.resource?.type.code, resourceSource: "matrix", "aria-hidden": true, className: "mr-2.5" }),
|
69
|
+
react_1.default.createElement(Icon_1.default, { icon: selectedSource.resource?.type.code, resourceSource: "matrix", "aria-hidden": true, className: "mr-2.5 h-[20px] w-[20px]" }),
|
70
70
|
react_1.default.createElement("div", { className: "truncate max-w-[200px]" }, selectedSource.resource?.name || selectedSource.source.name))),
|
71
71
|
!selectedSource && (react_1.default.createElement(react_1.default.Fragment, null,
|
72
72
|
react_1.default.createElement("span", { className: "sr-only" }, "view "),
|
73
|
-
react_1.default.createElement(Icon_1.default, { icon: 'root', "aria-hidden": true, className: "mr-2.5" }),
|
73
|
+
react_1.default.createElement(Icon_1.default, { icon: 'root', "aria-hidden": true, className: "mr-2.5 h-[20px] w-[20px]" }),
|
74
74
|
"All available sources")),
|
75
75
|
react_1.default.createElement(Icon_1.default, { icon: 'arrow-down', "aria-hidden": true, className: "absolute right-3" })),
|
76
76
|
react_1.default.createElement("ul", { id: `${uniqueId}-button-menu`, "aria-hidden": !isOpen, className: `absolute z-50 top-[calc(100%+5px)] -left-0.5 w-[calc(100%+4px)] bg-gray-100 border border-2 rounded border-gray-300 p-2 ${!isOpen ? 'hidden' : ''}` },
|
@@ -79,7 +79,7 @@ function SourceDropdown({ sources, selectedSource, isLoading, onRootSelect, onSo
|
|
79
79
|
react_1.default.createElement(Icon_1.default, { icon: 'root', "aria-hidden": true, className: "mr-2.5" }),
|
80
80
|
"All available sources")),
|
81
81
|
isLoading && (react_1.default.createElement("li", { className: "mt-6" },
|
82
|
-
react_1.default.createElement(Spinner_1.default, { size: "
|
82
|
+
react_1.default.createElement(Spinner_1.default, { size: "sm", label: "Loading sources", className: "m-3" }))),
|
83
83
|
!isLoading &&
|
84
84
|
categorisedSources.map(({ key, label, sources }, index) => {
|
85
85
|
return (react_1.default.createElement("li", { key: key, className: `flex flex-col text-sm font-semibold text-grey-800 ${index > 0 ? 'mt-3' : ''}` },
|
@@ -88,7 +88,7 @@ function SourceDropdown({ sources, selectedSource, isLoading, onRootSelect, onSo
|
|
88
88
|
sources?.length > 0 && (react_1.default.createElement("ul", { "aria-label": `${label} nodes`, className: "flex flex-col mt-2" }, sources.map(({ source, resource }) => {
|
89
89
|
const isSelectedSource = source.id === selectedSource?.source.id && resource?.id === selectedSource?.resource?.id;
|
90
90
|
return (react_1.default.createElement("li", { key: `${source.id}-${resource?.id}`, className: "flex items-center bg-white border border-b-0 last:border-b border-grey-200 first:rounded-t last:rounded-b" },
|
91
|
-
react_1.default.createElement("button", { type: "button", onClick: () => handleSourceClick({ source, resource }), className: `relative grow flex items-center p-2.5 hover:bg-gray-100 focus:bg-gray-100
|
91
|
+
react_1.default.createElement("button", { type: "button", onClick: () => handleSourceClick({ source, resource }), className: `relative grow flex items-center p-2.5 hover:bg-gray-100 focus:bg-gray-100` },
|
92
92
|
react_1.default.createElement(Icon_1.default, { icon: resource?.type.code, resourceSource: "matrix", "aria-label": resource?.type.name, className: "shrink-0 mr-2.5" }),
|
93
93
|
react_1.default.createElement("span", { className: "text-left mr-7" }, resource?.name || source.name),
|
94
94
|
isSelectedSource && (react_1.default.createElement(Icon_1.default, { icon: 'selected', "aria-label": "selected", className: "absolute right-4" })))));
|
package/lib/Spinner/Spinner.d.ts
CHANGED
package/lib/Spinner/Spinner.js
CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const react_1 = __importDefault(require("react"));
|
7
7
|
const clsx_1 = __importDefault(require("clsx"));
|
8
|
-
const Spinner = ({ size = '
|
8
|
+
const Spinner = ({ size = 'sm', className, label = 'Loading' }) => {
|
9
9
|
return (react_1.default.createElement("div", { className: "spinner__wrapper", "aria-label": label },
|
10
10
|
react_1.default.createElement("div", { className: (0, clsx_1.default)(`spinner`, size && `spinner--${size}`, className), role: "status" })));
|
11
11
|
};
|
package/lib/index.css
CHANGED
@@ -378,6 +378,9 @@
|
|
378
378
|
.squiz-rb-scope .-left-0\.5 {
|
379
379
|
left: -0.125rem;
|
380
380
|
}
|
381
|
+
.squiz-rb-scope .-right-8 {
|
382
|
+
right: -2rem;
|
383
|
+
}
|
381
384
|
.squiz-rb-scope .bottom-0 {
|
382
385
|
bottom: 0px;
|
383
386
|
}
|
@@ -390,9 +393,6 @@
|
|
390
393
|
.squiz-rb-scope .right-4 {
|
391
394
|
right: 1rem;
|
392
395
|
}
|
393
|
-
.squiz-rb-scope .right-5 {
|
394
|
-
right: 1.25rem;
|
395
|
-
}
|
396
396
|
.squiz-rb-scope .top-2 {
|
397
397
|
top: 0.5rem;
|
398
398
|
}
|
@@ -490,6 +490,9 @@
|
|
490
490
|
.squiz-rb-scope .mr-7 {
|
491
491
|
margin-right: 1.75rem;
|
492
492
|
}
|
493
|
+
.squiz-rb-scope .mr-8 {
|
494
|
+
margin-right: 2rem;
|
495
|
+
}
|
493
496
|
.squiz-rb-scope .mr-auto {
|
494
497
|
margin-right: auto;
|
495
498
|
}
|
@@ -511,6 +514,12 @@
|
|
511
514
|
.squiz-rb-scope .mt-7 {
|
512
515
|
margin-top: 1.75rem;
|
513
516
|
}
|
517
|
+
.squiz-rb-scope .line-clamp-2 {
|
518
|
+
overflow: hidden;
|
519
|
+
display: -webkit-box;
|
520
|
+
-webkit-box-orient: vertical;
|
521
|
+
-webkit-line-clamp: 2;
|
522
|
+
}
|
514
523
|
.squiz-rb-scope .block {
|
515
524
|
display: block;
|
516
525
|
}
|
@@ -550,11 +559,14 @@
|
|
550
559
|
.squiz-rb-scope .h-9 {
|
551
560
|
height: 2.25rem;
|
552
561
|
}
|
562
|
+
.squiz-rb-scope .h-\[20px\] {
|
563
|
+
height: 20px;
|
564
|
+
}
|
553
565
|
.squiz-rb-scope .h-\[50vh\] {
|
554
566
|
height: 50vh;
|
555
567
|
}
|
556
|
-
.squiz-rb-scope .h-\[calc\(100\%-
|
557
|
-
height: calc(100% -
|
568
|
+
.squiz-rb-scope .h-\[calc\(100\%-72px\)\] {
|
569
|
+
height: calc(100% - 72px);
|
558
570
|
}
|
559
571
|
.squiz-rb-scope .h-full {
|
560
572
|
height: 100%;
|
@@ -562,6 +574,9 @@
|
|
562
574
|
.squiz-rb-scope .h-screen {
|
563
575
|
height: 100vh;
|
564
576
|
}
|
577
|
+
.squiz-rb-scope .min-h-\[64px\] {
|
578
|
+
min-height: 64px;
|
579
|
+
}
|
565
580
|
.squiz-rb-scope .min-h-full {
|
566
581
|
min-height: 100%;
|
567
582
|
}
|
@@ -571,9 +586,6 @@
|
|
571
586
|
.squiz-rb-scope .w-1\/2 {
|
572
587
|
width: 50%;
|
573
588
|
}
|
574
|
-
.squiz-rb-scope .w-10 {
|
575
|
-
width: 2.5rem;
|
576
|
-
}
|
577
589
|
.squiz-rb-scope .w-12 {
|
578
590
|
width: 3rem;
|
579
591
|
}
|
@@ -601,6 +613,9 @@
|
|
601
613
|
.squiz-rb-scope .w-\[119px\] {
|
602
614
|
width: 119px;
|
603
615
|
}
|
616
|
+
.squiz-rb-scope .w-\[20px\] {
|
617
|
+
width: 20px;
|
618
|
+
}
|
604
619
|
.squiz-rb-scope .w-\[400px\] {
|
605
620
|
width: 400px;
|
606
621
|
}
|
@@ -684,9 +699,6 @@
|
|
684
699
|
text-overflow: ellipsis;
|
685
700
|
white-space: nowrap;
|
686
701
|
}
|
687
|
-
.squiz-rb-scope .break-all {
|
688
|
-
word-break: break-all;
|
689
|
-
}
|
690
702
|
.squiz-rb-scope .rounded {
|
691
703
|
border-radius: 4px;
|
692
704
|
}
|
@@ -768,6 +780,9 @@
|
|
768
780
|
.squiz-rb-scope .p-1 {
|
769
781
|
padding: 0.25rem;
|
770
782
|
}
|
783
|
+
.squiz-rb-scope .p-1\.5 {
|
784
|
+
padding: 0.375rem;
|
785
|
+
}
|
771
786
|
.squiz-rb-scope .p-2 {
|
772
787
|
padding: 0.5rem;
|
773
788
|
}
|
@@ -777,9 +792,6 @@
|
|
777
792
|
.squiz-rb-scope .p-4 {
|
778
793
|
padding: 1rem;
|
779
794
|
}
|
780
|
-
.squiz-rb-scope .p-6 {
|
781
|
-
padding: 1.5rem;
|
782
|
-
}
|
783
795
|
.squiz-rb-scope .px-1 {
|
784
796
|
padding-left: 0.25rem;
|
785
797
|
padding-right: 0.25rem;
|
@@ -800,6 +812,10 @@
|
|
800
812
|
padding-left: 0.75rem;
|
801
813
|
padding-right: 0.75rem;
|
802
814
|
}
|
815
|
+
.squiz-rb-scope .px-4 {
|
816
|
+
padding-left: 1rem;
|
817
|
+
padding-right: 1rem;
|
818
|
+
}
|
803
819
|
.squiz-rb-scope .px-7 {
|
804
820
|
padding-left: 1.75rem;
|
805
821
|
padding-right: 1.75rem;
|
@@ -891,19 +907,24 @@
|
|
891
907
|
--tw-text-opacity: 1;
|
892
908
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
893
909
|
}
|
910
|
+
.squiz-rb-scope .antialiased {
|
911
|
+
-webkit-font-smoothing: antialiased;
|
912
|
+
-moz-osx-font-smoothing: grayscale;
|
913
|
+
}
|
894
914
|
.squiz-rb-scope .opacity-40 {
|
895
915
|
opacity: 0.4;
|
896
916
|
}
|
917
|
+
.squiz-rb-scope .outline-0 {
|
918
|
+
outline-width: 0px;
|
919
|
+
}
|
897
920
|
.squiz-rb-scope .blur {
|
898
921
|
--tw-blur: blur(8px);
|
899
922
|
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
900
923
|
}
|
901
924
|
.squiz-rb-scope .spinner {
|
902
925
|
display: inline-block;
|
903
|
-
height: 2rem;
|
904
|
-
width: 2rem;
|
905
926
|
border-radius: 9999px;
|
906
|
-
border-width:
|
927
|
+
border-width: 2px;
|
907
928
|
border-style: solid;
|
908
929
|
border-color: currentColor;
|
909
930
|
border-right-color: transparent;
|
@@ -924,6 +945,10 @@
|
|
924
945
|
animation: spin 1.5s linear infinite;
|
925
946
|
}
|
926
947
|
}
|
948
|
+
.squiz-rb-scope .spinner {
|
949
|
+
height: 20px;
|
950
|
+
width: 20px;
|
951
|
+
}
|
927
952
|
.squiz-rb-scope .spinner__wrapper {
|
928
953
|
display: flex;
|
929
954
|
align-items: center;
|
@@ -931,9 +956,23 @@
|
|
931
956
|
--tw-text-opacity: 1;
|
932
957
|
color: rgb(224 224 224 / var(--tw-text-opacity));
|
933
958
|
}
|
934
|
-
.squiz-rb-scope .spinner--
|
935
|
-
height:
|
936
|
-
width:
|
959
|
+
.squiz-rb-scope .spinner--md {
|
960
|
+
height: 32px;
|
961
|
+
width: 32px;
|
962
|
+
}
|
963
|
+
.squiz-rb-scope .animate-skeleton-pulse {
|
964
|
+
animation: pulse 2s linear infinite;
|
965
|
+
}
|
966
|
+
@keyframes pulse {
|
967
|
+
0% {
|
968
|
+
opacity: 1;
|
969
|
+
}
|
970
|
+
50% {
|
971
|
+
opacity: 0.45;
|
972
|
+
}
|
973
|
+
100% {
|
974
|
+
opacity: 1;
|
975
|
+
}
|
937
976
|
}
|
938
977
|
.squiz-rb-scope .resource-breadcrumb--collapsed .resource-breadcrumb__label {
|
939
978
|
max-width: 250px;
|
@@ -1002,6 +1041,17 @@
|
|
1002
1041
|
gap: 0.5rem;
|
1003
1042
|
justify-items: center;
|
1004
1043
|
}
|
1044
|
+
.squiz-rb-scope *,
|
1045
|
+
.squiz-rb-scope button {
|
1046
|
+
letter-spacing: -0.02em;
|
1047
|
+
}
|
1048
|
+
.squiz-rb-scope svg {
|
1049
|
+
--tw-text-opacity: 1;
|
1050
|
+
color: rgb(112 112 112 / var(--tw-text-opacity));
|
1051
|
+
}
|
1052
|
+
.squiz-rb-scope .p-4\.5 {
|
1053
|
+
padding: 18px;
|
1054
|
+
}
|
1005
1055
|
.squiz-rb-scope .before\:fixed::before {
|
1006
1056
|
content: var(--tw-content);
|
1007
1057
|
position: fixed;
|
@@ -1111,6 +1161,10 @@
|
|
1111
1161
|
--tw-bg-opacity: 1;
|
1112
1162
|
background-color: rgb(245 245 245 / var(--tw-bg-opacity));
|
1113
1163
|
}
|
1164
|
+
.squiz-rb-scope .hover\:bg-gray-50:hover {
|
1165
|
+
--tw-bg-opacity: 1;
|
1166
|
+
background-color: rgb(247 247 247 / var(--tw-bg-opacity));
|
1167
|
+
}
|
1114
1168
|
.squiz-rb-scope .hover\:bg-transparent:hover {
|
1115
1169
|
background-color: transparent;
|
1116
1170
|
}
|
@@ -1126,6 +1180,10 @@
|
|
1126
1180
|
--tw-bg-opacity: 1;
|
1127
1181
|
background-color: rgb(245 245 245 / var(--tw-bg-opacity));
|
1128
1182
|
}
|
1183
|
+
.squiz-rb-scope .focus\:bg-gray-50:focus {
|
1184
|
+
--tw-bg-opacity: 1;
|
1185
|
+
background-color: rgb(247 247 247 / var(--tw-bg-opacity));
|
1186
|
+
}
|
1129
1187
|
.squiz-rb-scope .focus\:text-gray-800:focus {
|
1130
1188
|
--tw-text-opacity: 1;
|
1131
1189
|
color: rgb(61 61 61 / var(--tw-text-opacity));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/resource-browser",
|
3
|
-
"version": "1.32.1-alpha.
|
3
|
+
"version": "1.32.1-alpha.31",
|
4
4
|
"main": "lib/index.js",
|
5
5
|
"types": "lib/index.d.ts",
|
6
6
|
"scripts": {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
},
|
16
16
|
"dependencies": {
|
17
17
|
"@mui/icons-material": "5.11.16",
|
18
|
-
"@squiz/dx-json-schema-lib": "1.32.1-alpha.
|
18
|
+
"@squiz/dx-json-schema-lib": "1.32.1-alpha.31",
|
19
19
|
"pretty-bytes": "5.6.0",
|
20
20
|
"react-aria": "3.23.1",
|
21
21
|
"react-responsive": "9.0.2",
|
@@ -73,5 +73,5 @@
|
|
73
73
|
"volta": {
|
74
74
|
"node": "18.15.0"
|
75
75
|
},
|
76
|
-
"gitHead": "
|
76
|
+
"gitHead": "53b94e99c31f98b9b007eecff5d4a0ac0b384fb7"
|
77
77
|
}
|
@@ -36,16 +36,16 @@ const ResourceItem = <T,>({
|
|
36
36
|
const title = isDisabled ? "You can't select this item" : label;
|
37
37
|
|
38
38
|
return (
|
39
|
-
<li className={`flex items-stretch p-1 bg-white border border-grey-200 ${className}`}>
|
39
|
+
<li className={`flex items-stretch p-1 bg-white border border-grey-200 min-h-[64px] ${className}`}>
|
40
40
|
<ModalOpeningButton
|
41
41
|
type="button"
|
42
42
|
{...triggerProps}
|
43
43
|
isDisabled={isDisabled}
|
44
44
|
onPress={() => onSelect(item, overlayProps)}
|
45
45
|
className={`
|
46
|
-
relative grow flex items-center
|
46
|
+
relative grow flex items-center px-4 py-2 rounded outline-0 ${selected ? 'bg-blue-100 text-blue-400' : ''} ${
|
47
47
|
childCount > 0 ? 'mr-2' : ''
|
48
|
-
} ${isDisabled ? 'font-normal text-gray-600 cursor-not-allowed' : 'hover:bg-gray-
|
48
|
+
} ${isDisabled ? 'font-normal text-gray-600 cursor-not-allowed' : 'hover:bg-gray-50 focus:bg-gray-50'}
|
49
49
|
`}
|
50
50
|
title={title}
|
51
51
|
>
|
@@ -55,18 +55,20 @@ const ResourceItem = <T,>({
|
|
55
55
|
aria-label={type}
|
56
56
|
className={`mr-4 shrink-0 ${isDisabled && 'opacity-40'}`}
|
57
57
|
/>
|
58
|
-
<span className=
|
59
|
-
|
58
|
+
<span className={`relative flex items-center ${selected ? 'mr-8' : ''}`}>
|
59
|
+
<span className="line-clamp-2 text-left break-word">{label}</span>
|
60
|
+
{selected && <Icon icon={'selected' as IconOptions} aria-label="selected" className="absolute -right-8" />}
|
61
|
+
</span>
|
60
62
|
</ModalOpeningButton>
|
61
63
|
{childCount > 0 && (
|
62
64
|
<button
|
63
65
|
type="button"
|
64
66
|
aria-label={`Drill down to ${label} children`}
|
65
67
|
onClick={() => onDrillDown(item)}
|
66
|
-
className={`relative shrink-0 flex items-center p-4 rounded before:w-px before:h-[calc(100%-0.75rem)] before:bg-gray-200 before:absolute before:top-1.5 before:-left-1 hover:bg-gray-
|
68
|
+
className={`relative shrink-0 flex items-center p-4 rounded outline-0 before:w-px before:h-[calc(100%-0.75rem)] before:bg-gray-200 before:absolute before:top-1.5 before:-left-1 hover:bg-gray-50 focus:bg-gray-50`}
|
67
69
|
>
|
68
70
|
<span className="ml-auto flex items-center">
|
69
|
-
<span className="truncate w-
|
71
|
+
<span className="truncate w-14 text-right" title={String(childCount)}>
|
70
72
|
{childCount}
|
71
73
|
</span>
|
72
74
|
<Icon icon={'arrow-right' as IconOptions} className="ml-1" />
|
@@ -92,12 +92,12 @@ function ResourcePickerContainer({
|
|
92
92
|
}, [hierarchy]);
|
93
93
|
|
94
94
|
return (
|
95
|
-
<div className="relative flex flex-col h-full">
|
96
|
-
<div className="flex items-center p-
|
95
|
+
<div className="relative flex flex-col h-full text-gray-800 antialiased">
|
96
|
+
<div className="flex items-center p-4.5">
|
97
97
|
<h2 {...titleAriaProps} className="text-xl leading-6 text-gray-800 font-semibold mr-6">
|
98
98
|
{title}
|
99
99
|
</h2>
|
100
|
-
<div className="px-3 border-l border-
|
100
|
+
<div className="px-3 border-l border-gray-300 w-300px">
|
101
101
|
<SourceDropdown
|
102
102
|
sources={sources}
|
103
103
|
selectedSource={source}
|
@@ -120,7 +120,7 @@ function ResourcePickerContainer({
|
|
120
120
|
</svg>
|
121
121
|
</button>
|
122
122
|
</div>
|
123
|
-
<div className="flex border-t border-
|
123
|
+
<div className="flex border-t border-gray-300 h-[calc(100%-72px)]">
|
124
124
|
<div className="overflow-y-scroll flex-1 grow-[3] border-r border-gray-300">
|
125
125
|
<h3 className="sr-only">Resource List</h3>
|
126
126
|
{hierarchy.length > 0 && (
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
2
2
|
|
3
3
|
export const SkeletonListItem = () => (
|
4
4
|
<li className="flex items-center p-1 first:mt-0 bg-white border border-b-0 border-grey-200 first:rounded-t-lg last:rounded-b-lg last:border-b">
|
5
|
-
<div className="grid grid-cols-[24px_1fr_45px] w-full flex items-center p-4 rounded">
|
5
|
+
<div className="animate-skeleton-pulse grid grid-cols-[24px_1fr_45px] w-full flex items-center p-4 rounded">
|
6
6
|
<span className="w-6 h-6 bg-gray-200 rounded-full" />
|
7
7
|
<div className="w-full d-flex flex-col mx-4">
|
8
8
|
<div className="mb-1 w-3/4 h-2 bg-gray-200 rounded" />
|
@@ -64,7 +64,7 @@ export default function SourceDropdown({
|
|
64
64
|
aria-expanded={isOpen}
|
65
65
|
aria-controls={`${uniqueId}-button-menu`}
|
66
66
|
onClick={() => setIsOpen(!isOpen)}
|
67
|
-
className="relative flex items-center text-sm font-semibold p-
|
67
|
+
className="relative flex items-center text-sm font-semibold p-1.5 w-full"
|
68
68
|
>
|
69
69
|
{selectedSource && (
|
70
70
|
<>
|
@@ -73,7 +73,7 @@ export default function SourceDropdown({
|
|
73
73
|
icon={selectedSource.resource?.type.code as IconOptions}
|
74
74
|
resourceSource="matrix"
|
75
75
|
aria-hidden
|
76
|
-
className="mr-2.5"
|
76
|
+
className="mr-2.5 h-[20px] w-[20px]"
|
77
77
|
/>
|
78
78
|
<div className="truncate max-w-[200px]">{selectedSource.resource?.name || selectedSource.source.name}</div>
|
79
79
|
</>
|
@@ -82,7 +82,7 @@ export default function SourceDropdown({
|
|
82
82
|
{!selectedSource && (
|
83
83
|
<>
|
84
84
|
<span className="sr-only">view </span>
|
85
|
-
<Icon icon={'root' as IconOptions} aria-hidden className="mr-2.5" />
|
85
|
+
<Icon icon={'root' as IconOptions} aria-hidden className="mr-2.5 h-[20px] w-[20px]" />
|
86
86
|
All available sources
|
87
87
|
</>
|
88
88
|
)}
|
@@ -111,7 +111,7 @@ export default function SourceDropdown({
|
|
111
111
|
</li>
|
112
112
|
{isLoading && (
|
113
113
|
<li className="mt-6">
|
114
|
-
<Spinner size="
|
114
|
+
<Spinner size="sm" label="Loading sources" className="m-3" />
|
115
115
|
</li>
|
116
116
|
)}
|
117
117
|
{!isLoading &&
|
@@ -135,9 +135,7 @@ export default function SourceDropdown({
|
|
135
135
|
<button
|
136
136
|
type="button"
|
137
137
|
onClick={() => handleSourceClick({ source, resource })}
|
138
|
-
className={`relative grow flex items-center p-2.5 hover:bg-gray-100 focus:bg-gray-100
|
139
|
-
isSelectedSource ? 'bg-blue-100 text-blue-400' : ''
|
140
|
-
}`}
|
138
|
+
className={`relative grow flex items-center p-2.5 hover:bg-gray-100 focus:bg-gray-100`}
|
141
139
|
>
|
142
140
|
<Icon
|
143
141
|
icon={resource?.type.code as IconOptions}
|
package/src/Spinner/Spinner.tsx
CHANGED
@@ -2,12 +2,12 @@ import React, { ReactElement } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
3
3
|
|
4
4
|
export type SpinnerProps = {
|
5
|
-
size?: '
|
5
|
+
size?: 'sm' | 'md';
|
6
6
|
className?: string;
|
7
7
|
label?: string;
|
8
8
|
};
|
9
9
|
|
10
|
-
const Spinner = ({ size = '
|
10
|
+
const Spinner = ({ size = 'sm', className, label = 'Loading' }: SpinnerProps): ReactElement => {
|
11
11
|
return (
|
12
12
|
<div className="spinner__wrapper" aria-label={label}>
|
13
13
|
<div className={clsx(`spinner`, size && `spinner--${size}`, className)} role="status" />
|
@@ -1,11 +1,14 @@
|
|
1
1
|
.spinner {
|
2
|
-
@apply inline-block rounded-full
|
3
|
-
@apply border-
|
2
|
+
@apply inline-block rounded-full;
|
3
|
+
@apply border-2 border-solid border-current border-r-transparent;
|
4
4
|
@apply animate-spin align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite];
|
5
|
+
height: 20px;
|
6
|
+
width: 20px;
|
5
7
|
&__wrapper {
|
6
8
|
@apply flex items-center justify-center text-gray-300;
|
7
9
|
}
|
8
|
-
&--
|
9
|
-
|
10
|
+
&--md {
|
11
|
+
height: 32px;
|
12
|
+
width: 32px;
|
10
13
|
}
|
11
14
|
}
|
package/src/index.scss
CHANGED
@@ -5,5 +5,19 @@
|
|
5
5
|
|
6
6
|
// Components
|
7
7
|
@import './Spinner/spinner';
|
8
|
+
@import './Skeleton/skeleton';
|
8
9
|
@import './ResourceBreadcrumb/ResourceBreadcrumb';
|
9
10
|
@import './ResourcePicker/resource-picker';
|
11
|
+
|
12
|
+
*,
|
13
|
+
button {
|
14
|
+
letter-spacing: -0.02em;
|
15
|
+
}
|
16
|
+
|
17
|
+
svg {
|
18
|
+
@apply text-gray-600;
|
19
|
+
}
|
20
|
+
|
21
|
+
.p-4\.5 {
|
22
|
+
padding: 18px;
|
23
|
+
}
|