@shtabapp/ui-kit 1.32.0 → 1.33.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/SAvatar-C2gekygl.cjs +1 -0
  3. package/dist/SAvatar-DAfDAqrP.js +265 -0
  4. package/dist/{SAvatarGroup-CMa9KhUZ.cjs → SAvatarGroup-76j-sHCe.cjs} +1 -1
  5. package/dist/{SAvatarGroup-wkXHy_tK.js → SAvatarGroup-HvIlI5y0.js} +1 -1
  6. package/dist/{SSelect-iBb45tet.js → SSelect-CZe3djdm.js} +6 -1
  7. package/dist/{SSelect-CgL7ECfS.cjs → SSelect-DAPSmCWf.cjs} +1 -1
  8. package/dist/STag-BwzuI3cF.cjs +1 -0
  9. package/dist/STag-L6B4DxOx.js +122 -0
  10. package/dist/{STagGroup-BMyuxfVX.cjs → STagGroup-BMGq6jB5.cjs} +1 -1
  11. package/dist/{STagGroup-B2-_OG3R.js → STagGroup-DWsu0ket.js} +1 -1
  12. package/dist/components/SAvatar/SAvatar.vue.d.ts.map +1 -1
  13. package/dist/components/SAvatar/utils/getAvatarInitialsTextColor.d.ts +4 -0
  14. package/dist/components/SAvatar/utils/getAvatarInitialsTextColor.d.ts.map +1 -0
  15. package/dist/components/SAvatar/utils/resolveAvatarColor.d.ts +1 -3
  16. package/dist/components/SAvatar/utils/resolveAvatarColor.d.ts.map +1 -1
  17. package/dist/components/SSelect/SSelect.types.d.ts +5 -0
  18. package/dist/components/SSelect/SSelect.types.d.ts.map +1 -1
  19. package/dist/components/SSelect/SSelect.vue.d.ts.map +1 -1
  20. package/dist/components/STag/utils/resolveTagColor.d.ts +1 -3
  21. package/dist/components/STag/utils/resolveTagColor.d.ts.map +1 -1
  22. package/dist/contrastSurfaceTextColor-Dl641cZ_.js +33 -0
  23. package/dist/contrastSurfaceTextColor-Ybh-FZof.cjs +1 -0
  24. package/dist/entries/avatar-group.cjs +1 -1
  25. package/dist/entries/avatar-group.js +1 -1
  26. package/dist/entries/avatar.cjs +1 -1
  27. package/dist/entries/avatar.js +1 -1
  28. package/dist/entries/select.cjs +1 -1
  29. package/dist/entries/select.js +1 -1
  30. package/dist/entries/tag-group.cjs +1 -1
  31. package/dist/entries/tag-group.js +2 -2
  32. package/dist/entries/tag.cjs +1 -1
  33. package/dist/entries/tag.js +1 -1
  34. package/dist/index.cjs +1 -1
  35. package/dist/index.js +5 -5
  36. package/dist/uikit-components.css +1 -1
  37. package/dist/utils/color/contrastSurfaceTextColor.d.ts +4 -0
  38. package/dist/utils/color/contrastSurfaceTextColor.d.ts.map +1 -0
  39. package/dist/utils/color/index.d.ts +2 -0
  40. package/dist/utils/color/index.d.ts.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/SAvatar-BS9Lu2eL.js +0 -249
  43. package/dist/SAvatar-BXABKIV0.cjs +0 -1
  44. package/dist/STag-CYoj7L-p.js +0 -118
  45. package/dist/STag-DVrSWByQ.cjs +0 -1
