import{toConsumableArray as o}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import{difference as e,intersection as r}from"es-toolkit";import t,{forwardRef as i,useRef as l,useCallback as n,useMemo as s}from"react";import{BaseSizes as a}from"../../../../constants/sizes.js";import{ColorStyle as c,contentColors as d}from"../../../../utils/colors-vars-map.js";import{NoColor as m}from"@vibe/icons";import{ColorShapes as u,DEFAULT_NUMBER_OF_COLORS_IN_LINE as f}from"../../ColorPickerConstants.js";import{calculateColorPickerWidth as p}from"../../services/ColorPickerStyleService.js";import{useGridKeyboardNavigationContext as C,GridKeyboardNavigationContext as v}from"../../../GridKeyboardNavigationContext/GridKeyboardNavigationContext.js";import I from"./ColorPickerClearButton.js";import h from"./ColorPickerColorsGrid.js";import{withStaticProps as S}from"../../../../types/withStaticProps.js";import k from"../../../../hooks/useMergeRef.js";var y=S(i((function(i,c){var u=i.className,S=i.onValueChange,y=i.value,j=i.noColorText,b=i.colorStyle,g=void 0===b?"regular":b,x=i.ColorIndicatorIcon,B=i.SelectedIndicatorIcon,E=i.shouldRenderIndicatorWithoutBackground,M=i.NoColorIcon,N=void 0===M?m:M,P=i.isBlackListMode,w=void 0===P||P,z=i.colorsList,L=i.isMultiselect,O=i.colorSize,R=void 0===O?a.MEDIUM:O,T=i.numberOfColorsInLine,G=void 0===T?f:T,K=i.tooltipContentByColor,U=void 0===K?{}:K,W=i.focusOnMount,_=i.colorShape,q=void 0===_?"square":_,A=i.forceUseRawColorList,D=i.showColorNameTooltip,H=i.id,V=i["data-testid"],F=l(null),J=k(c,F),Q=l(null),X=l(null),Y=n((function(){S(null)}),[S]),Z=s((function(){return A?z:w?e(d,z):r(d,z)}),[A,w,z]),$=n((function(e){if(L){var r=o(y);if(r.includes(e)){var t=r.indexOf(e);t>-1&&r.splice(t,1)}else r.push(e);S(r)}else S([e])}),[L,S,y]),oo=s((function(){return[{topElement:Q,bottomElement:X}]}),[]),eo=C(oo,F),ro=p(R,G);return t.createElement("div",{className:u,style:{width:ro},ref:J,tabIndex:-1},t.createElement(v.Provider,{value:eo},t.createElement(h,{ref:Q,onColorClicked:$,colorsToRender:Z,numberOfColorsInLine:G,focusOnMount:W,value:y,colorStyle:g,ColorIndicatorIcon:x,shouldRenderIndicatorWithoutBackground:E,SelectedIndicatorIcon:B,colorSize:R,tooltipContentByColor:U,colorShape:q,showColorNameTooltip:D,id:H,"data-testid":V}),j&&t.createElement(I,{Icon:N,onClick:Y,text:j,ref:X})))})),{sizes:a,colorStyles:c,colorSizes:a,colorShapes:u});export{y as default};
//# sourceMappingURL=ColorPickerContent.js.map
