'use client';
import{jsxs as o,jsx as t}from"react/jsx-runtime";import e from"../dropdown-option/VariantOption.js";import i from"../dropdown-option/DropdownOption.js";import{getSelectClass as n}from"../../common/dropdown/classes.js";import{createClass as r,createStyle as a,createAttr as p,If as m}from"@gem-sdk/system";import{getSelectStyle as d}from"../../common/dropdown/styles.js";import{getSelectAttr as s}from"../../common/dropdown/attrs.js";import{useDropdownSwatches as l}from"./hooks/useDropdownSwatches.js";let DropdownVariant=c=>{let{option:w,optionPosition:h,optionNumber:u,variantGroup:f,variants:j,price:v,blankText:b,swatchHeight:g,optionTypography:k,optionTransform:y,initValue:C,hasPreSelected:D,optionTypo:N,combineHeight:S,combineWidth:x,soldOutStyle:O}=c,{optionBgColor:P,optionTextColor:V,optionRounded:B,optionShadow:R,optionHasShadow:H,optionBorder:M}=c,{value:T,preset:q,handleOnChangeSelect:z,checkVariantInStock:A}=l(c),E="disable"===O;f||(P=q?.optionBgColor,V=q?.optionTextColor,M=q?.optionBorder,H=q?.optionHasShadow,R=q?.optionShadow,B=q?.optionRounded);let F=r(n({optionTypo:N,optionTypography:k,optionBgColor:P,optionBorder:M,optionTextColor:V})),G=a(d({width:f?x:q?.width,height:f?S:q?.height,optionTypo:N,optionTypography:k,optionBgColor:P,optionTextColor:V,optionRounded:B,optionShadow:R,optionHasShadow:H,optionBorder:M,optionTransform:y,swatchHeight:g,isCombine:f})),I=p(s({optionName:w?.name,value:T??C,type:"React"})),J=()=>j?.map(o=>t(e,{disabled:!A(o)&&E,value:o?.id,variant:o,includePrice:v},o?.id)),K=()=>w?.values?.map(o=>t(i,{value:o,optionName:w.name,optionPosition:h,optionNumber:u,isSoldOutMark:E},o?.id));return o("select",{...I,className:F,style:G,onChange:o=>z(o),children:[m(!D,t("option",{value:"blank",children:b??"Please select an option"})," "),m(f,J(),K())]})};export{DropdownVariant as default};
