@equinor/amplify-component-lib 9.10.0 → 9.10.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import{useState as i,useRef as o}from"react";import{Icon as l,Typography as n,Button as a,Menu as s}from"@equinor/eds-core-react";import{account_circle as c,check as d,more_horizontal as m,edit as
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import{useState as i,useRef as o}from"react";import{Icon as l,Typography as n,Button as a,Menu as s}from"@equinor/eds-core-react";import{account_circle as c,check as d,more_horizontal as m,edit as p,delete_to_trash as g}from"@equinor/eds-icons";import{useMappedRoles as h}from"./hooks/useMappedRoles.js";import{Container as u,RoleChipContainer as f,RoleChip as b}from"./UserImpersonation.styles.js";import{colors as _}from"../../../../atoms/style/colors.js";import{ListItem as v}from"../../../../molecules/ListItem/ListItem.js";import{OptionalTooltip as C}from"../../../../molecules/OptionalTooltip/OptionalTooltip.js";import{impersonateUserDtoToFullName as j}from"./Impersonate.utils.js";import k from"styled-components";const $=k(v)`
|
|
2
2
|
svg {
|
|
3
3
|
fill: ${_.interactive.danger__resting.rgba};
|
|
4
4
|
}
|
|
@@ -13,4 +13,4 @@ import{jsxs as e,Fragment as t,jsx as r}from"react/jsx-runtime";import{useState
|
|
|
13
13
|
&:hover:not(:disabled) {
|
|
14
14
|
background: ${_.interactive.danger__highlight.rgba};
|
|
15
15
|
}
|
|
16
|
-
`,y=({firstName:k,lastName:y,uniqueName:N,roles:x,activeUsers:I,selected:q,onClick:E,onEdit:D,onDelete:L})=>{const[O,T]=i(!1),U=o(null),w=j({firstName:k,lastName:y}),M=h(x),R=()=>T(!1);return e(t,{children:[e(u,{$selected:q,onClick:e=>{e.target!==U.current&&E(N)},"data-testid":"impersonation-user",children:[r(l,{color:_.text.static_icons__tertiary.rgba,data:c}),r(n,{"data-testid":"name",children:w}),e(f,{$selected:q,children:[r(b,{"data-testid":"role",children:M[0].label}),M.length>1&&r(C,{title:M.slice(1).join(", "),children:r(b,{"data-testid":"additional-roles",children:"+"+(M.length-1)})})]}),q&&r(l,{data:d,color:_.interactive.primary__resting.rgba}),r(a,{variant:"ghost_icon",ref:U,onClick:()=>T((e=>!e)),children:r(l,{data:m})})]}),O&&e(s,{open:!0,anchorEl:U.current,placement:"right-start",onClose:R,children:[r(v,{label:"Edit user",onClick:()=>{D(N),R()},leadingContent:
|
|
16
|
+
`,y=({firstName:k,lastName:y,uniqueName:N,roles:x,activeUsers:I,selected:q,onClick:E,onEdit:D,onDelete:L})=>{const[O,T]=i(!1),U=o(null),w=j({firstName:k,lastName:y}),M=h(x),R=()=>T(!1);return e(t,{children:[e(u,{$selected:q,onClick:e=>{e.target!==U.current&&E(N)},"data-testid":"impersonation-user",children:[r(l,{color:_.text.static_icons__tertiary.rgba,data:c}),r(n,{"data-testid":"name",children:w}),e(f,{$selected:q,children:[r(b,{"data-testid":"role",children:M[0].label}),M.length>1&&r(C,{title:M.slice(1).map((e=>e.label)).join(", "),children:r(b,{"data-testid":"additional-roles",children:"+"+(M.length-1)})})]}),q&&r(l,{data:d,color:_.interactive.primary__resting.rgba}),r(a,{variant:"ghost_icon",ref:U,onClick:()=>T((e=>!e)),children:r(l,{data:m})})]}),O&&e(s,{open:!0,anchorEl:U.current,placement:"right-start",onClose:R,children:[r(v,{label:"Edit user",onClick:()=>{D(N),R()},leadingContent:p}),r(C,{title:I.length>0?"Cannot delete user with active sessions":void 0,children:r($,{label:"Delete user",onClick:()=>{L(N),R()},disabled:I.length>0,leadingContent:g})})]})]})};export{y as UserImpersonation};
|