UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

36 lines (35 loc) 1.22 kB
import { jsxs as v, jsx as r } from "react/jsx-runtime"; import { getPermissionLevelFromAccessType as d, permissionLevelToLabel as o, getAccessTypeFromPermissionLevel as h } from "../../utils/PermissionLevelToAccessType.js"; import { TextField as C, MenuItem as i, Typography as a } from "@mui/material"; const s = "CUSTOM", c = "Custom"; function x(u) { const { currentAccessType: t, availablePermissionLevels: m, onChange: T } = u, n = d(t), l = n == null; return /* @__PURE__ */ v( C, { value: l ? s : n, onChange: (e) => { const p = h( e.target.value ); T(p || t); }, fullWidth: !0, select: !0, size: "small", slotProps: { select: { renderValue: (e) => e == s ? c : o[e] } }, children: [ Object.values(m).map((e) => /* @__PURE__ */ r(i, { value: e, children: /* @__PURE__ */ r(a, { variant: "smallText1", noWrap: !0, children: o[e] }) }, e)), l && /* @__PURE__ */ r(i, { value: s, children: /* @__PURE__ */ r(a, { variant: "smallText1", noWrap: !0, children: c }) }) ] } ); } export { x as PermissionLevelMenu }; //# sourceMappingURL=PermissionLevelMenu.js.map