@oneb/ui-vue 0.1.66 → 0.1.67
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/dist/buttonGroup/OneButtonGroup.vue.d.ts +2 -0
- package/dist/buttonGroup/index.d.ts +2 -0
- package/dist/buttonGroup/props.d.ts +30 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +157 -130
- package/package.json +5 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Component } from "vue";
|
|
2
|
+
interface ButtonGroupElement {
|
|
3
|
+
label: string;
|
|
4
|
+
key: string;
|
|
5
|
+
icon?: Component;
|
|
6
|
+
}
|
|
7
|
+
export declare const propsButtonGroup: {
|
|
8
|
+
buttons: {
|
|
9
|
+
type: {
|
|
10
|
+
(arrayLength: number): ButtonGroupElement[];
|
|
11
|
+
(...items: ButtonGroupElement[]): ButtonGroupElement[];
|
|
12
|
+
new (arrayLength: number): ButtonGroupElement[];
|
|
13
|
+
new (...items: ButtonGroupElement[]): ButtonGroupElement[];
|
|
14
|
+
isArray(arg: any): arg is any[];
|
|
15
|
+
readonly prototype: any[];
|
|
16
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
17
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
18
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
19
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
20
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
21
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
22
|
+
};
|
|
23
|
+
default: any[];
|
|
24
|
+
};
|
|
25
|
+
modelValue: {
|
|
26
|
+
required: boolean;
|
|
27
|
+
type: PropType<any>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-9f8735d9.cjs"),f=require("./card/index.cjs"),p=require("./form/index.cjs"),m=require("./OneHelpMenu-cf061c6f.cjs"),_=require("./dropdown/index.cjs"),h=require("./common/index.cjs"),e=require("vue"),y=require("./_plugin-vue_export-helper-f246444f.cjs");require("./XMarkIcon-f94baa4c.cjs");const w={color:{type:String,default:"red"},size:{type:String,default:"sm"},text:{type:String,default:""},variant:{type:String,default:"indicators"},bargeVariant:{type:String,default:"stand"}},C={class:"px-1 font-semibold",style:{color:"white"}},O=e.defineComponent({__name:"OneIndicators",props:{...w},setup(u){const t=u,l=e.computed(()=>{switch(t.color){case"green":return"#22c55e";case"blue":return"#3b82f6";case"red":return"#ef4444";case"yellow":return"#eab308";default:return"#E3ECF2"}}),d=e.computed(()=>{let s="",r="",a;return t.text?t.size==="sm"?(r="min-w-[12px]",a="textSm"):t.size==="md"?(r="min-w-[16px]",a="textMd"):t.size==="lg"&&(r="min-w-[20px]",a="textLg"):t.size==="sm"?s="w-3 min-w-[12px]":t.size==="lg"?s="w-5 min-w-[20px]":t.size==="md"&&(s="w-4 min-w-[16px]"),`${s} ${a} ${r} h-${t.size==="sm"?3:t.size==="lg"?5:4}`}),o=e.computed(()=>{let s="",r="",a;return t.text?t.size==="sm"?(r="min-w-[44px]",a="textMd"):t.size==="md"?(r="min-w-[58px]",a="text10"):t.size==="lg"&&(r="min-w-[68px]",a="text-sm"):t.size==="sm"?s="min-w-[44px]":t.size==="lg"?s="min-w-[68px]":t.size==="md"&&(s="min-w-[58px]"),`${s} ${a} ${r} h-${t.size==="sm"?5:t.size==="lg"?7:6}`}),i=e.computed(()=>{const s=t.bargeVariant==="stand"?"1A":"",r=t.bargeVariant==="stand"?"1px solid":"none";return{backgroundColor:`${l.value}${s}`,border:r,borderColor:l.value}});return(s,r)=>t.variant==="indicators"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["rounded-full border border-white flex items-center justify-center w-max",[d.value]]),style:e.normalizeStyle({backgroundColor:l.value})},[e.createElementVNode("p",C,e.toDisplayString(s.text),1)],6)):t.variant==="barge"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["rounded px-2 py-1 text-center w-max",[o.value,{"rounded-full":s.bargeVariant==="round",rounded:s.bargeVariant!=="round"}]]),style:e.normalizeStyle([i.value])},[e.createElementVNode("p",{class:"font-medium",style:e.normalizeStyle({color:s.bargeVariant!=="stand"?"white":l.value})},e.toDisplayString(s.text),5)],6)):e.createCommentVNode("",!0)}});const b=y._export_sfc(O,[["__scopeId","data-v-3d58c944"]]),k=e.defineComponent({__name:"OneLabel",props:{size:{type:String,default:"standard"},color:{type:String,default:"blue"},filled:{type:Boolean,default:!0},text:{type:String,default:"Label"}},setup(u){const t=u,l=e.ref(!1),d=e.computed(()=>{const s="inline-flex items-center cursor-pointer transition-opacity rounded-full",r=t.size==="mini"?"text-xs px-3 py-1":"text-sm px-4 py-2",a=t.filled?`${t.color}-filled`:`${t.color}-border`;return`${s} ${r} ${a} ${l.value?"opacity-80":"hover:opacity-90"}`}),o=()=>{l.value=!0},i=()=>{l.value=!1};return(s,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(d.value),onMousedown:o,onMouseup:i,onMouseleave:i},[e.createElementVNode("span",null,e.toDisplayString(u.text),1)],34))}});const z=e.defineComponent({__name:"OneCollapse",props:{blockClass:{},titleClass:{},defaultOpen:{type:Boolean}},setup(u){const t=u,{blockClass:l,titleClass:d,defaultOpen:o}=e.toRefs(t),i=e.ref(null),s=e.ref((o==null?void 0:o.value)??!1),r=()=>{s.value=!s.value},a=c=>{const n=c;n.style.height="0"},v=c=>{const n=c;n.style.height=`${c.scrollHeight}px`,n.style.transition="height 0.3s ease"},x=c=>{const n=c;n.style.height=`${c.scrollHeight}px`,e.nextTick(()=>{n.style.height="0",n.style.transition="height 0.3s ease"})};return(c,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(l))},[e.createElementVNode("div",{onClick:r,class:e.normalizeClass(e.unref(d))},[e.renderSlot(c.$slots,"title",{isOpen:s.value},void 0,!0)],2),e.createVNode(e.Transition,{name:"accordion",onBeforeEnter:a,onEnter:v,onLeave:x},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{ref_key:"content",ref:i},[e.renderSlot(c.$slots,"default",{},void 0,!0)],512),[[e.vShow,s.value]])]),_:3})],2))}});const B=y._export_sfc(z,[["__scopeId","data-v-1c2c0817"]]);const S={},E={class:"spinner",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",style:{animation:"one-sp-ico-rot 2.7s linear infinite"}};function V(u,t){return e.openBlock(),e.createElementBlock("svg",E,t[0]||(t[0]=[e.createElementVNode("circle",{style:{"stroke-linecap":"round",animation:"one-sp-ico-dash 1.7s ease-in-out infinite"},class:"opacity-75",cx:"12",cy:"12",r:"8",fill:"none",stroke:"currentColor","stroke-width":"2"},null,-1)]))}const $=y._export_sfc(S,[["render",V]]),F={color:{type:String,default:"green"},size:{type:String,default:"md"},modelValue:{type:Boolean,default:!1},isLoading:{required:!1,type:Boolean,default:!1},disabled:{required:!1,type:Boolean,default:!1},textOn:{type:String,default:""},textOff:{type:String,default:""},iconOn:{type:[Function,Object]},iconOff:{type:[Function,Object]},iconClass:{type:[String,Array]}},D=["disabled","checked"],I=e.defineComponent({__name:"OneSwitch",props:F,emits:["update:modelValue"],setup(u,{emit:t}){const l=u,d=t,o=e.ref(l.modelValue),i=e.computed(()=>l.disabled),s=()=>{o.value=!o.value,d("update:modelValue",o.value)};e.watch(()=>l.modelValue,n=>{o.value=n});const r=e.computed(()=>l.size==="sm"?"w-max min-w-[40px] h-[20px]":l.size==="lg"?"w-max min-w-[60px] h-[31px]":l.size==="md"?"w-max min-w-[50px] h-[24px]":"w-max"),a=e.computed(()=>{if(o.value)switch(l.color){case"green":return"#86c94c";case"blue":return"#2196f3";case"red":return"#f44336";case"yellow":return"#ffeb3b";default:return"#86c94c"}else return"#E2E7EF"}),v=e.computed(()=>l.iconOn),x=e.computed(()=>l.iconOff),c=e.computed(()=>{const n=[];return typeof l.iconClass=="string"?n.push(l.iconClass):l.iconClass instanceof Array&&n.push(...l.iconClass),n});return(n,H)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("input",{type:"checkbox",disabled:n.disabled,checked:o.value,class:"hidden w-96",onClick:s},null,8,D),e.createElementVNode("div",{onClick:s,class:e.normalizeClass(["relative rounded-full cursor-pointer flex items-center",[r.value,n.isLoading?"loading":"",i.value?"disabled opacity-50 pointer-events-none":""]]),style:e.normalizeStyle({backgroundColor:i.value?"#ccc":a.value})},[e.createElementVNode("div",{class:e.normalizeClass(["bg-white absolute rounded-full",[n.size==="sm"?"w-[16px] h-[16px]":"",n.size==="md"?"w-[20px] h-[20px]":"",n.size==="lg"?"w-[27px] h-[27px]":"",o.value?"right-[2px] top-[2px]":"left-[2px] top-[2px]"]])},[e.createElementVNode("div",{class:e.normalizeClass(["circle",r.value])},[n.isLoading?(e.openBlock(),e.createBlock($,{key:0,class:"absolute w-3 h-3 text-gray-400 left-1/2 top-1/2 -ml-1.5 -mt-1.5"})):o.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(v.value),{key:1,class:e.normalizeClass([c.value,"absolute w-3 h-3 text-gray-400 left-1/2 top-1/2 -ml-1.5 -mt-1.5"]),style:e.normalizeStyle({color:o.value?a.value:""})},null,8,["class","style"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(x.value),{key:2,class:e.normalizeClass([c.value,"absolute w-3 h-3 text-gray-400 left-1/2 top-1/2 -ml-1.5 -mt-1.5"])},null,8,["class"]))],2)],2),o.value&&n.textOn?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["switch-text text-white",[n.size==="sm"?"text-xs pr-6 pl-2":"",n.size==="md"?"text-sm pr-6 pl-2":"",n.size==="lg"?"text-base pr-8 pl-2":""]])},e.toDisplayString(n.textOn),3)):!o.value&&n.textOff?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["switch-text w-max",[n.size==="sm"?"text-xs pl-6 pr-2":"",n.size==="md"?"text-sm pl-7 pr-2":"",n.size==="lg"?"text-base pl-8 pr-2":""]])},e.toDisplayString(n.textOff),3)):e.createCommentVNode("",!0)],6)],64))}});const M=y._export_sfc(I,[["__scopeId","data-v-d0ecef0b"]]),N={buttons:{type:Array,default:[]},modelValue:{required:!1,type:[String,Number,Array,Boolean,Object,null]}},L={class:"flex text-xs space-x-0.5 bg-gray-100 p-0.5 rounded-md"},q=["onClick"],A=e.defineComponent({__name:"OneButtonGroup",props:N,emits:["update:modelValue"],setup(u,{emit:t}){const l=t;return(d,o)=>(e.openBlock(),e.createElementBlock("div",L,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.buttons,i=>(e.openBlock(),e.createElementBlock("button",{key:i.key,class:e.normalizeClass([{"bg-white":i.key==d.modelValue,"text-blue-600":i.key==d.modelValue},"h-[32px] w-full transition-all px-3 rounded-md hover:text-blue-600"]),onClick:s=>l("update:modelValue",i.key)},e.toDisplayString(i.label),11,q))),128))]))}});exports.OneButton=g._sfc_main;exports.OneCard=f.OneCard;exports.OneCardBody=f.OneCardBody;exports.OneCardFooter=f.OneCardFooter;exports.OneCardHeader=f.OneCardHeader;exports.OneForm=p.OneForm;exports.OneFormFeedback=p.OneFormFeedback;exports.OneFormField=p.OneFormField;exports.OneFormInput=p.OneFormInput;exports.OneFormLabel=p.OneFormLabel;exports.OneBrowserMenu=m.OneBrowserMenu;exports.OneDropdown=m._sfc_main$1;exports.OneDropdownItem=m._sfc_main$2;exports.OneHelpMenu=m.OneHelpMenu;exports.OneUserMenu=m._sfc_main;exports.OneBrowserMenuGrid=_.OneBrowserMenuGrid;exports.OneDropdownAuto=_.OneDropdownAuto;exports.OneDropdownDivider=_.OneDropdownDivider;exports.OneAvatar=h.OneAvatar;exports.OneButtonGroup=A;exports.OneCollapse=B;exports.OneIndicators=b;exports.OneLabel=k;exports.OneSwitch=M;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { OneCard as
|
|
3
|
-
import { OneForm as
|
|
4
|
-
import { d as
|
|
5
|
-
import { OneBrowserMenuGrid as
|
|
6
|
-
import { OneAvatar as
|
|
7
|
-
import { defineComponent as
|
|
8
|
-
import { _
|
|
1
|
+
import { _ as ce } from "./index-f8afb6b6.js";
|
|
2
|
+
import { OneCard as de, OneCardBody as pe, OneCardFooter as me, OneCardHeader as fe } from "./card/index.js";
|
|
3
|
+
import { OneForm as ye, OneFormFeedback as ve, OneFormField as he, OneFormInput as ge, OneFormLabel as _e } from "./form/index.js";
|
|
4
|
+
import { d as be, e as Oe, f as Ce, O as ze, _ as ke } from "./OneHelpMenu-9c4bb5a6.js";
|
|
5
|
+
import { OneBrowserMenuGrid as Se, OneDropdownAuto as Ve, OneDropdownDivider as Be } from "./dropdown/index.js";
|
|
6
|
+
import { OneAvatar as Ee } from "./common/index.js";
|
|
7
|
+
import { defineComponent as h, computed as p, openBlock as i, createElementBlock as m, normalizeClass as u, normalizeStyle as v, createElementVNode as x, toDisplayString as y, createCommentVNode as $, ref as g, toRefs as V, unref as C, renderSlot as z, createVNode as B, Transition as I, withCtx as E, withDirectives as F, vShow as L, nextTick as M, watch as D, Fragment as S, createBlock as O, resolveDynamicComponent as k, renderList as A } from "vue";
|
|
8
|
+
import { _ } from "./_plugin-vue_export-helper-dad06003.js";
|
|
9
9
|
import "./XMarkIcon-51ef0691.js";
|
|
10
|
-
const
|
|
10
|
+
const j = {
|
|
11
11
|
color: {
|
|
12
12
|
type: String,
|
|
13
13
|
default: "red"
|
|
@@ -28,16 +28,16 @@ const A = {
|
|
|
28
28
|
type: String,
|
|
29
29
|
default: "stand"
|
|
30
30
|
}
|
|
31
|
-
},
|
|
31
|
+
}, G = {
|
|
32
32
|
class: "px-1 font-semibold",
|
|
33
33
|
style: { color: "white" }
|
|
34
|
-
},
|
|
34
|
+
}, H = /* @__PURE__ */ h({
|
|
35
35
|
__name: "OneIndicators",
|
|
36
36
|
props: {
|
|
37
|
-
...
|
|
37
|
+
...j
|
|
38
38
|
},
|
|
39
|
-
setup(
|
|
40
|
-
const e =
|
|
39
|
+
setup(f) {
|
|
40
|
+
const e = f, n = p(() => {
|
|
41
41
|
switch (e.color) {
|
|
42
42
|
case "green":
|
|
43
43
|
return "#22c55e";
|
|
@@ -50,39 +50,39 @@ const A = {
|
|
|
50
50
|
default:
|
|
51
51
|
return "#E3ECF2";
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
54
|
-
let s = "",
|
|
55
|
-
return e.text ? e.size === "sm" ? (
|
|
56
|
-
}),
|
|
57
|
-
let s = "",
|
|
58
|
-
return e.text ? e.size === "sm" ? (
|
|
59
|
-
}),
|
|
60
|
-
const s = e.bargeVariant === "stand" ? "1A" : "",
|
|
53
|
+
}), d = p(() => {
|
|
54
|
+
let s = "", o = "", a;
|
|
55
|
+
return e.text ? e.size === "sm" ? (o = "min-w-[12px]", a = "textSm") : e.size === "md" ? (o = "min-w-[16px]", a = "textMd") : e.size === "lg" && (o = "min-w-[20px]", a = "textLg") : e.size === "sm" ? s = "w-3 min-w-[12px]" : e.size === "lg" ? s = "w-5 min-w-[20px]" : e.size === "md" && (s = "w-4 min-w-[16px]"), `${s} ${a} ${o} h-${e.size === "sm" ? 3 : e.size === "lg" ? 5 : 4}`;
|
|
56
|
+
}), l = p(() => {
|
|
57
|
+
let s = "", o = "", a;
|
|
58
|
+
return e.text ? e.size === "sm" ? (o = "min-w-[44px]", a = "textMd") : e.size === "md" ? (o = "min-w-[58px]", a = "text10") : e.size === "lg" && (o = "min-w-[68px]", a = "text-sm") : e.size === "sm" ? s = "min-w-[44px]" : e.size === "lg" ? s = "min-w-[68px]" : e.size === "md" && (s = "min-w-[58px]"), `${s} ${a} ${o} h-${e.size === "sm" ? 5 : e.size === "lg" ? 7 : 6}`;
|
|
59
|
+
}), r = p(() => {
|
|
60
|
+
const s = e.bargeVariant === "stand" ? "1A" : "", o = e.bargeVariant === "stand" ? "1px solid" : "none";
|
|
61
61
|
return {
|
|
62
62
|
backgroundColor: `${n.value}${s}`,
|
|
63
|
-
border:
|
|
63
|
+
border: o,
|
|
64
64
|
borderColor: n.value
|
|
65
65
|
};
|
|
66
66
|
});
|
|
67
|
-
return (s,
|
|
67
|
+
return (s, o) => e.variant === "indicators" ? (i(), m("div", {
|
|
68
68
|
key: 0,
|
|
69
|
-
class:
|
|
69
|
+
class: u(["rounded-full border border-white flex items-center justify-center w-max", [d.value]]),
|
|
70
70
|
style: v({ backgroundColor: n.value })
|
|
71
71
|
}, [
|
|
72
|
-
|
|
73
|
-
], 6)) : e.variant === "barge" ? (
|
|
72
|
+
x("p", G, y(s.text), 1)
|
|
73
|
+
], 6)) : e.variant === "barge" ? (i(), m("div", {
|
|
74
74
|
key: 1,
|
|
75
|
-
class:
|
|
76
|
-
style: v([
|
|
75
|
+
class: u(["rounded px-2 py-1 text-center w-max", [l.value, { "rounded-full": s.bargeVariant === "round", rounded: s.bargeVariant !== "round" }]]),
|
|
76
|
+
style: v([r.value])
|
|
77
77
|
}, [
|
|
78
|
-
|
|
78
|
+
x("p", {
|
|
79
79
|
class: "font-medium",
|
|
80
80
|
style: v({ color: s.bargeVariant !== "stand" ? "white" : n.value })
|
|
81
81
|
}, y(s.text), 5)
|
|
82
82
|
], 6)) : $("", !0);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
const
|
|
85
|
+
const se = /* @__PURE__ */ _(H, [["__scopeId", "data-v-3d58c944"]]), ne = /* @__PURE__ */ h({
|
|
86
86
|
__name: "OneLabel",
|
|
87
87
|
props: {
|
|
88
88
|
size: {
|
|
@@ -106,70 +106,70 @@ const Y = /* @__PURE__ */ w(P, [["__scopeId", "data-v-3d58c944"]]), Z = /* @__PU
|
|
|
106
106
|
// Текст лейблу
|
|
107
107
|
}
|
|
108
108
|
},
|
|
109
|
-
setup(
|
|
110
|
-
const e =
|
|
111
|
-
const s = "inline-flex items-center cursor-pointer transition-opacity rounded-full",
|
|
112
|
-
return `${s} ${
|
|
113
|
-
}),
|
|
109
|
+
setup(f) {
|
|
110
|
+
const e = f, n = g(!1), d = p(() => {
|
|
111
|
+
const s = "inline-flex items-center cursor-pointer transition-opacity rounded-full", o = e.size === "mini" ? "text-xs px-3 py-1" : "text-sm px-4 py-2", a = e.filled ? `${e.color}-filled` : `${e.color}-border`;
|
|
112
|
+
return `${s} ${o} ${a} ${n.value ? "opacity-80" : "hover:opacity-90"}`;
|
|
113
|
+
}), l = () => {
|
|
114
114
|
n.value = !0;
|
|
115
|
-
},
|
|
115
|
+
}, r = () => {
|
|
116
116
|
n.value = !1;
|
|
117
117
|
};
|
|
118
|
-
return (s,
|
|
119
|
-
class:
|
|
120
|
-
onMousedown:
|
|
121
|
-
onMouseup:
|
|
122
|
-
onMouseleave:
|
|
118
|
+
return (s, o) => (i(), m("div", {
|
|
119
|
+
class: u(d.value),
|
|
120
|
+
onMousedown: l,
|
|
121
|
+
onMouseup: r,
|
|
122
|
+
onMouseleave: r
|
|
123
123
|
}, [
|
|
124
|
-
|
|
124
|
+
x("span", null, y(f.text), 1)
|
|
125
125
|
], 34));
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
const
|
|
128
|
+
const N = /* @__PURE__ */ h({
|
|
129
129
|
__name: "OneCollapse",
|
|
130
130
|
props: {
|
|
131
131
|
blockClass: {},
|
|
132
132
|
titleClass: {},
|
|
133
133
|
defaultOpen: { type: Boolean }
|
|
134
134
|
},
|
|
135
|
-
setup(
|
|
136
|
-
const e =
|
|
135
|
+
setup(f) {
|
|
136
|
+
const e = f, { blockClass: n, titleClass: d, defaultOpen: l } = V(e), r = g(null), s = g((l == null ? void 0 : l.value) ?? !1), o = () => {
|
|
137
137
|
s.value = !s.value;
|
|
138
|
-
}, a = (
|
|
139
|
-
const t =
|
|
138
|
+
}, a = (c) => {
|
|
139
|
+
const t = c;
|
|
140
140
|
t.style.height = "0";
|
|
141
|
-
},
|
|
142
|
-
const t =
|
|
143
|
-
t.style.height = `${
|
|
144
|
-
}, b = (
|
|
145
|
-
const t =
|
|
146
|
-
t.style.height = `${
|
|
141
|
+
}, w = (c) => {
|
|
142
|
+
const t = c;
|
|
143
|
+
t.style.height = `${c.scrollHeight}px`, t.style.transition = "height 0.3s ease";
|
|
144
|
+
}, b = (c) => {
|
|
145
|
+
const t = c;
|
|
146
|
+
t.style.height = `${c.scrollHeight}px`, M(() => {
|
|
147
147
|
t.style.height = "0", t.style.transition = "height 0.3s ease";
|
|
148
148
|
});
|
|
149
149
|
};
|
|
150
|
-
return (
|
|
151
|
-
class:
|
|
150
|
+
return (c, t) => (i(), m("div", {
|
|
151
|
+
class: u(C(n))
|
|
152
152
|
}, [
|
|
153
|
-
|
|
154
|
-
onClick:
|
|
155
|
-
class:
|
|
153
|
+
x("div", {
|
|
154
|
+
onClick: o,
|
|
155
|
+
class: u(C(d))
|
|
156
156
|
}, [
|
|
157
|
-
z(
|
|
157
|
+
z(c.$slots, "title", { isOpen: s.value }, void 0, !0)
|
|
158
158
|
], 2),
|
|
159
|
-
I
|
|
159
|
+
B(I, {
|
|
160
160
|
name: "accordion",
|
|
161
161
|
onBeforeEnter: a,
|
|
162
|
-
onEnter:
|
|
162
|
+
onEnter: w,
|
|
163
163
|
onLeave: b
|
|
164
164
|
}, {
|
|
165
|
-
default:
|
|
166
|
-
|
|
165
|
+
default: E(() => [
|
|
166
|
+
F(x("div", {
|
|
167
167
|
ref_key: "content",
|
|
168
|
-
ref:
|
|
168
|
+
ref: r
|
|
169
169
|
}, [
|
|
170
|
-
z(
|
|
170
|
+
z(c.$slots, "default", {}, void 0, !0)
|
|
171
171
|
], 512), [
|
|
172
|
-
[
|
|
172
|
+
[L, s.value]
|
|
173
173
|
])
|
|
174
174
|
]),
|
|
175
175
|
_: 3
|
|
@@ -177,16 +177,16 @@ const j = /* @__PURE__ */ g({
|
|
|
177
177
|
], 2));
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
const
|
|
181
|
-
const
|
|
180
|
+
const le = /* @__PURE__ */ _(N, [["__scopeId", "data-v-1c2c0817"]]);
|
|
181
|
+
const P = {}, q = {
|
|
182
182
|
class: "spinner",
|
|
183
183
|
xmlns: "http://www.w3.org/2000/svg",
|
|
184
184
|
viewBox: "0 0 24 24",
|
|
185
185
|
style: { animation: "one-sp-ico-rot 2.7s linear infinite" }
|
|
186
186
|
};
|
|
187
|
-
function R(
|
|
188
|
-
return
|
|
189
|
-
|
|
187
|
+
function R(f, e) {
|
|
188
|
+
return i(), m("svg", q, e[0] || (e[0] = [
|
|
189
|
+
x("circle", {
|
|
190
190
|
style: { "stroke-linecap": "round", animation: "one-sp-ico-dash 1.7s ease-in-out infinite" },
|
|
191
191
|
class: "opacity-75",
|
|
192
192
|
cx: "12",
|
|
@@ -198,7 +198,7 @@ function R(p, e) {
|
|
|
198
198
|
}, null, -1)
|
|
199
199
|
]));
|
|
200
200
|
}
|
|
201
|
-
const T = /* @__PURE__ */
|
|
201
|
+
const T = /* @__PURE__ */ _(P, [["render", R]]), W = {
|
|
202
202
|
color: {
|
|
203
203
|
type: String,
|
|
204
204
|
default: "green"
|
|
@@ -238,19 +238,19 @@ const T = /* @__PURE__ */ w(N, [["render", R]]), W = {
|
|
|
238
238
|
iconClass: {
|
|
239
239
|
type: [String, Array]
|
|
240
240
|
}
|
|
241
|
-
},
|
|
241
|
+
}, U = ["disabled", "checked"], J = /* @__PURE__ */ h({
|
|
242
242
|
__name: "OneSwitch",
|
|
243
243
|
props: W,
|
|
244
244
|
emits: ["update:modelValue"],
|
|
245
|
-
setup(
|
|
246
|
-
const n =
|
|
247
|
-
|
|
245
|
+
setup(f, { emit: e }) {
|
|
246
|
+
const n = f, d = e, l = g(n.modelValue), r = p(() => n.disabled), s = () => {
|
|
247
|
+
l.value = !l.value, d("update:modelValue", l.value);
|
|
248
248
|
};
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
D(() => n.modelValue, (t) => {
|
|
250
|
+
l.value = t;
|
|
251
251
|
});
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
252
|
+
const o = p(() => n.size === "sm" ? "w-max min-w-[40px] h-[20px]" : n.size === "lg" ? "w-max min-w-[60px] h-[31px]" : n.size === "md" ? "w-max min-w-[50px] h-[24px]" : "w-max"), a = p(() => {
|
|
253
|
+
if (l.value)
|
|
254
254
|
switch (n.color) {
|
|
255
255
|
case "green":
|
|
256
256
|
return "#86c94c";
|
|
@@ -265,61 +265,61 @@ const T = /* @__PURE__ */ w(N, [["render", R]]), W = {
|
|
|
265
265
|
}
|
|
266
266
|
else
|
|
267
267
|
return "#E2E7EF";
|
|
268
|
-
}),
|
|
268
|
+
}), w = p(() => n.iconOn), b = p(() => n.iconOff), c = p(() => {
|
|
269
269
|
const t = [];
|
|
270
270
|
return typeof n.iconClass == "string" ? t.push(n.iconClass) : n.iconClass instanceof Array && t.push(...n.iconClass), t;
|
|
271
271
|
});
|
|
272
|
-
return (t,
|
|
273
|
-
|
|
272
|
+
return (t, Y) => (i(), m(S, null, [
|
|
273
|
+
x("input", {
|
|
274
274
|
type: "checkbox",
|
|
275
275
|
disabled: t.disabled,
|
|
276
|
-
checked:
|
|
276
|
+
checked: l.value,
|
|
277
277
|
class: "hidden w-96",
|
|
278
278
|
onClick: s
|
|
279
|
-
}, null, 8,
|
|
280
|
-
|
|
279
|
+
}, null, 8, U),
|
|
280
|
+
x("div", {
|
|
281
281
|
onClick: s,
|
|
282
|
-
class:
|
|
283
|
-
|
|
282
|
+
class: u(["relative rounded-full cursor-pointer flex items-center", [
|
|
283
|
+
o.value,
|
|
284
284
|
t.isLoading ? "loading" : "",
|
|
285
|
-
|
|
285
|
+
r.value ? "disabled opacity-50 pointer-events-none" : ""
|
|
286
286
|
]]),
|
|
287
|
-
style: v({ backgroundColor:
|
|
287
|
+
style: v({ backgroundColor: r.value ? "#ccc" : a.value })
|
|
288
288
|
}, [
|
|
289
|
-
|
|
290
|
-
class:
|
|
289
|
+
x("div", {
|
|
290
|
+
class: u(["bg-white absolute rounded-full", [
|
|
291
291
|
t.size === "sm" ? "w-[16px] h-[16px]" : "",
|
|
292
292
|
t.size === "md" ? "w-[20px] h-[20px]" : "",
|
|
293
293
|
t.size === "lg" ? "w-[27px] h-[27px]" : "",
|
|
294
|
-
|
|
294
|
+
l.value ? "right-[2px] top-[2px]" : "left-[2px] top-[2px]"
|
|
295
295
|
]])
|
|
296
296
|
}, [
|
|
297
|
-
|
|
298
|
-
class:
|
|
297
|
+
x("div", {
|
|
298
|
+
class: u(["circle", o.value])
|
|
299
299
|
}, [
|
|
300
|
-
t.isLoading ? (
|
|
300
|
+
t.isLoading ? (i(), O(T, {
|
|
301
301
|
key: 0,
|
|
302
302
|
class: "absolute w-3 h-3 text-gray-400 left-1/2 top-1/2 -ml-1.5 -mt-1.5"
|
|
303
|
-
})) :
|
|
303
|
+
})) : l.value ? (i(), O(k(w.value), {
|
|
304
304
|
key: 1,
|
|
305
|
-
class:
|
|
306
|
-
style: v({ color:
|
|
307
|
-
}, null, 8, ["class", "style"])) : (
|
|
305
|
+
class: u([c.value, "absolute w-3 h-3 text-gray-400 left-1/2 top-1/2 -ml-1.5 -mt-1.5"]),
|
|
306
|
+
style: v({ color: l.value ? a.value : "" })
|
|
307
|
+
}, null, 8, ["class", "style"])) : (i(), O(k(b.value), {
|
|
308
308
|
key: 2,
|
|
309
|
-
class:
|
|
309
|
+
class: u([c.value, "absolute w-3 h-3 text-gray-400 left-1/2 top-1/2 -ml-1.5 -mt-1.5"])
|
|
310
310
|
}, null, 8, ["class"]))
|
|
311
311
|
], 2)
|
|
312
312
|
], 2),
|
|
313
|
-
|
|
313
|
+
l.value && t.textOn ? (i(), m("div", {
|
|
314
314
|
key: 0,
|
|
315
|
-
class:
|
|
315
|
+
class: u(["switch-text text-white", [
|
|
316
316
|
t.size === "sm" ? "text-xs pr-6 pl-2" : "",
|
|
317
317
|
t.size === "md" ? "text-sm pr-6 pl-2" : "",
|
|
318
318
|
t.size === "lg" ? "text-base pr-8 pl-2" : ""
|
|
319
319
|
]])
|
|
320
|
-
}, y(t.textOn), 3)) : !
|
|
320
|
+
}, y(t.textOn), 3)) : !l.value && t.textOff ? (i(), m("div", {
|
|
321
321
|
key: 1,
|
|
322
|
-
class:
|
|
322
|
+
class: u(["switch-text w-max", [
|
|
323
323
|
t.size === "sm" ? "text-xs pl-6 pr-2" : "",
|
|
324
324
|
t.size === "md" ? "text-sm pl-7 pr-2" : "",
|
|
325
325
|
t.size === "lg" ? "text-base pl-8 pr-2" : ""
|
|
@@ -329,29 +329,56 @@ const T = /* @__PURE__ */ w(N, [["render", R]]), W = {
|
|
|
329
329
|
], 64));
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
|
-
const
|
|
332
|
+
const oe = /* @__PURE__ */ _(J, [["__scopeId", "data-v-d0ecef0b"]]), K = {
|
|
333
|
+
buttons: {
|
|
334
|
+
type: Array,
|
|
335
|
+
default: []
|
|
336
|
+
},
|
|
337
|
+
modelValue: {
|
|
338
|
+
required: !1,
|
|
339
|
+
type: [String, Number, Array, Boolean, Object, null]
|
|
340
|
+
}
|
|
341
|
+
}, Q = { class: "flex text-xs space-x-0.5 bg-gray-100 p-0.5 rounded-md" }, X = ["onClick"], ae = /* @__PURE__ */ h({
|
|
342
|
+
__name: "OneButtonGroup",
|
|
343
|
+
props: K,
|
|
344
|
+
emits: ["update:modelValue"],
|
|
345
|
+
setup(f, { emit: e }) {
|
|
346
|
+
const n = e;
|
|
347
|
+
return (d, l) => (i(), m("div", Q, [
|
|
348
|
+
(i(!0), m(S, null, A(d.buttons, (r) => (i(), m("button", {
|
|
349
|
+
key: r.key,
|
|
350
|
+
class: u([{
|
|
351
|
+
"bg-white": r.key == d.modelValue,
|
|
352
|
+
"text-blue-600": r.key == d.modelValue
|
|
353
|
+
}, "h-[32px] w-full transition-all px-3 rounded-md hover:text-blue-600"]),
|
|
354
|
+
onClick: (s) => n("update:modelValue", r.key)
|
|
355
|
+
}, y(r.label), 11, X))), 128))
|
|
356
|
+
]));
|
|
357
|
+
}
|
|
358
|
+
});
|
|
333
359
|
export {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
ae as
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
360
|
+
Ee as OneAvatar,
|
|
361
|
+
be as OneBrowserMenu,
|
|
362
|
+
Se as OneBrowserMenuGrid,
|
|
363
|
+
ce as OneButton,
|
|
364
|
+
ae as OneButtonGroup,
|
|
365
|
+
de as OneCard,
|
|
366
|
+
pe as OneCardBody,
|
|
367
|
+
me as OneCardFooter,
|
|
368
|
+
fe as OneCardHeader,
|
|
369
|
+
le as OneCollapse,
|
|
370
|
+
Oe as OneDropdown,
|
|
371
|
+
Ve as OneDropdownAuto,
|
|
372
|
+
Be as OneDropdownDivider,
|
|
373
|
+
Ce as OneDropdownItem,
|
|
374
|
+
ye as OneForm,
|
|
375
|
+
ve as OneFormFeedback,
|
|
376
|
+
he as OneFormField,
|
|
377
|
+
ge as OneFormInput,
|
|
378
|
+
_e as OneFormLabel,
|
|
379
|
+
ze as OneHelpMenu,
|
|
380
|
+
se as OneIndicators,
|
|
381
|
+
ne as OneLabel,
|
|
382
|
+
oe as OneSwitch,
|
|
383
|
+
ke as OneUserMenu
|
|
357
384
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneb/ui-vue",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.67",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"types": "./dist/button/index.d.ts",
|
|
30
30
|
"import": "./dist/button/index.js"
|
|
31
31
|
},
|
|
32
|
+
"./buttonGroup": {
|
|
33
|
+
"types": "./dist/buttonGroup/index.d.ts",
|
|
34
|
+
"import": "./dist/buttonGroup/index.js"
|
|
35
|
+
},
|
|
32
36
|
"./form": {
|
|
33
37
|
"types": "./dist/form/index.d.ts",
|
|
34
38
|
"import": "./dist/form/index.js"
|