@shtabapp/ui-kit 1.32.0 → 1.34.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 +12 -0
- package/dist/SAvatar-C2gekygl.cjs +1 -0
- package/dist/SAvatar-DAfDAqrP.js +265 -0
- package/dist/{SAvatarGroup-CMa9KhUZ.cjs → SAvatarGroup-76j-sHCe.cjs} +1 -1
- package/dist/{SAvatarGroup-wkXHy_tK.js → SAvatarGroup-HvIlI5y0.js} +1 -1
- package/dist/SColorPalette-B9WrqgRz.js +146 -0
- package/dist/SColorPalette-CYGnmIWP.cjs +1 -0
- package/dist/SColorPicker-Cs0QmYWm.js +635 -0
- package/dist/SColorPicker-D7QwVS2t.cjs +1 -0
- package/dist/{SDropdown-Cv729__Y.js → SDropdown-CTQ5Qlez.js} +50 -49
- package/dist/SDropdown-_QUOP-rw.cjs +1 -0
- package/dist/{SSelect-iBb45tet.js → SSelect-AcH04gtk.js} +23 -18
- package/dist/{SSelect-CgL7ECfS.cjs → SSelect-CT3AMH-u.cjs} +1 -1
- package/dist/STag-COwzellL.js +123 -0
- package/dist/STag-HgFvU1Iy.cjs +1 -0
- package/dist/{STagGroup-BMyuxfVX.cjs → STagGroup-CKxDA9Y0.cjs} +1 -1
- package/dist/{STagGroup-B2-_OG3R.js → STagGroup-Cbe0AENj.js} +1 -1
- package/dist/colorValue-DClAEDHr.cjs +1 -0
- package/dist/colorValue-DXJiNKGE.js +5 -0
- package/dist/components/SAvatar/SAvatar.vue.d.ts.map +1 -1
- package/dist/components/SAvatar/utils/getAvatarInitialsTextColor.d.ts +4 -0
- package/dist/components/SAvatar/utils/getAvatarInitialsTextColor.d.ts.map +1 -0
- package/dist/components/SAvatar/utils/resolveAvatarColor.d.ts +1 -3
- package/dist/components/SAvatar/utils/resolveAvatarColor.d.ts.map +1 -1
- package/dist/components/SColorPalette/SColorPalette.types.d.ts +19 -0
- package/dist/components/SColorPalette/SColorPalette.types.d.ts.map +1 -0
- package/dist/components/SColorPalette/SColorPalette.vue.d.ts +26 -0
- package/dist/components/SColorPalette/SColorPalette.vue.d.ts.map +1 -0
- package/dist/components/SColorPalette/index.d.ts +4 -0
- package/dist/components/SColorPalette/index.d.ts.map +1 -0
- package/dist/components/SColorPicker/SColorPicker.types.d.ts +12 -0
- package/dist/components/SColorPicker/SColorPicker.types.d.ts.map +1 -0
- package/dist/components/SColorPicker/SColorPicker.vue.d.ts +25 -0
- package/dist/components/SColorPicker/SColorPicker.vue.d.ts.map +1 -0
- package/dist/components/SColorPicker/constants/SColorPicker.constants.d.ts +2 -0
- package/dist/components/SColorPicker/constants/SColorPicker.constants.d.ts.map +1 -0
- package/dist/components/SColorPicker/index.d.ts +8 -0
- package/dist/components/SColorPicker/index.d.ts.map +1 -0
- package/dist/components/SColorPicker/parts/SColorArea.types.d.ts +9 -0
- package/dist/components/SColorPicker/parts/SColorArea.types.d.ts.map +1 -0
- package/dist/components/SColorPicker/parts/SColorArea.vue.d.ts +15 -0
- package/dist/components/SColorPicker/parts/SColorArea.vue.d.ts.map +1 -0
- package/dist/components/SColorPicker/parts/SColorValues.types.d.ts +12 -0
- package/dist/components/SColorPicker/parts/SColorValues.types.d.ts.map +1 -0
- package/dist/components/SColorPicker/parts/SColorValues.vue.d.ts +22 -0
- package/dist/components/SColorPicker/parts/SColorValues.vue.d.ts.map +1 -0
- package/dist/components/SColorPicker/utils/resolveColorSwatchFillElement.d.ts +3 -0
- package/dist/components/SColorPicker/utils/resolveColorSwatchFillElement.d.ts.map +1 -0
- package/dist/components/SColorPicker/utils/useColorArea.d.ts +29 -0
- package/dist/components/SColorPicker/utils/useColorArea.d.ts.map +1 -0
- package/dist/components/SDropdown/SDropdown.vue.d.ts.map +1 -1
- package/dist/components/SSelect/SSelect.types.d.ts +5 -0
- package/dist/components/SSelect/SSelect.types.d.ts.map +1 -1
- package/dist/components/SSelect/SSelect.vue.d.ts.map +1 -1
- package/dist/components/STag/utils/resolveTagColor.d.ts +1 -3
- package/dist/components/STag/utils/resolveTagColor.d.ts.map +1 -1
- package/dist/composables/connectedPosition/parseAnchor.d.ts.map +1 -1
- package/dist/composables/connectedPosition/types.d.ts +5 -1
- package/dist/composables/connectedPosition/types.d.ts.map +1 -1
- package/dist/contrastSurfaceTextColor-Dl641cZ_.js +33 -0
- package/dist/contrastSurfaceTextColor-Ybh-FZof.cjs +1 -0
- package/dist/entries/avatar-group.cjs +1 -1
- package/dist/entries/avatar-group.js +1 -1
- package/dist/entries/avatar.cjs +1 -1
- package/dist/entries/avatar.js +1 -1
- package/dist/entries/color-palette.cjs +1 -0
- package/dist/entries/color-palette.d.ts +5 -0
- package/dist/entries/color-palette.d.ts.map +1 -0
- package/dist/entries/color-palette.js +3 -0
- package/dist/entries/color-picker.cjs +1 -0
- package/dist/entries/color-picker.d.ts +5 -0
- package/dist/entries/color-picker.d.ts.map +1 -0
- package/dist/entries/color-picker.js +4 -0
- 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/select.cjs +1 -1
- package/dist/entries/select.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 +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -34
- package/dist/uikit-components.css +1 -1
- package/dist/useFloatingOverlay-B1UCUYQQ.cjs +1 -0
- package/dist/{useFloatingOverlay-D-GlpoPP.js → useFloatingOverlay-QcumEYEq.js} +23 -3
- package/dist/utils/color/colorFormatChannels.d.ts +11 -0
- package/dist/utils/color/colorFormatChannels.d.ts.map +1 -0
- package/dist/utils/color/colorValue.d.ts +9 -0
- package/dist/utils/color/colorValue.d.ts.map +1 -0
- package/dist/utils/color/contrastSurfaceTextColor.d.ts +4 -0
- package/dist/utils/color/contrastSurfaceTextColor.d.ts.map +1 -0
- package/dist/utils/color/defaultPaletteColors.d.ts +3 -0
- package/dist/utils/color/defaultPaletteColors.d.ts.map +1 -0
- package/dist/utils/color/formatColorForDisplay.d.ts +9 -0
- package/dist/utils/color/formatColorForDisplay.d.ts.map +1 -0
- package/dist/utils/color/index.d.ts +10 -0
- package/dist/utils/color/index.d.ts.map +1 -0
- package/dist/utils/color/parseColorFromInput.d.ts +4 -0
- package/dist/utils/color/parseColorFromInput.d.ts.map +1 -0
- package/dist/utils/color/recommendedColorPalette.d.ts +3 -0
- package/dist/utils/color/recommendedColorPalette.d.ts.map +1 -0
- package/dist/utils/color/types.d.ts +35 -0
- package/dist/utils/color/types.d.ts.map +1 -0
- package/package.json +12 -2
- package/dist/SAvatar-BS9Lu2eL.js +0 -249
- package/dist/SAvatar-BXABKIV0.cjs +0 -1
- package/dist/SDropdown-B6b7IDjp.cjs +0 -1
- package/dist/STag-CYoj7L-p.js +0 -118
- package/dist/STag-DVrSWByQ.cjs +0 -1
- package/dist/useFloatingOverlay-Cwg2MWyD.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [@shtabapp/ui-kit-v1.34.0](https://gitlab.com/mstikharev/shtab-ui-kit/compare/@shtabapp/ui-kit@1.33.0...@shtabapp/ui-kit@1.34.0) (2026-07-01)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- color picker (swatch, palette, area, values) ([2fbc95c](https://gitlab.com/mstikharev/shtab-ui-kit/commit/2fbc95c15c65ed87f9a36b9aaec6fe71a6f5ff03))
|
|
6
|
+
|
|
7
|
+
## [@shtabapp/ui-kit-v1.33.0](https://gitlab.com/mstikharev/shtab-ui-kit/compare/@shtabapp/ui-kit@1.32.0...@shtabapp/ui-kit@1.33.0) (2026-07-01)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- contrast color text in avatars and tags & fitViewport in select ([1dd7352](https://gitlab.com/mstikharev/shtab-ui-kit/commit/1dd73524fafe22e79d28557d94acd3d440663f47))
|
|
12
|
+
|
|
1
13
|
## [@shtabapp/ui-kit-v1.32.0](https://gitlab.com/mstikharev/shtab-ui-kit/compare/@shtabapp/ui-kit@1.31.0...@shtabapp/ui-kit@1.32.0) (2026-06-30)
|
|
2
14
|
|
|
3
15
|
### Features
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./SBadge-d1GOPFP-.cjs"),t=require("./contrastSurfaceTextColor-Ybh-FZof.cjs");let n=require("vue"),r=require("@shtabapp/ui-kit-primitives");var i=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}({}),a=function(e){return e.CIRCLE=`circle`,e.SQUARE=`square`,e}({}),o=function(e){return e.TEAL=`teal`,e.CYAN=`cyan`,e.INDIGO=`indigo`,e.VIOLET=`violet`,e.PINK=`pink`,e.SURFACE=`surface`,e}({}),s=function(e){return e.NEUTRAL=`neutral`,e.MAIN=`main`,e}({}),c=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}({}),l=function(e){return e.SMALL=`s`,e.MEDIUM=`m`,e.LARGE=`l`,e}({}),u={[i.SIZE_80]:`s-ui-typography-heading-h3-semibold`,[i.SIZE_72]:`s-ui-typography-heading-h4-semibold`,[i.SIZE_64]:`s-ui-typography-heading-h4-semibold`,[i.SIZE_56]:`s-ui-typography-label-16-medium`,[i.SIZE_48]:`s-ui-typography-label-16-medium`,[i.SIZE_40]:`s-ui-typography-label-16-medium`,[i.SIZE_32]:`s-ui-typography-label-14-medium`,[i.SIZE_24]:`s-ui-typography-label-12-medium`,[i.SIZE_20]:`s-ui-typography-label-12-medium`,[i.SIZE_16]:`s-ui-typography-label-10-medium`},d={[i.SIZE_80]:40,[i.SIZE_72]:40,[i.SIZE_64]:40,[i.SIZE_56]:32,[i.SIZE_48]:32,[i.SIZE_40]:24,[i.SIZE_32]:24,[i.SIZE_24]:20,[i.SIZE_20]:16,[i.SIZE_16]:16},f={[i.SIZE_80]:l.LARGE,[i.SIZE_72]:l.LARGE,[i.SIZE_64]:l.MEDIUM,[i.SIZE_56]:l.MEDIUM,[i.SIZE_48]:l.SMALL,[i.SIZE_40]:l.SMALL,[i.SIZE_32]:l.SMALL,[i.SIZE_24]:l.SMALL,[i.SIZE_20]:l.SMALL,[i.SIZE_16]:l.SMALL},p={[l.SMALL]:e.i.SMALL,[l.MEDIUM]:e.i.MEDIUM,[l.LARGE]:e.i.LARGE},m={[e.i.SMALL]:8,[e.i.MEDIUM]:10,[e.i.LARGE]:12},h={[e.i.SMALL]:12,[e.i.MEDIUM]:16,[e.i.LARGE]:20},g=16,_={[i.SIZE_80]:0,[i.SIZE_72]:0,[i.SIZE_64]:0,[i.SIZE_56]:0,[i.SIZE_48]:0,[i.SIZE_40]:0,[i.SIZE_32]:-2,[i.SIZE_24]:-2,[i.SIZE_20]:-4,[i.SIZE_16]:-4},v={[i.SIZE_80]:-8,[i.SIZE_72]:-8,[i.SIZE_64]:-8,[i.SIZE_56]:-8,[i.SIZE_48]:-8,[i.SIZE_40]:-8,[i.SIZE_32]:-8,[i.SIZE_24]:-8,[i.SIZE_20]:-10,[i.SIZE_16]:-10},y={[c.DEFAULT]:e.n.MAIN,[c.ONLINE]:e.n.SUCCESS,[c.OFFLINE]:e.n.WHITE,[c.RECENTLY]:e.n.WARNING,[c.ERROR]:e.n.DANGER,[c.TRACK]:e.n.MAIN,[c.DONE]:e.n.SUCCESS,[c.CONTROLLER]:e.n.MAIN,[c.FAVORITE]:e.n.WARNING,[c.PIN]:e.n.MAIN,[c.PRIVATE]:e.n.BILLING},b={[c.TRACK]:r.ESIconName.playFill,[c.DONE]:r.ESIconName.checkBold,[c.CONTROLLER]:r.ESIconName.controlFill,[c.FAVORITE]:r.ESIconName.starFill,[c.PIN]:r.ESIconName.pinFill,[c.PRIVATE]:r.ESIconName.tabooBold},x=({avatarSize:e,badgeSize:t,hasIcon:n})=>{let r=_[e];return n?r:r+(h[t]-m[t])/2},S=(e,t)=>({offsetX:-e-t/2,offsetY:-e-t/2}),C=(e,t)=>({offsetX:-e-t/2,offsetY:e+t/2}),w=({badge:t,counter:r,size:i})=>{let a=(0,n.computed)(()=>{let r=(0,n.toValue)(t);if(!r)return;let a=(0,n.toValue)(i),o=b[r],s=p[f[a]],c=o?h[s]:m[s],l=S(x({avatarSize:a,badgeSize:s,hasIcon:!!o}),c);return{anchored:!0,color:y[r],icon:o,label:r,offsetX:l.offsetX,offsetY:l.offsetY,placement:e.r.BOTTOM_END,size:s}}),o=(0,n.computed)(()=>{let t=(0,n.toValue)(r);if(typeof t!=`number`)return;let a=v[(0,n.toValue)(i)],o=C(a,g);return{anchored:!0,color:e.n.MAIN,offsetX:o.offsetX,offsetY:o.offsetY,placement:e.r.TOP_END,size:e.i.MEDIUM,value:t}});return{avatarBadgeItemsProps:(0,n.computed)(()=>{let e=[];return o.value&&e.push(o.value),a.value&&e.push(a.value),e})}},T={[o.CYAN]:`#127c97`,[o.INDIGO]:`#755ace`,[o.PINK]:`#c33c86`,[o.TEAL]:`#158472`,[o.VIOLET]:`#8757c7`},E=e=>{if(t.n(e))return e;if(e!==o.SURFACE)return T[e]},D=e=>{let n=E(e);if(n)return t.t(n)},O=e=>t.n(e),k=e=>O(e)?`s-ui-avatar--color-custom`:`s-ui-avatar--color-${e}`,A=e=>{let t=D(e),n={};if(O(e)&&(n[`--s-ui-avatar-background`]=e),t&&(n[`--s-ui-avatar-color`]=t),Object.keys(n).length!==0)return n},j=[`aria-disabled`],M={class:`s-ui-avatar__content`},N=[`src`,`alt`],P={key:1,class:`s-ui-avatar__icon`},F=[`role`,`aria-label`],I={key:0,class:`s-ui-avatar__name`},L=(0,n.defineComponent)({inheritAttrs:!1,__name:`SAvatar`,props:{alt:{},badge:{},bordered:{type:Boolean,default:!0},color:{default:()=>o.TEAL},counter:{},disabled:{type:Boolean,default:!1},icon:{},iconBackground:{default:()=>s.NEUTRAL},initialLength:{default:1},name:{},shape:{default:()=>a.CIRCLE},showName:{type:Boolean,default:!0},size:{default:()=>i.SIZE_40},src:{}},setup(t){let i=(0,n.useAttrs)(),a=(0,n.ref)(!1),o=e=>typeof e==`number`||typeof e==`string`,s=(0,n.computed)(()=>{if(o(i.tabindex))return i.tabindex;if(o(i.tabIndex))return i.tabIndex}),c=(0,n.computed)(()=>o(i.tabindex)||o(i.tabIndex)),l=(0,n.computed)(()=>t.disabled?-1:c.value?s.value:0),f=(0,n.computed)(()=>({...i,tabindex:l.value})),p=(0,n.computed)(()=>[`s-ui-avatar--size-${t.size}`,`s-ui-avatar--shape-${t.shape}`,k(t.color),`s-ui-avatar--icon-background-${t.iconBackground}`,{"s-ui-avatar--bordered":t.bordered,"s-ui-avatar--disabled":t.disabled,"s-ui-avatar--icon":g.value,"s-ui-avatar--photo":h.value}]),m=(0,n.computed)(()=>{if(!g.value)return A(t.color)}),h=(0,n.computed)(()=>!!(t.src&&!a.value)),g=(0,n.computed)(()=>!!(!h.value&&t.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,n.computed)(()=>t.name?_(t.name):``),y=(0,n.computed)(()=>t.alt?t.alt:t.name?t.name:v.value),b=(0,n.computed)(()=>{if(t.alt)return t.alt;if(t.name)return t.name}),x=(0,n.computed)(()=>v.value.slice(0,Math.max(t.initialLength,0))),S=(0,n.computed)(()=>u[t.size]),C=(0,n.computed)(()=>d[t.size]),{avatarBadgeItemsProps:T}=w({badge:()=>t.badge,counter:()=>t.counter,size:()=>t.size}),E=()=>{a.value=!0};return(0,n.watch)(()=>t.src,()=>{a.value=!1}),(i,o)=>((0,n.openBlock)(),(0,n.createElementBlock)(`span`,(0,n.mergeProps)(f.value,{class:[`s-ui-avatar`,p.value],style:m.value,"aria-disabled":t.disabled||void 0}),[(0,n.createElementVNode)(`span`,M,[t.src&&!a.value?((0,n.openBlock)(),(0,n.createElementBlock)(`img`,{key:0,class:`s-ui-avatar__image`,src:t.src,alt:y.value,onError:E},null,40,N)):t.icon?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,P,[(0,n.createVNode)((0,n.unref)(r.SIcon),{name:t.icon,size:C.value,"aria-label":b.value},null,8,[`name`,`size`,`aria-label`])])):((0,n.openBlock)(),(0,n.createElementBlock)(`span`,{key:2,class:(0,n.normalizeClass)([`s-ui-avatar__initials`,S.value]),role:t.alt?`img`:void 0,"aria-label":t.alt},(0,n.toDisplayString)(x.value),11,F)),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(T),t=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(e.t),(0,n.mergeProps)({key:t.placement},{ref_for:!0},t),null,16))),128))]),t.showName&&t.name?((0,n.openBlock)(),(0,n.createElementBlock)(`span`,I,(0,n.toDisplayString)(t.name),1)):(0,n.createCommentVNode)(``,!0)],16,j))}});Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return L}});
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./SBadge-BDxQJh6c.js";
|
|
2
|
+
import { n as i, t as a } from "./contrastSurfaceTextColor-Dl641cZ_.js";
|
|
3
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createVNode as f, defineComponent as p, mergeProps as m, normalizeClass as h, openBlock as g, ref as _, renderList as v, toDisplayString as y, toValue as b, unref as x, useAttrs as S, watch as C } from "vue";
|
|
4
|
+
import { ESIconName as w, SIcon as T } from "@shtabapp/ui-kit-primitives";
|
|
5
|
+
//#region src/components/SAvatar/SAvatar.types.ts
|
|
6
|
+
var E = /* @__PURE__ */ function(e) {
|
|
7
|
+
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;
|
|
8
|
+
}({}), D = /* @__PURE__ */ function(e) {
|
|
9
|
+
return e.CIRCLE = "circle", e.SQUARE = "square", e;
|
|
10
|
+
}({}), O = /* @__PURE__ */ function(e) {
|
|
11
|
+
return e.TEAL = "teal", e.CYAN = "cyan", e.INDIGO = "indigo", e.VIOLET = "violet", e.PINK = "pink", e.SURFACE = "surface", e;
|
|
12
|
+
}({}), k = /* @__PURE__ */ function(e) {
|
|
13
|
+
return e.NEUTRAL = "neutral", e.MAIN = "main", e;
|
|
14
|
+
}({}), A = /* @__PURE__ */ function(e) {
|
|
15
|
+
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;
|
|
16
|
+
}({}), j = /* @__PURE__ */ function(e) {
|
|
17
|
+
return e.SMALL = "s", e.MEDIUM = "m", e.LARGE = "l", e;
|
|
18
|
+
}({}), M = {
|
|
19
|
+
[E.SIZE_80]: "s-ui-typography-heading-h3-semibold",
|
|
20
|
+
[E.SIZE_72]: "s-ui-typography-heading-h4-semibold",
|
|
21
|
+
[E.SIZE_64]: "s-ui-typography-heading-h4-semibold",
|
|
22
|
+
[E.SIZE_56]: "s-ui-typography-label-16-medium",
|
|
23
|
+
[E.SIZE_48]: "s-ui-typography-label-16-medium",
|
|
24
|
+
[E.SIZE_40]: "s-ui-typography-label-16-medium",
|
|
25
|
+
[E.SIZE_32]: "s-ui-typography-label-14-medium",
|
|
26
|
+
[E.SIZE_24]: "s-ui-typography-label-12-medium",
|
|
27
|
+
[E.SIZE_20]: "s-ui-typography-label-12-medium",
|
|
28
|
+
[E.SIZE_16]: "s-ui-typography-label-10-medium"
|
|
29
|
+
}, N = {
|
|
30
|
+
[E.SIZE_80]: 40,
|
|
31
|
+
[E.SIZE_72]: 40,
|
|
32
|
+
[E.SIZE_64]: 40,
|
|
33
|
+
[E.SIZE_56]: 32,
|
|
34
|
+
[E.SIZE_48]: 32,
|
|
35
|
+
[E.SIZE_40]: 24,
|
|
36
|
+
[E.SIZE_32]: 24,
|
|
37
|
+
[E.SIZE_24]: 20,
|
|
38
|
+
[E.SIZE_20]: 16,
|
|
39
|
+
[E.SIZE_16]: 16
|
|
40
|
+
}, P = {
|
|
41
|
+
[E.SIZE_80]: j.LARGE,
|
|
42
|
+
[E.SIZE_72]: j.LARGE,
|
|
43
|
+
[E.SIZE_64]: j.MEDIUM,
|
|
44
|
+
[E.SIZE_56]: j.MEDIUM,
|
|
45
|
+
[E.SIZE_48]: j.SMALL,
|
|
46
|
+
[E.SIZE_40]: j.SMALL,
|
|
47
|
+
[E.SIZE_32]: j.SMALL,
|
|
48
|
+
[E.SIZE_24]: j.SMALL,
|
|
49
|
+
[E.SIZE_20]: j.SMALL,
|
|
50
|
+
[E.SIZE_16]: j.SMALL
|
|
51
|
+
}, F = {
|
|
52
|
+
[j.SMALL]: e.SMALL,
|
|
53
|
+
[j.MEDIUM]: e.MEDIUM,
|
|
54
|
+
[j.LARGE]: e.LARGE
|
|
55
|
+
}, I = {
|
|
56
|
+
[e.SMALL]: 8,
|
|
57
|
+
[e.MEDIUM]: 10,
|
|
58
|
+
[e.LARGE]: 12
|
|
59
|
+
}, L = {
|
|
60
|
+
[e.SMALL]: 12,
|
|
61
|
+
[e.MEDIUM]: 16,
|
|
62
|
+
[e.LARGE]: 20
|
|
63
|
+
}, R = 16, z = {
|
|
64
|
+
[E.SIZE_80]: 0,
|
|
65
|
+
[E.SIZE_72]: 0,
|
|
66
|
+
[E.SIZE_64]: 0,
|
|
67
|
+
[E.SIZE_56]: 0,
|
|
68
|
+
[E.SIZE_48]: 0,
|
|
69
|
+
[E.SIZE_40]: 0,
|
|
70
|
+
[E.SIZE_32]: -2,
|
|
71
|
+
[E.SIZE_24]: -2,
|
|
72
|
+
[E.SIZE_20]: -4,
|
|
73
|
+
[E.SIZE_16]: -4
|
|
74
|
+
}, B = {
|
|
75
|
+
[E.SIZE_80]: -8,
|
|
76
|
+
[E.SIZE_72]: -8,
|
|
77
|
+
[E.SIZE_64]: -8,
|
|
78
|
+
[E.SIZE_56]: -8,
|
|
79
|
+
[E.SIZE_48]: -8,
|
|
80
|
+
[E.SIZE_40]: -8,
|
|
81
|
+
[E.SIZE_32]: -8,
|
|
82
|
+
[E.SIZE_24]: -8,
|
|
83
|
+
[E.SIZE_20]: -10,
|
|
84
|
+
[E.SIZE_16]: -10
|
|
85
|
+
}, V = {
|
|
86
|
+
[A.DEFAULT]: t.MAIN,
|
|
87
|
+
[A.ONLINE]: t.SUCCESS,
|
|
88
|
+
[A.OFFLINE]: t.WHITE,
|
|
89
|
+
[A.RECENTLY]: t.WARNING,
|
|
90
|
+
[A.ERROR]: t.DANGER,
|
|
91
|
+
[A.TRACK]: t.MAIN,
|
|
92
|
+
[A.DONE]: t.SUCCESS,
|
|
93
|
+
[A.CONTROLLER]: t.MAIN,
|
|
94
|
+
[A.FAVORITE]: t.WARNING,
|
|
95
|
+
[A.PIN]: t.MAIN,
|
|
96
|
+
[A.PRIVATE]: t.BILLING
|
|
97
|
+
}, H = {
|
|
98
|
+
[A.TRACK]: w.playFill,
|
|
99
|
+
[A.DONE]: w.checkBold,
|
|
100
|
+
[A.CONTROLLER]: w.controlFill,
|
|
101
|
+
[A.FAVORITE]: w.starFill,
|
|
102
|
+
[A.PIN]: w.pinFill,
|
|
103
|
+
[A.PRIVATE]: w.tabooBold
|
|
104
|
+
}, U = ({ avatarSize: e, badgeSize: t, hasIcon: n }) => {
|
|
105
|
+
let r = z[e];
|
|
106
|
+
return n ? r : r + (L[t] - I[t]) / 2;
|
|
107
|
+
}, W = (e, t) => ({
|
|
108
|
+
offsetX: -e - t / 2,
|
|
109
|
+
offsetY: -e - t / 2
|
|
110
|
+
}), G = (e, t) => ({
|
|
111
|
+
offsetX: -e - t / 2,
|
|
112
|
+
offsetY: e + t / 2
|
|
113
|
+
}), K = ({ badge: r, counter: i, size: a }) => {
|
|
114
|
+
let o = s(() => {
|
|
115
|
+
let e = b(r);
|
|
116
|
+
if (!e) return;
|
|
117
|
+
let t = b(a), i = H[e], o = F[P[t]], s = i ? L[o] : I[o], c = W(U({
|
|
118
|
+
avatarSize: t,
|
|
119
|
+
badgeSize: o,
|
|
120
|
+
hasIcon: !!i
|
|
121
|
+
}), s);
|
|
122
|
+
return {
|
|
123
|
+
anchored: !0,
|
|
124
|
+
color: V[e],
|
|
125
|
+
icon: i,
|
|
126
|
+
label: e,
|
|
127
|
+
offsetX: c.offsetX,
|
|
128
|
+
offsetY: c.offsetY,
|
|
129
|
+
placement: n.BOTTOM_END,
|
|
130
|
+
size: o
|
|
131
|
+
};
|
|
132
|
+
}), c = s(() => {
|
|
133
|
+
let r = b(i);
|
|
134
|
+
if (typeof r != "number") return;
|
|
135
|
+
let o = B[b(a)], s = G(o, R);
|
|
136
|
+
return {
|
|
137
|
+
anchored: !0,
|
|
138
|
+
color: t.MAIN,
|
|
139
|
+
offsetX: s.offsetX,
|
|
140
|
+
offsetY: s.offsetY,
|
|
141
|
+
placement: n.TOP_END,
|
|
142
|
+
size: e.MEDIUM,
|
|
143
|
+
value: r
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
return { avatarBadgeItemsProps: s(() => {
|
|
147
|
+
let e = [];
|
|
148
|
+
return c.value && e.push(c.value), o.value && e.push(o.value), e;
|
|
149
|
+
}) };
|
|
150
|
+
}, q = {
|
|
151
|
+
[O.CYAN]: "#127c97",
|
|
152
|
+
[O.INDIGO]: "#755ace",
|
|
153
|
+
[O.PINK]: "#c33c86",
|
|
154
|
+
[O.TEAL]: "#158472",
|
|
155
|
+
[O.VIOLET]: "#8757c7"
|
|
156
|
+
}, J = (e) => {
|
|
157
|
+
if (i(e)) return e;
|
|
158
|
+
if (e !== O.SURFACE) return q[e];
|
|
159
|
+
}, Y = (e) => {
|
|
160
|
+
let t = J(e);
|
|
161
|
+
if (t) return a(t);
|
|
162
|
+
}, X = (e) => i(e), Z = (e) => X(e) ? "s-ui-avatar--color-custom" : `s-ui-avatar--color-${e}`, Q = (e) => {
|
|
163
|
+
let t = Y(e), n = {};
|
|
164
|
+
if (X(e) && (n["--s-ui-avatar-background"] = e), t && (n["--s-ui-avatar-color"] = t), Object.keys(n).length !== 0) return n;
|
|
165
|
+
}, $ = ["aria-disabled"], ee = { class: "s-ui-avatar__content" }, te = ["src", "alt"], ne = {
|
|
166
|
+
key: 1,
|
|
167
|
+
class: "s-ui-avatar__icon"
|
|
168
|
+
}, re = ["role", "aria-label"], ie = {
|
|
169
|
+
key: 0,
|
|
170
|
+
class: "s-ui-avatar__name"
|
|
171
|
+
}, ae = /* @__PURE__ */ p({
|
|
172
|
+
inheritAttrs: !1,
|
|
173
|
+
__name: "SAvatar",
|
|
174
|
+
props: {
|
|
175
|
+
alt: {},
|
|
176
|
+
badge: {},
|
|
177
|
+
bordered: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: !0
|
|
180
|
+
},
|
|
181
|
+
color: { default: () => O.TEAL },
|
|
182
|
+
counter: {},
|
|
183
|
+
disabled: {
|
|
184
|
+
type: Boolean,
|
|
185
|
+
default: !1
|
|
186
|
+
},
|
|
187
|
+
icon: {},
|
|
188
|
+
iconBackground: { default: () => k.NEUTRAL },
|
|
189
|
+
initialLength: { default: 1 },
|
|
190
|
+
name: {},
|
|
191
|
+
shape: { default: () => D.CIRCLE },
|
|
192
|
+
showName: {
|
|
193
|
+
type: Boolean,
|
|
194
|
+
default: !0
|
|
195
|
+
},
|
|
196
|
+
size: { default: () => E.SIZE_40 },
|
|
197
|
+
src: {}
|
|
198
|
+
},
|
|
199
|
+
setup(e) {
|
|
200
|
+
let t = S(), n = _(!1), i = (e) => typeof e == "number" || typeof e == "string", a = s(() => {
|
|
201
|
+
if (i(t.tabindex)) return t.tabindex;
|
|
202
|
+
if (i(t.tabIndex)) return t.tabIndex;
|
|
203
|
+
}), p = s(() => i(t.tabindex) || i(t.tabIndex)), b = s(() => e.disabled ? -1 : p.value ? a.value : 0), w = s(() => ({
|
|
204
|
+
...t,
|
|
205
|
+
tabindex: b.value
|
|
206
|
+
})), E = s(() => [
|
|
207
|
+
`s-ui-avatar--size-${e.size}`,
|
|
208
|
+
`s-ui-avatar--shape-${e.shape}`,
|
|
209
|
+
Z(e.color),
|
|
210
|
+
`s-ui-avatar--icon-background-${e.iconBackground}`,
|
|
211
|
+
{
|
|
212
|
+
"s-ui-avatar--bordered": e.bordered,
|
|
213
|
+
"s-ui-avatar--disabled": e.disabled,
|
|
214
|
+
"s-ui-avatar--icon": k.value,
|
|
215
|
+
"s-ui-avatar--photo": O.value
|
|
216
|
+
}
|
|
217
|
+
]), D = s(() => {
|
|
218
|
+
if (!k.value) return Q(e.color);
|
|
219
|
+
}), O = s(() => !!(e.src && !n.value)), k = s(() => !!(!O.value && e.icon)), A = (e) => {
|
|
220
|
+
let t = e.split(/\s+/).filter(Boolean);
|
|
221
|
+
if (t.length === 1) {
|
|
222
|
+
let e = t[0];
|
|
223
|
+
if (e) return e;
|
|
224
|
+
}
|
|
225
|
+
return t.map((e) => e.slice(0, 1)).join("");
|
|
226
|
+
}, j = s(() => e.name ? A(e.name) : ""), P = s(() => e.alt ? e.alt : e.name ? e.name : j.value), F = s(() => {
|
|
227
|
+
if (e.alt) return e.alt;
|
|
228
|
+
if (e.name) return e.name;
|
|
229
|
+
}), I = s(() => j.value.slice(0, Math.max(e.initialLength, 0))), L = s(() => M[e.size]), R = s(() => N[e.size]), { avatarBadgeItemsProps: z } = K({
|
|
230
|
+
badge: () => e.badge,
|
|
231
|
+
counter: () => e.counter,
|
|
232
|
+
size: () => e.size
|
|
233
|
+
}), B = () => {
|
|
234
|
+
n.value = !0;
|
|
235
|
+
};
|
|
236
|
+
return C(() => e.src, () => {
|
|
237
|
+
n.value = !1;
|
|
238
|
+
}), (t, i) => (g(), u("span", m(w.value, {
|
|
239
|
+
class: ["s-ui-avatar", E.value],
|
|
240
|
+
style: D.value,
|
|
241
|
+
"aria-disabled": e.disabled || void 0
|
|
242
|
+
}), [d("span", ee, [e.src && !n.value ? (g(), u("img", {
|
|
243
|
+
key: 0,
|
|
244
|
+
class: "s-ui-avatar__image",
|
|
245
|
+
src: e.src,
|
|
246
|
+
alt: P.value,
|
|
247
|
+
onError: B
|
|
248
|
+
}, null, 40, te)) : e.icon ? (g(), u("span", ne, [f(x(T), {
|
|
249
|
+
name: e.icon,
|
|
250
|
+
size: R.value,
|
|
251
|
+
"aria-label": F.value
|
|
252
|
+
}, null, 8, [
|
|
253
|
+
"name",
|
|
254
|
+
"size",
|
|
255
|
+
"aria-label"
|
|
256
|
+
])])) : (g(), u("span", {
|
|
257
|
+
key: 2,
|
|
258
|
+
class: h(["s-ui-avatar__initials", L.value]),
|
|
259
|
+
role: e.alt ? "img" : void 0,
|
|
260
|
+
"aria-label": e.alt
|
|
261
|
+
}, y(I.value), 11, re)), (g(!0), u(o, null, v(x(z), (e) => (g(), c(x(r), m({ key: e.placement }, { ref_for: !0 }, e), null, 16))), 128))]), e.showName && e.name ? (g(), u("span", ie, y(e.name), 1)) : l("", !0)], 16, $));
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
//#endregion
|
|
265
|
+
export { D as a, k as i, A as n, E as o, O as r, ae as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./SAvatar-
|
|
1
|
+
const e=require("./SAvatar-C2gekygl.cjs"),t=require("./SOverflowGroup-DyVUzkNu.cjs");let n=require("vue");var r=function(e){return e.EXTRA_SMALL=`extra-small`,e.SMALL=`small`,e.MEDIUM=`medium`,e}({}),i={class:`s-ui-avatar-group__overflow`},a=(0,n.defineComponent)({__name:`SAvatarGroup`,props:{disabled:{type:Boolean,default:!1},maxVisible:{},size:{default:()=>r.SMALL}},setup(a){let o=(0,n.computed)(()=>[`s-ui-avatar-group--size-${a.size}`,{"s-ui-avatar-group--disabled":a.disabled}]),s={[r.EXTRA_SMALL]:e.o.SIZE_16,[r.SMALL]:e.o.SIZE_20,[r.MEDIUM]:e.o.SIZE_24},c=(0,n.computed)(()=>s[a.size]),l=(e,t)=>({"--s-ui-avatar-group-item-z-index":e-t}),u=(t,r)=>t.type===e.t?(0,n.cloneVNode)(t,{...a.disabled?{disabled:!0}:{},showName:!1,size:c.value,style:l(r.visibleCount,r.visibleIndex)}):t;return(e,r)=>((0,n.openBlock)(),(0,n.createBlock)(t.t,{class:(0,n.normalizeClass)([`s-ui-avatar-group`,o.value]),role:`group`,"aria-disabled":a.disabled||void 0,"cluster-class":`s-ui-avatar-group__cluster`,"max-visible":a.maxVisible,"map-vnode":u},{overflow:(0,n.withCtx)(({overflowLabel:e})=>[(0,n.createElementVNode)(`span`,i,(0,n.toDisplayString)(e),1)]),default:(0,n.withCtx)(()=>[(0,n.renderSlot)(e.$slots,`default`)]),_:3},8,[`class`,`aria-disabled`,`max-visible`]))}});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as e, t } from "./SAvatar-
|
|
1
|
+
import { o as e, t } from "./SAvatar-DAfDAqrP.js";
|
|
2
2
|
import { t as n } from "./SOverflowGroup-CVSon6Eg.js";
|
|
3
3
|
import { cloneVNode as r, computed as i, createBlock as a, createElementVNode as o, defineComponent as s, normalizeClass as c, openBlock as l, renderSlot as u, toDisplayString as d, withCtx as f } from "vue";
|
|
4
4
|
//#region src/components/SAvatarGroup/SAvatarGroup.types.ts
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { a as e, r as t } from "./colorValue-DXJiNKGE.js";
|
|
2
|
+
import { i as n, n as r, o as i, r as a } from "./useSelectionGroup-cKj38lEN.js";
|
|
3
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, defineComponent as d, mergeModels as f, mergeProps as p, onScopeDispose as m, openBlock as h, renderList as g, renderSlot as _, shallowReactive as v, unref as y, useModel as b, useSlots as x } from "vue";
|
|
4
|
+
import { ESColorSwatchSize as S, SColorSwatch as C } from "@shtabapp/ui-kit-primitives";
|
|
5
|
+
//#region src/utils/color/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.RED = "red", e;
|
|
8
|
+
}({}), T = /* @__PURE__ */ function(e) {
|
|
9
|
+
return e.HEX = "hex", e.RGB = "rgb", e.HSL = "hsl", e;
|
|
10
|
+
}({}), E = [
|
|
11
|
+
w.RED_ORANGE,
|
|
12
|
+
w.ORANGE,
|
|
13
|
+
w.YELLOW,
|
|
14
|
+
w.GREEN,
|
|
15
|
+
w.TEAL,
|
|
16
|
+
w.CYAN,
|
|
17
|
+
w.BLUE,
|
|
18
|
+
w.INDIGO,
|
|
19
|
+
w.VIOLET,
|
|
20
|
+
w.MAGENTA,
|
|
21
|
+
w.PINK
|
|
22
|
+
], D = [
|
|
23
|
+
w.RED_ORANGE,
|
|
24
|
+
w.ORANGE,
|
|
25
|
+
w.YELLOW,
|
|
26
|
+
w.GREEN,
|
|
27
|
+
w.TEAL,
|
|
28
|
+
w.CYAN,
|
|
29
|
+
w.BLUE,
|
|
30
|
+
w.INDIGO,
|
|
31
|
+
w.VIOLET,
|
|
32
|
+
w.MAGENTA,
|
|
33
|
+
w.PINK
|
|
34
|
+
], O = [
|
|
35
|
+
"primary",
|
|
36
|
+
"secondary",
|
|
37
|
+
"tertiary"
|
|
38
|
+
], k = (e, t) => `var(--s-ui-color-background-accent-${e}-${t})`, A = [
|
|
39
|
+
"var(--s-ui-color-icon-surface-primary)",
|
|
40
|
+
"var(--s-ui-color-icon-surface-tertiary)",
|
|
41
|
+
"var(--s-ui-color-icon-surface-disabled)"
|
|
42
|
+
], j = [...(() => {
|
|
43
|
+
let e = [];
|
|
44
|
+
for (let t of D) for (let n of O) e.push(k(t, n));
|
|
45
|
+
return e;
|
|
46
|
+
})(), ...A], M = /* @__PURE__ */ function(e) {
|
|
47
|
+
return e.ROW = "row", e.GRID = "grid", e;
|
|
48
|
+
}({}), N = ["aria-disabled"], P = {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: "s-ui-color-palette__append"
|
|
51
|
+
}, F = /* @__PURE__ */ d({
|
|
52
|
+
__name: "SColorPalette",
|
|
53
|
+
props: /*@__PURE__*/ f({
|
|
54
|
+
layout: { default: () => M.ROW },
|
|
55
|
+
disabled: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !1
|
|
58
|
+
},
|
|
59
|
+
colors: {},
|
|
60
|
+
size: { default: () => S.SIZE_40 }
|
|
61
|
+
}, {
|
|
62
|
+
modelValue: {},
|
|
63
|
+
modelModifiers: {}
|
|
64
|
+
}),
|
|
65
|
+
emits: /*@__PURE__*/ f(["select"], ["update:modelValue"]),
|
|
66
|
+
setup(d, { emit: f }) {
|
|
67
|
+
let S = b(d, "modelValue"), w = f, T = x(), D = s(() => d.colors === void 0 ? E : d.colors), O = i({
|
|
68
|
+
modelValue: () => S.value,
|
|
69
|
+
onUpdateModelValue: (e) => {
|
|
70
|
+
n(e) && (S.value = e, w("select", e));
|
|
71
|
+
},
|
|
72
|
+
mode: r.SINGLE,
|
|
73
|
+
orientation: a.HORIZONTAL,
|
|
74
|
+
orderedValues: () => D.value,
|
|
75
|
+
compareValues: t,
|
|
76
|
+
loop: !0
|
|
77
|
+
}), k = v(/* @__PURE__ */ new Map()), A = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), M = (e, t) => `${String(e)}-${t}`, F = (e) => e && (e instanceof HTMLElement || "$el" in e) ? e : null, I = (e, t) => {
|
|
78
|
+
let n = M(e, t), r = j.get(n);
|
|
79
|
+
if (r) return r;
|
|
80
|
+
let i = (t) => {
|
|
81
|
+
let r = A.get(n), i = F(t);
|
|
82
|
+
if (!t) {
|
|
83
|
+
r && (r(), A.delete(n)), k.delete(n);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!i || k.get(n) === i && r) return;
|
|
87
|
+
r && (r(), A.delete(n)), k.set(n, i);
|
|
88
|
+
let a = O.registerItem({
|
|
89
|
+
value: e,
|
|
90
|
+
el: () => k.get(n) ?? null,
|
|
91
|
+
disabled: () => d.disabled
|
|
92
|
+
});
|
|
93
|
+
A.set(n, a);
|
|
94
|
+
};
|
|
95
|
+
return j.set(n, i), i;
|
|
96
|
+
};
|
|
97
|
+
m(() => {
|
|
98
|
+
for (let e of A.values()) e();
|
|
99
|
+
A.clear(), k.clear(), j.clear();
|
|
100
|
+
});
|
|
101
|
+
let L = (e) => d.disabled ? -1 : O.getItemTabIndex(e), R = (e, t) => {
|
|
102
|
+
if (d.disabled) {
|
|
103
|
+
t.preventDefault(), t.stopPropagation();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
O.select(e);
|
|
107
|
+
}, z = (e, t) => {
|
|
108
|
+
d.disabled || O.handleItemKeydown(t, e);
|
|
109
|
+
}, B = s(() => [`s-ui-color-palette--layout-${d.layout}`, {
|
|
110
|
+
"s-ui-color-palette--disabled": d.disabled,
|
|
111
|
+
"s-ui-color-palette--has-append": !!T.append
|
|
112
|
+
}]);
|
|
113
|
+
return (t, n) => (h(), u("div", p({
|
|
114
|
+
class: ["s-ui-color-palette", B.value],
|
|
115
|
+
role: "radiogroup",
|
|
116
|
+
"aria-disabled": d.disabled || void 0
|
|
117
|
+
}, t.$attrs), [(h(!0), u(o, null, g(D.value, (t, n) => (h(), c(y(C), {
|
|
118
|
+
key: `${String(t)}-${n}`,
|
|
119
|
+
ref_for: !0,
|
|
120
|
+
ref: I(t, n),
|
|
121
|
+
role: "radio",
|
|
122
|
+
class: "s-ui-color-palette__swatch",
|
|
123
|
+
color: y(e)(t),
|
|
124
|
+
size: d.size,
|
|
125
|
+
selected: y(O).isSelected(t),
|
|
126
|
+
disabled: d.disabled,
|
|
127
|
+
"aria-checked": y(O).isSelected(t) ? "true" : "false",
|
|
128
|
+
"aria-label": String(t),
|
|
129
|
+
tabindex: L(t),
|
|
130
|
+
onClick: (e) => R(t, e),
|
|
131
|
+
onKeydown: (e) => z(t, e)
|
|
132
|
+
}, null, 8, [
|
|
133
|
+
"color",
|
|
134
|
+
"size",
|
|
135
|
+
"selected",
|
|
136
|
+
"disabled",
|
|
137
|
+
"aria-checked",
|
|
138
|
+
"aria-label",
|
|
139
|
+
"tabindex",
|
|
140
|
+
"onClick",
|
|
141
|
+
"onKeydown"
|
|
142
|
+
]))), 128)), y(T).append ? (h(), u("div", P, [_(t.$slots, "append")])) : l("", !0)], 16, N));
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
//#endregion
|
|
146
|
+
export { w as a, E as i, M as n, T as o, j as r, F as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./colorValue-DClAEDHr.cjs"),t=require("./useSelectionGroup-TaektE-I.cjs");let n=require("vue"),r=require("@shtabapp/ui-kit-primitives");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.RED=`red`,e}({}),a=function(e){return e.HEX=`hex`,e.RGB=`rgb`,e.HSL=`hsl`,e}({}),o=[i.RED_ORANGE,i.ORANGE,i.YELLOW,i.GREEN,i.TEAL,i.CYAN,i.BLUE,i.INDIGO,i.VIOLET,i.MAGENTA,i.PINK],s=[i.RED_ORANGE,i.ORANGE,i.YELLOW,i.GREEN,i.TEAL,i.CYAN,i.BLUE,i.INDIGO,i.VIOLET,i.MAGENTA,i.PINK],c=[`primary`,`secondary`,`tertiary`],l=(e,t)=>`var(--s-ui-color-background-accent-${e}-${t})`,u=[`var(--s-ui-color-icon-surface-primary)`,`var(--s-ui-color-icon-surface-tertiary)`,`var(--s-ui-color-icon-surface-disabled)`],d=[...(()=>{let e=[];for(let t of s)for(let n of c)e.push(l(t,n));return e})(),...u],f=function(e){return e.ROW=`row`,e.GRID=`grid`,e}({}),p=[`aria-disabled`],m={key:0,class:`s-ui-color-palette__append`},h=(0,n.defineComponent)({__name:`SColorPalette`,props:(0,n.mergeModels)({layout:{default:()=>f.ROW},disabled:{type:Boolean,default:!1},colors:{},size:{default:()=>r.ESColorSwatchSize.SIZE_40}},{modelValue:{},modelModifiers:{}}),emits:(0,n.mergeModels)([`select`],[`update:modelValue`]),setup(i,{emit:a}){let s=(0,n.useModel)(i,`modelValue`),c=a,l=(0,n.useSlots)(),u=(0,n.computed)(()=>i.colors===void 0?o:i.colors),d=t.o({modelValue:()=>s.value,onUpdateModelValue:e=>{t.i(e)&&(s.value=e,c(`select`,e))},mode:t.n.SINGLE,orientation:t.r.HORIZONTAL,orderedValues:()=>u.value,compareValues:e.r,loop:!0}),f=(0,n.shallowReactive)(new Map),h=new Map,g=new Map,_=(e,t)=>`${String(e)}-${t}`,v=e=>e&&(e instanceof HTMLElement||`$el`in e)?e:null,y=(e,t)=>{let n=_(e,t),r=g.get(n);if(r)return r;let a=t=>{let r=h.get(n),a=v(t);if(!t){r&&(r(),h.delete(n)),f.delete(n);return}if(!a||f.get(n)===a&&r)return;r&&(r(),h.delete(n)),f.set(n,a);let o=d.registerItem({value:e,el:()=>f.get(n)??null,disabled:()=>i.disabled});h.set(n,o)};return g.set(n,a),a};(0,n.onScopeDispose)(()=>{for(let e of h.values())e();h.clear(),f.clear(),g.clear()});let b=e=>i.disabled?-1:d.getItemTabIndex(e),x=(e,t)=>{if(i.disabled){t.preventDefault(),t.stopPropagation();return}d.select(e)},S=(e,t)=>{i.disabled||d.handleItemKeydown(t,e)},C=(0,n.computed)(()=>[`s-ui-color-palette--layout-${i.layout}`,{"s-ui-color-palette--disabled":i.disabled,"s-ui-color-palette--has-append":!!l.append}]);return(t,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,(0,n.mergeProps)({class:[`s-ui-color-palette`,C.value],role:`radiogroup`,"aria-disabled":i.disabled||void 0},t.$attrs),[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(u.value,(t,a)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.SColorSwatch),{key:`${String(t)}-${a}`,ref_for:!0,ref:y(t,a),role:`radio`,class:`s-ui-color-palette__swatch`,color:(0,n.unref)(e.a)(t),size:i.size,selected:(0,n.unref)(d).isSelected(t),disabled:i.disabled,"aria-checked":(0,n.unref)(d).isSelected(t)?`true`:`false`,"aria-label":String(t),tabindex:b(t),onClick:e=>x(t,e),onKeydown:e=>S(t,e)},null,8,[`color`,`size`,`selected`,`disabled`,`aria-checked`,`aria-label`,`tabindex`,`onClick`,`onKeydown`]))),128)),(0,n.unref)(l).append?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,m,[(0,n.renderSlot)(t.$slots,`append`)])):(0,n.createCommentVNode)(``,!0)],16,p))}});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 f}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|