@shtabapp/ui-kit 1.64.1 → 1.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/SButton-BN-PppY7.cjs +1 -0
- package/dist/{SButton-6AL2ipRT.js → SButton-DQTSlo61.js} +58 -53
- package/dist/SChip-B6vcMlZD.cjs +1 -0
- package/dist/{SChip-DN8oicUv.js → SChip-DBlJ-4jv.js} +4 -5
- package/dist/SColorPicker-B_rbs-0d.cjs +1 -0
- package/dist/{SColorPicker-Djr-R81h.js → SColorPicker-C_161aLA.js} +16 -17
- package/dist/{SDropdown-LNVnMol3.cjs → SDropdown-B1OGbIYg.cjs} +1 -1
- package/dist/SDropdown-CiXHI3g1.js +362 -0
- package/dist/SInput-Be10IJ_E.cjs +1 -0
- package/dist/{SInput-BLxSis1f.js → SInput-CqC-jrCC.js} +7 -8
- package/dist/{SList-D0PDc8VN.cjs → SList-3YwWEhUU.cjs} +1 -1
- package/dist/{SList-D2K9dNsj.js → SList-Bxet9twB.js} +1 -1
- package/dist/SListItem-Chd81xY0.js +209 -0
- package/dist/SListItem-Rb59ZhEw.cjs +1 -0
- package/dist/SPhotoEdit-0grpjqZQ.cjs +1 -0
- package/dist/{SPhotoEdit-CTXpy4AE.js → SPhotoEdit-COkIQFxd.js} +4 -5
- package/dist/SSegmentControl-BaD9BK2s.cjs +1 -0
- package/dist/SSegmentControl-Bjech2v4.js +208 -0
- package/dist/{SSelect-D6taevzT.js → SSelect-C3-8vi2u.js} +8 -9
- package/dist/SSelect-EhvfGB4d.cjs +1 -0
- package/dist/{STable-aS1eGuVB.js → STable-CADyNvk8.js} +28 -29
- package/dist/STable-D1x-kIBO.cjs +1 -0
- package/dist/{STabs-CU1lSmcH.js → STabs-BbABxzdN.js} +4 -5
- package/dist/STabs-a337ikYi.cjs +1 -0
- package/dist/STag-B68ch31f.cjs +1 -0
- package/dist/{STag-DwIU1Uje.js → STag-BJV5gtD6.js} +4 -5
- package/dist/{STagGroup-D9hENgSo.cjs → STagGroup-B4ktVLZ5.cjs} +1 -1
- package/dist/{STagGroup-DWaTQbj6.js → STagGroup-DnNdOCrX.js} +1 -1
- package/dist/components/SBanner/SBanner.types.d.ts +7 -0
- package/dist/components/SBanner/SBanner.types.d.ts.map +1 -1
- package/dist/components/SBanner/SBanner.vue.d.ts.map +1 -1
- package/dist/components/SDropdown/SDropdown.types.d.ts +10 -2
- package/dist/components/SDropdown/SDropdown.types.d.ts.map +1 -1
- package/dist/components/SDropdown/SDropdown.vue.d.ts.map +1 -1
- package/dist/components/SDropdown/index.d.ts +1 -1
- package/dist/components/SDropdown/index.d.ts.map +1 -1
- package/dist/components/SListItem/SListItem.types.d.ts +12 -2
- package/dist/components/SListItem/SListItem.types.d.ts.map +1 -1
- package/dist/components/SListItem/SListItem.vue.d.ts.map +1 -1
- package/dist/components/SListItem/index.d.ts +1 -1
- package/dist/components/SListItem/index.d.ts.map +1 -1
- package/dist/components/SNotification/SNotification.types.d.ts +2 -0
- package/dist/components/SNotification/SNotification.types.d.ts.map +1 -1
- package/dist/components/SNotification/SNotification.vue.d.ts.map +1 -1
- package/dist/components/SSegmentControl/SSegmentControl.types.d.ts +9 -5
- package/dist/components/SSegmentControl/SSegmentControl.types.d.ts.map +1 -1
- package/dist/components/SSegmentControl/SSegmentControl.vue.d.ts +1 -1
- package/dist/components/SSegmentControl/SSegmentControl.vue.d.ts.map +1 -1
- package/dist/components/SSegmentControl/SSegmentControlItem.vue.d.ts +1 -1
- package/dist/components/SSegmentControl/SSegmentControlItem.vue.d.ts.map +1 -1
- package/dist/components/SSegmentControl/utils/context.d.ts +2 -2
- package/dist/components/SSegmentControl/utils/context.d.ts.map +1 -1
- package/dist/composables/connectedPosition/index.d.ts +1 -1
- package/dist/composables/connectedPosition/index.d.ts.map +1 -1
- package/dist/composables/connectedPosition/types.d.ts +4 -0
- package/dist/composables/connectedPosition/types.d.ts.map +1 -1
- package/dist/composables/useFloatingOverlay.d.ts +2 -1
- package/dist/composables/useFloatingOverlay.d.ts.map +1 -1
- package/dist/entries/button.cjs +1 -1
- package/dist/entries/button.js +2 -3
- package/dist/entries/chip.cjs +1 -1
- package/dist/entries/chip.js +1 -1
- package/dist/entries/color-picker.cjs +1 -1
- package/dist/entries/color-picker.js +1 -1
- package/dist/entries/composables.cjs +1 -1
- package/dist/entries/composables.js +1 -1
- package/dist/entries/dropdown.cjs +1 -1
- package/dist/entries/dropdown.js +2 -2
- package/dist/entries/input.cjs +1 -1
- package/dist/entries/input.js +1 -1
- package/dist/entries/list-item.cjs +1 -1
- package/dist/entries/list-item.d.ts +1 -1
- package/dist/entries/list-item.d.ts.map +1 -1
- package/dist/entries/list-item.js +1 -1
- package/dist/entries/list.cjs +1 -1
- package/dist/entries/list.js +1 -1
- package/dist/entries/photo-edit.cjs +1 -1
- package/dist/entries/photo-edit.js +1 -1
- package/dist/entries/segment-control.cjs +1 -1
- package/dist/entries/segment-control.js +1 -2
- package/dist/entries/select.cjs +1 -1
- package/dist/entries/select.js +1 -1
- package/dist/entries/table.cjs +1 -1
- package/dist/entries/table.js +1 -1
- package/dist/entries/tabs.cjs +1 -1
- package/dist/entries/tabs.js +1 -1
- package/dist/entries/tag-group.cjs +1 -1
- package/dist/entries/tag-group.js +2 -2
- package/dist/entries/tag.cjs +1 -1
- package/dist/entries/tag.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +207 -197
- package/dist/uikit-components.css +1 -1
- package/dist/{useFloatingOverlay-QcumEYEq.js → useFloatingOverlay-B1BvRxLz.js} +134 -130
- package/dist/useFloatingOverlay-CtQBdvS9.cjs +1 -0
- package/package.json +3 -3
- package/dist/SButton-9dLbCJvh.cjs +0 -1
- package/dist/SButton.types-CpdHQtyx.js +0 -10
- package/dist/SButton.types-UKroD-ev.cjs +0 -1
- package/dist/SChip-nzYT9SEi.cjs +0 -1
- package/dist/SColorPicker-BRSi0Xhm.cjs +0 -1
- package/dist/SDropdown-LOTCtlCX.js +0 -356
- package/dist/SInput-IfbP8zrv.cjs +0 -1
- package/dist/SListItem-C1IeCv8M.js +0 -184
- package/dist/SListItem-cWTuQQY-.cjs +0 -1
- package/dist/SPhotoEdit-CxYaBC3u.cjs +0 -1
- package/dist/SSegmentControl-B9KkAQiG.js +0 -204
- package/dist/SSegmentControl-OXTka86u.cjs +0 -1
- package/dist/SSelect-CRlkCLik.cjs +0 -1
- package/dist/STable-NbCfen0n.cjs +0 -1
- package/dist/STabs-g1pGWDkl.cjs +0 -1
- package/dist/STag-D8xdkjVR.cjs +0 -1
- package/dist/useFloatingOverlay-B1UCUYQQ.cjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./contrastSurfaceTextColor-BRjRzXyZ.cjs"),t=require("./SColorPalette-CqIA4Qtp.cjs"),n=require("./colorValue-Dda7fKd3.cjs"),r=require("./SButton.types-UKroD-ev.cjs"),i=require("./SButton-9dLbCJvh.cjs"),a=require("./useFloatingOverlay-B1UCUYQQ.cjs"),o=require("./SDropdown-LNVnMol3.cjs"),s=require("./SDropdownMenu-k9SxaFVH.cjs"),c=require("./SSelect-CRlkCLik.cjs");let l=require("vue"),u=require("@shtabapp/ui-kit-primitives"),d=require("@vueuse/core");var f=e=>Math.max(0,Math.min(255,Math.round(e))),p=e=>{let t=e%360;return t<0?t+360:t},m=e=>Math.max(0,Math.min(100,Math.round(e))),h=e=>{let t=e.slice(1);if(t.length===3){let e=t[0],n=t[1],r=t[2];return!e||!n||!r?void 0:`${e}${e}${n}${n}${r}${r}`}if(t.length===6||t.length===8)return t.slice(0,6)},g=e=>{let t=h(e);if(!t)return;let n=Number.parseInt(t.slice(0,2),16),r=Number.parseInt(t.slice(2,4),16),i=Number.parseInt(t.slice(4,6),16);if(!(Number.isNaN(n)||Number.isNaN(r)||Number.isNaN(i)))return{first:n,second:r,third:i}},_=e=>{let t=f(e.first),n=f(e.second),r=f(e.third);return`#${t.toString(16).padStart(2,`0`).toUpperCase()}${n.toString(16).padStart(2,`0`).toUpperCase()}${r.toString(16).padStart(2,`0`).toUpperCase()}`},v=e=>{let t=g(e);if(!t)return;let n=t.first/255,r=t.second/255,i=t.third/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=a-o,c=0,l=(a+o)/2;s!==0&&(c=a===n?((r-i)/s+(r<i?6:0))*60:a===r?((i-n)/s+2)*60:((n-r)/s+4)*60);let u=0;return s!==0&&(u=l>.5?s/(2-a-o):s/(a+o)),{first:Math.round(c),second:Math.round(u*100),third:Math.round(l*100)}},y=e=>{let t=p(e.first),n=m(e.second)/100,r=m(e.third)/100,i=e=>{let i=(t+e)/30;return f((r-n*Math.min(r,1-r)*Math.max(-1,Math.min(i%2-1,1)))*255)};return _({first:i(0),second:i(8),third:i(4)})},b=t=>{let n=t.toUpperCase(),r=n.startsWith(`#`)?n.slice(1):n;if(!/^[0-9A-F]{3}$/.test(r)&&!/^[0-9A-F]{6}$/.test(r))return;let i=`#${r}`;if(e.n(i))return _(g(i)??{first:0,second:0,third:0})},x=e=>e.slice(1).toUpperCase(),S=e=>{let t=e.first/255,n=e.second/255,r=e.third/255,i=Math.max(t,n,r),a=i-Math.min(t,n,r),o=0;a!==0&&(o=i===t?(n-r)/a%6:i===n?(r-t)/a+2:(t-n)/a+4,o=Math.round(o*60),o<0&&(o+=360));let s=i===0?0:a/i;return{hue:o,saturation:s,value:i}},C=e=>{let t=e.value*e.saturation,n=e.hue/60,r=t*(1-Math.abs(n%2-1)),i=e.value-t,a=0,o=0,s=0;return n>=0&&n<1?(a=t,o=r):n>=1&&n<2?(a=r,o=t):n>=2&&n<3?(o=t,s=r):n>=3&&n<4?(o=r,s=t):n>=4&&n<5?(a=r,s=t):(a=t,s=r),{first:f((a+i)*255),second:f((o+i)*255),third:f((s+i)*255)}},w=e=>{let t=g(e);if(t)return S(t)},T=e=>_(C(e)),E=[t.o.HEX,t.o.RGB,t.o.HSL],D={[t.o.HEX]:`Hex`,[t.o.RGB]:`RGB`,[t.o.HSL]:`HSL`},O=e=>{let t=getComputedStyle(e).backgroundColor.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(!t)return;let n=Number.parseInt(t[1]??`0`,10),r=Number.parseInt(t[2]??`0`,10),i=Number.parseInt(t[3]??`0`,10);return`#${n.toString(16).padStart(2,`0`).toUpperCase()}${r.toString(16).padStart(2,`0`).toUpperCase()}${i.toString(16).padStart(2,`0`).toUpperCase()}`},k=(t,r)=>{if(n.n(t)&&e.n(t))return t;if(r)return O(r)},A=(e,n)=>n===t.o.HEX?x(e):n===t.o.RGB?g(e)??{first:0,second:0,third:0}:v(e)??{first:0,second:0,third:0},j=e=>{let t=Number.parseInt(e,10);if(!Number.isNaN(t))return t},M=(e,n)=>{if(e===t.o.HEX)return typeof n==`string`?b(n):void 0;if(typeof n==`string`)return;if(e===t.o.RGB){let e=_({first:j(String(n.first))??0,second:j(String(n.second))??0,third:j(String(n.third))??0});return g(e)?e:void 0}let r=y({first:j(String(n.first))??0,second:j(String(n.second))??0,third:j(String(n.third))??0});if(r&&v(r))return r},N=17,P=`#000000`,F=e=>e??P,I=({modelValue:e,getEditableHex:t,saturationAreaRef:n,hueSliderRef:r,disabled:i,readonly:a})=>{let o=w(F(t()))??{hue:0,saturation:0,value:0},s=(0,l.ref)(o.hue),c=(0,l.ref)(o.saturation),u=(0,l.ref)(o.value),f=(0,l.ref)(!1),p=(0,l.ref)(!1),m=(0,l.ref)(!1),h=(0,l.shallowRef)(null),g=(0,l.shallowRef)(null),_=(0,l.computed)(()=>T({hue:s.value,saturation:c.value,value:u.value})),v=(0,l.computed)(()=>T({hue:s.value,saturation:1,value:1})),y=e=>{s.value=Math.max(0,Math.min(360,e))},b=(e,t)=>{c.value=Math.max(0,Math.min(1,e)),u.value=Math.max(0,Math.min(1,t))},x=e=>{let t=w(F(e));t&&(f.value=!0,t.saturation>0&&(s.value=t.hue),c.value=t.saturation,u.value=t.value,f.value=!1)},S=()=>{let e=t();e&&e.toUpperCase()!==_.value.toUpperCase()&&x(e)},C=()=>{let n=_.value;t()?.toUpperCase()!==n.toUpperCase()&&(f.value=!0,e.value=n,f.value=!1)};(0,l.watch)([s,c,u],()=>{f.value||C()}),(0,l.watch)(e,()=>{f.value||S()}),(0,l.onMounted)(()=>{(0,l.nextTick)(()=>{E(),D(),S()})});let E=()=>{h.value=n.value?.getBoundingClientRect()??null},D=()=>{g.value=r.value?.getBoundingClientRect()??null},O=(0,l.computed)(()=>{let e=h.value;return e?{transform:`translate3d(calc(${c.value*e.width}px - 50%), calc(${(1-u.value)*e.height}px - 50%), 0)`}:{}}),k=(0,l.computed)(()=>{let e=g.value;return e?{transform:`translate3d(-50%, calc(${s.value/360*e.height}px - 50%), 0)`}:{}}),A=()=>!i.value&&!a.value,j=e=>{let t=h.value;if(!t)return;let n=Math.max(0,Math.min(e.clientX-t.left,t.width)),r=Math.max(0,Math.min(e.clientY-t.top,t.height));b(n/t.width,1-r/t.height)},M=e=>{let t=g.value;t&&y(Math.max(0,Math.min(e.clientY-t.top,t.height))/t.height*360)},N=e=>{A()&&(E(),p.value=!0,j(e),e.currentTarget instanceof HTMLElement&&e.currentTarget.setPointerCapture(e.pointerId))},P=e=>{A()&&(D(),m.value=!0,M(e),e.currentTarget instanceof HTMLElement&&e.currentTarget.setPointerCapture(e.pointerId))},I=()=>{p.value=!1},L=()=>{m.value=!1};return(0,d.useEventListener)(n,`pointermove`,e=>{p.value&&j(e)}),(0,d.useEventListener)(n,`pointerup`,I),(0,d.useEventListener)(n,`pointercancel`,I),(0,d.useEventListener)(n,`lostpointercapture`,I),(0,d.useEventListener)(r,`pointermove`,e=>{m.value&&M(e)}),(0,d.useEventListener)(r,`pointerup`,L),(0,d.useEventListener)(r,`pointercancel`,L),(0,d.useEventListener)(r,`lostpointercapture`,L),{hexColor:_,hueBackground:v,saturationPointerStyle:O,huePointerStyle:k,handleSaturationPointerDown:N,handleHuePointerDown:P,syncFromModelValue:S}},L=e=>{if(!e)return null;let t=e.$el;if(!(t instanceof HTMLElement))return null;let n=t.querySelector(`.s-ui-color-swatch__fill`);return n instanceof HTMLElement?n:null},R={class:`s-ui-color-area__canvas-row`},ee=[`aria-label`],te=[`aria-label`,`aria-disabled`],z=(0,l.defineComponent)({__name:`SColorArea`,props:(0,l.mergeModels)({disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=(0,l.useModel)(e,`modelValue`),{t:r}=(0,u.useUiKitI18n)(),i=(0,l.useTemplateRef)(`colorResolutionSwatchRef`),a=(0,l.useTemplateRef)(`saturationAreaRef`),o=(0,l.useTemplateRef)(`hueSliderRef`),s=()=>k(t.value,L(i.value)),c=(0,l.computed)(()=>n.a(t.value)),{hexColor:d,hueBackground:f,saturationPointerStyle:p,huePointerStyle:m,handleSaturationPointerDown:h,handleHuePointerDown:g}=I({modelValue:t,getEditableHex:s,saturationAreaRef:a,hueSliderRef:o,disabled:(0,l.toRef)(()=>e.disabled),readonly:(0,l.toRef)(()=>e.readonly)});return(t,n)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,(0,l.mergeProps)({class:[`s-ui-color-area`,{"s-ui-color-area--disabled":e.disabled,"s-ui-color-area--readonly":e.readonly}]},t.$attrs),[(0,l.createVNode)((0,l.unref)(u.SColorSwatch),{ref_key:`colorResolutionSwatchRef`,ref:i,class:`s-ui-color-area__color-resolution`,color:c.value,size:(0,l.unref)(u.ESColorSwatchSize).SIZE_24,tabindex:`-1`,"aria-hidden":`true`},null,8,[`color`,`size`]),(0,l.createElementVNode)(`div`,R,[(0,l.createElementVNode)(`div`,{ref_key:`saturationAreaRef`,ref:a,class:`s-ui-color-area__canvas`,role:`img`,"aria-label":(0,l.unref)(r)(`colorArea.saturationBrightness`),style:(0,l.normalizeStyle)({"--s-ui-color-area-hue":(0,l.unref)(f)}),onPointerdown:n[0]||=(...e)=>(0,l.unref)(h)&&(0,l.unref)(h)(...e)},[(0,l.createElementVNode)(`div`,{class:`s-ui-color-area__canvas-pointer`,style:(0,l.normalizeStyle)({...(0,l.unref)(p),backgroundColor:(0,l.unref)(d)})},null,4)],44,ee),(0,l.createElementVNode)(`div`,{ref_key:`hueSliderRef`,ref:o,class:`s-ui-color-area__hue`,role:`slider`,"aria-label":(0,l.unref)(r)(`colorArea.hue`),"aria-valuemin":`0`,"aria-valuemax":`360`,"aria-disabled":e.disabled||e.readonly,onPointerdown:n[1]||=(...e)=>(0,l.unref)(g)&&(0,l.unref)(g)(...e)},[(0,l.createElementVNode)(`div`,{class:`s-ui-color-area__hue-pointer`,style:(0,l.normalizeStyle)({...(0,l.unref)(m),backgroundColor:(0,l.unref)(f)})},null,4)],40,te)])],16))}}),B={class:`s-ui-color-values__left`},V={class:`s-ui-color-values__format`},H={class:`s-ui-color-values__value-group`},U={class:`s-ui-color-values__inputs`},W={key:0,class:`s-ui-color-values__input-wrap`},G=[`disabled`,`readonly`,`aria-label`],K={class:`s-ui-color-values__input-wrap`},q=[`disabled`,`readonly`,`aria-label`],J={class:`s-ui-color-values__input-wrap`},Y=[`disabled`,`readonly`,`aria-label`],X={class:`s-ui-color-values__input-wrap`},Z=[`disabled`,`readonly`,`aria-label`],Q=(0,l.defineComponent)({__name:`SColorValues`,props:(0,l.mergeModels)({disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},formats:{default:()=>E}},{modelValue:{required:!0},modelModifiers:{},format:{default:t.o.HEX},formatModifiers:{}}),emits:(0,l.mergeModels)([`formatDropdownOpen`,`formatDropdownClose`],[`update:modelValue`,`update:format`]),setup(e,{emit:a}){let{t:o}=(0,u.useUiKitI18n)(),s=(0,l.useModel)(e,`modelValue`),d=(0,l.useModel)(e,`format`),f=a,p=(0,l.useTemplateRef)(`previewSwatchRef`),m=(0,l.ref)(``),h=(0,l.ref)(`0`),g=(0,l.ref)(`0`),_=(0,l.ref)(`0`),v=(0,l.computed)(()=>(e.formats.length>0?e.formats:E).map(e=>({value:e,label:D[e]}))),y=(0,l.computed)(()=>n.a(s.value)),b=(0,l.computed)(()=>k(s.value,L(p.value))),x=(0,l.computed)(()=>d.value===t.o.RGB?o(`colorValues.redChannel`):o(`colorValues.hueChannel`)),S=(0,l.computed)(()=>d.value===t.o.RGB?o(`colorValues.greenChannel`):o(`colorValues.saturationChannel`)),C=(0,l.computed)(()=>d.value===t.o.RGB?o(`colorValues.blueChannel`):o(`colorValues.lightnessChannel`)),w=()=>{let e=b.value;if(!e)return;let n=A(e,d.value);if(d.value===t.o.HEX&&typeof n==`string`){m.value=n;return}typeof n==`object`&&(h.value=String(n.first),g.value=String(n.second),_.value=String(n.third))};(0,l.watch)([s,d,b],()=>{w()}),(0,l.onMounted)(()=>{(0,l.nextTick)(()=>{w()})});let T=()=>{if(e.disabled||e.readonly)return;if(d.value===t.o.HEX){let e=M(t.o.HEX,m.value);e&&(s.value=e),w();return}let n=M(d.value,{first:Number.parseInt(h.value,10),second:Number.parseInt(g.value,10),third:Number.parseInt(_.value,10)});n&&(s.value=n),w()},O=e=>{e.key===`Enter`&&(e.preventDefault(),T())};return(n,a)=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,(0,l.mergeProps)({class:[`s-ui-color-values`,{"s-ui-color-values--disabled":e.disabled,"s-ui-color-values--readonly":e.readonly}]},n.$attrs),[(0,l.createElementVNode)(`div`,B,[(0,l.createVNode)((0,l.unref)(u.SColorSwatch),{ref_key:`previewSwatchRef`,ref:p,class:`s-ui-color-values__preview`,color:y.value,size:(0,l.unref)(u.ESColorSwatchSize).SIZE_32,disabled:e.disabled,tabindex:`-1`,"aria-hidden":`true`},null,8,[`color`,`size`,`disabled`]),(0,l.createElementVNode)(`div`,V,[(0,l.createVNode)((0,l.unref)(c.t),{modelValue:d.value,"onUpdate:modelValue":a[0]||=e=>d.value=e,class:`s-ui-color-values__format-select`,options:v.value,disabled:e.disabled,readonly:e.readonly,bordered:!0,clearable:!1,"close-on-select":!0,"fit-viewport":!1,"aria-label":(0,l.unref)(o)(`colorValues.format`),onOpen:a[1]||=e=>f(`formatDropdownOpen`),onClose:a[2]||=e=>f(`formatDropdownClose`)},null,8,[`modelValue`,`options`,`disabled`,`readonly`,`aria-label`])])]),(0,l.createElementVNode)(`div`,H,[(0,l.createVNode)((0,l.unref)(i.t),{class:`s-ui-color-values__pipette`,appearance:(0,l.unref)(r.t).BARE,variant:(0,l.unref)(r.r).NEUTRAL,size:(0,l.unref)(r.n).SMALL,icon:`pipette`,"aria-label":(0,l.unref)(o)(`colorValues.pickColor`),"aria-disabled":`true`,disabled:e.disabled,tabindex:`-1`},null,8,[`appearance`,`variant`,`size`,`aria-label`,`disabled`]),a[9]||=(0,l.createElementVNode)(`span`,{class:`s-ui-color-values__separator`,"aria-hidden":`true`},null,-1),(0,l.createElementVNode)(`div`,U,[d.value===(0,l.unref)(t.o).HEX?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,W,[(0,l.withDirectives)((0,l.createElementVNode)(`input`,{"onUpdate:modelValue":a[3]||=e=>m.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`text`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":(0,l.unref)(o)(`colorValues.hexValue`),onBlur:T,onKeydown:O},null,40,G),[[l.vModelText,m.value]])])):((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:1},[(0,l.createElementVNode)(`div`,K,[(0,l.withDirectives)((0,l.createElementVNode)(`input`,{"onUpdate:modelValue":a[4]||=e=>h.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`numeric`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":x.value,onBlur:T,onKeydown:O},null,40,q),[[l.vModelText,h.value]])]),a[7]||=(0,l.createElementVNode)(`span`,{class:`s-ui-color-values__separator`,"aria-hidden":`true`},null,-1),(0,l.createElementVNode)(`div`,J,[(0,l.withDirectives)((0,l.createElementVNode)(`input`,{"onUpdate:modelValue":a[5]||=e=>g.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`numeric`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":S.value,onBlur:T,onKeydown:O},null,40,Y),[[l.vModelText,g.value]])]),a[8]||=(0,l.createElementVNode)(`span`,{class:`s-ui-color-values__separator`,"aria-hidden":`true`},null,-1),(0,l.createElementVNode)(`div`,X,[(0,l.withDirectives)((0,l.createElementVNode)(`input`,{"onUpdate:modelValue":a[6]||=e=>_.value=e,class:`s-ui-color-values__input s-ui-typography-body-14-regular`,type:`text`,inputmode:`numeric`,spellcheck:`false`,disabled:e.disabled,readonly:e.readonly,"aria-label":C.value,onBlur:T,onKeydown:O},null,40,Z),[[l.vModelText,_.value]])])],64))])])],16))}}),ne={class:`s-ui-color-picker__section`},re={class:`s-ui-color-picker__label`},$={class:`s-ui-color-picker__section`},ie={class:`s-ui-color-picker__label`},ae={class:`s-ui-color-picker__custom-editor`},oe={class:`s-ui-color-picker__custom-actions`},se=(0,l.defineComponent)({__name:`SColorPicker`,props:(0,l.mergeModels)({disabled:{type:Boolean,default:!1},recommendedColors:{},recentColors:{default:()=>[]}},{modelValue:{},modelModifiers:{}}),emits:(0,l.mergeModels)([`select`,`customEditorOpen`,`customEditorClose`,`formatDropdownOpen`,`formatDropdownClose`],[`update:modelValue`]),setup(e,{emit:n}){let c=(0,l.useModel)(e,`modelValue`),d=n,{t:f}=(0,u.useUiKitI18n)(),p=(0,l.ref)(!1),m=(0,l.ref)(`#526DE3`),h=(0,l.ref)(t.o.HEX),g=(0,l.computed)(()=>e.recommendedColors&&e.recommendedColors.length>0?e.recommendedColors:t.r),_=(0,l.computed)(()=>e.recentColors.length<=17?e.recentColors:e.recentColors.slice(0,17)),v=()=>{if(c.value){m.value=c.value;return}m.value=`#526DE3`},y=e=>{d(`select`,e)},b=()=>{c.value=m.value,d(`select`,m.value),p.value=!1},x=()=>{p.value=!1};return(0,l.watch)(p,(e,t)=>{if(e&&!t){v(),d(`customEditorOpen`);return}!e&&t&&d(`customEditorClose`)}),(n,v)=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(s.t),(0,l.mergeProps)({width:336},n.$attrs),{default:(0,l.withCtx)(()=>[(0,l.createElementVNode)(`div`,{class:(0,l.normalizeClass)([`s-ui-color-picker`,{"s-ui-color-picker--disabled":e.disabled}])},[(0,l.createElementVNode)(`section`,ne,[(0,l.createElementVNode)(`span`,re,(0,l.toDisplayString)((0,l.unref)(f)(`colorPicker.recommendedColors`)),1),(0,l.createVNode)((0,l.unref)(t.t),{modelValue:c.value,"onUpdate:modelValue":v[0]||=e=>c.value=e,class:`s-ui-color-picker__palette`,layout:(0,l.unref)(t.n).GRID,colors:g.value,size:(0,l.unref)(u.ESColorSwatchSize).SIZE_32,disabled:e.disabled,onSelect:y},null,8,[`modelValue`,`layout`,`colors`,`size`,`disabled`])]),(0,l.createElementVNode)(`section`,$,[(0,l.createElementVNode)(`span`,ie,(0,l.toDisplayString)((0,l.unref)(f)(`colorPicker.recentColors`)),1),(0,l.createVNode)((0,l.unref)(t.t),{modelValue:c.value,"onUpdate:modelValue":v[7]||=e=>c.value=e,class:`s-ui-color-picker__palette`,layout:(0,l.unref)(t.n).ROW,colors:_.value,size:(0,l.unref)(u.ESColorSwatchSize).SIZE_32,disabled:e.disabled,onSelect:y},{append:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(o.t),{modelValue:p.value,"onUpdate:modelValue":v[6]||=e=>p.value=e,placement:(0,l.unref)(a.i).RIGHT_START,offset:8,shift:!0,flip:!0,disabled:e.disabled,"dismiss-on-click-outside":!0,"dismiss-on-escape":!0},{trigger:(0,l.withCtx)(({toggle:t,triggerProps:n})=>[(0,l.createVNode)((0,l.unref)(i.t),(0,l.mergeProps)(n,{class:`s-ui-color-picker__add-button`,appearance:(0,l.unref)(r.t).OUTLINED,variant:(0,l.unref)(r.r).NEUTRAL,size:(0,l.unref)(r.n).SMALL,icon:`plus`,"aria-label":(0,l.unref)(f)(`colorPicker.addCustomColor`),disabled:e.disabled,onClick:t}),null,16,[`appearance`,`variant`,`size`,`aria-label`,`disabled`,`onClick`])]),content:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(s.t),{width:320},{footer:(0,l.withCtx)(()=>[(0,l.createElementVNode)(`div`,oe,[(0,l.createVNode)((0,l.unref)(i.t),{class:`s-ui-color-picker__save-button`,appearance:(0,l.unref)(r.t).MAJOR,variant:(0,l.unref)(r.r).MAIN,size:(0,l.unref)(r.n).SMALL,disabled:e.disabled,onClick:b},{default:(0,l.withCtx)(()=>[(0,l.createTextVNode)((0,l.toDisplayString)((0,l.unref)(f)(`colorPicker.save`)),1)]),_:1},8,[`appearance`,`variant`,`size`,`disabled`]),(0,l.createVNode)((0,l.unref)(i.t),{class:`s-ui-color-picker__cancel-button`,appearance:(0,l.unref)(r.t).MINOR,variant:(0,l.unref)(r.r).NEUTRAL,size:(0,l.unref)(r.n).SMALL,disabled:e.disabled,onClick:x},{default:(0,l.withCtx)(()=>[(0,l.createTextVNode)((0,l.toDisplayString)((0,l.unref)(f)(`colorPicker.cancel`)),1)]),_:1},8,[`appearance`,`variant`,`size`,`disabled`])])]),default:(0,l.withCtx)(()=>[(0,l.createElementVNode)(`div`,ae,[(0,l.createVNode)(z,{modelValue:m.value,"onUpdate:modelValue":v[1]||=e=>m.value=e,disabled:e.disabled},null,8,[`modelValue`,`disabled`]),(0,l.createVNode)(Q,{modelValue:m.value,"onUpdate:modelValue":v[2]||=e=>m.value=e,format:h.value,"onUpdate:format":v[3]||=e=>h.value=e,disabled:e.disabled,onFormatDropdownOpen:v[4]||=e=>d(`formatDropdownOpen`),onFormatDropdownClose:v[5]||=e=>d(`formatDropdownClose`)},null,8,[`modelValue`,`format`,`disabled`])])]),_:1})]),_:1},8,[`modelValue`,`placement`,`disabled`])]),_:1},8,[`modelValue`,`layout`,`colors`,`size`,`disabled`])])],2)]),_:1},16))}});Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return se}});
|
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
import { i as e, t } from "./useFloatingOverlay-QcumEYEq.js";
|
|
2
|
-
import { Fragment as n, Teleport as r, Transition as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, mergeModels as d, mergeProps as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as g, onScopeDispose as _, openBlock as v, ref as y, renderSlot as b, shallowRef as x, toDisplayString as S, toValue as C, unref as w, useId as T, useModel as E, useSlots as D, useTemplateRef as O, watch as k, withCtx as A, withModifiers as j } from "vue";
|
|
3
|
-
import { useUiKitI18n as M } from "@shtabapp/ui-kit-primitives";
|
|
4
|
-
import { useElementHover as N, useEventListener as P, useMediaQuery as F, useScrollLock as I } from "@vueuse/core";
|
|
5
|
-
//#region src/components/SDropdown/SDropdown.types.ts
|
|
6
|
-
var L = 768, R = (e) => {
|
|
7
|
-
let t = y(e.value), n = y(e.value);
|
|
8
|
-
return k(e, (e) => {
|
|
9
|
-
if (e) {
|
|
10
|
-
t.value = !0, n.value = !0;
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
t.value = !1;
|
|
14
|
-
}, { flush: "sync" }), {
|
|
15
|
-
isPanelShown: t,
|
|
16
|
-
isPanelActive: n,
|
|
17
|
-
handlePanelAfterLeave: () => {
|
|
18
|
-
e.value || (n.value = !1);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}, ee = (e, t) => {
|
|
22
|
-
let n = F(a(() => `(max-width: ${(C(t) || 768) - .02}px)`));
|
|
23
|
-
return a(() => C(e) && n.value);
|
|
24
|
-
}, te = (e) => {
|
|
25
|
-
if (!e) return null;
|
|
26
|
-
let t = e.getBoundingClientRect();
|
|
27
|
-
if (t.width > 0 || t.height > 0) return e;
|
|
28
|
-
let n = e.firstElementChild;
|
|
29
|
-
return n instanceof HTMLElement ? n : e;
|
|
30
|
-
}, z = {
|
|
31
|
-
OVERDRAG_LIMIT: 50,
|
|
32
|
-
CLOSE_DISTANCE_RATIO: .3,
|
|
33
|
-
CLOSE_DISTANCE_LIMIT: 140,
|
|
34
|
-
CLOSE_VELOCITY: .5,
|
|
35
|
-
SETTLE_TIMEOUT: 400,
|
|
36
|
-
INTERACTIVE_SELECTOR: "button, a[href], input, select, textarea, [role=\"button\"], [contenteditable=\"true\"]"
|
|
37
|
-
}, B = (e) => {
|
|
38
|
-
let t = x(0), n = x(!1), r = x(!1), i = null, o = 0, s = 0, c = 0, l = 0, u = 0, d, f = a(() => n.value || r.value), p = () => {
|
|
39
|
-
clearTimeout(d), d = void 0, r.value = !1;
|
|
40
|
-
}, m = () => {
|
|
41
|
-
r.value = !0, clearTimeout(d), d = setTimeout(p, z.SETTLE_TIMEOUT);
|
|
42
|
-
}, h = () => {
|
|
43
|
-
i = null, t.value = 0, n.value = !1, p();
|
|
44
|
-
}, g = () => C(e.popup)?.offsetHeight ?? 0, v = () => {
|
|
45
|
-
let e = l - o;
|
|
46
|
-
if (e <= 0) return !1;
|
|
47
|
-
let t = u - c;
|
|
48
|
-
return (t > 0 ? (l - s) / t : 0) >= z.CLOSE_VELOCITY ? !0 : e >= Math.min(g() * z.CLOSE_DISTANCE_RATIO, z.CLOSE_DISTANCE_LIMIT);
|
|
49
|
-
}, y = (e) => {
|
|
50
|
-
i === null && (e.pointerType === "mouse" && e.button !== 0 || e.target instanceof Element && e.target.closest(z.INTERACTIVE_SELECTOR) || (i = e.pointerId, o = e.clientY, l = e.clientY, s = e.clientY, u = e.timeStamp, c = e.timeStamp, p(), n.value = !0));
|
|
51
|
-
}, b = (e) => {
|
|
52
|
-
i === e.pointerId && (s = l, c = u, l = e.clientY, u = e.timeStamp, t.value = Math.max(e.clientY - o, -z.OVERDRAG_LIMIT));
|
|
53
|
-
}, S = (a) => {
|
|
54
|
-
if (i === a.pointerId) {
|
|
55
|
-
if (i = null, n.value = !1, v()) {
|
|
56
|
-
r.value = !0, t.value = g() + z.OVERDRAG_LIMIT, e.onClose();
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (t.value === 0) {
|
|
60
|
-
p();
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
m(), t.value = 0;
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
return P(() => C(e.handle), "pointerdown", y), P(window, "pointermove", b), P(window, "pointerup", S), P(window, "pointercancel", S), P(() => C(e.popup), "transitionend", (e) => {
|
|
67
|
-
e.propertyName !== "transform" || n.value || t.value !== 0 || p();
|
|
68
|
-
}), _(() => {
|
|
69
|
-
clearTimeout(d);
|
|
70
|
-
}), {
|
|
71
|
-
isActive: f,
|
|
72
|
-
popupStyles: a(() => {
|
|
73
|
-
if (f.value) return {
|
|
74
|
-
transform: `translate3d(0, ${t.value}px, 0)`,
|
|
75
|
-
transition: r.value ? "transform var(--s-ui-transition-duration-slow) var(--s-ui-transition-easing-standard)" : "none"
|
|
76
|
-
};
|
|
77
|
-
}),
|
|
78
|
-
reset: h
|
|
79
|
-
};
|
|
80
|
-
}, V = ["aria-label"], H = { class: "s-ui-dropdown-sheet__side" }, U = { class: "s-ui-dropdown-sheet__title" }, W = { class: "s-ui-dropdown-sheet__side s-ui-dropdown-sheet__side--end" }, G = ["id"], K = /* @__PURE__ */ u({
|
|
81
|
-
__name: "SDropdownSheet",
|
|
82
|
-
props: {
|
|
83
|
-
open: { type: Boolean },
|
|
84
|
-
title: { default: "" },
|
|
85
|
-
dismissOnOverlayClick: {
|
|
86
|
-
type: Boolean,
|
|
87
|
-
default: !0
|
|
88
|
-
},
|
|
89
|
-
dismissOnEscape: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
default: !0
|
|
92
|
-
},
|
|
93
|
-
contentId: {}
|
|
94
|
-
},
|
|
95
|
-
emits: ["close"],
|
|
96
|
-
setup(e, { emit: t }) {
|
|
97
|
-
let n = t, { t: r } = M(), a = O("popupRef"), u = O("headerRef"), d = () => n("close"), { isActive: f, popupStyles: m, reset: _ } = B({
|
|
98
|
-
handle: u,
|
|
99
|
-
popup: a,
|
|
100
|
-
onClose: d
|
|
101
|
-
}), y = I(() => typeof document > "u" ? null : document.body), x = () => {
|
|
102
|
-
e.dismissOnOverlayClick && d();
|
|
103
|
-
}, C = (e) => {
|
|
104
|
-
f.value && e.stopPropagation();
|
|
105
|
-
}, T = () => _(), E = null, D = () => {
|
|
106
|
-
let e = document.activeElement;
|
|
107
|
-
E = e instanceof HTMLElement ? e : null;
|
|
108
|
-
}, N = async () => {
|
|
109
|
-
await p();
|
|
110
|
-
let e = a.value;
|
|
111
|
-
!e || e.contains(document.activeElement) || e.focus({ preventScroll: !0 });
|
|
112
|
-
}, F = () => {
|
|
113
|
-
let e = E, t = !!a.value?.contains(document.activeElement);
|
|
114
|
-
E = null, !(!t || !e?.isConnected) && e.focus({ preventScroll: !0 });
|
|
115
|
-
};
|
|
116
|
-
return k(() => e.open, (e) => {
|
|
117
|
-
if (y.value = e, e) {
|
|
118
|
-
D(), N();
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
F();
|
|
122
|
-
}, { immediate: !0 }), P(window, "keydown", (t) => {
|
|
123
|
-
!e.open || !e.dismissOnEscape || t.key !== "Escape" || d();
|
|
124
|
-
}), g(() => {
|
|
125
|
-
y.value = !1;
|
|
126
|
-
}), (t, n) => (v(), o(i, {
|
|
127
|
-
name: "s-ui-dropdown-sheet",
|
|
128
|
-
onAfterLeave: T
|
|
129
|
-
}, {
|
|
130
|
-
default: A(() => [e.open ? (v(), c("div", {
|
|
131
|
-
key: 0,
|
|
132
|
-
class: "s-ui-dropdown-sheet",
|
|
133
|
-
onClick: x
|
|
134
|
-
}, [l("div", {
|
|
135
|
-
ref_key: "popupRef",
|
|
136
|
-
ref: a,
|
|
137
|
-
class: "s-ui-dropdown-sheet__popup",
|
|
138
|
-
style: h(w(m)),
|
|
139
|
-
role: "dialog",
|
|
140
|
-
"aria-modal": "true",
|
|
141
|
-
"aria-label": e.title || w(r)("dropdown.sheet"),
|
|
142
|
-
tabindex: "-1",
|
|
143
|
-
onClickCapture: C,
|
|
144
|
-
onClick: n[0] ||= j(() => {}, ["stop"])
|
|
145
|
-
}, [l("header", {
|
|
146
|
-
ref_key: "headerRef",
|
|
147
|
-
ref: u,
|
|
148
|
-
class: "s-ui-dropdown-sheet__header"
|
|
149
|
-
}, [
|
|
150
|
-
n[1] ||= l("span", {
|
|
151
|
-
class: "s-ui-dropdown-sheet__handle",
|
|
152
|
-
"aria-hidden": "true"
|
|
153
|
-
}, null, -1),
|
|
154
|
-
l("div", H, [b(t.$slots, "header-left")]),
|
|
155
|
-
l("div", U, S(e.title), 1),
|
|
156
|
-
l("div", W, [b(t.$slots, "header-right")])
|
|
157
|
-
], 512), l("div", {
|
|
158
|
-
id: e.contentId,
|
|
159
|
-
class: "s-ui-dropdown-sheet__content"
|
|
160
|
-
}, [b(t.$slots, "default")], 8, G)], 44, V)])) : s("", !0)]),
|
|
161
|
-
_: 3
|
|
162
|
-
}));
|
|
163
|
-
}
|
|
164
|
-
}), q = ["id"], ne = ["data-placement"], re = { class: "s-ui-dropdown__content" }, J = /* @__PURE__ */ u({
|
|
165
|
-
inheritAttrs: !1,
|
|
166
|
-
__name: "SDropdown",
|
|
167
|
-
props: /*@__PURE__*/ d({
|
|
168
|
-
placement: { default: () => e.BOTTOM_START },
|
|
169
|
-
offset: { default: 8 },
|
|
170
|
-
flip: {
|
|
171
|
-
type: Boolean,
|
|
172
|
-
default: !0
|
|
173
|
-
},
|
|
174
|
-
shift: {
|
|
175
|
-
type: Boolean,
|
|
176
|
-
default: !1
|
|
177
|
-
},
|
|
178
|
-
matchReferenceWidth: {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: !1
|
|
181
|
-
},
|
|
182
|
-
fitViewport: {
|
|
183
|
-
type: Boolean,
|
|
184
|
-
default: !1
|
|
185
|
-
},
|
|
186
|
-
surfaceClass: {},
|
|
187
|
-
teleportTo: {
|
|
188
|
-
type: [String, Boolean],
|
|
189
|
-
default: "body"
|
|
190
|
-
},
|
|
191
|
-
dismissOnClickOutside: {
|
|
192
|
-
type: Boolean,
|
|
193
|
-
default: !0
|
|
194
|
-
},
|
|
195
|
-
dismissOnEscape: {
|
|
196
|
-
type: Boolean,
|
|
197
|
-
default: !0
|
|
198
|
-
},
|
|
199
|
-
disabled: {
|
|
200
|
-
type: Boolean,
|
|
201
|
-
default: !1
|
|
202
|
-
},
|
|
203
|
-
reference: { default: null },
|
|
204
|
-
contentId: {},
|
|
205
|
-
viewportPadding: { default: 8 },
|
|
206
|
-
arrow: {
|
|
207
|
-
type: Boolean,
|
|
208
|
-
default: !1
|
|
209
|
-
},
|
|
210
|
-
showOnHover: {
|
|
211
|
-
type: Boolean,
|
|
212
|
-
default: !1
|
|
213
|
-
},
|
|
214
|
-
hoverLeaveDelay: { default: 100 },
|
|
215
|
-
sheet: {
|
|
216
|
-
type: Boolean,
|
|
217
|
-
default: !0
|
|
218
|
-
},
|
|
219
|
-
sheetBreakpoint: { default: () => 768 },
|
|
220
|
-
sheetTitle: { default: "" }
|
|
221
|
-
}, {
|
|
222
|
-
modelValue: {
|
|
223
|
-
type: Boolean,
|
|
224
|
-
default: !1
|
|
225
|
-
},
|
|
226
|
-
modelModifiers: {}
|
|
227
|
-
}),
|
|
228
|
-
emits: ["update:modelValue"],
|
|
229
|
-
setup(u, { expose: d }) {
|
|
230
|
-
let p = E(u, "modelValue"), g = ee(() => u.sheet, () => u.sheetBreakpoint), { isPanelShown: _, isPanelActive: y, handlePanelAfterLeave: x } = R(p), S = (e) => {
|
|
231
|
-
p.value = e;
|
|
232
|
-
}, C = () => S(!1), j = D(), M = O("triggerWrapperRef"), P = O("panelRef"), F = T(), I = T(), L = a(() => u.contentId ?? F), z = a(() => j.trigger ? te(M.value) : u.reference), B = a(() => u.teleportTo !== !1), V = a(() => u.teleportTo === !1 ? "body" : u.teleportTo), H = e.BOTTOM_START, U = () => {
|
|
233
|
-
u.disabled || S(!0);
|
|
234
|
-
}, W = () => {
|
|
235
|
-
u.disabled || (p.value = !p.value);
|
|
236
|
-
}, G = a(() => ({
|
|
237
|
-
id: I,
|
|
238
|
-
"aria-expanded": p.value,
|
|
239
|
-
"aria-haspopup": "dialog",
|
|
240
|
-
"aria-controls": L.value
|
|
241
|
-
})), { panelStyles: J, panelMaxHeight: Y, resolvedPlacement: X, arrowStyles: ie, isArrowOverflow: ae, isPositionReady: oe, updatePosition: se } = t({
|
|
242
|
-
open: () => y.value && !g.value,
|
|
243
|
-
onOpenChange: S,
|
|
244
|
-
reference: () => z.value,
|
|
245
|
-
panel: () => P.value,
|
|
246
|
-
placement: () => u.placement,
|
|
247
|
-
offset: () => u.offset,
|
|
248
|
-
flip: () => u.flip,
|
|
249
|
-
shift: () => u.shift,
|
|
250
|
-
matchReferenceWidth: () => u.matchReferenceWidth,
|
|
251
|
-
fitViewport: () => u.fitViewport,
|
|
252
|
-
dismissOnClickOutside: () => u.dismissOnClickOutside,
|
|
253
|
-
dismissOnEscape: () => u.dismissOnEscape,
|
|
254
|
-
viewportPadding: () => u.viewportPadding,
|
|
255
|
-
arrow: () => u.arrow
|
|
256
|
-
}), Z = a(() => u.showOnHover && !g.value), ce = a(() => Z.value ? z.value : null), le = a(() => Z.value ? P.value : null), Q = N(ce, { delayLeave: u.hoverLeaveDelay }), $ = N(le, { delayLeave: u.hoverLeaveDelay });
|
|
257
|
-
k([
|
|
258
|
-
Q,
|
|
259
|
-
$,
|
|
260
|
-
Z,
|
|
261
|
-
() => u.disabled
|
|
262
|
-
], () => {
|
|
263
|
-
if (Z.value) {
|
|
264
|
-
if (u.disabled) {
|
|
265
|
-
S(!1);
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
S(Q.value || $.value);
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
let ue = a(() => !!Y.value), de = a(() => {
|
|
272
|
-
if (Y.value) return { maxHeight: `${Y.value}px` };
|
|
273
|
-
});
|
|
274
|
-
return k(() => u.disabled, (e) => {
|
|
275
|
-
e && p.value && (p.value = !1);
|
|
276
|
-
}), d({
|
|
277
|
-
updatePosition: se,
|
|
278
|
-
show: U,
|
|
279
|
-
close: C,
|
|
280
|
-
toggle: W
|
|
281
|
-
}), (e, t) => (v(), c(n, null, [w(j).trigger ? (v(), c("span", f({
|
|
282
|
-
key: 0,
|
|
283
|
-
ref_key: "triggerWrapperRef",
|
|
284
|
-
ref: M,
|
|
285
|
-
class: "s-ui-dropdown"
|
|
286
|
-
}, e.$attrs), [b(e.$slots, "trigger", {
|
|
287
|
-
open: p.value,
|
|
288
|
-
toggle: W,
|
|
289
|
-
close: C,
|
|
290
|
-
isSheet: w(g),
|
|
291
|
-
triggerProps: G.value
|
|
292
|
-
})], 16)) : s("", !0), (v(), o(r, {
|
|
293
|
-
to: V.value,
|
|
294
|
-
disabled: !B.value
|
|
295
|
-
}, [w(g) ? (v(), o(K, {
|
|
296
|
-
key: 0,
|
|
297
|
-
open: p.value,
|
|
298
|
-
title: u.sheetTitle,
|
|
299
|
-
"dismiss-on-overlay-click": u.dismissOnClickOutside,
|
|
300
|
-
"dismiss-on-escape": u.dismissOnEscape,
|
|
301
|
-
"content-id": L.value,
|
|
302
|
-
onClose: C
|
|
303
|
-
}, {
|
|
304
|
-
"header-left": A(() => [b(e.$slots, "sheet-header-left", { close: C })]),
|
|
305
|
-
"header-right": A(() => [b(e.$slots, "sheet-header-right", { close: C })]),
|
|
306
|
-
default: A(() => [b(e.$slots, "content", {
|
|
307
|
-
resolvedPlacement: w(H),
|
|
308
|
-
isSheet: !0,
|
|
309
|
-
close: C
|
|
310
|
-
})]),
|
|
311
|
-
_: 3
|
|
312
|
-
}, 8, [
|
|
313
|
-
"open",
|
|
314
|
-
"title",
|
|
315
|
-
"dismiss-on-overlay-click",
|
|
316
|
-
"dismiss-on-escape",
|
|
317
|
-
"content-id"
|
|
318
|
-
])) : (v(), o(i, {
|
|
319
|
-
key: 1,
|
|
320
|
-
name: "s-ui-dropdown",
|
|
321
|
-
onAfterLeave: w(x)
|
|
322
|
-
}, {
|
|
323
|
-
default: A(() => [w(_) ? (v(), c("div", {
|
|
324
|
-
key: 0,
|
|
325
|
-
id: L.value,
|
|
326
|
-
ref_key: "panelRef",
|
|
327
|
-
ref: P,
|
|
328
|
-
class: m(["s-ui-dropdown__panel", {
|
|
329
|
-
"s-ui-dropdown__panel--match-reference-width": u.matchReferenceWidth,
|
|
330
|
-
"s-ui-dropdown__panel--ready": w(oe)
|
|
331
|
-
}]),
|
|
332
|
-
style: h(w(J)),
|
|
333
|
-
role: "dialog"
|
|
334
|
-
}, [l("div", {
|
|
335
|
-
class: m(["s-ui-dropdown__surface", [u.surfaceClass, {
|
|
336
|
-
"s-ui-dropdown__surface--fit-viewport": ue.value,
|
|
337
|
-
"s-ui-dropdown__surface--with-arrow": u.arrow
|
|
338
|
-
}]]),
|
|
339
|
-
style: h(de.value),
|
|
340
|
-
"data-placement": w(X)
|
|
341
|
-
}, [u.arrow ? (v(), c("div", {
|
|
342
|
-
key: 0,
|
|
343
|
-
class: m(["s-ui-dropdown__arrow", { "s-ui-dropdown__arrow--overflow": w(ae) }]),
|
|
344
|
-
style: h(w(ie)),
|
|
345
|
-
"aria-hidden": "true"
|
|
346
|
-
}, [...t[0] ||= [l("span", { class: "s-ui-dropdown__arrow-outer" }, null, -1), l("span", { class: "s-ui-dropdown__arrow-inner" }, null, -1)]], 6)) : s("", !0), l("div", re, [b(e.$slots, "content", {
|
|
347
|
-
resolvedPlacement: w(X),
|
|
348
|
-
isSheet: !1,
|
|
349
|
-
close: C
|
|
350
|
-
})])], 14, ne)], 14, q)) : s("", !0)]),
|
|
351
|
-
_: 3
|
|
352
|
-
}, 8, ["onAfterLeave"]))], 8, ["to", "disabled"]))], 64));
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
//#endregion
|
|
356
|
-
export { L as n, J as t };
|
package/dist/SInput-IfbP8zrv.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-9dLbCJvh.cjs"),n=require("./SInlineMessage-gjkMiE-W.cjs"),r=require("./SLabel-DLKfepRW.cjs"),i=require("./useFieldMessages-2TaArixP.cjs");let a=require("vue"),o=require("@shtabapp/ui-kit-primitives");var s=function(e){return e.NONE=`none`,e.HORIZONTAL=`horizontal`,e.VERTICAL=`vertical`,e}({}),c=e=>()=>e.hasControlSlot()?e.hasValue()===!0:e.value().length>0,l=[`inert`,`aria-disabled`],u={key:0,class:`s-ui-input__prepend`},d={class:`s-ui-input__row`},f={key:0,class:`s-ui-input__prefix`},p=[`id`,`type`,`name`,`placeholder`,`disabled`,`readonly`,`autocomplete`],m={key:0,class:`s-ui-input__inline`},h={key:1,class:`s-ui-input__clear`},g={key:2,class:`s-ui-input__action`},_=16,v=(0,a.defineComponent)({inheritAttrs:!1,__name:`SInput`,props:(0,a.mergeModels)({label:{},labelProps:{},placeholder:{},helpMessages:{},errorMessages:{},bordered:{type:Boolean,default:!0},reserveMessageSpace:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},hasValue:{type:Boolean},focused:{type:Boolean,default:!1},iconLeft:{},iconRight:{},customize:{default:()=>s.NONE},name:{},type:{default:`text`},id:{},autocomplete:{},autofocus:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,a.mergeModels)([`clear`,`focus`,`blur`],[`update:modelValue`]),setup(v,{expose:y,emit:b}){let x=(0,a.useModel)(v,`modelValue`),{t:S}=(0,o.useUiKitI18n)(),C=b,{rootAttrs:w,controlAttrs:T,errorQa:E}=i.r(),D=(0,a.useSlots)(),O=(0,a.useId)(),k=(0,a.useTemplateRef)(`fieldElementRef`),A=(0,a.useTemplateRef)(`inputElementRef`),{isFocused:j,handleFocus:M,handleFocusOut:N}=i.n({isDisabled:()=>v.disabled,blurField:()=>Q(),emitFocus:e=>C(`focus`,e),emitBlur:e=>C(`blur`,e)}),{normalizedHelpMessages:P,normalizedErrorMessages:F,hasErrorMessages:I,hasHelpMessages:L}=i.t(()=>v.helpMessages,()=>v.errorMessages),R=(0,a.computed)(()=>v.id?v.id:O),z=(0,a.computed)(()=>!!(v.label||D.label)),B=(0,a.computed)(()=>!!(v.iconLeft||D.prefix)),V=(0,a.computed)(()=>v.customize===s.VERTICAL&&!!D.prepend),H=(0,a.computed)(()=>v.customize===s.HORIZONTAL&&!!D.prepend),U=()=>!v.clearable||v.disabled||v.readonly?!1:q(),W=(0,a.computed)(()=>{if(!j.value)return-1}),G=(0,a.computed)(()=>!!(v.iconRight||D.action)),K=(0,a.computed)(()=>!!D.message||L.value||I.value),q=c({hasControlSlot:()=>!!D.control,hasValue:()=>v.hasValue,value:()=>x.value}),J=(0,a.computed)(()=>({"s-ui-input--disabled":v.disabled,"s-ui-input--readonly":v.readonly})),Y=(0,a.computed)(()=>[{"s-ui-input__field--bordered":v.bordered,"s-ui-input__field--borderless":!v.bordered,"s-ui-input__field--disabled":v.disabled,"s-ui-input__field--readonly":v.readonly,"s-ui-input__field--error":I.value,"s-ui-input__field--vertical":v.customize===s.VERTICAL,"s-ui-input__field--focused":j.value||v.focused}]),X=e=>{let t=k.value;t&&t.querySelector(`.s-ui-input__control, .s-ui-select__control, .s-ui-select__search-input, [tabindex]:not([tabindex="-1"])`)?.focus(e)},Z=e=>{if(D.control){X(e);return}A.value?.focus(e)},Q=()=>{if(D.control){let e=document.activeElement;e instanceof HTMLElement&&k.value?.contains(e)&&e.blur();return}A.value?.blur()},$=e=>{v.disabled||v.readonly||e.target instanceof HTMLElement&&(e.target.closest(`.s-ui-input__prepend, .s-ui-input__inline, .s-ui-input__clear, .s-ui-input__action`)||Z())},ee=()=>{x.value=``,C(`clear`),Z()};return(0,a.onMounted)(()=>{v.autofocus&&(0,a.nextTick)(()=>{Z()})}),y({blur:Q,focus:Z,fieldElementRef:k,inputElementRef:A}),(i,c)=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,(0,a.mergeProps)({class:[`s-ui-input`,J.value]},(0,a.unref)(w)),[z.value?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(r.t),(0,a.mergeProps)({key:0},v.labelProps,{"html-for":R.value}),{default:(0,a.withCtx)(()=>[(0,a.renderSlot)(i.$slots,`label`,{},()=>[(0,a.createTextVNode)((0,a.toDisplayString)(v.label),1)])]),_:3},16,[`html-for`])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{ref_key:`fieldElementRef`,ref:k,class:(0,a.normalizeClass)([`s-ui-input__field`,[Y.value,{"s-ui-input__field--filled":(0,a.unref)(q)()}]]),inert:v.disabled?!0:void 0,"aria-disabled":v.disabled?!0:void 0,onClick:c[2]||=e=>$(e),onFocusout:c[3]||=(...e)=>(0,a.unref)(N)&&(0,a.unref)(N)(...e)},[V.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,u,[(0,a.renderSlot)(i.$slots,`prepend`,{disabled:v.disabled})])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,d,[B.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,f,[(0,a.renderSlot)(i.$slots,`prefix`,{disabled:v.disabled},()=>[v.iconLeft?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(o.SIcon),{key:0,name:v.iconLeft,size:_},null,8,[`name`])):(0,a.createCommentVNode)(``,!0)])])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,{class:(0,a.normalizeClass)([`s-ui-input__control-wrap`,{"s-ui-input__control-wrap--horizontal":v.customize===(0,a.unref)(s).HORIZONTAL}])},[(0,a.renderSlot)(i.$slots,`control`,{disabled:v.disabled},()=>[(0,a.withDirectives)((0,a.createElementVNode)(`input`,(0,a.mergeProps)({id:R.value,ref_key:`inputElementRef`,ref:A,"onUpdate:modelValue":c[0]||=e=>x.value=e,class:`s-ui-input__control s-ui-typography-body-14-regular`,type:v.type,name:v.name,placeholder:v.placeholder,disabled:v.disabled,readonly:v.readonly,autocomplete:v.autocomplete},(0,a.unref)(T),{onFocus:c[1]||=(...e)=>(0,a.unref)(M)&&(0,a.unref)(M)(...e)}),null,16,p),[[a.vModelDynamic,x.value]])]),H.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,m,[(0,a.renderSlot)(i.$slots,`prepend`,{disabled:v.disabled})])):(0,a.createCommentVNode)(``,!0)],2),U()?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,h,[(0,a.createVNode)((0,a.unref)(t.t),{appearance:(0,a.unref)(e.t).BARE,variant:(0,a.unref)(e.r).NEUTRAL,size:(0,a.unref)(e.n).SMALL,icon:`closeMini`,"aria-label":(0,a.unref)(S)(`input.clear`),tabindex:W.value,onClick:(0,a.withModifiers)(ee,[`stop`])},null,8,[`appearance`,`variant`,`size`,`aria-label`,`tabindex`])])):(0,a.createCommentVNode)(``,!0),G.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,g,[(0,a.renderSlot)(i.$slots,`action`,{disabled:v.disabled},()=>[v.iconRight?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(t.t),{key:0,appearance:(0,a.unref)(e.t).BARE,variant:(0,a.unref)(e.r).NEUTRAL,size:(0,a.unref)(e.n).SMALL,disabled:v.disabled,icon:v.iconRight,tabindex:-1},null,8,[`appearance`,`variant`,`size`,`disabled`,`icon`])):(0,a.createCommentVNode)(``,!0)])])):(0,a.createCommentVNode)(``,!0)])],42,l),K.value||v.reserveMessageSpace?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:1,class:(0,a.normalizeClass)([`s-ui-input__messages`,{"s-ui-input__messages--reserved":v.reserveMessageSpace}])},[(0,a.renderSlot)(i.$slots,`message`,{},()=>[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)((0,a.unref)(P),(e,t)=>((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(n.t),{key:`help-${t}`,message:e},null,8,[`message`]))),128)),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)((0,a.unref)(F),(e,t)=>((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(n.t),{key:`error-${t}`,message:e,"data-qa":(0,a.unref)(E),"validation-status":(0,a.unref)(n.n).ERROR},null,8,[`message`,`data-qa`,`validation-status`]))),128))])],2)):(0,a.createCommentVNode)(``,!0)],16))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { n as e, r as t, t as ee } from "./SButton.types-CpdHQtyx.js";
|
|
2
|
-
import { t as n } from "./SButton-6AL2ipRT.js";
|
|
3
|
-
import { n as r } from "./useSelectLink-2aCIYmF6.js";
|
|
4
|
-
import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, defineComponent as d, guardReactiveProps as f, inject as p, normalizeClass as m, normalizeProps as h, normalizeStyle as te, openBlock as g, renderSlot as _, toDisplayString as v, unref as y, useSlots as ne, useTemplateRef as b, withModifiers as x } from "vue";
|
|
5
|
-
import { ESSkeletonType as S, SIcon as C, SSkeleton as re, useUiKitI18n as ie } from "@shtabapp/ui-kit-primitives";
|
|
6
|
-
//#region src/components/SList/utils/context.ts
|
|
7
|
-
var w = Symbol("sListInjectionKey"), T = /* @__PURE__ */ function(e) {
|
|
8
|
-
return e.NEUTRAL = "neutral", e.MAIN = "main", e.ERROR = "error", e.BILLING = "billing", e;
|
|
9
|
-
}({}), E = [
|
|
10
|
-
"id",
|
|
11
|
-
"tabindex",
|
|
12
|
-
"aria-selected",
|
|
13
|
-
"aria-disabled",
|
|
14
|
-
"aria-readonly",
|
|
15
|
-
"aria-busy",
|
|
16
|
-
"aria-expanded"
|
|
17
|
-
], D = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "s-ui-list-item__level"
|
|
20
|
-
}, O = { class: "s-ui-list-item__body" }, k = {
|
|
21
|
-
key: 0,
|
|
22
|
-
class: "s-ui-list-item__icon-left"
|
|
23
|
-
}, A = { class: "s-ui-list-item__text" }, j = {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: "s-ui-list-item__title s-ui-typography-label-14-medium"
|
|
26
|
-
}, M = {
|
|
27
|
-
key: 1,
|
|
28
|
-
class: "s-ui-list-item__subtitle s-ui-typography-body-12-regular"
|
|
29
|
-
}, N = {
|
|
30
|
-
key: 1,
|
|
31
|
-
class: "s-ui-list-item__title-action"
|
|
32
|
-
}, P = {
|
|
33
|
-
key: 1,
|
|
34
|
-
class: "s-ui-list-item__actions"
|
|
35
|
-
}, F = { class: "s-ui-list-item__actions-reveal" }, I = { class: "s-ui-list-item__actions-inner" }, L = {
|
|
36
|
-
key: 0,
|
|
37
|
-
class: "s-ui-list-item__trailing"
|
|
38
|
-
}, R = {
|
|
39
|
-
key: 1,
|
|
40
|
-
class: "s-ui-list-item__action-end"
|
|
41
|
-
}, z = 16, B = ".s-ui-list-item__expand, .s-ui-list-item__title-action, .s-ui-list-item__actions", V = /* @__PURE__ */ d({
|
|
42
|
-
__name: "SListItem",
|
|
43
|
-
props: {
|
|
44
|
-
depth: { default: 0 },
|
|
45
|
-
expandable: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: !1
|
|
48
|
-
},
|
|
49
|
-
expanded: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: !1
|
|
52
|
-
},
|
|
53
|
-
variant: { default: () => T.NEUTRAL },
|
|
54
|
-
tiny: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: !1
|
|
57
|
-
},
|
|
58
|
-
selected: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: !1
|
|
61
|
-
},
|
|
62
|
-
active: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: !1
|
|
65
|
-
},
|
|
66
|
-
disabled: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: !1
|
|
69
|
-
},
|
|
70
|
-
readonly: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: !1
|
|
73
|
-
},
|
|
74
|
-
loading: {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
default: !1
|
|
77
|
-
},
|
|
78
|
-
title: {},
|
|
79
|
-
subtitle: {},
|
|
80
|
-
iconLeft: {},
|
|
81
|
-
rowKey: {},
|
|
82
|
-
revealRight: { type: Boolean },
|
|
83
|
-
expandOnClick: { type: Boolean }
|
|
84
|
-
},
|
|
85
|
-
emits: [
|
|
86
|
-
"click",
|
|
87
|
-
"toggleExpand",
|
|
88
|
-
"keydown"
|
|
89
|
-
],
|
|
90
|
-
setup(d, { expose: V, emit: H }) {
|
|
91
|
-
let U = H, W = a(() => ({
|
|
92
|
-
disabled: d.disabled,
|
|
93
|
-
readonly: d.readonly
|
|
94
|
-
})), G = ne(), K = b("listItemElementRef"), q = p(w, null), { t: J } = ie(), Y = r({
|
|
95
|
-
group: () => q,
|
|
96
|
-
value: () => d.rowKey,
|
|
97
|
-
el: () => K.value,
|
|
98
|
-
disabled: () => d.disabled || d.loading,
|
|
99
|
-
interactive: () => !d.readonly && !d.loading
|
|
100
|
-
}), ae = a(() => d.variant === T.BILLING && !d.disabled), X = a(() => q && d.rowKey ? q.isExpanded(d.rowKey) : d.expanded), oe = a(() => X.value ? J("listItem.collapse") : J("listItem.expand")), Z = a(() => Y.isInGroup.value ? Y.isActive.value : d.selected), se = a(() => q && d.rowKey ? q.activeKey() === d.rowKey : d.active), ce = a(() => d.revealRight ? !0 : q ? q.revealRight() : !1), le = a(() => d.expandOnClick ? !0 : q ? q.expandOnClick() : !1), ue = a(() => {
|
|
101
|
-
if (!(!q || !d.rowKey)) return q.getItemOptionId(d.rowKey);
|
|
102
|
-
}), de = a(() => {
|
|
103
|
-
if (q?.usesActiveDescendantNavigation()) return -1;
|
|
104
|
-
if (!(d.disabled || d.readonly || d.loading)) return Y.tabIndex.value === void 0 ? 0 : Y.tabIndex.value;
|
|
105
|
-
}), fe = a(() => ({ "--s-ui-list-item-depth": String(d.depth) })), pe = a(() => [`s-ui-list-item--variant-${d.variant}`, {
|
|
106
|
-
"s-ui-list-item--tiny": d.tiny,
|
|
107
|
-
"s-ui-list-item--selected": Z.value,
|
|
108
|
-
"s-ui-list-item--active": se.value,
|
|
109
|
-
"s-ui-list-item--disabled": d.disabled,
|
|
110
|
-
"s-ui-list-item--readonly": d.readonly,
|
|
111
|
-
"s-ui-list-item--loading": d.loading,
|
|
112
|
-
"s-ui-list-item--expandable": d.expandable,
|
|
113
|
-
"s-ui-list-item--reveal-right": ce.value
|
|
114
|
-
}]), Q = () => {
|
|
115
|
-
if (q && d.rowKey) {
|
|
116
|
-
q.toggleExpanded(d.rowKey);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
U("toggleExpand");
|
|
120
|
-
}, $ = () => {
|
|
121
|
-
d.disabled || d.readonly || d.loading || Q();
|
|
122
|
-
}, me = (e) => e.target instanceof Element && !!e.target.closest(B), he = (e) => {
|
|
123
|
-
d.disabled || d.readonly || d.loading || me(e) || (d.expandable && le.value && (q && d.rowKey ? q.toggleExpanded(d.rowKey) : U("toggleExpand")), q && d.rowKey && q.setActiveKey(d.rowKey), Y.isInGroup.value && Y.handleClick(), U("click", e));
|
|
124
|
-
}, ge = (e) => !d.expandable || q?.handlesTreeKeyboardNavigation() || e.key !== "ArrowLeft" && e.key !== "ArrowRight" || e.key === "ArrowRight" === X.value ? !1 : (e.preventDefault(), Q(), !0), _e = (e) => {
|
|
125
|
-
d.disabled || d.readonly || d.loading || (!ge(e) && Y.isInGroup.value && Y.handleKeydown(e), U("keydown", e));
|
|
126
|
-
};
|
|
127
|
-
return V({ listItemElementRef: K }), (r, a) => (g(), c("div", {
|
|
128
|
-
ref_key: "listItemElementRef",
|
|
129
|
-
ref: K,
|
|
130
|
-
id: ue.value,
|
|
131
|
-
class: m(["s-ui-list-item", pe.value]),
|
|
132
|
-
style: te(fe.value),
|
|
133
|
-
tabindex: de.value,
|
|
134
|
-
role: "option",
|
|
135
|
-
"aria-selected": Z.value ? !0 : void 0,
|
|
136
|
-
"aria-disabled": d.disabled || d.loading ? !0 : void 0,
|
|
137
|
-
"aria-readonly": d.readonly ? !0 : void 0,
|
|
138
|
-
"aria-busy": d.loading ? !0 : void 0,
|
|
139
|
-
"aria-expanded": d.expandable && !d.loading ? X.value : void 0,
|
|
140
|
-
onClick: he,
|
|
141
|
-
onKeydown: _e
|
|
142
|
-
}, [d.loading ? (g(), o(y(re), {
|
|
143
|
-
key: 0,
|
|
144
|
-
type: y(S).S_LIST_ITEM
|
|
145
|
-
}, null, 8, ["type"])) : (g(), c(i, { key: 1 }, [
|
|
146
|
-
d.expandable || d.depth || y(G).level ? (g(), c("div", D, [_(r.$slots, "level", {}, () => [d.expandable ? (g(), o(y(n), {
|
|
147
|
-
key: 0,
|
|
148
|
-
class: m(["s-ui-list-item__expand", { "s-ui-list-item__expand--expanded": X.value }]),
|
|
149
|
-
appearance: y(ee).BARE,
|
|
150
|
-
variant: y(t).NEUTRAL,
|
|
151
|
-
size: y(e).SMALL,
|
|
152
|
-
icon: "chevronMiniRight",
|
|
153
|
-
disabled: d.disabled || d.readonly,
|
|
154
|
-
tabindex: -1,
|
|
155
|
-
"aria-label": oe.value,
|
|
156
|
-
onClick: x($, ["stop"])
|
|
157
|
-
}, null, 8, [
|
|
158
|
-
"class",
|
|
159
|
-
"appearance",
|
|
160
|
-
"variant",
|
|
161
|
-
"size",
|
|
162
|
-
"disabled",
|
|
163
|
-
"aria-label"
|
|
164
|
-
])) : s("", !0)])])) : s("", !0),
|
|
165
|
-
l("div", O, [
|
|
166
|
-
d.iconLeft || y(G)["icon-left"] ? (g(), c("div", k, [_(r.$slots, "icon-left", {}, () => [d.iconLeft ? (g(), o(y(C), {
|
|
167
|
-
key: 0,
|
|
168
|
-
name: d.iconLeft,
|
|
169
|
-
size: z,
|
|
170
|
-
billing: ae.value
|
|
171
|
-
}, null, 8, ["name", "billing"])) : s("", !0)])])) : s("", !0),
|
|
172
|
-
l("div", A, [d.title || y(G).title ? (g(), c("span", j, [_(r.$slots, "title", {}, () => [u(v(d.title), 1)])])) : s("", !0), d.subtitle || y(G).subtitle ? (g(), c("span", M, [_(r.$slots, "subtitle", {}, () => [u(v(d.subtitle), 1)])])) : s("", !0)]),
|
|
173
|
-
y(G)["title-action"] ? (g(), c("div", N, [_(r.$slots, "title-action", h(f(W.value)))])) : s("", !0)
|
|
174
|
-
]),
|
|
175
|
-
y(G).trailing || y(G).right || y(G)["action-end"] ? (g(), c("div", P, [l("div", F, [l("div", I, [
|
|
176
|
-
y(G).trailing ? (g(), c("div", L, [_(r.$slots, "trailing", h(f(W.value)))])) : s("", !0),
|
|
177
|
-
_(r.$slots, "right", h(f(W.value))),
|
|
178
|
-
y(G)["action-end"] ? (g(), c("div", R, [_(r.$slots, "action-end", h(f(W.value)))])) : s("", !0)
|
|
179
|
-
])])])) : s("", !0)
|
|
180
|
-
], 64))], 46, E));
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
//#endregion
|
|
184
|
-
export { T as n, w as r, V as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-9dLbCJvh.cjs"),n=require("./useSelectLink-DZIAhQ2J.cjs");let r=require("vue"),i=require("@shtabapp/ui-kit-primitives");var a=Symbol(`sListInjectionKey`),o=function(e){return e.NEUTRAL=`neutral`,e.MAIN=`main`,e.ERROR=`error`,e.BILLING=`billing`,e}({}),s=[`id`,`tabindex`,`aria-selected`,`aria-disabled`,`aria-readonly`,`aria-busy`,`aria-expanded`],c={key:0,class:`s-ui-list-item__level`},l={class:`s-ui-list-item__body`},u={key:0,class:`s-ui-list-item__icon-left`},d={class:`s-ui-list-item__text`},f={key:0,class:`s-ui-list-item__title s-ui-typography-label-14-medium`},p={key:1,class:`s-ui-list-item__subtitle s-ui-typography-body-12-regular`},m={key:1,class:`s-ui-list-item__title-action`},h={key:1,class:`s-ui-list-item__actions`},g={class:`s-ui-list-item__actions-reveal`},_={class:`s-ui-list-item__actions-inner`},v={key:0,class:`s-ui-list-item__trailing`},y={key:1,class:`s-ui-list-item__action-end`},b=16,x=`.s-ui-list-item__expand, .s-ui-list-item__title-action, .s-ui-list-item__actions`,S=(0,r.defineComponent)({__name:`SListItem`,props:{depth:{default:0},expandable:{type:Boolean,default:!1},expanded:{type:Boolean,default:!1},variant:{default:()=>o.NEUTRAL},tiny:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},title:{},subtitle:{},iconLeft:{},rowKey:{},revealRight:{type:Boolean},expandOnClick:{type:Boolean}},emits:[`click`,`toggleExpand`,`keydown`],setup(S,{expose:C,emit:w}){let T=w,E=(0,r.computed)(()=>({disabled:S.disabled,readonly:S.readonly})),D=(0,r.useSlots)(),O=(0,r.useTemplateRef)(`listItemElementRef`),k=(0,r.inject)(a,null),{t:A}=(0,i.useUiKitI18n)(),j=n.n({group:()=>k,value:()=>S.rowKey,el:()=>O.value,disabled:()=>S.disabled||S.loading,interactive:()=>!S.readonly&&!S.loading}),M=(0,r.computed)(()=>S.variant===o.BILLING&&!S.disabled),N=(0,r.computed)(()=>k&&S.rowKey?k.isExpanded(S.rowKey):S.expanded),P=(0,r.computed)(()=>N.value?A(`listItem.collapse`):A(`listItem.expand`)),F=(0,r.computed)(()=>j.isInGroup.value?j.isActive.value:S.selected),I=(0,r.computed)(()=>k&&S.rowKey?k.activeKey()===S.rowKey:S.active),L=(0,r.computed)(()=>S.revealRight?!0:k?k.revealRight():!1),R=(0,r.computed)(()=>S.expandOnClick?!0:k?k.expandOnClick():!1),z=(0,r.computed)(()=>{if(!(!k||!S.rowKey))return k.getItemOptionId(S.rowKey)}),B=(0,r.computed)(()=>{if(k?.usesActiveDescendantNavigation())return-1;if(!(S.disabled||S.readonly||S.loading))return j.tabIndex.value===void 0?0:j.tabIndex.value}),V=(0,r.computed)(()=>({"--s-ui-list-item-depth":String(S.depth)})),H=(0,r.computed)(()=>[`s-ui-list-item--variant-${S.variant}`,{"s-ui-list-item--tiny":S.tiny,"s-ui-list-item--selected":F.value,"s-ui-list-item--active":I.value,"s-ui-list-item--disabled":S.disabled,"s-ui-list-item--readonly":S.readonly,"s-ui-list-item--loading":S.loading,"s-ui-list-item--expandable":S.expandable,"s-ui-list-item--reveal-right":L.value}]),U=()=>{if(k&&S.rowKey){k.toggleExpanded(S.rowKey);return}T(`toggleExpand`)},W=()=>{S.disabled||S.readonly||S.loading||U()},G=e=>e.target instanceof Element&&!!e.target.closest(x),K=e=>{S.disabled||S.readonly||S.loading||G(e)||(S.expandable&&R.value&&(k&&S.rowKey?k.toggleExpanded(S.rowKey):T(`toggleExpand`)),k&&S.rowKey&&k.setActiveKey(S.rowKey),j.isInGroup.value&&j.handleClick(),T(`click`,e))},q=e=>!S.expandable||k?.handlesTreeKeyboardNavigation()||e.key!==`ArrowLeft`&&e.key!==`ArrowRight`||e.key===`ArrowRight`===N.value?!1:(e.preventDefault(),U(),!0),J=e=>{S.disabled||S.readonly||S.loading||(!q(e)&&j.isInGroup.value&&j.handleKeydown(e),T(`keydown`,e))};return C({listItemElementRef:O}),(n,a)=>((0,r.openBlock)(),(0,r.createElementBlock)(`div`,{ref_key:`listItemElementRef`,ref:O,id:z.value,class:(0,r.normalizeClass)([`s-ui-list-item`,H.value]),style:(0,r.normalizeStyle)(V.value),tabindex:B.value,role:`option`,"aria-selected":F.value?!0:void 0,"aria-disabled":S.disabled||S.loading?!0:void 0,"aria-readonly":S.readonly?!0:void 0,"aria-busy":S.loading?!0:void 0,"aria-expanded":S.expandable&&!S.loading?N.value:void 0,onClick:K,onKeydown:J},[S.loading?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(i.SSkeleton),{key:0,type:(0,r.unref)(i.ESSkeletonType).S_LIST_ITEM},null,8,[`type`])):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[S.expandable||S.depth||(0,r.unref)(D).level?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,c,[(0,r.renderSlot)(n.$slots,`level`,{},()=>[S.expandable?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(t.t),{key:0,class:(0,r.normalizeClass)([`s-ui-list-item__expand`,{"s-ui-list-item__expand--expanded":N.value}]),appearance:(0,r.unref)(e.t).BARE,variant:(0,r.unref)(e.r).NEUTRAL,size:(0,r.unref)(e.n).SMALL,icon:`chevronMiniRight`,disabled:S.disabled||S.readonly,tabindex:-1,"aria-label":P.value,onClick:(0,r.withModifiers)(W,[`stop`])},null,8,[`class`,`appearance`,`variant`,`size`,`disabled`,`aria-label`])):(0,r.createCommentVNode)(``,!0)])])):(0,r.createCommentVNode)(``,!0),(0,r.createElementVNode)(`div`,l,[S.iconLeft||(0,r.unref)(D)[`icon-left`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,u,[(0,r.renderSlot)(n.$slots,`icon-left`,{},()=>[S.iconLeft?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(i.SIcon),{key:0,name:S.iconLeft,size:b,billing:M.value},null,8,[`name`,`billing`])):(0,r.createCommentVNode)(``,!0)])])):(0,r.createCommentVNode)(``,!0),(0,r.createElementVNode)(`div`,d,[S.title||(0,r.unref)(D).title?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,f,[(0,r.renderSlot)(n.$slots,`title`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(S.title),1)])])):(0,r.createCommentVNode)(``,!0),S.subtitle||(0,r.unref)(D).subtitle?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,p,[(0,r.renderSlot)(n.$slots,`subtitle`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(S.subtitle),1)])])):(0,r.createCommentVNode)(``,!0)]),(0,r.unref)(D)[`title-action`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,m,[(0,r.renderSlot)(n.$slots,`title-action`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value)))])):(0,r.createCommentVNode)(``,!0)]),(0,r.unref)(D).trailing||(0,r.unref)(D).right||(0,r.unref)(D)[`action-end`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,h,[(0,r.createElementVNode)(`div`,g,[(0,r.createElementVNode)(`div`,_,[(0,r.unref)(D).trailing?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,v,[(0,r.renderSlot)(n.$slots,`trailing`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value)))])):(0,r.createCommentVNode)(``,!0),(0,r.renderSlot)(n.$slots,`right`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value))),(0,r.unref)(D)[`action-end`]?((0,r.openBlock)(),(0,r.createElementBlock)(`div`,y,[(0,r.renderSlot)(n.$slots,`action-end`,(0,r.normalizeProps)((0,r.guardReactiveProps)(E.value)))])):(0,r.createCommentVNode)(``,!0)])])])):(0,r.createCommentVNode)(``,!0)],64))],46,s))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return S}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-9dLbCJvh.cjs");let n=require("vue"),r=require("@shtabapp/ui-kit-primitives");var i=function(e){return e.X_SMALL=`x-small`,e.SMALL=`small`,e.BIG=`big`,e}({}),a=function(e){return e.CIRCLE=`circle`,e.SQUARE=`square`,e}({}),o={key:0,class:`s-ui-photo-edit__remove`},s={class:`s-ui-photo-edit__wrapper`},c=[`tabindex`,`aria-disabled`,`aria-label`],l=[`src`,`alt`],u={key:1,class:`s-ui-photo-edit__placeholder`},d={class:`s-ui-photo-edit__camera`},f={class:`s-ui-photo-edit__overlay`},p=[`accept`,`disabled`],m=(0,n.defineComponent)({__name:`SPhotoEdit`,props:(0,n.mergeModels)({accept:{default:`image/jpeg,image/png,image/jpg`},alt:{},disabled:{type:Boolean,default:!1},shape:{default:()=>a.CIRCLE},size:{default:()=>i.SMALL}},{modelValue:{default:null},modelModifiers:{}}),emits:(0,n.mergeModels)([`change`,`remove`],[`update:modelValue`]),setup(a,{emit:m}){let h=(0,n.useModel)(a,`modelValue`),g=m,{t:_}=(0,r.useUiKitI18n)(),v=(0,n.useTemplateRef)(`fileInputRef`),y=(0,n.ref)(null),b=()=>{y.value&&=(URL.revokeObjectURL(y.value),null)};(0,n.watch)(()=>h.value,e=>{b(),e instanceof File&&(y.value=URL.createObjectURL(e))},{immediate:!0}),(0,n.onScopeDispose)(b);let x=(0,n.computed)(()=>{let e=h.value;return e instanceof File?y.value??``:typeof e==`string`?e:``}),S=(0,n.computed)(()=>{let e=h.value;return e instanceof File?!0:typeof e==`string`?e.length>0:!1}),C=(0,n.computed)(()=>({[`s-ui-photo-edit--size-${a.size}`]:!0,[`s-ui-photo-edit--shape-${a.shape}`]:!0,"s-ui-photo-edit--filled":S.value,"s-ui-photo-edit--disabled":a.disabled})),w=(0,n.computed)(()=>a.size===i.X_SMALL?`s-ui-typography-label-10-medium`:`s-ui-typography-label-12-medium`),T=(0,n.computed)(()=>S.value?_(`photoEdit.changePhoto`):_(`photoEdit.uploadPhoto`)),E=(0,n.computed)(()=>S.value?_(`photoEdit.changePhoto`):_(`photoEdit.pickPhoto`)),D=(0,n.computed)(()=>a.disabled?-1:0),O=()=>{v.value&&(v.value.value=``)},k=()=>{h.value=null,b(),O()},A=e=>{g(`change`,{file:e,abort:k})},j=()=>{a.disabled||v.value?.click()},M=()=>{j()},N=e=>{a.disabled||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),j())},P=e=>{if(!(e.target instanceof HTMLInputElement))return;let t=e.target.files?.[0];t&&(h.value=t,A(t),O())},F=()=>{a.disabled||(g(`remove`),h.value=null,b(),O(),A(null))};return(i,m)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{class:(0,n.normalizeClass)([`s-ui-photo-edit`,C.value])},[S.value?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,o,[(0,n.createVNode)((0,n.unref)(t.t),{appearance:(0,n.unref)(e.t).BARE,variant:(0,n.unref)(e.r).NEUTRAL,size:(0,n.unref)(e.n).SMALL,disabled:a.disabled,tabindex:-1,icon:`closeMini`,"aria-label":(0,n.unref)(_)(`photoEdit.removePhoto`),onClick:(0,n.withModifiers)(F,[`stop`])},null,8,[`appearance`,`variant`,`size`,`disabled`,`aria-label`])])):(0,n.createCommentVNode)(``,!0),(0,n.createElementVNode)(`div`,s,[(0,n.createElementVNode)(`div`,{class:`s-ui-photo-edit__trigger`,role:`button`,tabindex:D.value,"aria-disabled":a.disabled||void 0,"aria-label":E.value,onClick:M,onKeydown:N},[x.value?((0,n.openBlock)(),(0,n.createElementBlock)(`img`,{key:0,class:`s-ui-photo-edit__preview`,src:x.value,alt:a.alt??``},null,8,l)):((0,n.openBlock)(),(0,n.createElementBlock)(`div`,u,[(0,n.createElementVNode)(`span`,d,[(0,n.createVNode)((0,n.unref)(r.SIcon),{name:`camera`,size:40})])])),(0,n.createElementVNode)(`div`,f,[(0,n.createElementVNode)(`span`,{class:(0,n.normalizeClass)([`s-ui-photo-edit__label`,w.value])},(0,n.toDisplayString)(T.value),3)])],40,c)]),(0,n.createElementVNode)(`input`,{ref_key:`fileInputRef`,ref:v,class:`s-ui-photo-edit__input`,type:`file`,accept:a.accept,disabled:a.disabled,onChange:P},null,40,p)],2))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
|