@manifest-editor/components 1.0.3 → 1.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 digirati-co-uk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs CHANGED
@@ -994,6 +994,7 @@ function ManifestOverviewEmptyState({ onCreate, canCreate }) {
994
994
  // src/SidebarTabs.tsx
995
995
  var import_react6 = require("react");
996
996
  var import_react_aria_components7 = require("react-aria-components");
997
+ var import_collections = require("@react-aria/collections");
997
998
  var import_jsx_runtime33 = require("react/jsx-runtime");
998
999
  function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
999
1000
  const ref = (0, import_react6.useRef)(null);
@@ -1033,6 +1034,7 @@ function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
1033
1034
  clearInterval(interval);
1034
1035
  };
1035
1036
  }, []);
1037
+ const menuHidden = menu.filter((item, idx) => hidden >= menu.length - idx);
1036
1038
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1037
1039
  import_react_aria_components7.Tabs,
1038
1040
  {
@@ -1060,34 +1062,16 @@ function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
1060
1062
  item.id
1061
1063
  );
1062
1064
  }) }),
1063
- hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_aria_components7.MenuTrigger, { children: [
1064
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1065
- import_react_aria_components7.Button,
1066
- {
1067
- className: cn(
1068
- "border-none rounded bg-gray-100 px-1.5 py-1 mr-2 mb-1 text-me-primary-500 semibold uppercase text-[10px]",
1069
- selectedIndex > hidden && "bg-me-primary-500 text-white rounded"
1070
- ),
1071
- children: "MORE"
1072
- }
1073
- ),
1074
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components7.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components7.Menu, { className: "bg-white rounded shadow-lg flex flex-col gap-0.5 p-0.5 min-w-28", children: menu.map((item, idx) => {
1075
- if (idx < menu.length - hidden)
1076
- return null;
1077
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1078
- import_react_aria_components7.MenuItem,
1079
- {
1080
- className: (state) => cn(
1081
- "hover:bg-me-gray-100 p-1 rounded-sm text-sm",
1082
- selectedKey === item.id && "ring ring-me-primary-500"
1083
- ),
1084
- onAction: () => onSelectionChange?.(item.id),
1085
- children: item.label
1086
- },
1087
- item.id
1088
- );
1089
- }) }) })
1090
- ] })
1065
+ hidden > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1066
+ MoreMenu,
1067
+ {
1068
+ hidden,
1069
+ menuHidden,
1070
+ selectedIndex,
1071
+ selectedKey,
1072
+ onSelectionChange
1073
+ }
1074
+ )
1091
1075
  ] }),
1092
1076
  menu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components7.TabPanel, { id: item.id, className: "flex-1 overflow-y-auto h-full", children: item.renderComponent }, item.id))
1093
1077
  ]
@@ -1095,6 +1079,34 @@ function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
1095
1079
  menuId
1096
1080
  );
1097
1081
  }
1082
+ var MoreMenu = (0, import_collections.createHideableComponent)(({ selectedIndex, hidden, menuHidden, selectedKey, onSelectionChange }) => {
1083
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_aria_components7.MenuTrigger, { children: [
1084
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1085
+ import_react_aria_components7.Button,
1086
+ {
1087
+ className: cn(
1088
+ "border-none rounded bg-gray-100 px-1.5 py-1 mr-2 mb-1 text-me-primary-500 semibold uppercase text-[10px]",
1089
+ selectedIndex > hidden && "bg-me-primary-500 text-white rounded"
1090
+ ),
1091
+ children: "MORE"
1092
+ }
1093
+ ),
1094
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components7.Popover, { children: menuHidden.length ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_aria_components7.Menu, { className: "bg-white rounded shadow-lg flex flex-col gap-0.5 p-0.5 min-w-28", children: menuHidden.map((item, idx) => {
1095
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1096
+ import_react_aria_components7.MenuItem,
1097
+ {
1098
+ className: (state) => cn(
1099
+ "hover:bg-me-gray-100 p-1 rounded-sm text-sm",
1100
+ selectedKey === item.id && "ring ring-me-primary-500"
1101
+ ),
1102
+ onAction: () => onSelectionChange?.(item.id),
1103
+ children: item.label
1104
+ },
1105
+ item.id
1106
+ );
1107
+ }) }, menuHidden.length) : null })
1108
+ ] });
1109
+ });
1098
1110
 
1099
1111
  // src/MetadataContainer.tsx
1100
1112
  var import_react_iiif_vault5 = require("react-iiif-vault");
package/dist/index.css CHANGED
@@ -590,6 +590,9 @@
590
590
  --tw-ring-opacity: 1;
591
591
  --tw-ring-color: rgb(184 76 116 / var(--tw-ring-opacity));
592
592
  }
593
+ .filter {
594
+ 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);
595
+ }
593
596
  .transition-all {
594
597
  transition-property: all;
595
598
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
package/dist/index.js CHANGED
@@ -932,6 +932,7 @@ function ManifestOverviewEmptyState({ onCreate, canCreate }) {
932
932
  // src/SidebarTabs.tsx
933
933
  import { useLayoutEffect as useLayoutEffect3, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
934
934
  import { Button as Button5, Menu, MenuItem, MenuTrigger, Popover, Tab as Tab2, TabList as TabList2, TabPanel as TabPanel2, Tabs as Tabs2 } from "react-aria-components";
935
+ import { createHideableComponent } from "@react-aria/collections";
935
936
  import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
936
937
  function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
937
938
  const ref = useRef3(null);
@@ -971,6 +972,7 @@ function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
971
972
  clearInterval(interval);
972
973
  };
973
974
  }, []);
