@shtabapp/ui-kit 1.48.0 → 1.50.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shtabapp/ui-kit",
3
- "version": "1.48.0",
3
+ "version": "1.50.0",
4
4
  "description": "Vue 3 component library by Shtab — 30+ typed components, design tokens, light/dark themes",
5
5
  "keywords": [
6
6
  "shtab",
@@ -1 +0,0 @@
1
- const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs");let n=require("vue"),r=require("@shtabapp/ui-kit-primitives");var i=function(e){return 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={class:`s-ui-photo-edit__label s-ui-typography-label-12-medium`},m=[`accept`,`disabled`],h=(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(i,{emit:a}){let h=(0,n.useModel)(i,`modelValue`),g=a,{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-${i.size}`]:!0,[`s-ui-photo-edit--shape-${i.shape}`]:!0,"s-ui-photo-edit--filled":S.value,"s-ui-photo-edit--disabled":i.disabled})),w=(0,n.computed)(()=>S.value?_(`photoEdit.changePhoto`):_(`photoEdit.uploadPhoto`)),T=(0,n.computed)(()=>S.value?_(`photoEdit.changePhoto`):_(`photoEdit.pickPhoto`)),E=(0,n.computed)(()=>i.disabled?-1:0),D=()=>{v.value&&(v.value.value=``)},O=()=>{h.value=null,b(),D()},k=e=>{g(`change`,{file:e,abort:O})},A=()=>{i.disabled||v.value?.click()},j=()=>{A()},M=e=>{i.disabled||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),A())},N=e=>{if(!(e.target instanceof HTMLInputElement))return;let t=e.target.files?.[0];t&&(h.value=t,k(t),D())},P=()=>{i.disabled||(g(`remove`),h.value=null,b(),D(),k(null))};return(a,h)=>((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:i.disabled,tabindex:-1,icon:`closeMini`,"aria-label":(0,n.unref)(_)(`photoEdit.removePhoto`),onClick:(0,n.withModifiers)(P,[`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:E.value,"aria-disabled":i.disabled||void 0,"aria-label":T.value,onClick:j,onKeydown:M},[x.value?((0,n.openBlock)(),(0,n.createElementBlock)(`img`,{key:0,class:`s-ui-photo-edit__preview`,src:x.value,alt:i.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`,p,(0,n.toDisplayString)(w.value),1)])],40,c)]),(0,n.createElementVNode)(`input`,{ref_key:`fileInputRef`,ref:v,class:`s-ui-photo-edit__input`,type:`file`,accept:i.accept,disabled:i.disabled,onChange:N},null,40,m)],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 h}});