sanity-plugin-utils
2.0.132.0.14
dist/index.js~
dist/index.jsModified+10−8
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -1,11 +1,13 @@
+import "@sanity/ui/styles.css";
import { c } from "react/compiler-runtime";
-import { Badge, Box, Card, Flex, Menu, MenuItem, Stack, Text, TextInput } from "@sanity/ui";
+import { Badge, Box, Card, Flex, Stack, Text, TextInput } from "@sanity/ui";
import { jsx, jsxs } from "react/jsx-runtime";
import { css, styled } from "styled-components";
import { AddCircleIcon } from "@sanity/icons/AddCircle";
import { RemoveCircleIcon } from "@sanity/icons/RemoveCircle";
import { RestoreIcon } from "@sanity/icons/Restore";
+import { Menu, MenuItem } from "@sanity/ui/menu";
import { useContext, useEffect, useRef, useState } from "react";
import { UserAvatar, useClient, useDocumentStore, useWorkspace } from "sanity";
import { createImageUrlBuilder } from "@sanity/image-url";
import isEqual from "react-fast-compare";
@@ -43,17 +45,17 @@
border: !0,
children: t3
}), $[9] = t3, $[10] = tone, $[11] = t4) : t4 = $[11], t4;
}
-const StyledTable = /* @__PURE__ */ styled((t0) => {
+const TableWrapper = (t0) => {
let $ = c(4), t1;
$[0] === t0 ? t1 = $[1] : (t1 = t0 === void 0 ? {} : t0, $[0] = t0, $[1] = t1);
let props = t1, t2;
return $[2] === props ? t2 = $[3] : (t2 = /* @__PURE__ */ jsx(Card, {
as: "table",
...props
}), $[2] = props, $[3] = t2), t2;
-}).withConfig({
+}, StyledTable = /* @__PURE__ */ styled(TableWrapper).withConfig({
displayName: "StyledTable",
componentId: "sc-j6xlpp-0"
})(() => css`display:table;width:100%;border-collapse:collapse;&:not([hidden]){display:table;border-collapse:collapse;}`);
function Table(props) {
@@ -64,17 +66,17 @@
...rest,
children
}), $[3] = children, $[4] = rest, $[5] = t0) : t0 = $[5], t0;
}
-const StyledRow = /* @__PURE__ */ styled((t0) => {
+const RowWrapper = (t0) => {
let $ = c(4), t1;
$[0] === t0 ? t1 = $[1] : (t1 = t0 === void 0 ? {} : t0, $[0] = t0, $[1] = t1);
let props = t1, t2;
return $[2] === props ? t2 = $[3] : (t2 = /* @__PURE__ */ jsx(Card, {
as: "tr",
...props
}), $[2] = props, $[3] = t2), t2;
-}).withConfig({
+}, StyledRow = /* @__PURE__ */ styled(RowWrapper).withConfig({
displayName: "StyledRow",
componentId: "sc-j6xlpp-1"
})(() => css`display:table-row;&:not([hidden]){display:table-row;}`);
function Row(props) {
@@ -85,17 +87,17 @@
...rest,
children
}), $[3] = children, $[4] = rest, $[5] = t0) : t0 = $[5], t0;
}
-const StyledCell = /* @__PURE__ */ styled((t0) => {
+const CellWrapper = (t0) => {
let $ = c(4), t1;
$[0] === t0 ? t1 = $[1] : (t1 = t0 === void 0 ? {} : t0, $[0] = t0, $[1] = t1);
let props = t1, t2;
return $[2] === props ? t2 = $[3] : (t2 = /* @__PURE__ */ jsx(Card, {
as: "td",
...props
}), $[2] = props, $[3] = t2), t2;
-}).withConfig({
+}, StyledCell = /* @__PURE__ */ styled(CellWrapper).withConfig({
displayName: "StyledCell",
componentId: "sc-j6xlpp-2"
})(() => css`display:table-cell;&:not([hidden]){display:table-cell;}`);
function Cell(props) {
@@ -119,9 +121,9 @@
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [], $[2] = t3) : t3 = $[2];
let [users, setUsers] = useState(t3), t4;
$[3] !== client || $[4] !== currentUser?.id || $[5] !== users.length ? (t4 = () => {
let { projectId } = client.config();
- users.length || async function() {
+ users.length || async function getUsersWithRoles() {
try {
let aclData = await client.request({ url: `/projects/${projectId}/acl` }), userIdChunks = chunkArray(aclData.map(_temp$1), 200), usersWithRoles = (await Promise.all(userIdChunks.map((chunk) => client.request({ url: `/projects/${projectId}/users/${chunk.join(",")}` })))).flat().map((user_0) => {
let userRoles = aclData.find((aclUser) => aclUser.projectUserId === user_0.id)?.roles || [];
return Object.assign(user_0, {