975
+ const menuHidden = menu.filter((item, idx) => hidden >= menu.length - idx);
974
976
  return /* @__PURE__ */ jsxs22(
975
977
  Tabs2,
976
978
  {
@@ -998,34 +1000,16 @@ function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
998
1000
  item.id
999
1001
  );
1000
1002
  }) }),
1001
- hidden > 0 && /* @__PURE__ */ jsxs22(MenuTrigger, { children: [
1002
- /* @__PURE__ */ jsx32(
1003
- Button5,
1004
- {
1005
- className: cn(
1006
- "border-none rounded bg-gray-100 px-1.5 py-1 mr-2 mb-1 text-me-primary-500 semibold uppercase text-[10px]",
1007
- selectedIndex > hidden && "bg-me-primary-500 text-white rounded"
1008
- ),
1009
- children: "MORE"
1010
- }
1011
- ),
1012
- /* @__PURE__ */ jsx32(Popover, { children: /* @__PURE__ */ jsx32(Menu, { className: "bg-white rounded shadow-lg flex flex-col gap-0.5 p-0.5 min-w-28", children: menu.map((item, idx) => {
1013
- if (idx < menu.length - hidden)
1014
- return null;
1015
- return /* @__PURE__ */ jsx32(
1016
- MenuItem,
1017
- {
1018
- className: (state) => cn(
1019
- "hover:bg-me-gray-100 p-1 rounded-sm text-sm",
1020
- selectedKey === item.id && "ring ring-me-primary-500"
1021
- ),
1022
- onAction: () => onSelectionChange?.(item.id),
1023
- children: item.label
1024
- },
1025
- item.id
1026
- );
1027
- }) }) })
1028
- ] })
1003
+ hidden > 0 && /* @__PURE__ */ jsx32(
1004
+ MoreMenu,
1005
+ {
1006
+ hidden,
1007
+ menuHidden,
1008
+ selectedIndex,
1009
+ selectedKey,
1010
+ onSelectionChange
1011
+ }
1012
+ )
1029
1013
  ] }),
1030
1014
  menu.map((item) => /* @__PURE__ */ jsx32(TabPanel2, { id: item.id, className: "flex-1 overflow-y-auto h-full", children: item.renderComponent }, item.id))
1031
1015
  ]
@@ -1033,6 +1017,34 @@ function SidebarTabs({ menu, menuId, selectedKey, onSelectionChange }) {
1033
1017
  menuId
1034
1018
  );
1035
1019
  }
1020
+ var MoreMenu = createHideableComponent(({ selectedIndex, hidden, menuHidden, selectedKey, onSelectionChange }) => {
1021
+ return /* @__PURE__ */ jsxs22(MenuTrigger, { children: [
1022
+ /* @__PURE__ */ jsx32(
1023
+ Button5,
1024
+ {
1025
+ className: cn(
1026
+ "border-none rounded bg-gray-100 px-1.5 py-1 mr-2 mb-1 text-me-primary-500 semibold uppercase text-[10px]",
1027
+ selectedIndex > hidden && "bg-me-primary-500 text-white rounded"
1028
+ ),
1029
+ children: "MORE"
1030
+ }
1031
+ ),
1032
+ /* @__PURE__ */ jsx32(Popover, { children: menuHidden.length ? /* @__PURE__ */ jsx32(Menu, { className: "bg-white rounded shadow-lg flex flex-col gap-0.5 p-0.5 min-w-28", children: menuHidden.map((item, idx) => {
1033
+ return /* @__PURE__ */ jsx32(
1034
+ MenuItem,
1035
+ {
1036
+ className: (state) => cn(
1037
+ "hover:bg-me-gray-100 p-1 rounded-sm text-sm",
1038
+ selectedKey === item.id && "ring ring-me-primary-500"
1039
+ ),
1040
+ onAction: () => onSelectionChange?.(item.id),
1041
+ children: item.label
1042
+ },
1043
+ item.id
1044
+ );
1045
+ }) }, menuHidden.length) : null })
1046
+ ] });
1047
+ });
1036
1048
 
1037
1049
  // src/MetadataContainer.tsx
1038
1050
  import { LocaleString as LocaleString3 } from "react-iiif-vault";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manifest-editor/components",
3
- "version": "1.0.3",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "bugs": "https://github.com/digirati-co-uk/iiif-manifest-editor/issues",
6
6
  "repository": {
@@ -49,12 +49,14 @@
49
49
  "@headlessui/react": "^2.0.3",
50
50
  "@iiif/helpers": "^1.2.12",
51
51
  "@iiif/presentation-3": "^2.2.3",
52
+ "@react-aria/collections": "3.0.0-alpha.4",
52
53
  "clsx": "^2.1.1",
53
54
  "polygon-editor": "^0.0.4",
54
55
  "react": "^18.3.1",
55
- "react-aria": "^3.33.1",
56
- "react-aria-components": "^1.2.1",
56
+ "react-aria": "^3.34.3",
57
+ "react-aria-components": "^1.3.3",
57
58
  "react-dom": "^18.3.1",
59
+ "react-error-boundary": "^4.0.13",
58
60
  "react-iiif-vault": "^1.2.1",
59
61
  "react-lazy-load-image-component": "^1.6.0",
60
62
  "tailwind-merge": "^2.3.0"
@@ -75,5 +77,6 @@
75
77
  "publishConfig": {
76
78
  "access": "public"
77
79
  },
78
- "globalName": "ClientVault"
80
+ "globalName": "ClientVault",
81
+ "gitHead": "d1de1d181a41f39cd2f01839348fa2da187331cb"
79
82
  }