RadioGroup-6edab0a1.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. import{r as Ce,ee as we,cJ as ye,h as Re,bv as H,cU as ze,ah as j,L as Se,d as U,k as s,W as O,aa as N,f as D,C as P,ac as G,aZ as re,ab as E,be as te,al as x,U as C,T as f,V as g,Z as F,bB as _e,ax as Be,ay as Te,aU as ae,ad as X,$ as A,ef as Fe,ae as oe,a5 as M,a1 as ne,bw as $e,bz as Ie,bu as De,n as Pe,bG as Ue,Y as ee,eg as ie,ag as Le,bn as Ae}from"./index-e497b666.js";import{g as Ve}from"./get-slot-1efb97e5.js";function Xe(e={},o){const r=Ce({ctrl:!1,command:!1,win:!1,shift:!1,tab:!1}),{keydown:c,keyup:u}=e,b=n=>{switch(n.key){case"Control":r.ctrl=!0;break;case"Meta":r.command=!0,r.win=!0;break;case"Shift":r.shift=!0;break;case"Tab":r.tab=!0;break}c!==void 0&&Object.keys(c).forEach(l=>{if(l!==n.key)return;const v=c[l];if(typeof v=="function")v(n);else{const{stop:p=!1,prevent:a=!1}=v;p&&n.stopPropagation(),a&&n.preventDefault(),v.handler(n)}})},i=n=>{switch(n.key){case"Control":r.ctrl=!1;break;case"Meta":r.command=!1,r.win=!1;break;case"Shift":r.shift=!1;break;case"Tab":r.tab=!1;break}u!==void 0&&Object.keys(u).forEach(l=>{if(l!==n.key)return;const v=u[l];if(typeof v=="function")v(n);else{const{stop:p=!1,prevent:a=!1}=v;p&&n.stopPropagation(),a&&n.preventDefault(),v.handler(n)}})},h=()=>{(o===void 0||o.value)&&(j("keydown",document,b),j("keyup",document,i)),o!==void 0&&Se(o,n=>{n?(j("keydown",document,b),j("keyup",document,i)):(H("keydown",document,b),H("keyup",document,i))})};return we()?(ye(h),Re(()=>{(o===void 0||o.value)&&(H("keydown",document,b),H("keyup",document,i))})):h(),ze(r)}const eo=U({name:"Backward",render(){return s("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("path",{d:"M12.2674 15.793C11.9675 16.0787 11.4927 16.0672 11.2071 15.7673L6.20572 10.5168C5.9298 10.2271 5.9298 9.7719 6.20572 9.48223L11.2071 4.23177C11.4927 3.93184 11.9675 3.92031 12.2674 4.206C12.5673 4.49169 12.5789 4.96642 12.2932 5.26634L7.78458 9.99952L12.2932 14.7327C12.5789 15.0326 12.5673 15.5074 12.2674 15.793Z",fill:"currentColor"}))}}),oo=U({name:"FastBackward",render(){return s("svg",{viewBox:"0 0 20 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},s("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},s("g",{fill:"currentColor","fill-rule":"nonzero"},s("path",{d:"M8.73171,16.7949 C9.03264,17.0795 9.50733,17.0663 9.79196,16.7654 C10.0766,16.4644 10.0634,15.9897 9.76243,15.7051 L4.52339,10.75 L17.2471,10.75 C17.6613,10.75 17.9971,10.4142 17.9971,10 C17.9971,9.58579 17.6613,9.25 17.2471,9.25 L4.52112,9.25 L9.76243,4.29275 C10.0634,4.00812 10.0766,3.53343 9.79196,3.2325 C9.50733,2.93156 9.03264,2.91834 8.73171,3.20297 L2.31449,9.27241 C2.14819,9.4297 2.04819,9.62981 2.01448,9.8386 C2.00308,9.89058 1.99707,9.94459 1.99707,10 C1.99707,10.0576 2.00356,10.1137 2.01585,10.1675 C2.05084,10.3733 2.15039,10.5702 2.31449,10.7254 L8.73171,16.7949 Z"}))))}}),no=U({name:"FastForward",render(){return s("svg",{viewBox:"0 0 20 20",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},s("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},s("g",{fill:"currentColor","fill-rule":"nonzero"},s("path",{d:"M11.2654,3.20511 C10.9644,2.92049 10.4897,2.93371 10.2051,3.23464 C9.92049,3.53558 9.93371,4.01027 10.2346,4.29489 L15.4737,9.25 L2.75,9.25 C2.33579,9.25 2,9.58579 2,10.0000012 C2,10.4142 2.33579,10.75 2.75,10.75 L15.476,10.75 L10.2346,15.7073 C9.93371,15.9919 9.92049,16.4666 10.2051,16.7675 C10.4897,17.0684 10.9644,17.0817 11.2654,16.797 L17.6826,10.7276 C17.8489,10.5703 17.9489,10.3702 17.9826,10.1614 C17.994,10.1094 18,10.0554 18,10.0000012 C18,9.94241 17.9935,9.88633 17.9812,9.83246 C17.9462,9.62667 17.8467,9.42976 17.6826,9.27455 L11.2654,3.20511 Z"}))))}}),ro=U({name:"Forward",render(){return s("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},s("path",{d:"M7.73271 4.20694C8.03263 3.92125 8.50737 3.93279 8.79306 4.23271L13.7944 9.48318C14.0703 9.77285 14.0703 10.2281 13.7944 10.5178L8.79306 15.7682C8.50737 16.0681 8.03263 16.0797 7.73271 15.794C7.43279 15.5083 7.42125 15.0336 7.70694 14.7336L12.2155 10.0005L7.70694 5.26729C7.42125 4.96737 7.43279 4.49264 7.73271 4.20694Z",fill:"currentColor"}))}}),Ee=s("svg",{viewBox:"0 0 64 64",class:"check-icon"},s("path",{d:"M50.42,16.76L22.34,39.45l-8.1-11.46c-1.12-1.58-3.3-1.96-4.88-0.84c-1.58,1.12-1.95,3.3-0.84,4.88l10.26,14.51 c0.56,0.79,1.42,1.31,2.38,1.45c0.16,0.02,0.32,0.03,0.48,0.03c0.8,0,1.57-0.27,2.2-0.78l30.99-25.03c1.5-1.21,1.74-3.42,0.52-4.92 C54.13,15.78,51.93,15.55,50.42,16.76z"})),Me=s("svg",{viewBox:"0 0 100 100",class:"line-icon"},s("path",{d:"M80.2,55.5H21.4c-2.8,0-5.1-2.5-5.1-5.5l0,0c0-3,2.3-5.5,5.1-5.5h58.7c2.8,0,5.1,2.5,5.1,5.5l0,0C85.2,53.1,82.9,55.5,80.2,55.5z"})),le=te("n-checkbox-group"),Oe={min:Number,max:Number,size:String,value:Array,defaultValue:{type:Array,default:null},disabled:{type:Boolean,default:void 0},"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array],onChange:[Function,Array]},to=U({name:"CheckboxGroup",props:Oe,setup(e){const{mergedClsPrefixRef:o}=O(e),r=N(e),{mergedSizeRef:c,mergedDisabledRef:u}=r,b=D(e.defaultValue),i=P(()=>e.value),h=G(i,b),n=P(()=>{var p;return((p=h.value)===null||p===void 0?void 0:p.length)||0}),l=P(()=>Array.isArray(h.value)?new Set(h.value):new Set);function v(p,a){const{nTriggerFormInput:y,nTriggerFormChange:w}=r,{onChange:R,"onUpdate:value":z,onUpdateValue:S}=e;if(Array.isArray(h.value)){const d=Array.from(h.value),k=d.findIndex(_=>_===a);p?~k||(d.push(a),S&&x(S,d,{actionType:"check",value:a}),z&&x(z,d,{actionType:"check",value:a}),y(),w(),b.value=d,R&&x(R,d)):~k&&(d.splice(k,1),S&&x(S,d,{actionType:"uncheck",value:a}),z&&x(z,d,{actionType:"uncheck",value:a}),R&&x(R,d),b.value=d,y(),w())}else p?(S&&x(S,[a],{actionType:"check",value:a}),z&&x(z,[a],{actionType:"check",value:a}),R&&x(R,[a]),b.value=[a],y(),w()):(S&&x(S,[],{actionType:"uncheck",value:a}),z&&x(z,[],{actionType:"uncheck",value:a}),R&&x(R,[]),b.value=[],y(),w())}return re(le,{checkedCountRef:n,maxRef:E(e,"max"),minRef:E(e,"min"),valueSetRef:l,disabledRef:u,mergedSizeRef:c,toggleCheckbox:v}),{mergedClsPrefix:o}},render(){return s("div",{class:`${this.mergedClsPrefix}-checkbox-group`,role:"group"},this.$slots)}}),je=C([f("checkbox",`
  2. line-height: var(--n-label-line-height);
  3. font-size: var(--n-font-size);
  4. outline: none;
  5. cursor: pointer;
  6. display: inline-flex;
  7. flex-wrap: nowrap;
  8. align-items: flex-start;
  9. word-break: break-word;
  10. --n-merged-color-table: var(--n-color-table);
  11. `,[C("&:hover",[f("checkbox-box",[g("border",{border:"var(--n-border-checked)"})])]),C("&:focus:not(:active)",[f("checkbox-box",[g("border",`
  12. border: var(--n-border-focus);
  13. box-shadow: var(--n-box-shadow-focus);
  14. `)])]),F("inside-table",[f("checkbox-box",`
  15. background-color: var(--n-merged-color-table);
  16. `)]),F("checked",[f("checkbox-box",`
  17. background-color: var(--n-color-checked);
  18. `,[f("checkbox-icon",[C(".check-icon",`
  19. opacity: 1;
  20. transform: scale(1);
  21. `)])])]),F("indeterminate",[f("checkbox-box",[f("checkbox-icon",[C(".check-icon",`
  22. opacity: 0;
  23. transform: scale(.5);
  24. `),C(".line-icon",`
  25. opacity: 1;
  26. transform: scale(1);
  27. `)])])]),F("checked, indeterminate",[C("&:focus:not(:active)",[f("checkbox-box",[g("border",`
  28. border: var(--n-border-checked);
  29. box-shadow: var(--n-box-shadow-focus);
  30. `)])]),f("checkbox-box",`
  31. background-color: var(--n-color-checked);
  32. border-left: 0;
  33. border-top: 0;
  34. `,[g("border",{border:"var(--n-border-checked)"})])]),F("disabled",{cursor:"not-allowed"},[F("checked",[f("checkbox-box",`
  35. background-color: var(--n-color-disabled-checked);
  36. `,[g("border",{border:"var(--n-border-disabled-checked)"}),f("checkbox-icon",[C(".check-icon, .line-icon",{fill:"var(--n-check-mark-color-disabled-checked)"})])])]),f("checkbox-box",`
  37. background-color: var(--n-color-disabled);
  38. `,[g("border",{border:"var(--n-border-disabled)"}),f("checkbox-icon",[C(".check-icon, .line-icon",{fill:"var(--n-check-mark-color-disabled)"})])]),g("label",{color:"var(--n-text-color-disabled)"})]),f("checkbox-box-wrapper",`
  39. position: relative;
  40. width: var(--n-size);
  41. flex-shrink: 0;
  42. flex-grow: 0;
  43. user-select: none;
  44. -webkit-user-select: none;
  45. `),f("checkbox-box",`
  46. position: absolute;
  47. left: 0;
  48. top: 50%;
  49. transform: translateY(-50%);
  50. height: var(--n-size);
  51. width: var(--n-size);
  52. display: inline-block;
  53. box-sizing: border-box;
  54. border-radius: var(--n-border-radius);
  55. background-color: var(--n-color);
  56. transition: background-color 0.3s var(--n-bezier);
  57. `,[g("border",`
  58. transition:
  59. border-color .3s var(--n-bezier),
  60. box-shadow .3s var(--n-bezier);
  61. border-radius: inherit;
  62. position: absolute;
  63. left: 0;
  64. right: 0;
  65. top: 0;
  66. bottom: 0;
  67. border: var(--n-border);
  68. `),f("checkbox-icon",`
  69. display: flex;
  70. align-items: center;
  71. justify-content: center;
  72. position: absolute;
  73. left: 1px;
  74. right: 1px;
  75. top: 1px;
  76. bottom: 1px;
  77. `,[C(".check-icon, .line-icon",`
  78. width: 100%;
  79. fill: var(--n-check-mark-color);
  80. opacity: 0;
  81. transform: scale(0.5);
  82. transform-origin: center;
  83. transition:
  84. fill 0.3s var(--n-bezier),
  85. transform 0.3s var(--n-bezier),
  86. opacity 0.3s var(--n-bezier),
  87. border-color 0.3s var(--n-bezier);
  88. `),_e({left:"1px",top:"1px"})])]),g("label",`
  89. color: var(--n-text-color);
  90. transition: color .3s var(--n-bezier);
  91. user-select: none;
  92. -webkit-user-select: none;
  93. padding: var(--n-label-padding);
  94. font-weight: var(--n-label-font-weight);
  95. `,[C("&:empty",{display:"none"})])]),Be(f("checkbox",`
  96. --n-merged-color-table: var(--n-color-table-modal);
  97. `)),Te(f("checkbox",`
  98. --n-merged-color-table: var(--n-color-table-popover);
  99. `))]),He=Object.assign(Object.assign({},A.props),{size:String,checked:{type:[Boolean,String,Number],default:void 0},defaultChecked:{type:[Boolean,String,Number],default:!1},value:[String,Number],disabled:{type:Boolean,default:void 0},indeterminate:Boolean,label:String,focusable:{type:Boolean,default:!0},checkedValue:{type:[Boolean,String,Number],default:!0},uncheckedValue:{type:[Boolean,String,Number],default:!1},"onUpdate:checked":[Function,Array],onUpdateChecked:[Function,Array],privateInsideTable:Boolean,onChange:[Function,Array]}),ao=U({name:"Checkbox",props:He,setup(e){const o=D(null),{mergedClsPrefixRef:r,inlineThemeDisabled:c,mergedRtlRef:u}=O(e),b=N(e,{mergedSize(t){const{size:B}=e;if(B!==void 0)return B;if(n){const{value:T}=n.mergedSizeRef;if(T!==void 0)return T}if(t){const{mergedSize:T}=t;if(T!==void 0)return T.value}return"medium"},mergedDisabled(t){const{disabled:B}=e;if(B!==void 0)return B;if(n){if(n.disabledRef.value)return!0;const{maxRef:{value:T},checkedCountRef:$}=n;if(T!==void 0&&$.value>=T&&!a.value)return!0;const{minRef:{value:I}}=n;if(I!==void 0&&$.value<=I&&a.value)return!0}return t?t.disabled.value:!1}}),{mergedDisabledRef:i,mergedSizeRef:h}=b,n=ae(le,null),l=D(e.defaultChecked),v=E(e,"checked"),p=G(v,l),a=X(()=>{if(n){const t=n.valueSetRef.value;return t&&e.value!==void 0?t.has(e.value):!1}else return p.value===e.checkedValue}),y=A("Checkbox","-checkbox",je,Fe,e,r);function w(t){if(n&&e.value!==void 0)n.toggleCheckbox(!a.value,e.value);else{const{onChange:B,"onUpdate:checked":T,onUpdateChecked:$}=e,{nTriggerFormInput:I,nTriggerFormChange:V}=b,L=a.value?e.uncheckedValue:e.checkedValue;T&&x(T,L,t),$&&x($,L,t),B&&x(B,L,t),I(),V(),l.value=L}}function R(t){i.value||w(t)}function z(t){if(!i.value)switch(t.key){case" ":case"Enter":w(t)}}function S(t){switch(t.key){case" ":t.preventDefault()}}const d={focus:()=>{var t;(t=o.value)===null||t===void 0||t.focus()},blur:()=>{var t;(t=o.value)===null||t===void 0||t.blur()}},k=oe("Checkbox",u,r),_=P(()=>{const{value:t}=h,{common:{cubicBezierEaseInOut:B},self:{borderRadius:T,color:$,colorChecked:I,colorDisabled:V,colorTableHeader:L,colorTableHeaderModal:K,colorTableHeaderPopover:Z,checkMarkColor:W,checkMarkColorDisabled:Y,border:J,borderFocus:q,borderDisabled:Q,borderChecked:se,boxShadowFocus:ce,textColor:ue,textColorDisabled:be,checkMarkColorDisabledChecked:he,colorDisabledChecked:fe,borderDisabledChecked:ve,labelPadding:ge,labelLineHeight:pe,labelFontWeight:me,[M("fontSize",t)]:ke,[M("size",t)]:xe}}=y.value;return{"--n-label-line-height":pe,"--n-label-font-weight":me,"--n-size":xe,"--n-bezier":B,"--n-border-radius":T,"--n-border":J,"--n-border-checked":se,"--n-border-focus":q,"--n-border-disabled":Q,"--n-border-disabled-checked":ve,"--n-box-shadow-focus":ce,"--n-color":$,"--n-color-checked":I,"--n-color-table":L,"--n-color-table-modal":K,"--n-color-table-popover":Z,"--n-color-disabled":V,"--n-color-disabled-checked":fe,"--n-text-color":ue,"--n-text-color-disabled":be,"--n-check-mark-color":W,"--n-check-mark-color-disabled":Y,"--n-check-mark-color-disabled-checked":he,"--n-font-size":ke,"--n-label-padding":ge}}),m=c?ne("checkbox",P(()=>h.value[0]),_,e):void 0;return Object.assign(b,d,{rtlEnabled:k,selfRef:o,mergedClsPrefix:r,mergedDisabled:i,renderedChecked:a,mergedTheme:y,labelId:$e(),handleClick:R,handleKeyUp:z,handleKeyDown:S,cssVars:c?void 0:_,themeClass:m==null?void 0:m.themeClass,onRender:m==null?void 0:m.onRender})},render(){var e;const{$slots:o,renderedChecked:r,mergedDisabled:c,indeterminate:u,privateInsideTable:b,cssVars:i,labelId:h,label:n,mergedClsPrefix:l,focusable:v,handleKeyUp:p,handleKeyDown:a,handleClick:y}=this;return(e=this.onRender)===null||e===void 0||e.call(this),s("div",{ref:"selfRef",class:[`${l}-checkbox`,this.themeClass,this.rtlEnabled&&`${l}-checkbox--rtl`,r&&`${l}-checkbox--checked`,c&&`${l}-checkbox--disabled`,u&&`${l}-checkbox--indeterminate`,b&&`${l}-checkbox--inside-table`],tabindex:c||!v?void 0:0,role:"checkbox","aria-checked":u?"mixed":r,"aria-labelledby":h,style:i,onKeyup:p,onKeydown:a,onClick:y,onMousedown:()=>{j("selectstart",window,w=>{w.preventDefault()},{once:!0})}},s("div",{class:`${l}-checkbox-box-wrapper`}," ",s("div",{class:`${l}-checkbox-box`},s(Ie,null,{default:()=>this.indeterminate?s("div",{key:"indeterminate",class:`${l}-checkbox-icon`},Me):s("div",{key:"check",class:`${l}-checkbox-icon`},Ee)}),s("div",{class:`${l}-checkbox-box__border`}))),n!==null||o.default?s("span",{class:`${l}-checkbox__label`,id:h},o.default?o.default():n):null)}}),Ne=Object.assign(Object.assign({},Ue),A.props),io=U({name:"Tooltip",props:Ne,__popover__:!0,setup(e){const{mergedClsPrefixRef:o}=O(e),r=A("Tooltip","-tooltip",void 0,De,e,o),c=D(null);return Object.assign(Object.assign({},{syncPosition(){c.value.syncPosition()},setShow(b){c.value.setShow(b)}}),{popoverRef:c,mergedTheme:r,popoverThemeOverrides:P(()=>r.value.self)})},render(){const{mergedTheme:e,internalExtraClass:o}=this;return s(Pe,Object.assign(Object.assign({},this.$props),{theme:e.peers.Popover,themeOverrides:e.peerOverrides.Popover,builtinThemeOverrides:this.popoverThemeOverrides,internalExtraClass:o.concat("tooltip"),ref:"popoverRef"}),this.$slots)}}),Ge={name:String,value:{type:[String,Number,Boolean],default:"on"},checked:{type:Boolean,default:void 0},defaultChecked:Boolean,disabled:{type:Boolean,default:void 0},label:String,size:String,onUpdateChecked:[Function,Array],"onUpdate:checked":[Function,Array],checkedValue:{type:Boolean,default:void 0}},de=te("n-radio-group");function Ke(e){const o=N(e,{mergedSize(d){const{size:k}=e;if(k!==void 0)return k;if(i){const{mergedSizeRef:{value:_}}=i;if(_!==void 0)return _}return d?d.mergedSize.value:"medium"},mergedDisabled(d){return!!(e.disabled||i!=null&&i.disabledRef.value||d!=null&&d.disabled.value)}}),{mergedSizeRef:r,mergedDisabledRef:c}=o,u=D(null),b=D(null),i=ae(de,null),h=D(e.defaultChecked),n=E(e,"checked"),l=G(n,h),v=X(()=>i?i.valueRef.value===e.value:l.value),p=X(()=>{const{name:d}=e;if(d!==void 0)return d;if(i)return i.nameRef.value}),a=D(!1);function y(){if(i){const{doUpdateValue:d}=i,{value:k}=e;x(d,k)}else{const{onUpdateChecked:d,"onUpdate:checked":k}=e,{nTriggerFormInput:_,nTriggerFormChange:m}=o;d&&x(d,!0),k&&x(k,!0),_(),m(),h.value=!0}}function w(){c.value||v.value||y()}function R(){w()}function z(){a.value=!1}function S(){a.value=!0}return{mergedClsPrefix:i?i.mergedClsPrefixRef:O(e).mergedClsPrefixRef,inputRef:u,labelRef:b,mergedName:p,mergedDisabled:c,uncontrolledChecked:h,renderSafeChecked:v,focus:a,mergedSize:r,handleRadioInputChange:R,handleRadioInputBlur:z,handleRadioInputFocus:S}}const Ze=f("radio",`
  100. line-height: var(--n-label-line-height);
  101. outline: none;
  102. position: relative;
  103. user-select: none;
  104. -webkit-user-select: none;
  105. display: inline-flex;
  106. align-items: flex-start;
  107. flex-wrap: nowrap;
  108. font-size: var(--n-font-size);
  109. word-break: break-word;
  110. `,[F("checked",[g("dot",`
  111. background-color: var(--n-color-active);
  112. `)]),g("dot-wrapper",`
  113. position: relative;
  114. flex-shrink: 0;
  115. flex-grow: 0;
  116. width: var(--n-radio-size);
  117. `),f("radio-input",`
  118. position: absolute;
  119. border: 0;
  120. border-radius: inherit;
  121. left: 0;
  122. right: 0;
  123. top: 0;
  124. bottom: 0;
  125. opacity: 0;
  126. z-index: 1;
  127. cursor: pointer;
  128. `),g("dot",`
  129. position: absolute;
  130. top: 50%;
  131. left: 0;
  132. transform: translateY(-50%);
  133. height: var(--n-radio-size);
  134. width: var(--n-radio-size);
  135. background: var(--n-color);
  136. box-shadow: var(--n-box-shadow);
  137. border-radius: 50%;
  138. transition:
  139. background-color .3s var(--n-bezier),
  140. box-shadow .3s var(--n-bezier);
  141. `,[C("&::before",`
  142. content: "";
  143. opacity: 0;
  144. position: absolute;
  145. left: 4px;
  146. top: 4px;
  147. height: calc(100% - 8px);
  148. width: calc(100% - 8px);
  149. border-radius: 50%;
  150. transform: scale(.8);
  151. background: var(--n-dot-color-active);
  152. transition:
  153. opacity .3s var(--n-bezier),
  154. background-color .3s var(--n-bezier),
  155. transform .3s var(--n-bezier);
  156. `),F("checked",{boxShadow:"var(--n-box-shadow-active)"},[C("&::before",`
  157. opacity: 1;
  158. transform: scale(1);
  159. `)])]),g("label",`
  160. color: var(--n-text-color);
  161. padding: var(--n-label-padding);
  162. font-weight: var(--n-label-font-weight);
  163. display: inline-block;
  164. transition: color .3s var(--n-bezier);
  165. `),ee("disabled",`
  166. cursor: pointer;
  167. `,[C("&:hover",[g("dot",{boxShadow:"var(--n-box-shadow-hover)"})]),F("focus",[C("&:not(:active)",[g("dot",{boxShadow:"var(--n-box-shadow-focus)"})])])]),F("disabled",`
  168. cursor: not-allowed;
  169. `,[g("dot",{boxShadow:"var(--n-box-shadow-disabled)",backgroundColor:"var(--n-color-disabled)"},[C("&::before",{backgroundColor:"var(--n-dot-color-disabled)"}),F("checked",`
  170. opacity: 1;
  171. `)]),g("label",{color:"var(--n-text-color-disabled)"}),f("radio-input",`
  172. cursor: not-allowed;
  173. `)])]),lo=U({name:"Radio",props:Object.assign(Object.assign({},A.props),Ge),setup(e){const o=Ke(e),r=A("Radio","-radio",Ze,ie,e,o.mergedClsPrefix),c=P(()=>{const{mergedSize:{value:l}}=o,{common:{cubicBezierEaseInOut:v},self:{boxShadow:p,boxShadowActive:a,boxShadowDisabled:y,boxShadowFocus:w,boxShadowHover:R,color:z,colorDisabled:S,colorActive:d,textColor:k,textColorDisabled:_,dotColorActive:m,dotColorDisabled:t,labelPadding:B,labelLineHeight:T,labelFontWeight:$,[M("fontSize",l)]:I,[M("radioSize",l)]:V}}=r.value;return{"--n-bezier":v,"--n-label-line-height":T,"--n-label-font-weight":$,"--n-box-shadow":p,"--n-box-shadow-active":a,"--n-box-shadow-disabled":y,"--n-box-shadow-focus":w,"--n-box-shadow-hover":R,"--n-color":z,"--n-color-active":d,"--n-color-disabled":S,"--n-dot-color-active":m,"--n-dot-color-disabled":t,"--n-font-size":I,"--n-radio-size":V,"--n-text-color":k,"--n-text-color-disabled":_,"--n-label-padding":B}}),{inlineThemeDisabled:u,mergedClsPrefixRef:b,mergedRtlRef:i}=O(e),h=oe("Radio",i,b),n=u?ne("radio",P(()=>o.mergedSize.value[0]),c,e):void 0;return Object.assign(o,{rtlEnabled:h,cssVars:u?void 0:c,themeClass:n==null?void 0:n.themeClass,onRender:n==null?void 0:n.onRender})},render(){const{$slots:e,mergedClsPrefix:o,onRender:r,label:c}=this;return r==null||r(),s("label",{class:[`${o}-radio`,this.themeClass,{[`${o}-radio--rtl`]:this.rtlEnabled,[`${o}-radio--disabled`]:this.mergedDisabled,[`${o}-radio--checked`]:this.renderSafeChecked,[`${o}-radio--focus`]:this.focus}],style:this.cssVars},s("input",{ref:"inputRef",type:"radio",class:`${o}-radio-input`,value:this.value,name:this.mergedName,checked:this.renderSafeChecked,disabled:this.mergedDisabled,onChange:this.handleRadioInputChange,onFocus:this.handleRadioInputFocus,onBlur:this.handleRadioInputBlur}),s("div",{class:`${o}-radio__dot-wrapper`}," ",s("div",{class:[`${o}-radio__dot`,this.renderSafeChecked&&`${o}-radio__dot--checked`]})),Le(e.default,u=>!u&&!c?null:s("div",{ref:"labelRef",class:`${o}-radio__label`},u||c)))}}),We=f("radio-group",`
  174. display: inline-block;
  175. font-size: var(--n-font-size);
  176. `,[g("splitor",`
  177. display: inline-block;
  178. vertical-align: bottom;
  179. width: 1px;
  180. transition:
  181. background-color .3s var(--n-bezier),
  182. opacity .3s var(--n-bezier);
  183. background: var(--n-button-border-color);
  184. `,[F("checked",{backgroundColor:"var(--n-button-border-color-active)"}),F("disabled",{opacity:"var(--n-opacity-disabled)"})]),F("button-group",`
  185. white-space: nowrap;
  186. height: var(--n-height);
  187. line-height: var(--n-height);
  188. `,[f("radio-button",{height:"var(--n-height)",lineHeight:"var(--n-height)"}),g("splitor",{height:"var(--n-height)"})]),f("radio-button",`
  189. vertical-align: bottom;
  190. outline: none;
  191. position: relative;
  192. user-select: none;
  193. -webkit-user-select: none;
  194. display: inline-block;
  195. box-sizing: border-box;
  196. padding-left: 14px;
  197. padding-right: 14px;
  198. white-space: nowrap;
  199. transition:
  200. background-color .3s var(--n-bezier),
  201. opacity .3s var(--n-bezier),
  202. border-color .3s var(--n-bezier),
  203. color .3s var(--n-bezier);
  204. color: var(--n-button-text-color);
  205. border-top: 1px solid var(--n-button-border-color);
  206. border-bottom: 1px solid var(--n-button-border-color);
  207. `,[f("radio-input",`
  208. pointer-events: none;
  209. position: absolute;
  210. border: 0;
  211. border-radius: inherit;
  212. left: 0;
  213. right: 0;
  214. top: 0;
  215. bottom: 0;
  216. opacity: 0;
  217. z-index: 1;
  218. `),g("state-border",`
  219. z-index: 1;
  220. pointer-events: none;
  221. position: absolute;
  222. box-shadow: var(--n-button-box-shadow);
  223. transition: box-shadow .3s var(--n-bezier);
  224. left: -1px;
  225. bottom: -1px;
  226. right: -1px;
  227. top: -1px;
  228. `),C("&:first-child",`
  229. border-top-left-radius: var(--n-button-border-radius);
  230. border-bottom-left-radius: var(--n-button-border-radius);
  231. border-left: 1px solid var(--n-button-border-color);
  232. `,[g("state-border",`
  233. border-top-left-radius: var(--n-button-border-radius);
  234. border-bottom-left-radius: var(--n-button-border-radius);
  235. `)]),C("&:last-child",`
  236. border-top-right-radius: var(--n-button-border-radius);
  237. border-bottom-right-radius: var(--n-button-border-radius);
  238. border-right: 1px solid var(--n-button-border-color);
  239. `,[g("state-border",`
  240. border-top-right-radius: var(--n-button-border-radius);
  241. border-bottom-right-radius: var(--n-button-border-radius);
  242. `)]),ee("disabled",`
  243. cursor: pointer;
  244. `,[C("&:hover",[g("state-border",`
  245. transition: box-shadow .3s var(--n-bezier);
  246. box-shadow: var(--n-button-box-shadow-hover);
  247. `),ee("checked",{color:"var(--n-button-text-color-hover)"})]),F("focus",[C("&:not(:active)",[g("state-border",{boxShadow:"var(--n-button-box-shadow-focus)"})])])]),F("checked",`
  248. background: var(--n-button-color-active);
  249. color: var(--n-button-text-color-active);
  250. border-color: var(--n-button-border-color-active);
  251. `),F("disabled",`
  252. cursor: not-allowed;
  253. opacity: var(--n-opacity-disabled);
  254. `)])]);function Ye(e,o,r){var c;const u=[];let b=!1;for(let i=0;i<e.length;++i){const h=e[i],n=(c=h.type)===null||c===void 0?void 0:c.name;n==="RadioButton"&&(b=!0);const l=h.props;if(n!=="RadioButton"){u.push(h);continue}if(i===0)u.push(h);else{const v=u[u.length-1].props,p=o===v.value,a=v.disabled,y=o===l.value,w=l.disabled,R=(p?2:0)+(a?0:1),z=(y?2:0)+(w?0:1),S={[`${r}-radio-group__splitor--disabled`]:a,[`${r}-radio-group__splitor--checked`]:p},d={[`${r}-radio-group__splitor--disabled`]:w,[`${r}-radio-group__splitor--checked`]:y},k=R<z?d:S;u.push(s("div",{class:[`${r}-radio-group__splitor`,k]}),h)}}return{children:u,isButtonGroup:b}}const Je=Object.assign(Object.assign({},A.props),{name:String,value:[String,Number,Boolean],defaultValue:{type:[String,Number,Boolean],default:null},size:String,disabled:{type:Boolean,default:void 0},"onUpdate:value":[Function,Array],onUpdateValue:[Function,Array]}),so=U({name:"RadioGroup",props:Je,setup(e){const o=D(null),{mergedSizeRef:r,mergedDisabledRef:c,nTriggerFormChange:u,nTriggerFormInput:b,nTriggerFormBlur:i,nTriggerFormFocus:h}=N(e),{mergedClsPrefixRef:n,inlineThemeDisabled:l,mergedRtlRef:v}=O(e),p=A("Radio","-radio-group",We,ie,e,n),a=D(e.defaultValue),y=E(e,"value"),w=G(y,a);function R(m){const{onUpdateValue:t,"onUpdate:value":B}=e;t&&x(t,m),B&&x(B,m),a.value=m,u(),b()}function z(m){const{value:t}=o;t&&(t.contains(m.relatedTarget)||h())}function S(m){const{value:t}=o;t&&(t.contains(m.relatedTarget)||i())}re(de,{mergedClsPrefixRef:n,nameRef:E(e,"name"),valueRef:w,disabledRef:c,mergedSizeRef:r,doUpdateValue:R});const d=oe("Radio",v,n),k=P(()=>{const{value:m}=r,{common:{cubicBezierEaseInOut:t},self:{buttonBorderColor:B,buttonBorderColorActive:T,buttonBorderRadius:$,buttonBoxShadow:I,buttonBoxShadowFocus:V,buttonBoxShadowHover:L,buttonColorActive:K,buttonTextColor:Z,buttonTextColorActive:W,buttonTextColorHover:Y,opacityDisabled:J,[M("buttonHeight",m)]:q,[M("fontSize",m)]:Q}}=p.value;return{"--n-font-size":Q,"--n-bezier":t,"--n-button-border-color":B,"--n-button-border-color-active":T,"--n-button-border-radius":$,"--n-button-box-shadow":I,"--n-button-box-shadow-focus":V,"--n-button-box-shadow-hover":L,"--n-button-color-active":K,"--n-button-text-color":Z,"--n-button-text-color-hover":Y,"--n-button-text-color-active":W,"--n-height":q,"--n-opacity-disabled":J}}),_=l?ne("radio-group",P(()=>r.value[0]),k,e):void 0;return{selfElRef:o,rtlEnabled:d,mergedClsPrefix:n,mergedValue:w,handleFocusout:S,handleFocusin:z,cssVars:l?void 0:k,themeClass:_==null?void 0:_.themeClass,onRender:_==null?void 0:_.onRender}},render(){var e;const{mergedValue:o,mergedClsPrefix:r,handleFocusin:c,handleFocusout:u}=this,{children:b,isButtonGroup:i}=Ye(Ae(Ve(this)),o,r);return(e=this.onRender)===null||e===void 0||e.call(this),s("div",{onFocusin:c,onFocusout:u,ref:"selfElRef",class:[`${r}-radio-group`,this.rtlEnabled&&`${r}-radio-group--rtl`,this.themeClass,i&&`${r}-radio-group--button-group`],style:this.cssVars},b)}});export{eo as B,oo as F,io as N,lo as _,so as a,ao as b,to as c,ro as d,no as e,Xe as u};