import{K as w,u as i,a5 as I,h as F,L as B}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{r as a}from"./index-NdkWRN8K.js";import{M as O}from"./MuiPropsContext-DhRylJZk.js";import{j as H}from"./jsx-runtime-CnH95YSl.js";import{C as N}from"./Chip-CXnMieIl.js";/*!
 * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */const n=a.createContext({chipElementType:"div"}),f=({colorVariant:u,contrastMode:c,odysseyDesignTokens:t})=>{const r={default:{...c==="highContrast"&&{background:t.HueNeutral200,text:t.HueNeutral700,textDisabled:t.HueNeutral400},...c==="lowContrast"&&{background:t.HueNeutral100,text:t.HueNeutral700,textDisabled:t.HueNeutral300},hover:t.HueNeutral200,active:t.HueNeutral300,border:t.HueNeutral200,deleteIcon:t.HueNeutral500,deleteIconHover:t.HueNeutral700,icon:t.HueNeutral700,iconDisabled:t.HueNeutral300},info:{...c==="highContrast"&&{background:t.HueBlue200,text:t.HueBlue700,textDisabled:t.HueBlue400},...c==="lowContrast"&&{background:t.HueBlue100,text:t.HueBlue700,textDisabled:t.HueBlue300},hover:t.HueBlue200,active:t.HueBlue300,border:t.HueBlue200,deleteIcon:t.HueBlue500,deleteIconHover:t.HueBlue700,icon:t.HueBlue700,iconDisabled:t.HueBlue300},accentOne:{...c==="highContrast"&&{background:t.HueAccentOne200,text:t.HueAccentOne700,textDisabled:t.HueAccentOne400},...c==="lowContrast"&&{background:t.HueAccentOne100,text:t.HueAccentOne700,textDisabled:t.HueAccentOne300},hover:t.HueAccentOne200,active:t.HueAccentOne300,border:t.HueAccentOne200,deleteIcon:t.HueAccentOne500,deleteIconHover:t.HueAccentOne700,icon:t.HueAccentOne700,iconDisabled:t.HueAccentOne300},accentTwo:{...c==="highContrast"&&{background:t.HueAccentTwo200,text:t.HueAccentTwo800,textDisabled:t.HueAccentTwo400},...c==="lowContrast"&&{background:t.HueAccentTwo100,text:t.HueAccentTwo700,textDisabled:t.HueAccentTwo300},hover:t.HueAccentTwo200,active:t.HueAccentTwo300,border:t.HueAccentTwo200,deleteIcon:t.HueAccentTwo500,deleteIconHover:t.HueAccentTwo700,icon:t.HueAccentTwo700,iconDisabled:t.HueAccentTwo300},accentThree:{...c==="highContrast"&&{background:t.HueAccentThree200,text:t.HueAccentThree700,textDisabled:t.HueAccentThree400},...c==="lowContrast"&&{background:t.HueAccentThree100,text:t.HueAccentThree700,textDisabled:t.HueAccentThree300},hover:t.HueAccentThree200,active:t.HueAccentThree300,border:t.HueAccentThree200,deleteIcon:t.HueAccentThree500,deleteIconHover:t.HueAccentThree700,icon:t.HueAccentThree700,iconDisabled:t.HueAccentThree300},accentFour:{...c==="highContrast"&&{background:t.HueAccentFour200,text:t.HueAccentFour700,textDisabled:t.HueAccentFour400},...c==="lowContrast"&&{background:t.HueAccentFour100,text:t.HueAccentFour700,textDisabled:t.HueAccentFour300},hover:t.HueAccentFour200,active:t.HueAccentFour300,border:t.HueAccentFour200,deleteIcon:t.HueAccentFour500,deleteIconHover:t.HueAccentFour700,icon:t.HueAccentFour700,iconDisabled:t.HueAccentFour300}};return r[u]||r.default},d=F(N,{shouldForwardProp:u=>!["colorVariant","contrastMode","odysseyDesignTokens","size"].includes(u)})(({colorVariant:u,contrastMode:c,odysseyDesignTokens:t,clickable:r,size:l})=>{const e=f({colorVariant:u,odysseyDesignTokens:t,contrastMode:c});return{backgroundColor:e.background,color:e.text,...r===!0&&{borderColor:e.border},...r===!1&&{borderColor:"transparent"},...l==="small"&&{paddingBlock:`calc(${t.Spacing1})`},"&.MuiChip-clickable:hover":{backgroundColor:e.hover},"&.MuiChip-clickable:active":{backgroundColor:e.active},"&.Mui-disabled":{color:e.textDisabled,borderColor:e.border,"& .MuiChip-icon, & .MuiChip-deleteIcon":{color:e.iconDisabled}},"& .MuiChip-icon":{color:e.icon},"& .MuiChip-deleteIcon":{color:e.deleteIcon,"&:hover":{color:e.deleteIconHover}}}}),j=({colorVariant:u="default",icon:c,isDisabled:t,label:r,onClick:l,onRemove:e,size:A="medium",testId:b,translate:h})=>{const{t:x}=w(),o=i(),{chipElementType:C}=a.useContext(n),{contrastMode:p}=I(),v=a.useCallback(m=>H.jsx(d,{...m,"aria-disabled":t,as:C,clickable:!!l,colorVariant:u,contrastMode:p,"data-se":b,deleteIcon:H.jsx(B,{role:"button",titleAccess:x("tag.remove")}),disabled:t,icon:c,label:r,odysseyDesignTokens:o,onClick:l,onDelete:e,size:A,translate:h}),[x,C,u,p,c,t,r,o,l,e,A,b,h]);return H.jsx(O.Consumer,{children:v})},M=a.memo(j);M.displayName="Tag";export{M,n as T};