@@ -0,0 +1,4 @@
1
+ export type THexColor = `#${string}`;
2
+ export declare const isHexColor: (value: string) => value is THexColor;
3
+ export declare const getContrastingSurfaceTextColor: (backgroundHex: THexColor) => "var(--s-ui-color-text-surface-primary)" | "var(--s-ui-color-text-surface-static)";
4
+ //# sourceMappingURL=contrastSurfaceTextColor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrastSurfaceTextColor.d.ts","sourceRoot":"","sources":["../../../src/utils/color/contrastSurfaceTextColor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,IAAI,MAAM,EAAE,CAAA;AAapC,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,KAAK,IAAI,SAEnD,CAAA;AAqED,eAAO,MAAM,8BAA8B,GAAI,eAAe,SAAS,uFAiBtE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { getContrastingSurfaceTextColor, isHexColor, type THexColor, } from './contrastSurfaceTextColor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/color/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,UAAU,EACV,KAAK,SAAS,GACf,MAAM,4BAA4B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shtabapp/ui-kit",
3
- "version": "1.32.0",
3
+ "version": "1.33.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,249 +0,0 @@
1
- import { i as e, n as t, r as n, t as r } from "./SBadge-BDxQJh6c.js";
2
- import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, mergeProps as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, toValue as v, unref as y, useAttrs as b, watch as x } from "vue";
3
- import { ESIconName as S, SIcon as C } from "@shtabapp/ui-kit-primitives";
4
- //#region src/components/SAvatar/SAvatar.types.ts
5
- var w = /* @__PURE__ */ function(e) {
6
- return e.SIZE_80 = "80", e.SIZE_72 = "72", e.SIZE_64 = "64", e.SIZE_56 = "56", e.SIZE_48 = "48", e.SIZE_40 = "40", e.SIZE_32 = "32", e.SIZE_24 = "24", e.SIZE_20 = "20", e.SIZE_16 = "16", e;
7
- }({}), T = /* @__PURE__ */ function(e) {
8
- return e.CIRCLE = "circle", e.SQUARE = "square", e;
9
- }({}), E = /* @__PURE__ */ function(e) {
10
- return e.TEAL = "teal", e.CYAN = "cyan", e.INDIGO = "indigo", e.VIOLET = "violet", e.PINK = "pink", e.SURFACE = "surface", e;
11
- }({}), D = /* @__PURE__ */ function(e) {
12
- return e.NEUTRAL = "neutral", e.MAIN = "main", e;
13
- }({}), O = /* @__PURE__ */ function(e) {
14
- return e.DEFAULT = "default", e.ONLINE = "online", e.OFFLINE = "offline", e.RECENTLY = "recently", e.ERROR = "error", e.TRACK = "track", e.DONE = "done", e.CONTROLLER = "controller", e.FAVORITE = "favorite", e.PIN = "pin", e.PRIVATE = "private", e;
15
- }({}), k = /* @__PURE__ */ function(e) {
16
- return e.SMALL = "s", e.MEDIUM = "m", e.LARGE = "l", e;
17
- }({}), A = {
18
- [w.SIZE_80]: "s-ui-typography-heading-h3-semibold",
19
- [w.SIZE_72]: "s-ui-typography-heading-h4-semibold",
20
- [w.SIZE_64]: "s-ui-typography-heading-h4-semibold",
21
- [w.SIZE_56]: "s-ui-typography-label-16-medium",
22
- [w.SIZE_48]: "s-ui-typography-label-16-medium",
23
- [w.SIZE_40]: "s-ui-typography-label-16-medium",
24
- [w.SIZE_32]: "s-ui-typography-label-14-medium",
25
- [w.SIZE_24]: "s-ui-typography-label-12-medium",
26
- [w.SIZE_20]: "s-ui-typography-label-12-medium",
27
- [w.SIZE_16]: "s-ui-typography-label-10-medium"
28
- }, j = {
29
- [w.SIZE_80]: 40,
30
- [w.SIZE_72]: 40,
31
- [w.SIZE_64]: 40,
32
- [w.SIZE_56]: 32,
33
- [w.SIZE_48]: 32,
34
- [w.SIZE_40]: 24,
35
- [w.SIZE_32]: 24,
36
- [w.SIZE_24]: 20,
37
- [w.SIZE_20]: 16,
38
- [w.SIZE_16]: 16
39
- }, M = {
40
- [w.SIZE_80]: k.LARGE,
41
- [w.SIZE_72]: k.LARGE,
42
- [w.SIZE_64]: k.MEDIUM,
43
- [w.SIZE_56]: k.MEDIUM,
44
- [w.SIZE_48]: k.SMALL,
45
- [w.SIZE_40]: k.SMALL,
46
- [w.SIZE_32]: k.SMALL,
47
- [w.SIZE_24]: k.SMALL,
48
- [w.SIZE_20]: k.SMALL,
49
- [w.SIZE_16]: k.SMALL
50
- }, N = {
51
- [k.SMALL]: e.SMALL,
52
- [k.MEDIUM]: e.MEDIUM,
53
- [k.LARGE]: e.LARGE
54
- }, P = {
55
- [e.SMALL]: 8,
56
- [e.MEDIUM]: 10,
57
- [e.LARGE]: 12
58
- }, F = {
59
- [e.SMALL]: 12,
60
- [e.MEDIUM]: 16,
61
- [e.LARGE]: 20
62
- }, I = 16, L = {
63
- [w.SIZE_80]: 0,
64
- [w.SIZE_72]: 0,
65
- [w.SIZE_64]: 0,
66
- [w.SIZE_56]: 0,
67
- [w.SIZE_48]: 0,
68
- [w.SIZE_40]: 0,
69
- [w.SIZE_32]: -2,
70
- [w.SIZE_24]: -2,
71
- [w.SIZE_20]: -4,
72
- [w.SIZE_16]: -4
73
- }, R = {
74
- [w.SIZE_80]: -8,
75
- [w.SIZE_72]: -8,
76
- [w.SIZE_64]: -8,
77
- [w.SIZE_56]: -8,
78
- [w.SIZE_48]: -8,
79
- [w.SIZE_40]: -8,
80
- [w.SIZE_32]: -8,
81
- [w.SIZE_24]: -8,
82
- [w.SIZE_20]: -10,
83
- [w.SIZE_16]: -10
84
- }, z = {
85
- [O.DEFAULT]: t.MAIN,
86
- [O.ONLINE]: t.SUCCESS,
87
- [O.OFFLINE]: t.WHITE,
88
- [O.RECENTLY]: t.WARNING,
89
- [O.ERROR]: t.DANGER,
90
- [O.TRACK]: t.MAIN,
91
- [O.DONE]: t.SUCCESS,
92
- [O.CONTROLLER]: t.MAIN,
93
- [O.FAVORITE]: t.WARNING,
94
- [O.PIN]: t.MAIN,
95
- [O.PRIVATE]: t.BILLING
96
- }, B = {
97
- [O.TRACK]: S.playFill,
98
- [O.DONE]: S.checkBold,
99
- [O.CONTROLLER]: S.controlFill,
100
- [O.FAVORITE]: S.starFill,
101
- [O.PIN]: S.pinFill,
102
- [O.PRIVATE]: S.tabooBold
103
- }, V = ({ avatarSize: e, badgeSize: t, hasIcon: n }) => {
104
- let r = L[e];
105
- return n ? r : r + (F[t] - P[t]) / 2;
106
- }, H = (e, t) => ({
107
- offsetX: -e - t / 2,
108
- offsetY: -e - t / 2
109
- }), U = (e, t) => ({
110
- offsetX: -e - t / 2,
111
- offsetY: e + t / 2
112
- }), W = ({ badge: r, counter: i, size: o }) => {
113
- let s = a(() => {
114
- let e = v(r);
115
- if (!e) return;
116
- let t = v(o), i = B[e], a = N[M[t]], s = i ? F[a] : P[a], c = H(V({
117
- avatarSize: t,
118
- badgeSize: a,
119
- hasIcon: !!i
120
- }), s);
121
- return {
122
- anchored: !0,
123
- color: z[e],
124
- icon: i,
125
- label: e,
126
- offsetX: c.offsetX,
127
- offsetY: c.offsetY,
128
- placement: n.BOTTOM_END,
129
- size: a
130
- };
131
- }), c = a(() => {
132
- let r = v(i);
133
- if (typeof r != "number") return;
134
- let a = R[v(o)], s = U(a, I);
135
- return {
136
- anchored: !0,
137
- color: t.MAIN,
138
- offsetX: s.offsetX,
139
- offsetY: s.offsetY,
140
- placement: n.TOP_END,
141
- size: e.MEDIUM,
142
- value: r
143
- };
144
- });
145
- return { avatarBadgeItemsProps: a(() => {
146
- let e = [];
147
- return c.value && e.push(c.value), s.value && e.push(s.value), e;
148
- }) };
149
- }, G = (e) => e.startsWith("#"), K = (e) => G(e) ? "s-ui-avatar--color-custom" : `s-ui-avatar--color-${e}`, q = (e) => ({ "--s-ui-avatar-background": e }), J = ["aria-disabled"], Y = { class: "s-ui-avatar__content" }, X = ["src", "alt"], Z = {
150
- key: 1,
151
- class: "s-ui-avatar__icon"
152
- }, Q = ["role", "aria-label"], $ = {
153
- key: 0,
154
- class: "s-ui-avatar__name"
155
- }, ee = /* @__PURE__ */ d({
156
- inheritAttrs: !1,
157
- __name: "SAvatar",
158
- props: {
159
- alt: {},
160
- badge: {},
161
- bordered: {
162
- type: Boolean,
163
- default: !0
164
- },
165
- color: { default: () => E.TEAL },
166
- counter: {},
167
- disabled: {
168
- type: Boolean,
169
- default: !1
170
- },
171
- icon: {},
172
- iconBackground: { default: () => D.NEUTRAL },
173
- initialLength: { default: 1 },
174
- name: {},
175
- shape: { default: () => T.CIRCLE },
176
- showName: {
177
- type: Boolean,
178
- default: !0
179
- },
180
- size: { default: () => w.SIZE_40 },
181
- src: {}
182
- },
183
- setup(e) {
184
- let t = b(), n = h(!1), d = (e) => typeof e == "number" || typeof e == "string", v = a(() => {
185
- if (d(t.tabindex)) return t.tabindex;
186
- if (d(t.tabIndex)) return t.tabIndex;
187
- }), S = a(() => d(t.tabindex) || d(t.tabIndex)), w = a(() => e.disabled ? -1 : S.value ? v.value : 0), T = a(() => ({
188
- ...t,
189
- tabindex: w.value
190
- })), E = a(() => [
191
- `s-ui-avatar--size-${e.size}`,
192
- `s-ui-avatar--shape-${e.shape}`,
193
- K(e.color),
194
- `s-ui-avatar--icon-background-${e.iconBackground}`,
195
- {
196
- "s-ui-avatar--bordered": e.bordered,
197
- "s-ui-avatar--disabled": e.disabled,
198
- "s-ui-avatar--icon": k.value,
199
- "s-ui-avatar--photo": O.value
200
- }
201
- ]), D = a(() => {
202
- if (!k.value && G(e.color)) return q(e.color);
203
- }), O = a(() => !!(e.src && !n.value)), k = a(() => !!(!O.value && e.icon)), M = (e) => {
204
- let t = e.split(/\s+/).filter(Boolean);
205
- if (t.length === 1) {
206
- let e = t[0];
207
- if (e) return e;
208
- }
209
- return t.map((e) => e.slice(0, 1)).join("");
210
- }, N = a(() => e.name ? M(e.name) : ""), P = a(() => e.alt ? e.alt : e.name ? e.name : N.value), F = a(() => {
211
- if (e.alt) return e.alt;
212
- if (e.name) return e.name;
213
- }), I = a(() => N.value.slice(0, Math.max(e.initialLength, 0))), L = a(() => A[e.size]), R = a(() => j[e.size]), { avatarBadgeItemsProps: z } = W({
214
- badge: () => e.badge,
215
- counter: () => e.counter,
216
- size: () => e.size
217
- }), B = () => {
218
- n.value = !0;
219
- };
220
- return x(() => e.src, () => {
221
- n.value = !1;
222
- }), (t, a) => (m(), c("span", f(T.value, {
223
- class: ["s-ui-avatar", E.value],
224
- style: D.value,
225
- "aria-disabled": e.disabled || void 0
226
- }), [l("span", Y, [e.src && !n.value ? (m(), c("img", {
227
- key: 0,
228
- class: "s-ui-avatar__image",
229
- src: e.src,
230
- alt: P.value,
231
- onError: B
232
- }, null, 40, X)) : e.icon ? (m(), c("span", Z, [u(y(C), {
233
- name: e.icon,
234
- size: R.value,
235
- "aria-label": F.value
236
- }, null, 8, [
237
- "name",
238
- "size",
239
- "aria-label"
240
- ])])) : (m(), c("span", {
241
- key: 2,
242
- class: p(["s-ui-avatar__initials", L.value]),
243
- role: e.alt ? "img" : void 0,
244
- "aria-label": e.alt
245
- }, _(I.value), 11, Q)), (m(!0), c(i, null, g(y(z), (e) => (m(), o(y(r), f({ key: e.placement }, { ref_for: !0 }, e), null, 16))), 128))]), e.showName && e.name ? (m(), c("span", $, _(e.name), 1)) : s("", !0)], 16, J));
246
- }
247
- });
248
- //#endregion
249
- export { T as a, D as i, O as n, w as o, E as r, ee as t };
@@ -1 +0,0 @@
1
- const e=require("./SBadge-d1GOPFP-.cjs");let t=require("vue"),n=require("@shtabapp/ui-kit-primitives");var r=function(e){return e.SIZE_80=`80`,e.SIZE_72=`72`,e.SIZE_64=`64`,e.SIZE_56=`56`,e.SIZE_48=`48`,e.SIZE_40=`40`,e.SIZE_32=`32`,e.SIZE_24=`24`,e.SIZE_20=`20`,e.SIZE_16=`16`,e}({}),i=function(e){return e.CIRCLE=`circle`,e.SQUARE=`square`,e}({}),a=function(e){return e.TEAL=`teal`,e.CYAN=`cyan`,e.INDIGO=`indigo`,e.VIOLET=`violet`,e.PINK=`pink`,e.SURFACE=`surface`,e}({}),o=function(e){return e.NEUTRAL=`neutral`,e.MAIN=`main`,e}({}),s=function(e){return e.DEFAULT=`default`,e.ONLINE=`online`,e.OFFLINE=`offline`,e.RECENTLY=`recently`,e.ERROR=`error`,e.TRACK=`track`,e.DONE=`done`,e.CONTROLLER=`controller`,e.FAVORITE=`favorite`,e.PIN=`pin`,e.PRIVATE=`private`,e}({}),c=function(e){return e.SMALL=`s`,e.MEDIUM=`m`,e.LARGE=`l`,e}({}),l={[r.SIZE_80]:`s-ui-typography-heading-h3-semibold`,[r.SIZE_72]:`s-ui-typography-heading-h4-semibold`,[r.SIZE_64]:`s-ui-typography-heading-h4-semibold`,[r.SIZE_56]:`s-ui-typography-label-16-medium`,[r.SIZE_48]:`s-ui-typography-label-16-medium`,[r.SIZE_40]:`s-ui-typography-label-16-medium`,[r.SIZE_32]:`s-ui-typography-label-14-medium`,[r.SIZE_24]:`s-ui-typography-label-12-medium`,[r.SIZE_20]:`s-ui-typography-label-12-medium`,[r.SIZE_16]:`s-ui-typography-label-10-medium`},u={[r.SIZE_80]:40,[r.SIZE_72]:40,[r.SIZE_64]:40,[r.SIZE_56]:32,[r.SIZE_48]:32,[r.SIZE_40]:24,[r.SIZE_32]:24,[r.SIZE_24]:20,[r.SIZE_20]:16,[r.SIZE_16]:16},d={[r.SIZE_80]:c.LARGE,[r.SIZE_72]:c.LARGE,[r.SIZE_64]:c.MEDIUM,[r.SIZE_56]:c.MEDIUM,[r.SIZE_48]:c.SMALL,[r.SIZE_40]:c.SMALL,[r.SIZE_32]:c.SMALL,[r.SIZE_24]:c.SMALL,[r.SIZE_20]:c.SMALL,[r.SIZE_16]:c.SMALL},f={[c.SMALL]:e.i.SMALL,[c.MEDIUM]:e.i.MEDIUM,[c.LARGE]:e.i.LARGE},p={[e.i.SMALL]:8,[e.i.MEDIUM]:10,[e.i.LARGE]:12},m={[e.i.SMALL]:12,[e.i.MEDIUM]:16,[e.i.LARGE]:20},h=16,g={[r.SIZE_80]:0,[r.SIZE_72]:0,[r.SIZE_64]:0,[r.SIZE_56]:0,[r.SIZE_48]:0,[r.SIZE_40]:0,[r.SIZE_32]:-2,[r.SIZE_24]:-2,[r.SIZE_20]:-4,[r.SIZE_16]:-4},_={[r.SIZE_80]:-8,[r.SIZE_72]:-8,[r.SIZE_64]:-8,[r.SIZE_56]:-8,[r.SIZE_48]:-8,[r.SIZE_40]:-8,[r.SIZE_32]:-8,[r.SIZE_24]:-8,[r.SIZE_20]:-10,[r.SIZE_16]:-10},v={[s.DEFAULT]:e.n.MAIN,[s.ONLINE]:e.n.SUCCESS,[s.OFFLINE]:e.n.WHITE,[s.RECENTLY]:e.n.WARNING,[s.ERROR]:e.n.DANGER,[s.TRACK]:e.n.MAIN,[s.DONE]:e.n.SUCCESS,[s.CONTROLLER]:e.n.MAIN,[s.FAVORITE]:e.n.WARNING,[s.PIN]:e.n.MAIN,[s.PRIVATE]:e.n.BILLING},y={[s.TRACK]:n.ESIconName.playFill,[s.DONE]:n.ESIconName.checkBold,[s.CONTROLLER]:n.ESIconName.controlFill,[s.FAVORITE]:n.ESIconName.starFill,[s.PIN]:n.ESIconName.pinFill,[s.PRIVATE]:n.ESIconName.tabooBold},b=({avatarSize:e,badgeSize:t,hasIcon:n})=>{let r=g[e];return n?r:r+(m[t]-p[t])/2},x=(e,t)=>({offsetX:-e-t/2,offsetY:-e-t/2}),S=(e,t)=>({offsetX:-e-t/2,offsetY:e+t/2}),C=({badge:n,counter:r,size:i})=>{let a=(0,t.computed)(()=>{let r=(0,t.toValue)(n);if(!r)return;let a=(0,t.toValue)(i),o=y[r],s=f[d[a]],c=o?m[s]:p[s],l=x(b({avatarSize:a,badgeSize:s,hasIcon:!!o}),c);return{anchored:!0,color:v[r],icon:o,label:r,offsetX:l.offsetX,offsetY:l.offsetY,placement:e.r.BOTTOM_END,size:s}}),o=(0,t.computed)(()=>{let n=(0,t.toValue)(r);if(typeof n!=`number`)return;let a=_[(0,t.toValue)(i)],o=S(a,h);return{anchored:!0,color:e.n.MAIN,offsetX:o.offsetX,offsetY:o.offsetY,placement:e.r.TOP_END,size:e.i.MEDIUM,value:n}});return{avatarBadgeItemsProps:(0,t.computed)(()=>{let e=[];return o.value&&e.push(o.value),a.value&&e.push(a.value),e})}},w=e=>e.startsWith(`#`),T=e=>w(e)?`s-ui-avatar--color-custom`:`s-ui-avatar--color-${e}`,E=e=>({"--s-ui-avatar-background":e}),D=[`aria-disabled`],O={class:`s-ui-avatar__content`},k=[`src`,`alt`],A={key:1,class:`s-ui-avatar__icon`},j=[`role`,`aria-label`],M={key:0,class:`s-ui-avatar__name`},N=(0,t.defineComponent)({inheritAttrs:!1,__name:`SAvatar`,props:{alt:{},badge:{},bordered:{type:Boolean,default:!0},color:{default:()=>a.TEAL},counter:{},disabled:{type:Boolean,default:!1},icon:{},iconBackground:{default:()=>o.NEUTRAL},initialLength:{default:1},name:{},shape:{default:()=>i.CIRCLE},showName:{type:Boolean,default:!0},size:{default:()=>r.SIZE_40},src:{}},setup(r){let i=(0,t.useAttrs)(),a=(0,t.ref)(!1),o=e=>typeof e==`number`||typeof e==`string`,s=(0,t.computed)(()=>{if(o(i.tabindex))return i.tabindex;if(o(i.tabIndex))return i.tabIndex}),c=(0,t.computed)(()=>o(i.tabindex)||o(i.tabIndex)),d=(0,t.computed)(()=>r.disabled?-1:c.value?s.value:0),f=(0,t.computed)(()=>({...i,tabindex:d.value})),p=(0,t.computed)(()=>[`s-ui-avatar--size-${r.size}`,`s-ui-avatar--shape-${r.shape}`,T(r.color),`s-ui-avatar--icon-background-${r.iconBackground}`,{"s-ui-avatar--bordered":r.bordered,"s-ui-avatar--disabled":r.disabled,"s-ui-avatar--icon":g.value,"s-ui-avatar--photo":h.value}]),m=(0,t.computed)(()=>{if(!g.value&&w(r.color))return E(r.color)}),h=(0,t.computed)(()=>!!(r.src&&!a.value)),g=(0,t.computed)(()=>!!(!h.value&&r.icon)),_=e=>{let t=e.split(/\s+/).filter(Boolean);if(t.length===1){let e=t[0];if(e)return e}return t.map(e=>e.slice(0,1)).join(``)},v=(0,t.computed)(()=>r.name?_(r.name):``),y=(0,t.computed)(()=>r.alt?r.alt:r.name?r.name:v.value),b=(0,t.computed)(()=>{if(r.alt)return r.alt;if(r.name)return r.name}),x=(0,t.computed)(()=>v.value.slice(0,Math.max(r.initialLength,0))),S=(0,t.computed)(()=>l[r.size]),N=(0,t.computed)(()=>u[r.size]),{avatarBadgeItemsProps:P}=C({badge:()=>r.badge,counter:()=>r.counter,size:()=>r.size}),F=()=>{a.value=!0};return(0,t.watch)(()=>r.src,()=>{a.value=!1}),(i,o)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,(0,t.mergeProps)(f.value,{class:[`s-ui-avatar`,p.value],style:m.value,"aria-disabled":r.disabled||void 0}),[(0,t.createElementVNode)(`span`,O,[r.src&&!a.value?((0,t.openBlock)(),(0,t.createElementBlock)(`img`,{key:0,class:`s-ui-avatar__image`,src:r.src,alt:y.value,onError:F},null,40,k)):r.icon?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,A,[(0,t.createVNode)((0,t.unref)(n.SIcon),{name:r.icon,size:N.value,"aria-label":b.value},null,8,[`name`,`size`,`aria-label`])])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:2,class:(0,t.normalizeClass)([`s-ui-avatar__initials`,S.value]),role:r.alt?`img`:void 0,"aria-label":r.alt},(0,t.toDisplayString)(x.value),11,j)),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)((0,t.unref)(P),n=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(e.t),(0,t.mergeProps)({key:n.placement},{ref_for:!0},n),null,16))),128))]),r.showName&&r.name?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,M,(0,t.toDisplayString)(r.name),1)):(0,t.createCommentVNode)(``,!0)],16,D))}});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return N}});
@@ -1,118 +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 i, r as a, t as o } from "./useLink-Com5VhOk.js";
4
- import { computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createVNode as f, defineComponent as p, mergeModels as m, mergeProps as h, openBlock as g, resolveDynamicComponent as _, toDisplayString as v, unref as y, useAttrs as b, useModel as x, withCtx as S, withModifiers as C } from "vue";
5
- //#region src/components/STag/STag.types.ts
6
- var w = /* @__PURE__ */ function(e) {
7
- return e.RED_ORANGE = "red-orange", e.ORANGE = "orange", e.YELLOW = "yellow", e.GREEN = "green", e.TEAL = "teal", e.CYAN = "cyan", e.BLUE = "blue", e.INDIGO = "indigo", e.VIOLET = "violet", e.MAGENTA = "magenta", e.PINK = "pink", e.GRAY = "gray", e.RED = "red", e.WHITE_BORDER = "white-border", e.BILLING = "billing", e.BILLING_LIGHT = "billing-light", e;
8
- }({}), T = /* @__PURE__ */ function(e) {
9
- return e.SMALL = "small", e.MEDIUM = "medium", e;
10
- }({}), E = (e) => e.startsWith("#") || e.startsWith("var(--"), D = (e) => E(e) ? "s-ui-tag--color-custom" : `s-ui-tag--color-${e}`, O = (e) => ({ "--s-ui-tag-bg": e }), k = { class: "s-ui-tag__content s-ui-typography-body-12-regular" }, A = {
11
- key: 0,
12
- class: "s-ui-tag__actions"
13
- }, j = { class: "s-ui-tag__action-close" }, M = /* @__PURE__ */ p({
14
- inheritAttrs: !1,
15
- __name: "STag",
16
- props: /*@__PURE__*/ m({
17
- color: { default: () => w.RED_ORANGE },
18
- size: { default: () => T.MEDIUM },
19
- short: {
20
- type: Boolean,
21
- default: !1
22
- },
23
- closable: {
24
- type: Boolean,
25
- default: !1
26
- },
27
- disabled: {
28
- type: Boolean,
29
- default: !1
30
- },
31
- selected: {
32
- type: Boolean,
33
- default: !1
34
- },
35
- link: {},
36
- exact: {
37
- type: Boolean,
38
- default: !1
39
- },
40
- replace: {
41
- type: Boolean,
42
- default: !1
43
- }
44
- }, {
45
- modelValue: { default: "" },
46
- modelModifiers: {}
47
- }),
48
- emits: /*@__PURE__*/ m(["close"], ["update:modelValue"]),
49
- setup(p, { emit: m }) {
50
- let w = b(), T = x(p, "modelValue"), M = m, N = o(() => p.link, () => p.exact, () => p.replace), P = N.linkPresentation, F = s(() => {
51
- let e = P.value;
52
- return e.mode === "none" ? "span" : e.rootTag;
53
- }), I = s(() => i(P.value, { replace: p.replace })), L = s(() => ({
54
- ...I.value,
55
- ...w
56
- })), R = s(() => N.isRouterLink.value ? N.isActive.value : p.selected), z = s(() => p.closable && !p.short), B = s(() => {
57
- if (p.disabled) return -1;
58
- if (!a(p.link)) return z.value ? 0 : -1;
59
- }), V = s(() => [
60
- D(p.color),
61
- `s-ui-tag--size-${p.size}`,
62
- {
63
- "s-ui-tag--short": p.short,
64
- "s-ui-tag--disabled": p.disabled,
65
- "s-ui-tag--selected": R.value,
66
- "s-ui-tag--link": a(p.link)
67
- }
68
- ]), H = s(() => {
69
- if (E(p.color)) return O(p.color);
70
- }), U = s(() => p.short ? T.value.slice(0, 1) : T.value), W = () => {
71
- M("close");
72
- }, G = [
73
- "Enter",
74
- " ",
75
- "Spacebar"
76
- ], K = ["Delete", "Backspace"], q = (e) => {
77
- if (!p.disabled) {
78
- if (N.isRouterLink.value && G.includes(e.key)) {
79
- e.preventDefault(), N.navigate();
80
- return;
81
- }
82
- if (e.target === e.currentTarget && K.includes(e.key)) {
83
- if (!z.value) return;
84
- e.preventDefault(), M("close");
85
- }
86
- }
87
- };
88
- return (i, a) => (g(), c(_(F.value), h({
89
- class: ["s-ui-tag", V.value],
90
- style: H.value,
91
- tabindex: B.value,
92
- "aria-disabled": p.disabled ? !0 : void 0
93
- }, L.value, { onKeydown: q }), {
94
- default: S(() => [d("span", k, v(U.value), 1), z.value ? (g(), u("span", A, [d("span", j, [f(y(r), {
95
- appearance: y(n).BARE,
96
- variant: y(t).NEUTRAL,
97
- size: y(e).SMALL,
98
- disabled: p.disabled,
99
- tabindex: -1,
100
- icon: "closeMini",
101
- onClick: C(W, ["stop"])
102
- }, null, 8, [
103
- "appearance",
104
- "variant",
105
- "size",
106
- "disabled"
107
- ])])])) : l("", !0)]),
108
- _: 1
109
- }, 16, [
110
- "class",
111
- "style",
112
- "tabindex",
113
- "aria-disabled"
114
- ]));
115
- }
116
- });
117
- //#endregion
118
- export { w as n, T as r, M as t };
@@ -1 +0,0 @@
1
- const e=require("./SButton.types-UKroD-ev.cjs"),t=require("./SButton-C-z_q5CG.cjs"),n=require("./useLink-1LLWpdDZ.cjs");let r=require("vue");var i=function(e){return e.RED_ORANGE=`red-orange`,e.ORANGE=`orange`,e.YELLOW=`yellow`,e.GREEN=`green`,e.TEAL=`teal`,e.CYAN=`cyan`,e.BLUE=`blue`,e.INDIGO=`indigo`,e.VIOLET=`violet`,e.MAGENTA=`magenta`,e.PINK=`pink`,e.GRAY=`gray`,e.RED=`red`,e.WHITE_BORDER=`white-border`,e.BILLING=`billing`,e.BILLING_LIGHT=`billing-light`,e}({}),a=function(e){return e.SMALL=`small`,e.MEDIUM=`medium`,e}({}),o=e=>e.startsWith(`#`)||e.startsWith(`var(--`),s=e=>o(e)?`s-ui-tag--color-custom`:`s-ui-tag--color-${e}`,c=e=>({"--s-ui-tag-bg":e}),l={class:`s-ui-tag__content s-ui-typography-body-12-regular`},u={key:0,class:`s-ui-tag__actions`},d={class:`s-ui-tag__action-close`},f=(0,r.defineComponent)({inheritAttrs:!1,__name:`STag`,props:(0,r.mergeModels)({color:{default:()=>i.RED_ORANGE},size:{default:()=>a.MEDIUM},short:{type:Boolean,default:!1},closable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},link:{},exact:{type:Boolean,default:!1},replace:{type:Boolean,default:!1}},{modelValue:{default:``},modelModifiers:{}}),emits:(0,r.mergeModels)([`close`],[`update:modelValue`]),setup(i,{emit:a}){let f=(0,r.useAttrs)(),p=(0,r.useModel)(i,`modelValue`),m=a,h=n.t(()=>i.link,()=>i.exact,()=>i.replace),g=h.linkPresentation,_=(0,r.computed)(()=>{let e=g.value;return e.mode===`none`?`span`:e.rootTag}),v=(0,r.computed)(()=>n.n(g.value,{replace:i.replace})),y=(0,r.computed)(()=>({...v.value,...f})),b=(0,r.computed)(()=>h.isRouterLink.value?h.isActive.value:i.selected),x=(0,r.computed)(()=>i.closable&&!i.short),S=(0,r.computed)(()=>{if(i.disabled)return-1;if(!n.r(i.link))return x.value?0:-1}),C=(0,r.computed)(()=>[s(i.color),`s-ui-tag--size-${i.size}`,{"s-ui-tag--short":i.short,"s-ui-tag--disabled":i.disabled,"s-ui-tag--selected":b.value,"s-ui-tag--link":n.r(i.link)}]),w=(0,r.computed)(()=>{if(o(i.color))return c(i.color)}),T=(0,r.computed)(()=>i.short?p.value.slice(0,1):p.value),E=()=>{m(`close`)},D=[`Enter`,` `,`Spacebar`],O=[`Delete`,`Backspace`],k=e=>{if(!i.disabled){if(h.isRouterLink.value&&D.includes(e.key)){e.preventDefault(),h.navigate();return}if(e.target===e.currentTarget&&O.includes(e.key)){if(!x.value)return;e.preventDefault(),m(`close`)}}};return(n,a)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(_.value),(0,r.mergeProps)({class:[`s-ui-tag`,C.value],style:w.value,tabindex:S.value,"aria-disabled":i.disabled?!0:void 0},y.value,{onKeydown:k}),{default:(0,r.withCtx)(()=>[(0,r.createElementVNode)(`span`,l,(0,r.toDisplayString)(T.value),1),x.value?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,u,[(0,r.createElementVNode)(`span`,d,[(0,r.createVNode)((0,r.unref)(t.t),{appearance:(0,r.unref)(e.t).BARE,variant:(0,r.unref)(e.r).NEUTRAL,size:(0,r.unref)(e.n).SMALL,disabled:i.disabled,tabindex:-1,icon:`closeMini`,onClick:(0,r.withModifiers)(E,[`stop`])},null,8,[`appearance`,`variant`,`size`,`disabled`])])])):(0,r.createCommentVNode)(``,!0)]),_:1},16,[`class`,`style`,`tabindex`,`aria-disabled`]))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});