UNPKG

ll-package

Version:

2 lines (1 loc) 4.39 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("../../../../@babel/runtime/helpers/esm/extends.js");require("../../theme/internal.js");const p=require("./dropdown.js"),g=require("./multiple.js"),f=require("./single.js"),i=require("../../style/index.js"),m=require("../../style/compact-item.js"),$=require("../../theme/util/genComponentStyleHook.js"),l=require("../../theme/util/statistic.js"),b=e=>{const{componentCls:o}=e;return{position:"relative",backgroundColor:e.colorBgContainer,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,transition:`all ${e.motionDurationMid} ${e.motionEaseInOut}`,input:{cursor:"pointer"},[`${o}-show-search&`]:{cursor:"text",input:{cursor:"auto",color:"inherit"}},[`${o}-disabled&`]:{color:e.colorTextDisabled,background:e.colorBgContainerDisabled,cursor:"not-allowed",[`${o}-multiple&`]:{background:e.colorBgContainerDisabled},input:{cursor:"not-allowed"}}}},s=function(e,o){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{componentCls:t,borderHoverColor:a,outlineColor:c,antCls:u}=o,d=n?{[`${t}-selector`]:{borderColor:a}}:{};return{[e]:{[`&:not(${t}-disabled):not(${t}-customize-input):not(${u}-pagination-size-changer)`]:r.default(r.default({},d),{[`${t}-focused& ${t}-selector`]:{borderColor:a,boxShadow:`0 0 0 ${o.controlOutlineWidth}px ${c}`,borderInlineEndWidth:`${o.controlLineWidth}px !important`,outline:0},[`&:hover ${t}-selector`]:{borderColor:a,borderInlineEndWidth:`${o.controlLineWidth}px !important`}})}}},S=e=>{const{componentCls:o}=e;return{[`${o}-selection-search-input`]:{margin:0,padding:0,background:"transparent",border:"none",outline:"none",appearance:"none","&::-webkit-search-cancel-button":{display:"none","-webkit-appearance":"none"}}}},h=e=>{const{componentCls:o,inputPaddingHorizontalBase:n,iconCls:t}=e;return{[o]:r.default(r.default({},i.resetComponent(e)),{position:"relative",display:"inline-block",cursor:"pointer",[`&:not(${o}-customize-input) ${o}-selector`]:r.default(r.default({},b(e)),S(e)),[`${o}-selection-item`]:r.default({flex:1,fontWeight:"normal"},i.textEllipsis),[`${o}-selection-placeholder`]:r.default(r.default({},i.textEllipsis),{flex:1,color:e.colorTextPlaceholder,pointerEvents:"none"}),[`${o}-arrow`]:r.default(r.default({},i.resetIcon()),{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:n,height:e.fontSizeIcon,marginTop:-e.fontSizeIcon/2,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,lineHeight:1,textAlign:"center",pointerEvents:"none",display:"flex",alignItems:"center",[t]:{verticalAlign:"top",transition:`transform ${e.motionDurationSlow}`,"> svg":{verticalAlign:"top"},[`&:not(${o}-suffix)`]:{pointerEvents:"auto"}},[`${o}-disabled &`]:{cursor:"not-allowed"},"> *:not(:last-child)":{marginInlineEnd:8}}),[`${o}-clear`]:{position:"absolute",top:"50%",insetInlineStart:"auto",insetInlineEnd:n,zIndex:1,display:"inline-block",width:e.fontSizeIcon,height:e.fontSizeIcon,marginTop:-e.fontSizeIcon/2,color:e.colorTextQuaternary,fontSize:e.fontSizeIcon,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",background:e.colorBgContainer,cursor:"pointer",opacity:0,transition:`color ${e.motionDurationMid} ease, opacity ${e.motionDurationSlow} ease`,textRendering:"auto","&:before":{display:"block"},"&:hover":{color:e.colorTextTertiary}},"&:hover":{[`${o}-clear`]:{opacity:1}}}),[`${o}-has-feedback`]:{[`${o}-clear`]:{insetInlineEnd:n+e.fontSize+e.paddingXXS}}}},C=e=>{const{componentCls:o}=e;return[{[o]:{[`&-borderless ${o}-selector`]:{backgroundColor:"transparent !important",borderColor:"transparent !important",boxShadow:"none !important"},[`&${o}-in-form-item`]:{width:"100%"}}},h(e),f.default(e),g.default(e),p.default(e),{[`${o}-rtl`]:{direction:"rtl"}},s(o,l.merge(e,{borderHoverColor:e.colorPrimaryHover,outlineColor:e.controlOutline})),s(`${o}-status-error`,l.merge(e,{borderHoverColor:e.colorErrorHover,outlineColor:e.colorErrorOutline}),!0),s(`${o}-status-warning`,l.merge(e,{borderHoverColor:e.colorWarningHover,outlineColor:e.colorWarningOutline}),!0),m.genCompactItemStyle(e,{borderElCls:`${o}-selector`,focusElCls:`${o}-focused`})]},x=$.default("Select",(e,o)=>{let{rootPrefixCls:n}=o;const t=l.merge(e,{rootPrefixCls:n,inputPaddingHorizontalBase:e.paddingSM-1});return[C(t)]},e=>({zIndexPopup:e.zIndexPopupBase+50}));exports.default=x;