@shtabapp/ui-kit 1.57.0 → 1.59.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 +26 -0
- package/dist/SButtonGroup-BOZQSxWY.js +90 -0
- package/dist/SButtonGroup-Cnuo4SzC.cjs +1 -0
- package/dist/SChip-BL47yJ-i.cjs +1 -0
- package/dist/SChip-XCYvlpaS.js +102 -0
- package/dist/{SColorPicker-Cucd749L.cjs → SColorPicker-BFw8CCDr.cjs} +1 -1
- package/dist/{SColorPicker-PI3xoFtS.js → SColorPicker-CTl7cSAO.js} +2 -2
- package/dist/SDropdown-LNVnMol3.cjs +1 -0
- package/dist/SDropdown-LOTCtlCX.js +356 -0
- package/dist/SInput-CRAegYKS.cjs +1 -0
- package/dist/SInput-Csy2uch7.js +224 -0
- package/dist/{SSelect-8RPurgr-.js → SSelect-fLtErA7p.js} +2 -2
- package/dist/{SSelect-BVs3lWQ9.cjs → SSelect-mFCdoFuO.cjs} +1 -1
- package/dist/STextarea-BDyy7Ku5.js +269 -0
- package/dist/STextarea-C4qDIp2k.cjs +1 -0
- package/dist/components/SButtonGroup/SButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/SButtonGroup/utils/context.d.ts.map +1 -1
- package/dist/components/SChip/SChip.types.d.ts +4 -0
- package/dist/components/SChip/SChip.types.d.ts.map +1 -1
- package/dist/components/SChip/SChip.vue.d.ts +6 -2
- package/dist/components/SChip/SChip.vue.d.ts.map +1 -1
- package/dist/components/SDropdown/SDropdown.types.d.ts +12 -0
- package/dist/components/SDropdown/SDropdown.types.d.ts.map +1 -1
- package/dist/components/SDropdown/SDropdown.vue.d.ts +23 -2
- 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/SDropdown/parts/SDropdownSheet.types.d.ts +13 -0
- package/dist/components/SDropdown/parts/SDropdownSheet.types.d.ts.map +1 -0
- package/dist/components/SDropdown/parts/SDropdownSheet.vue.d.ts +23 -0
- package/dist/components/SDropdown/parts/SDropdownSheet.vue.d.ts.map +1 -0
- package/dist/components/SDropdown/utils/useDropdownSheetMode.d.ts +7 -0
- package/dist/components/SDropdown/utils/useDropdownSheetMode.d.ts.map +1 -0
- package/dist/components/SDropdown/utils/useSheetDrag.d.ts +18 -0
- package/dist/components/SDropdown/utils/useSheetDrag.d.ts.map +1 -0
- package/dist/components/SInlineGroup/SInlineGroup.types.d.ts +11 -0
- package/dist/components/SInlineGroup/SInlineGroup.types.d.ts.map +1 -0
- package/dist/components/SInlineGroup/SInlineGroup.vue.d.ts +14 -0
- package/dist/components/SInlineGroup/SInlineGroup.vue.d.ts.map +1 -0
- package/dist/components/SInlineGroup/index.d.ts +4 -0
- package/dist/components/SInlineGroup/index.d.ts.map +1 -0
- package/dist/components/SInput/SInput.types.d.ts +5 -1
- package/dist/components/SInput/SInput.types.d.ts.map +1 -1
- package/dist/components/SInput/SInput.vue.d.ts.map +1 -1
- package/dist/components/STextarea/STextarea.vue.d.ts.map +1 -1
- package/dist/composables/useFieldAttrs.d.ts +22 -0
- package/dist/composables/useFieldAttrs.d.ts.map +1 -0
- package/dist/composables/useFieldFilled.d.ts +19 -0
- package/dist/composables/useFieldFilled.d.ts.map +1 -0
- package/dist/entries/button-group.cjs +1 -1
- package/dist/entries/button-group.js +1 -1
- 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/dropdown.cjs +1 -1
- package/dist/entries/dropdown.d.ts +2 -2
- package/dist/entries/dropdown.d.ts.map +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/select.cjs +1 -1
- package/dist/entries/select.js +1 -1
- package/dist/entries/textarea.cjs +1 -1
- package/dist/entries/textarea.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +137 -137
- package/dist/uikit-components.css +1 -1
- package/dist/useFieldMessages-2TaArixP.cjs +1 -0
- package/dist/useFieldMessages-C-GXaf_q.js +43 -0
- package/package.json +2 -2
- package/dist/SButtonGroup-BPy2YaEP.cjs +0 -1
- package/dist/SButtonGroup-CmSlYnSv.js +0 -72
- package/dist/SChip-DRz5BA4Z.cjs +0 -1
- package/dist/SChip-DvPazz7Y.js +0 -67
- package/dist/SDropdown-CTQ5Qlez.js +0 -175
- package/dist/SDropdown-_QUOP-rw.cjs +0 -1
- package/dist/SInput-C-_R5pug.js +0 -204
- package/dist/SInput-Cw8pt9Sr.cjs +0 -1
- package/dist/STextarea-CFOemAYa.js +0 -264
- package/dist/STextarea-Dg-Dy3ZT.cjs +0 -1
- package/dist/useFieldMessages-Cb06My1W.js +0 -30
- package/dist/useFieldMessages-CzjU0ajM.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("vue");var t=new Set([`class`,`style`]),n=`data-qa`,r=()=>{let r=(0,e.useAttrs)();return{rootAttrs:(0,e.computed)(()=>({class:r.class,style:r.style})),controlAttrs:(0,e.computed)(()=>Object.fromEntries(Object.entries(r).filter(([e])=>!t.has(e)))),errorQa:(0,e.computed)(()=>{let e=r[n];if(typeof e==`string`)return`${e}:error`})}},i=t=>{let n=(0,e.ref)(!1);return{isFocused:n,handleFocus:e=>{if(t.isDisabled()){t.blurField();return}n.value||(n.value=!0,t.emitFocus(e))},handleFocusOut:e=>{if(!(e.currentTarget instanceof HTMLElement))return;let r=e.relatedTarget;r instanceof Node&&e.currentTarget.contains(r)||n.value&&(n.value=!1,t.emitBlur(e))}}},a=e=>e?typeof e==`string`?[e]:e.filter(e=>e.length>0):[],o=(t,n)=>{let r=(0,e.computed)(()=>a((0,e.toValue)(t))),i=(0,e.computed)(()=>a((0,e.toValue)(n)));return{normalizedHelpMessages:r,normalizedErrorMessages:i,hasHelpMessages:(0,e.computed)(()=>r.value.length>0),hasErrorMessages:(0,e.computed)(()=>i.value.length>0)}};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { computed as e, ref as t, toValue as n, useAttrs as r } from "vue";
|
|
2
|
+
//#region src/composables/useFieldAttrs.ts
|
|
3
|
+
var i = new Set(["class", "style"]), a = "data-qa", o = () => {
|
|
4
|
+
let t = r();
|
|
5
|
+
return {
|
|
6
|
+
rootAttrs: e(() => ({
|
|
7
|
+
class: t.class,
|
|
8
|
+
style: t.style
|
|
9
|
+
})),
|
|
10
|
+
controlAttrs: e(() => Object.fromEntries(Object.entries(t).filter(([e]) => !i.has(e)))),
|
|
11
|
+
errorQa: e(() => {
|
|
12
|
+
let e = t[a];
|
|
13
|
+
if (typeof e == "string") return `${e}:error`;
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
}, s = (e) => {
|
|
17
|
+
let n = t(!1);
|
|
18
|
+
return {
|
|
19
|
+
isFocused: n,
|
|
20
|
+
handleFocus: (t) => {
|
|
21
|
+
if (e.isDisabled()) {
|
|
22
|
+
e.blurField();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
n.value || (n.value = !0, e.emitFocus(t));
|
|
26
|
+
},
|
|
27
|
+
handleFocusOut: (t) => {
|
|
28
|
+
if (!(t.currentTarget instanceof HTMLElement)) return;
|
|
29
|
+
let r = t.relatedTarget;
|
|
30
|
+
r instanceof Node && t.currentTarget.contains(r) || n.value && (n.value = !1, e.emitBlur(t));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}, c = (e) => e ? typeof e == "string" ? [e] : e.filter((e) => e.length > 0) : [], l = (t, r) => {
|
|
34
|
+
let i = e(() => c(n(t))), a = e(() => c(n(r)));
|
|
35
|
+
return {
|
|
36
|
+
normalizedHelpMessages: i,
|
|
37
|
+
normalizedErrorMessages: a,
|
|
38
|
+
hasHelpMessages: e(() => i.value.length > 0),
|
|
39
|
+
hasErrorMessages: e(() => a.value.length > 0)
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { s as n, o as r, l as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shtabapp/ui-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.59.0",
|
|
4
4
|
"description": "Vue 3 component library by Shtab — 30+ typed components, design tokens, light/dark themes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"shtab",
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
"dependencies": {
|
|
265
265
|
"chart.js": "^4.5.0",
|
|
266
266
|
"vue-i18n": "^9.14.5",
|
|
267
|
-
"@shtabapp/ui-kit-primitives": "^1.
|
|
267
|
+
"@shtabapp/ui-kit-primitives": "^1.26.0",
|
|
268
268
|
"@shtabapp/ui-kit-tokens": "^1.19.0"
|
|
269
269
|
},
|
|
270
270
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./context-kCi2xRHY.cjs"),t=require("./useSelectionGroup-TaektE-I.cjs");let n=require("vue");var r=function(e){return e.ATTACHED=`attached`,e.SEPARATED=`separated`,e}({}),i=[`aria-orientation`,`aria-disabled`],a=(0,n.defineComponent)({__name:`SButtonGroup`,props:(0,n.mergeModels)({mode:{default:()=>t.n.SINGLE},mandatory:{type:Boolean,default:!1},orientation:{default:()=>t.r.HORIZONTAL},layout:{default:()=>r.ATTACHED},loop:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},appearance:{},variant:{},size:{}},{modelValue:{},modelModifiers:{}}),emits:[`update:modelValue`],setup(r){let a=(0,n.useModel)(r,`modelValue`),o=t.o({modelValue:()=>a.value,onUpdateModelValue:e=>{a.value=e},mode:()=>r.mode,mandatory:()=>r.mandatory,orientation:()=>r.orientation,loop:()=>r.loop});(0,n.provide)(e.t,{mode:()=>r.mode,isSelected:o.isSelected,selectItem:o.toggle,registerItem:o.registerItem,getItemTabIndex:o.getItemTabIndex,getGroupTabIndex:o.getGroupTabIndex,handleItemKeydown:o.handleItemKeydown,appearance:()=>r.appearance,variant:()=>r.variant,size:()=>r.size,disabled:()=>r.disabled});let s=(0,n.computed)(()=>[`s-ui-button-group`,`s-ui-button-group--orientation-${r.orientation}`,`s-ui-button-group--layout-${r.layout}`,{"s-ui-button-group--disabled":r.disabled}]);return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{class:(0,n.normalizeClass)(s.value),role:`group`,"aria-orientation":r.orientation,"aria-disabled":r.disabled||void 0},[(0,n.renderSlot)(e.$slots,`default`)],10,i))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./context-C3WoLJS4.js";
|
|
2
|
-
import { n as t, o as n, r } from "./useSelectionGroup-cKj38lEN.js";
|
|
3
|
-
import { computed as i, createElementBlock as a, defineComponent as o, mergeModels as s, normalizeClass as c, openBlock as l, provide as u, renderSlot as d, useModel as f } from "vue";
|
|
4
|
-
//#region src/components/SButtonGroup/SButtonGroup.types.ts
|
|
5
|
-
var p = /* @__PURE__ */ function(e) {
|
|
6
|
-
return e.ATTACHED = "attached", e.SEPARATED = "separated", e;
|
|
7
|
-
}({}), m = ["aria-orientation", "aria-disabled"], h = /* @__PURE__ */ o({
|
|
8
|
-
__name: "SButtonGroup",
|
|
9
|
-
props: /*@__PURE__*/ s({
|
|
10
|
-
mode: { default: () => t.SINGLE },
|
|
11
|
-
mandatory: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: !1
|
|
14
|
-
},
|
|
15
|
-
orientation: { default: () => r.HORIZONTAL },
|
|
16
|
-
layout: { default: () => p.ATTACHED },
|
|
17
|
-
loop: {
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: !0
|
|
20
|
-
},
|
|
21
|
-
disabled: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: !1
|
|
24
|
-
},
|
|
25
|
-
appearance: {},
|
|
26
|
-
variant: {},
|
|
27
|
-
size: {}
|
|
28
|
-
}, {
|
|
29
|
-
modelValue: {},
|
|
30
|
-
modelModifiers: {}
|
|
31
|
-
}),
|
|
32
|
-
emits: ["update:modelValue"],
|
|
33
|
-
setup(t) {
|
|
34
|
-
let r = f(t, "modelValue"), o = n({
|
|
35
|
-
modelValue: () => r.value,
|
|
36
|
-
onUpdateModelValue: (e) => {
|
|
37
|
-
r.value = e;
|
|
38
|
-
},
|
|
39
|
-
mode: () => t.mode,
|
|
40
|
-
mandatory: () => t.mandatory,
|
|
41
|
-
orientation: () => t.orientation,
|
|
42
|
-
loop: () => t.loop
|
|
43
|
-
});
|
|
44
|
-
u(e, {
|
|
45
|
-
mode: () => t.mode,
|
|
46
|
-
isSelected: o.isSelected,
|
|
47
|
-
selectItem: o.toggle,
|
|
48
|
-
registerItem: o.registerItem,
|
|
49
|
-
getItemTabIndex: o.getItemTabIndex,
|
|
50
|
-
getGroupTabIndex: o.getGroupTabIndex,
|
|
51
|
-
handleItemKeydown: o.handleItemKeydown,
|
|
52
|
-
appearance: () => t.appearance,
|
|
53
|
-
variant: () => t.variant,
|
|
54
|
-
size: () => t.size,
|
|
55
|
-
disabled: () => t.disabled
|
|
56
|
-
});
|
|
57
|
-
let s = i(() => [
|
|
58
|
-
"s-ui-button-group",
|
|
59
|
-
`s-ui-button-group--orientation-${t.orientation}`,
|
|
60
|
-
`s-ui-button-group--layout-${t.layout}`,
|
|
61
|
-
{ "s-ui-button-group--disabled": t.disabled }
|
|
62
|
-
]);
|
|
63
|
-
return (e, n) => (l(), a("div", {
|
|
64
|
-
class: c(s.value),
|
|
65
|
-
role: "group",
|
|
66
|
-
"aria-orientation": t.orientation,
|
|
67
|
-
"aria-disabled": t.disabled || void 0
|
|
68
|
-
}, [d(e.$slots, "default")], 10, m));
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
//#endregion
|
|
72
|
-
export { p as n, h as t };
|
package/dist/SChip-DRz5BA4Z.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("vue");var t=function(e){return e.BLUE=`blue`,e.RED=`red`,e.WHITE=`white`,e.BILLING=`billing`,e}({}),n=function(e){return e.SIZE_20=`20`,e.SIZE_24=`24`,e.SIZE_32=`32`,e}({}),r=[`tabindex`,`aria-disabled`,`inert`],i={class:`s-ui-chip__content`},a={key:0,class:`s-ui-chip__icon`},o={key:1,class:`s-ui-chip__prefix`},s={key:0,class:`s-ui-chip__actions`},c=(0,e.defineComponent)({__name:`SChip`,props:{color:{default:()=>t.BLUE},disabled:{type:Boolean,default:!1},size:{default:()=>n.SIZE_32}},setup(c){let l=(0,e.useSlots)(),u=(0,e.computed)(()=>c.color===t.BILLING),d=(0,e.computed)(()=>c.disabled?!1:u.value),f=(0,e.computed)(()=>c.disabled?-1:0),p=(0,e.computed)(()=>[`s-ui-chip--color-${c.color}`,`s-ui-chip--size-${c.size}`,{"s-ui-chip--disabled":c.disabled}]),m=(0,e.computed)(()=>c.size===n.SIZE_20?`s-ui-typography-label-12-medium`:`s-ui-typography-label-14-medium`),h={[n.SIZE_20]:16,[n.SIZE_24]:20,[n.SIZE_32]:20},g=(0,e.computed)(()=>h[c.size]);return(t,n)=>((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{class:(0,e.normalizeClass)([`s-ui-chip`,p.value]),tabindex:f.value,role:`group`,"aria-disabled":c.disabled?!0:void 0,inert:c.disabled?!0:void 0},[(0,e.createElementVNode)(`span`,i,[(0,e.unref)(l).icon?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,a,[(0,e.renderSlot)(t.$slots,`icon`,{billing:d.value,disabled:c.disabled,size:g.value})])):(0,e.createCommentVNode)(``,!0),(0,e.unref)(l).prefix?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,o,[(0,e.renderSlot)(t.$slots,`prefix`,{disabled:c.disabled,size:c.size})])):(0,e.createCommentVNode)(``,!0),(0,e.unref)(l).default?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,{key:2,class:(0,e.normalizeClass)([`s-ui-chip__label`,m.value])},[(0,e.renderSlot)(t.$slots,`default`)],2)):(0,e.createCommentVNode)(``,!0)]),(0,e.unref)(l).actions?((0,e.openBlock)(),(0,e.createElementBlock)(`span`,s,[(0,e.renderSlot)(t.$slots,`actions`,{billing:u.value,disabled:c.disabled})])):(0,e.createCommentVNode)(``,!0)],10,r))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
package/dist/SChip-DvPazz7Y.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { computed as e, createCommentVNode as t, createElementBlock as n, createElementVNode as r, defineComponent as i, normalizeClass as a, openBlock as o, renderSlot as s, unref as c, useSlots as l } from "vue";
|
|
2
|
-
//#region src/components/SChip/SChip.types.ts
|
|
3
|
-
var u = /* @__PURE__ */ function(e) {
|
|
4
|
-
return e.BLUE = "blue", e.RED = "red", e.WHITE = "white", e.BILLING = "billing", e;
|
|
5
|
-
}({}), d = /* @__PURE__ */ function(e) {
|
|
6
|
-
return e.SIZE_20 = "20", e.SIZE_24 = "24", e.SIZE_32 = "32", e;
|
|
7
|
-
}({}), f = [
|
|
8
|
-
"tabindex",
|
|
9
|
-
"aria-disabled",
|
|
10
|
-
"inert"
|
|
11
|
-
], p = { class: "s-ui-chip__content" }, m = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "s-ui-chip__icon"
|
|
14
|
-
}, h = {
|
|
15
|
-
key: 1,
|
|
16
|
-
class: "s-ui-chip__prefix"
|
|
17
|
-
}, g = {
|
|
18
|
-
key: 0,
|
|
19
|
-
class: "s-ui-chip__actions"
|
|
20
|
-
}, _ = /* @__PURE__ */ i({
|
|
21
|
-
__name: "SChip",
|
|
22
|
-
props: {
|
|
23
|
-
color: { default: () => u.BLUE },
|
|
24
|
-
disabled: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: !1
|
|
27
|
-
},
|
|
28
|
-
size: { default: () => d.SIZE_32 }
|
|
29
|
-
},
|
|
30
|
-
setup(i) {
|
|
31
|
-
let _ = l(), v = e(() => i.color === u.BILLING), y = e(() => i.disabled ? !1 : v.value), b = e(() => i.disabled ? -1 : 0), x = e(() => [
|
|
32
|
-
`s-ui-chip--color-${i.color}`,
|
|
33
|
-
`s-ui-chip--size-${i.size}`,
|
|
34
|
-
{ "s-ui-chip--disabled": i.disabled }
|
|
35
|
-
]), S = e(() => i.size === d.SIZE_20 ? "s-ui-typography-label-12-medium" : "s-ui-typography-label-14-medium"), C = {
|
|
36
|
-
[d.SIZE_20]: 16,
|
|
37
|
-
[d.SIZE_24]: 20,
|
|
38
|
-
[d.SIZE_32]: 20
|
|
39
|
-
}, w = e(() => C[i.size]);
|
|
40
|
-
return (e, l) => (o(), n("span", {
|
|
41
|
-
class: a(["s-ui-chip", x.value]),
|
|
42
|
-
tabindex: b.value,
|
|
43
|
-
role: "group",
|
|
44
|
-
"aria-disabled": i.disabled ? !0 : void 0,
|
|
45
|
-
inert: i.disabled ? !0 : void 0
|
|
46
|
-
}, [r("span", p, [
|
|
47
|
-
c(_).icon ? (o(), n("span", m, [s(e.$slots, "icon", {
|
|
48
|
-
billing: y.value,
|
|
49
|
-
disabled: i.disabled,
|
|
50
|
-
size: w.value
|
|
51
|
-
})])) : t("", !0),
|
|
52
|
-
c(_).prefix ? (o(), n("span", h, [s(e.$slots, "prefix", {
|
|
53
|
-
disabled: i.disabled,
|
|
54
|
-
size: i.size
|
|
55
|
-
})])) : t("", !0),
|
|
56
|
-
c(_).default ? (o(), n("span", {
|
|
57
|
-
key: 2,
|
|
58
|
-
class: a(["s-ui-chip__label", S.value])
|
|
59
|
-
}, [s(e.$slots, "default")], 2)) : t("", !0)
|
|
60
|
-
]), c(_).actions ? (o(), n("span", g, [s(e.$slots, "actions", {
|
|
61
|
-
billing: v.value,
|
|
62
|
-
disabled: i.disabled
|
|
63
|
-
})])) : t("", !0)], 10, f));
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
//#endregion
|
|
67
|
-
export { u as n, d as r, _ as t };
|
|
@@ -1,175 +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, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, normalizeClass as m, normalizeStyle as h, openBlock as g, ref as _, renderSlot as v, unref as y, useId as b, useModel as x, useSlots as S, useTemplateRef as C, watch as w, withCtx as T } from "vue";
|
|
3
|
-
import { useElementHover as E } from "@vueuse/core";
|
|
4
|
-
//#region src/components/SDropdown/utils/useDropdownPanelTransition.ts
|
|
5
|
-
var D = (e) => {
|
|
6
|
-
let t = _(e.value), n = _(e.value);
|
|
7
|
-
return w(e, (e) => {
|
|
8
|
-
if (e) {
|
|
9
|
-
t.value = !0, n.value = !0;
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
t.value = !1;
|
|
13
|
-
}, { flush: "sync" }), {
|
|
14
|
-
isPanelShown: t,
|
|
15
|
-
isPanelActive: n,
|
|
16
|
-
handlePanelAfterLeave: () => {
|
|
17
|
-
e.value || (n.value = !1);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}, O = (e) => {
|
|
21
|
-
if (!e) return null;
|
|
22
|
-
let t = e.getBoundingClientRect();
|
|
23
|
-
if (t.width > 0 || t.height > 0) return e;
|
|
24
|
-
let n = e.firstElementChild;
|
|
25
|
-
return n instanceof HTMLElement ? n : e;
|
|
26
|
-
}, ee = ["id"], te = ["data-placement"], k = { class: "s-ui-dropdown__content" }, A = /* @__PURE__ */ d({
|
|
27
|
-
inheritAttrs: !1,
|
|
28
|
-
__name: "SDropdown",
|
|
29
|
-
props: /*@__PURE__*/ f({
|
|
30
|
-
placement: { default: () => e.BOTTOM_START },
|
|
31
|
-
offset: { default: 8 },
|
|
32
|
-
flip: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: !0
|
|
35
|
-
},
|
|
36
|
-
shift: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: !1
|
|
39
|
-
},
|
|
40
|
-
matchReferenceWidth: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: !1
|
|
43
|
-
},
|
|
44
|
-
fitViewport: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: !1
|
|
47
|
-
},
|
|
48
|
-
surfaceClass: {},
|
|
49
|
-
teleportTo: {
|
|
50
|
-
type: [String, Boolean],
|
|
51
|
-
default: "body"
|
|
52
|
-
},
|
|
53
|
-
dismissOnClickOutside: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
default: !0
|
|
56
|
-
},
|
|
57
|
-
dismissOnEscape: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: !0
|
|
60
|
-
},
|
|
61
|
-
disabled: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
default: !1
|
|
64
|
-
},
|
|
65
|
-
reference: { default: null },
|
|
66
|
-
contentId: {},
|
|
67
|
-
viewportPadding: { default: 8 },
|
|
68
|
-
arrow: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: !1
|
|
71
|
-
},
|
|
72
|
-
showOnHover: {
|
|
73
|
-
type: Boolean,
|
|
74
|
-
default: !1
|
|
75
|
-
},
|
|
76
|
-
hoverLeaveDelay: { default: 100 }
|
|
77
|
-
}, {
|
|
78
|
-
modelValue: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: !1
|
|
81
|
-
},
|
|
82
|
-
modelModifiers: {}
|
|
83
|
-
}),
|
|
84
|
-
emits: ["update:modelValue"],
|
|
85
|
-
setup(e, { expose: d }) {
|
|
86
|
-
let f = x(e, "modelValue"), { isPanelShown: _, isPanelActive: A, handlePanelAfterLeave: j } = D(f), M = (e) => {
|
|
87
|
-
f.value = e;
|
|
88
|
-
}, N = S(), P = C("triggerWrapperRef"), F = C("panelRef"), I = b(), L = b(), R = a(() => e.contentId ?? I), z = a(() => N.trigger ? O(P.value) : e.reference), B = a(() => e.teleportTo !== !1), V = a(() => e.teleportTo === !1 ? "body" : e.teleportTo), H = () => {
|
|
89
|
-
e.disabled || (f.value = !f.value);
|
|
90
|
-
}, U = a(() => ({
|
|
91
|
-
id: L,
|
|
92
|
-
"aria-expanded": f.value,
|
|
93
|
-
"aria-haspopup": "dialog",
|
|
94
|
-
"aria-controls": R.value
|
|
95
|
-
})), { panelStyles: W, panelMaxHeight: G, resolvedPlacement: K, arrowStyles: q, isArrowOverflow: J, isPositionReady: Y, updatePosition: X } = t({
|
|
96
|
-
open: () => A.value,
|
|
97
|
-
onOpenChange: M,
|
|
98
|
-
reference: () => z.value,
|
|
99
|
-
panel: () => F.value,
|
|
100
|
-
placement: () => e.placement,
|
|
101
|
-
offset: () => e.offset,
|
|
102
|
-
flip: () => e.flip,
|
|
103
|
-
shift: () => e.shift,
|
|
104
|
-
matchReferenceWidth: () => e.matchReferenceWidth,
|
|
105
|
-
fitViewport: () => e.fitViewport,
|
|
106
|
-
dismissOnClickOutside: () => e.dismissOnClickOutside,
|
|
107
|
-
dismissOnEscape: () => e.dismissOnEscape,
|
|
108
|
-
viewportPadding: () => e.viewportPadding,
|
|
109
|
-
arrow: () => e.arrow
|
|
110
|
-
}), Z = a(() => e.showOnHover ? z.value : null), ne = a(() => e.showOnHover ? F.value : null), Q = E(Z, { delayLeave: e.hoverLeaveDelay }), $ = E(ne, { delayLeave: e.hoverLeaveDelay });
|
|
111
|
-
w([
|
|
112
|
-
Q,
|
|
113
|
-
$,
|
|
114
|
-
() => e.showOnHover,
|
|
115
|
-
() => e.disabled
|
|
116
|
-
], () => {
|
|
117
|
-
if (e.showOnHover) {
|
|
118
|
-
if (e.disabled) {
|
|
119
|
-
M(!1);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
M(Q.value || $.value);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
let re = a(() => !!G.value), ie = a(() => {
|
|
126
|
-
if (G.value) return { maxHeight: `${G.value}px` };
|
|
127
|
-
});
|
|
128
|
-
return w(() => e.disabled, (e) => {
|
|
129
|
-
e && f.value && (f.value = !1);
|
|
130
|
-
}), d({ updatePosition: X }), (t, a) => (g(), c(n, null, [y(N).trigger ? (g(), c("span", p({
|
|
131
|
-
key: 0,
|
|
132
|
-
ref_key: "triggerWrapperRef",
|
|
133
|
-
ref: P,
|
|
134
|
-
class: "s-ui-dropdown"
|
|
135
|
-
}, t.$attrs), [v(t.$slots, "trigger", {
|
|
136
|
-
open: f.value,
|
|
137
|
-
toggle: H,
|
|
138
|
-
triggerProps: U.value
|
|
139
|
-
})], 16)) : s("", !0), (g(), o(r, {
|
|
140
|
-
to: V.value,
|
|
141
|
-
disabled: !B.value
|
|
142
|
-
}, [u(i, {
|
|
143
|
-
name: "s-ui-dropdown",
|
|
144
|
-
onAfterLeave: y(j)
|
|
145
|
-
}, {
|
|
146
|
-
default: T(() => [y(_) ? (g(), c("div", {
|
|
147
|
-
key: 0,
|
|
148
|
-
id: R.value,
|
|
149
|
-
ref_key: "panelRef",
|
|
150
|
-
ref: F,
|
|
151
|
-
class: m(["s-ui-dropdown__panel", {
|
|
152
|
-
"s-ui-dropdown__panel--match-reference-width": e.matchReferenceWidth,
|
|
153
|
-
"s-ui-dropdown__panel--ready": y(Y)
|
|
154
|
-
}]),
|
|
155
|
-
style: h(y(W)),
|
|
156
|
-
role: "dialog"
|
|
157
|
-
}, [l("div", {
|
|
158
|
-
class: m(["s-ui-dropdown__surface", [e.surfaceClass, {
|
|
159
|
-
"s-ui-dropdown__surface--fit-viewport": re.value,
|
|
160
|
-
"s-ui-dropdown__surface--with-arrow": e.arrow
|
|
161
|
-
}]]),
|
|
162
|
-
style: h(ie.value),
|
|
163
|
-
"data-placement": y(K)
|
|
164
|
-
}, [e.arrow ? (g(), c("div", {
|
|
165
|
-
key: 0,
|
|
166
|
-
class: m(["s-ui-dropdown__arrow", { "s-ui-dropdown__arrow--overflow": y(J) }]),
|
|
167
|
-
style: h(y(q)),
|
|
168
|
-
"aria-hidden": "true"
|
|
169
|
-
}, [...a[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", k, [v(t.$slots, "content", { resolvedPlacement: y(K) })])], 14, te)], 14, ee)) : s("", !0)]),
|
|
170
|
-
_: 3
|
|
171
|
-
}, 8, ["onAfterLeave"])], 8, ["to", "disabled"]))], 64));
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
//#endregion
|
|
175
|
-
export { A as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./useFloatingOverlay-B1UCUYQQ.cjs");let t=require("vue"),n=require("@vueuse/core");var r=e=>{let n=(0,t.ref)(e.value),r=(0,t.ref)(e.value);return(0,t.watch)(e,e=>{if(e){n.value=!0,r.value=!0;return}n.value=!1},{flush:`sync`}),{isPanelShown:n,isPanelActive:r,handlePanelAfterLeave:()=>{e.value||(r.value=!1)}}},i=e=>{if(!e)return null;let t=e.getBoundingClientRect();if(t.width>0||t.height>0)return e;let n=e.firstElementChild;return n instanceof HTMLElement?n:e},a=[`id`],o=[`data-placement`],s={class:`s-ui-dropdown__content`},c=(0,t.defineComponent)({inheritAttrs:!1,__name:`SDropdown`,props:(0,t.mergeModels)({placement:{default:()=>e.i.BOTTOM_START},offset:{default:8},flip:{type:Boolean,default:!0},shift:{type:Boolean,default:!1},matchReferenceWidth:{type:Boolean,default:!1},fitViewport:{type:Boolean,default:!1},surfaceClass:{},teleportTo:{type:[String,Boolean],default:`body`},dismissOnClickOutside:{type:Boolean,default:!0},dismissOnEscape:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},reference:{default:null},contentId:{},viewportPadding:{default:8},arrow:{type:Boolean,default:!1},showOnHover:{type:Boolean,default:!1},hoverLeaveDelay:{default:100}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:[`update:modelValue`],setup(c,{expose:l}){let u=(0,t.useModel)(c,`modelValue`),{isPanelShown:d,isPanelActive:f,handlePanelAfterLeave:p}=r(u),m=e=>{u.value=e},h=(0,t.useSlots)(),g=(0,t.useTemplateRef)(`triggerWrapperRef`),_=(0,t.useTemplateRef)(`panelRef`),v=(0,t.useId)(),y=(0,t.useId)(),b=(0,t.computed)(()=>c.contentId??v),x=(0,t.computed)(()=>h.trigger?i(g.value):c.reference),S=(0,t.computed)(()=>c.teleportTo!==!1),C=(0,t.computed)(()=>c.teleportTo===!1?`body`:c.teleportTo),w=()=>{c.disabled||(u.value=!u.value)},T=(0,t.computed)(()=>({id:y,"aria-expanded":u.value,"aria-haspopup":`dialog`,"aria-controls":b.value})),{panelStyles:E,panelMaxHeight:D,resolvedPlacement:O,arrowStyles:k,isArrowOverflow:A,isPositionReady:j,updatePosition:M}=e.t({open:()=>f.value,onOpenChange:m,reference:()=>x.value,panel:()=>_.value,placement:()=>c.placement,offset:()=>c.offset,flip:()=>c.flip,shift:()=>c.shift,matchReferenceWidth:()=>c.matchReferenceWidth,fitViewport:()=>c.fitViewport,dismissOnClickOutside:()=>c.dismissOnClickOutside,dismissOnEscape:()=>c.dismissOnEscape,viewportPadding:()=>c.viewportPadding,arrow:()=>c.arrow}),N=(0,t.computed)(()=>c.showOnHover?x.value:null),P=(0,t.computed)(()=>c.showOnHover?_.value:null),F=(0,n.useElementHover)(N,{delayLeave:c.hoverLeaveDelay}),I=(0,n.useElementHover)(P,{delayLeave:c.hoverLeaveDelay});(0,t.watch)([F,I,()=>c.showOnHover,()=>c.disabled],()=>{if(c.showOnHover){if(c.disabled){m(!1);return}m(F.value||I.value)}});let L=(0,t.computed)(()=>!!D.value),R=(0,t.computed)(()=>{if(D.value)return{maxHeight:`${D.value}px`}});return(0,t.watch)(()=>c.disabled,e=>{e&&u.value&&(u.value=!1)}),l({updatePosition:M}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.unref)(h).trigger?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,(0,t.mergeProps)({key:0,ref_key:`triggerWrapperRef`,ref:g,class:`s-ui-dropdown`},e.$attrs),[(0,t.renderSlot)(e.$slots,`trigger`,{open:u.value,toggle:w,triggerProps:T.value})],16)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:C.value,disabled:!S.value},[(0,t.createVNode)(t.Transition,{name:`s-ui-dropdown`,onAfterLeave:(0,t.unref)(p)},{default:(0,t.withCtx)(()=>[(0,t.unref)(d)?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,id:b.value,ref_key:`panelRef`,ref:_,class:(0,t.normalizeClass)([`s-ui-dropdown__panel`,{"s-ui-dropdown__panel--match-reference-width":c.matchReferenceWidth,"s-ui-dropdown__panel--ready":(0,t.unref)(j)}]),style:(0,t.normalizeStyle)((0,t.unref)(E)),role:`dialog`},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`s-ui-dropdown__surface`,[c.surfaceClass,{"s-ui-dropdown__surface--fit-viewport":L.value,"s-ui-dropdown__surface--with-arrow":c.arrow}]]),style:(0,t.normalizeStyle)(R.value),"data-placement":(0,t.unref)(O)},[c.arrow?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([`s-ui-dropdown__arrow`,{"s-ui-dropdown__arrow--overflow":(0,t.unref)(A)}]),style:(0,t.normalizeStyle)((0,t.unref)(k)),"aria-hidden":`true`},[...n[0]||=[(0,t.createElementVNode)(`span`,{class:`s-ui-dropdown__arrow-outer`},null,-1),(0,t.createElementVNode)(`span`,{class:`s-ui-dropdown__arrow-inner`},null,-1)]],6)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,s,[(0,t.renderSlot)(e.$slots,`content`,{resolvedPlacement:(0,t.unref)(O)})])],14,o)],14,a)):(0,t.createCommentVNode)(``,!0)]),_:3},8,[`onAfterLeave`])],8,[`to`,`disabled`]))],64))}});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
package/dist/SInput-C-_R5pug.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./SButton.types-CpdHQtyx.js";
|
|
2
|
-
import { t as r } from "./SButton-DnU_XZ1C.js";
|
|
3
|
-
import { n as ee, t as i } from "./SInlineMessage-Dirk5RwO.js";
|
|
4
|
-
import { t as te } from "./SLabel-FHHPlcKq.js";
|
|
5
|
-
import { n as a, t as o } from "./useFieldMessages-Cb06My1W.js";
|
|
6
|
-
import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, mergeModels as g, mergeProps as _, normalizeClass as v, openBlock as y, renderList as b, renderSlot as x, toDisplayString as S, unref as C, useAttrs as w, useId as ne, useModel as re, useSlots as ie, useTemplateRef as T, vModelDynamic as ae, withCtx as oe, withDirectives as se, withModifiers as ce } from "vue";
|
|
7
|
-
import { SIcon as le, useUiKitI18n as ue } from "@shtabapp/ui-kit-primitives";
|
|
8
|
-
//#region src/components/SInput/SInput.types.ts
|
|
9
|
-
var E = /* @__PURE__ */ function(e) {
|
|
10
|
-
return e.NONE = "none", e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e;
|
|
11
|
-
}({}), de = ["inert", "aria-disabled"], D = {
|
|
12
|
-
key: 0,
|
|
13
|
-
class: "s-ui-input__prepend"
|
|
14
|
-
}, O = { class: "s-ui-input__row" }, k = {
|
|
15
|
-
key: 0,
|
|
16
|
-
class: "s-ui-input__prefix"
|
|
17
|
-
}, A = [
|
|
18
|
-
"id",
|
|
19
|
-
"type",
|
|
20
|
-
"name",
|
|
21
|
-
"placeholder",
|
|
22
|
-
"disabled",
|
|
23
|
-
"readonly",
|
|
24
|
-
"autocomplete"
|
|
25
|
-
], j = {
|
|
26
|
-
key: 0,
|
|
27
|
-
class: "s-ui-input__inline"
|
|
28
|
-
}, M = {
|
|
29
|
-
key: 1,
|
|
30
|
-
class: "s-ui-input__clear"
|
|
31
|
-
}, N = {
|
|
32
|
-
key: 2,
|
|
33
|
-
class: "s-ui-input__action"
|
|
34
|
-
}, P = {
|
|
35
|
-
key: 1,
|
|
36
|
-
class: "s-ui-input__messages"
|
|
37
|
-
}, F = 16, I = /* @__PURE__ */ h({
|
|
38
|
-
inheritAttrs: !1,
|
|
39
|
-
__name: "SInput",
|
|
40
|
-
props: /*@__PURE__*/ g({
|
|
41
|
-
label: {},
|
|
42
|
-
labelProps: {},
|
|
43
|
-
placeholder: {},
|
|
44
|
-
helpMessages: {},
|
|
45
|
-
errorMessages: {},
|
|
46
|
-
bordered: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: !0
|
|
49
|
-
},
|
|
50
|
-
disabled: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: !1
|
|
53
|
-
},
|
|
54
|
-
readonly: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: !1
|
|
57
|
-
},
|
|
58
|
-
clearable: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: !1
|
|
61
|
-
},
|
|
62
|
-
hasValue: { type: Boolean },
|
|
63
|
-
focused: {
|
|
64
|
-
type: Boolean,
|
|
65
|
-
default: !1
|
|
66
|
-
},
|
|
67
|
-
iconLeft: {},
|
|
68
|
-
iconRight: {},
|
|
69
|
-
customize: { default: () => E.NONE },
|
|
70
|
-
name: {},
|
|
71
|
-
type: { default: "text" },
|
|
72
|
-
id: {},
|
|
73
|
-
autocomplete: {}
|
|
74
|
-
}, {
|
|
75
|
-
modelValue: { default: "" },
|
|
76
|
-
modelModifiers: {}
|
|
77
|
-
}),
|
|
78
|
-
emits: /*@__PURE__*/ g([
|
|
79
|
-
"clear",
|
|
80
|
-
"focus",
|
|
81
|
-
"blur"
|
|
82
|
-
], ["update:modelValue"]),
|
|
83
|
-
setup(h, { expose: g, emit: I }) {
|
|
84
|
-
let L = re(h, "modelValue"), { t: R } = ue(), z = I, B = w(), V = ie(), H = ne(), U = T("fieldElementRef"), W = T("inputElementRef"), { isFocused: G, handleFocus: K, handleFocusOut: q } = a({
|
|
85
|
-
isDisabled: () => h.disabled,
|
|
86
|
-
blurField: () => $(),
|
|
87
|
-
emitFocus: (e) => z("focus", e),
|
|
88
|
-
emitBlur: (e) => z("blur", e)
|
|
89
|
-
}), { normalizedHelpMessages: fe, normalizedErrorMessages: pe, hasErrorMessages: J, hasHelpMessages: me } = o(() => h.helpMessages, () => h.errorMessages), Y = c(() => h.id ? h.id : H), he = c(() => !!(h.label || V.label)), ge = c(() => !!(h.iconLeft || V.prefix)), _e = c(() => h.customize === E.VERTICAL && !!V.prepend), ve = c(() => h.customize === E.HORIZONTAL && !!V.prepend), ye = c(() => !h.clearable || h.disabled || h.readonly ? !1 : X.value), be = c(() => {
|
|
90
|
-
if (!G.value) return -1;
|
|
91
|
-
}), xe = c(() => !!(h.iconRight || V.action)), Se = c(() => !!V.message || me.value || J.value), X = c(() => h.hasValue === void 0 ? L.value.length > 0 : h.hasValue), Z = c(() => ({
|
|
92
|
-
"s-ui-input--disabled": h.disabled,
|
|
93
|
-
"s-ui-input--readonly": h.readonly
|
|
94
|
-
})), Ce = c(() => [{
|
|
95
|
-
"s-ui-input__field--bordered": h.bordered,
|
|
96
|
-
"s-ui-input__field--borderless": !h.bordered,
|
|
97
|
-
"s-ui-input__field--disabled": h.disabled,
|
|
98
|
-
"s-ui-input__field--readonly": h.readonly,
|
|
99
|
-
"s-ui-input__field--error": J.value,
|
|
100
|
-
"s-ui-input__field--filled": X.value,
|
|
101
|
-
"s-ui-input__field--vertical": h.customize === E.VERTICAL,
|
|
102
|
-
"s-ui-input__field--focused": G.value || h.focused
|
|
103
|
-
}]), we = (e) => {
|
|
104
|
-
let t = U.value;
|
|
105
|
-
t && t.querySelector(".s-ui-input__control, .s-ui-select__control, .s-ui-select__search-input, [tabindex]:not([tabindex=\"-1\"])")?.focus(e);
|
|
106
|
-
}, Q = (e) => {
|
|
107
|
-
if (V.control) {
|
|
108
|
-
we(e);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
W.value?.focus(e);
|
|
112
|
-
}, $ = () => {
|
|
113
|
-
if (V.control) {
|
|
114
|
-
let e = document.activeElement;
|
|
115
|
-
e instanceof HTMLElement && U.value?.contains(e) && e.blur();
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
W.value?.blur();
|
|
119
|
-
}, Te = (e) => {
|
|
120
|
-
h.disabled || h.readonly || e.target instanceof HTMLElement && (e.target.closest(".s-ui-input__prepend, .s-ui-input__inline, .s-ui-input__clear, .s-ui-input__action") || Q());
|
|
121
|
-
}, Ee = () => {
|
|
122
|
-
L.value = "", z("clear"), Q();
|
|
123
|
-
};
|
|
124
|
-
return g({
|
|
125
|
-
blur: $,
|
|
126
|
-
focus: Q,
|
|
127
|
-
fieldElementRef: U,
|
|
128
|
-
inputElementRef: W
|
|
129
|
-
}), (a, o) => (y(), d("div", { class: v(["s-ui-input", Z.value]) }, [
|
|
130
|
-
he.value ? (y(), l(C(te), _({ key: 0 }, h.labelProps, { "html-for": Y.value }), {
|
|
131
|
-
default: oe(() => [x(a.$slots, "label", {}, () => [p(S(h.label), 1)])]),
|
|
132
|
-
_: 3
|
|
133
|
-
}, 16, ["html-for"])) : u("", !0),
|
|
134
|
-
f("div", {
|
|
135
|
-
ref_key: "fieldElementRef",
|
|
136
|
-
ref: U,
|
|
137
|
-
class: v(["s-ui-input__field", Ce.value]),
|
|
138
|
-
inert: h.disabled ? !0 : void 0,
|
|
139
|
-
"aria-disabled": h.disabled ? !0 : void 0,
|
|
140
|
-
onClick: o[2] ||= (e) => Te(e),
|
|
141
|
-
onFocusout: o[3] ||= (...e) => C(q) && C(q)(...e)
|
|
142
|
-
}, [_e.value ? (y(), d("div", D, [x(a.$slots, "prepend", { disabled: h.disabled })])) : u("", !0), f("div", O, [
|
|
143
|
-
ge.value ? (y(), d("span", k, [x(a.$slots, "prefix", { disabled: h.disabled }, () => [h.iconLeft ? (y(), l(C(le), {
|
|
144
|
-
key: 0,
|
|
145
|
-
name: h.iconLeft,
|
|
146
|
-
size: F
|
|
147
|
-
}, null, 8, ["name"])) : u("", !0)])])) : u("", !0),
|
|
148
|
-
f("div", { class: v(["s-ui-input__control-wrap", { "s-ui-input__control-wrap--horizontal": h.customize === C(E).HORIZONTAL }]) }, [x(a.$slots, "control", { disabled: h.disabled }, () => [se(f("input", _({
|
|
149
|
-
id: Y.value,
|
|
150
|
-
ref_key: "inputElementRef",
|
|
151
|
-
ref: W,
|
|
152
|
-
"onUpdate:modelValue": o[0] ||= (e) => L.value = e,
|
|
153
|
-
class: "s-ui-input__control s-ui-typography-body-14-regular",
|
|
154
|
-
type: h.type,
|
|
155
|
-
name: h.name,
|
|
156
|
-
placeholder: h.placeholder,
|
|
157
|
-
disabled: h.disabled,
|
|
158
|
-
readonly: h.readonly,
|
|
159
|
-
autocomplete: h.autocomplete
|
|
160
|
-
}, C(B), { onFocus: o[1] ||= (...e) => C(K) && C(K)(...e) }), null, 16, A), [[ae, L.value]])]), ve.value ? (y(), d("div", j, [x(a.$slots, "prepend", { disabled: h.disabled })])) : u("", !0)], 2),
|
|
161
|
-
ye.value ? (y(), d("span", M, [m(C(r), {
|
|
162
|
-
appearance: C(n).BARE,
|
|
163
|
-
variant: C(t).NEUTRAL,
|
|
164
|
-
size: C(e).SMALL,
|
|
165
|
-
icon: "closeMini",
|
|
166
|
-
"aria-label": C(R)("input.clear"),
|
|
167
|
-
tabindex: be.value,
|
|
168
|
-
onClick: ce(Ee, ["stop"])
|
|
169
|
-
}, null, 8, [
|
|
170
|
-
"appearance",
|
|
171
|
-
"variant",
|
|
172
|
-
"size",
|
|
173
|
-
"aria-label",
|
|
174
|
-
"tabindex"
|
|
175
|
-
])])) : u("", !0),
|
|
176
|
-
xe.value ? (y(), d("span", N, [x(a.$slots, "action", { disabled: h.disabled }, () => [h.iconRight ? (y(), l(C(r), {
|
|
177
|
-
key: 0,
|
|
178
|
-
appearance: C(n).BARE,
|
|
179
|
-
variant: C(t).NEUTRAL,
|
|
180
|
-
size: C(e).SMALL,
|
|
181
|
-
disabled: h.disabled,
|
|
182
|
-
icon: h.iconRight,
|
|
183
|
-
tabindex: -1
|
|
184
|
-
}, null, 8, [
|
|
185
|
-
"appearance",
|
|
186
|
-
"variant",
|
|
187
|
-
"size",
|
|
188
|
-
"disabled",
|
|
189
|
-
"icon"
|
|
190
|
-
])) : u("", !0)])])) : u("", !0)
|
|
191
|
-
])], 42, de),
|
|
192
|
-
Se.value ? (y(), d("div", P, [x(a.$slots, "message", {}, () => [(y(!0), d(s, null, b(C(fe), (e, t) => (y(), l(C(i), {
|
|
193
|
-
key: `help-${t}`,
|
|
194
|
-
message: e
|
|
195
|
-
}, null, 8, ["message"]))), 128)), (y(!0), d(s, null, b(C(pe), (e, t) => (y(), l(C(i), {
|
|
196
|
-
key: `error-${t}`,
|
|
197
|
-
message: e,
|
|
198
|
-
"validation-status": C(ee).ERROR
|
|
199
|
-
}, null, 8, ["message", "validation-status"]))), 128))])])) : u("", !0)
|
|
200
|
-
], 2));
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
//#endregion
|
|
204
|
-
export { E as n, I as t };
|
package/dist/SInput-Cw8pt9Sr.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs"),n=require("./SInlineMessage-gjkMiE-W.cjs"),r=require("./SLabel-DLKfepRW.cjs"),i=require("./useFieldMessages-CzjU0ajM.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=[`inert`,`aria-disabled`],l={key:0,class:`s-ui-input__prepend`},u={class:`s-ui-input__row`},d={key:0,class:`s-ui-input__prefix`},f=[`id`,`type`,`name`,`placeholder`,`disabled`,`readonly`,`autocomplete`],p={key:0,class:`s-ui-input__inline`},m={key:1,class:`s-ui-input__clear`},h={key:2,class:`s-ui-input__action`},g={key:1,class:`s-ui-input__messages`},_=16,v=(0,a.defineComponent)({inheritAttrs:!1,__name:`SInput`,props:(0,a.mergeModels)({label:{},labelProps:{},placeholder:{},helpMessages:{},errorMessages:{},bordered:{type:Boolean,default:!0},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:{}},{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,w=(0,a.useAttrs)(),T=(0,a.useSlots)(),E=(0,a.useId)(),D=(0,a.useTemplateRef)(`fieldElementRef`),O=(0,a.useTemplateRef)(`inputElementRef`),{isFocused:k,handleFocus:A,handleFocusOut:j}=i.n({isDisabled:()=>v.disabled,blurField:()=>X(),emitFocus:e=>C(`focus`,e),emitBlur:e=>C(`blur`,e)}),{normalizedHelpMessages:M,normalizedErrorMessages:N,hasErrorMessages:P,hasHelpMessages:F}=i.t(()=>v.helpMessages,()=>v.errorMessages),I=(0,a.computed)(()=>v.id?v.id:E),L=(0,a.computed)(()=>!!(v.label||T.label)),R=(0,a.computed)(()=>!!(v.iconLeft||T.prefix)),z=(0,a.computed)(()=>v.customize===s.VERTICAL&&!!T.prepend),B=(0,a.computed)(()=>v.customize===s.HORIZONTAL&&!!T.prepend),V=(0,a.computed)(()=>!v.clearable||v.disabled||v.readonly?!1:G.value),H=(0,a.computed)(()=>{if(!k.value)return-1}),U=(0,a.computed)(()=>!!(v.iconRight||T.action)),W=(0,a.computed)(()=>!!T.message||F.value||P.value),G=(0,a.computed)(()=>v.hasValue===void 0?x.value.length>0:v.hasValue),K=(0,a.computed)(()=>({"s-ui-input--disabled":v.disabled,"s-ui-input--readonly":v.readonly})),q=(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":P.value,"s-ui-input__field--filled":G.value,"s-ui-input__field--vertical":v.customize===s.VERTICAL,"s-ui-input__field--focused":k.value||v.focused}]),J=e=>{let t=D.value;t&&t.querySelector(`.s-ui-input__control, .s-ui-select__control, .s-ui-select__search-input, [tabindex]:not([tabindex="-1"])`)?.focus(e)},Y=e=>{if(T.control){J(e);return}O.value?.focus(e)},X=()=>{if(T.control){let e=document.activeElement;e instanceof HTMLElement&&D.value?.contains(e)&&e.blur();return}O.value?.blur()},Z=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`)||Y())},Q=()=>{x.value=``,C(`clear`),Y()};return y({blur:X,focus:Y,fieldElementRef:D,inputElementRef:O}),(i,y)=>((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{class:(0,a.normalizeClass)([`s-ui-input`,K.value])},[L.value?((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(r.t),(0,a.mergeProps)({key:0},v.labelProps,{"html-for":I.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:D,class:(0,a.normalizeClass)([`s-ui-input__field`,q.value]),inert:v.disabled?!0:void 0,"aria-disabled":v.disabled?!0:void 0,onClick:y[2]||=e=>Z(e),onFocusout:y[3]||=(...e)=>(0,a.unref)(j)&&(0,a.unref)(j)(...e)},[z.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,l,[(0,a.renderSlot)(i.$slots,`prepend`,{disabled:v.disabled})])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`div`,u,[R.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,d,[(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:I.value,ref_key:`inputElementRef`,ref:O,"onUpdate:modelValue":y[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)(w),{onFocus:y[1]||=(...e)=>(0,a.unref)(A)&&(0,a.unref)(A)(...e)}),null,16,f),[[a.vModelDynamic,x.value]])]),B.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,p,[(0,a.renderSlot)(i.$slots,`prepend`,{disabled:v.disabled})])):(0,a.createCommentVNode)(``,!0)],2),V.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,m,[(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:H.value,onClick:(0,a.withModifiers)(Q,[`stop`])},null,8,[`appearance`,`variant`,`size`,`aria-label`,`tabindex`])])):(0,a.createCommentVNode)(``,!0),U.value?((0,a.openBlock)(),(0,a.createElementBlock)(`span`,h,[(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,c),W.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,g,[(0,a.renderSlot)(i.$slots,`message`,{},()=>[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)((0,a.unref)(M),(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)(N),(e,t)=>((0,a.openBlock)(),(0,a.createBlock)((0,a.unref)(n.t),{key:`error-${t}`,message:e,"validation-status":(0,a.unref)(n.n).ERROR},null,8,[`message`,`validation-status`]))),128))])])):(0,a.createCommentVNode)(``,!0)],2))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
|