scq-vue 1.0.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/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # scq-vue
2
+
3
+ Vue 3 component library with Button and Input.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add scq-vue
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Global install
14
+
15
+ ```ts
16
+ import { createApp } from 'vue'
17
+ import App from './App.vue'
18
+ import ScqVue from 'scq-vue'
19
+ import 'scq-vue/style.css'
20
+
21
+ createApp(App).use(ScqVue).mount('#app')
22
+ ```
23
+
24
+ ### On-demand import
25
+
26
+ ```ts
27
+ import { Button, Input } from 'scq-vue'
28
+ import 'scq-vue/style.css'
29
+ ```
30
+
31
+ ### On-demand style import
32
+
33
+ ```ts
34
+ import { Button, Input } from 'scq-vue'
35
+ import 'scq-vue/styles/button.css'
36
+ import 'scq-vue/styles/input.css'
37
+ ```
38
+
39
+ ## Components
40
+
41
+ - Button
42
+ - Input
43
+
44
+ ## Development
45
+
46
+ ```bash
47
+ pnpm install
48
+ pnpm dev
49
+ pnpm build
50
+ pnpm dev:play
51
+ ```
52
+
53
+ ## Publish
54
+
55
+ 1. Update version in package.json
56
+ 2. Build package
57
+
58
+ ```bash
59
+ pnpm build
60
+ ```
61
+
62
+ 3. Login and publish
63
+
64
+ ```bash
65
+ npm login
66
+ npm publish
67
+ ```
68
+
69
+ ## Build output
70
+
71
+ - dist/scq-vue.es.js
72
+ - dist/scq-vue.umd.js
73
+ - dist/style.css
74
+ - dist/types
@@ -0,0 +1,290 @@
1
+ import { computed as g, openBlock as s, createElementBlock as i, normalizeClass as f, createElementVNode as y, createCommentVNode as r, renderSlot as v, defineComponent as P, ref as x, normalizeStyle as $, withModifiers as q, toDisplayString as E } from "vue";
2
+ const S = (e, d) => {
3
+ const o = e.__vccOpts || e;
4
+ for (const [n, u] of d)
5
+ o[n] = u;
6
+ return o;
7
+ }, M = ["disabled", "type", "autofocus"], N = {
8
+ key: 0,
9
+ class: "my-btn__loading",
10
+ "aria-hidden": "true"
11
+ }, R = /* @__PURE__ */ Object.assign({
12
+ name: "Button"
13
+ }, {
14
+ __name: "Button",
15
+ props: {
16
+ type: {
17
+ type: String,
18
+ default: "default",
19
+ validator: (e) => ["default", "primary", "success", "warning", "info", "danger"].includes(e)
20
+ },
21
+ size: {
22
+ type: String,
23
+ default: "default",
24
+ validator: (e) => ["large", "default", "small"].includes(e)
25
+ },
26
+ plain: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ round: {
31
+ type: Boolean,
32
+ default: !1
33
+ },
34
+ circle: {
35
+ type: Boolean,
36
+ default: !1
37
+ },
38
+ loading: {
39
+ type: Boolean,
40
+ default: !1
41
+ },
42
+ text: {
43
+ type: Boolean,
44
+ default: !1
45
+ },
46
+ bg: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ link: {
51
+ type: Boolean,
52
+ default: !1
53
+ },
54
+ nativeType: {
55
+ type: String,
56
+ default: "button",
57
+ validator: (e) => ["button", "submit", "reset"].includes(e)
58
+ },
59
+ autofocus: {
60
+ type: Boolean,
61
+ default: !1
62
+ },
63
+ disabled: {
64
+ type: Boolean,
65
+ default: !1
66
+ }
67
+ },
68
+ emits: ["click"],
69
+ setup(e, { emit: d }) {
70
+ const o = e, n = d, u = g(() => o.disabled || o.loading), m = (c) => {
71
+ u.value || n("click", c);
72
+ };
73
+ return (c, p) => (s(), i("button", {
74
+ class: f([
75
+ "my-btn",
76
+ `my-btn--${e.type}`,
77
+ `my-btn--${e.size}`,
78
+ {
79
+ "is-disabled": u.value,
80
+ "is-loading": e.loading,
81
+ "is-plain": e.plain,
82
+ "is-round": e.round,
83
+ "is-circle": e.circle,
84
+ "is-text": e.text,
85
+ "is-link": e.link,
86
+ "is-bg": e.bg
87
+ }
88
+ ]),
89
+ disabled: u.value,
90
+ type: e.nativeType,
91
+ autofocus: e.autofocus,
92
+ onClick: m
93
+ }, [
94
+ e.loading ? (s(), i("span", N, [...p[0] || (p[0] = [
95
+ y("svg", {
96
+ viewBox: "0 0 50 50",
97
+ class: "my-btn__loading-svg"
98
+ }, [
99
+ y("circle", {
100
+ class: "my-btn__loading-path",
101
+ cx: "25",
102
+ cy: "25",
103
+ r: "20",
104
+ fill: "none"
105
+ })
106
+ ], -1)
107
+ ])])) : r("", !0),
108
+ y("span", {
109
+ class: f(["my-btn__content", { "is-hidden": e.loading && e.circle }])
110
+ }, [
111
+ v(c.$slots, "default", {}, void 0, !0)
112
+ ], 2)
113
+ ], 10, M));
114
+ }
115
+ }), b = /* @__PURE__ */ S(R, [["__scopeId", "data-v-a92927da"]]);
116
+ b.install = (e) => {
117
+ e.component(b.name, b);
118
+ };
119
+ const T = {
120
+ key: 0,
121
+ class: "scq-input__group-prepend"
122
+ }, D = { class: "scq-input__wrapper" }, O = {
123
+ key: 0,
124
+ class: "scq-input__prefix"
125
+ }, j = ["value", "placeholder", "disabled", "readonly", "maxlength", "minlength", "name", "id"], A = ["type", "value", "placeholder", "disabled", "readonly", "maxlength", "minlength", "autocomplete", "name", "id"], G = {
126
+ key: 5,
127
+ class: "scq-input__suffix"
128
+ }, H = {
129
+ key: 1,
130
+ class: "scq-input__group-append"
131
+ }, J = /* @__PURE__ */ P({
132
+ name: "Input",
133
+ __name: "Input",
134
+ props: {
135
+ modelValue: { default: "" },
136
+ type: { default: "text" },
137
+ size: { default: "default" },
138
+ placeholder: { default: "" },
139
+ disabled: { type: Boolean, default: !1 },
140
+ readonly: { type: Boolean, default: !1 },
141
+ clearable: { type: Boolean, default: !1 },
142
+ showPassword: { type: Boolean, default: !1 },
143
+ prefixIcon: { default: "" },
144
+ suffixIcon: { default: "" },
145
+ maxlength: {},
146
+ minlength: {},
147
+ autocomplete: { default: "off" },
148
+ name: { default: "" },
149
+ id: { default: "" },
150
+ inputStyle: { default: "" },
151
+ inputClass: { default: "" }
152
+ },
153
+ emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "keydown", "keyup", "compositionstart", "compositionupdate", "compositionend"],
154
+ setup(e, { emit: d }) {
155
+ const o = e, n = d, u = x(), m = x(!1), c = x(!1), p = g(() => o.type === "textarea"), h = g(() => String(o.modelValue ?? "")), V = g(
156
+ () => o.clearable && !o.disabled && !o.readonly && m.value && h.value.length > 0
157
+ ), z = g(
158
+ () => o.showPassword && !p.value && !o.disabled && !o.readonly
159
+ ), B = (l) => {
160
+ const t = l.target.value;
161
+ n("update:modelValue", t), n("input", t);
162
+ }, w = (l) => {
163
+ const t = l.target.value;
164
+ n("change", t);
165
+ }, C = (l) => {
166
+ m.value = !0, n("focus", l);
167
+ }, I = (l) => {
168
+ m.value = !1, n("blur", l);
169
+ }, F = () => {
170
+ var l;
171
+ n("update:modelValue", ""), n("input", ""), n("change", ""), n("clear"), (l = u.value) == null || l.focus();
172
+ }, K = () => {
173
+ var l;
174
+ c.value = !c.value, (l = u.value) == null || l.focus();
175
+ };
176
+ return (l, t) => (s(), i("div", {
177
+ class: f(["scq-input", [
178
+ `scq-input--${e.size}`,
179
+ {
180
+ "is-disabled": e.disabled,
181
+ "is-focus": m.value,
182
+ "is-textarea": p.value
183
+ }
184
+ ]])
185
+ }, [
186
+ l.$slots.prepend ? (s(), i("div", T, [
187
+ v(l.$slots, "prepend", {}, void 0, !0)
188
+ ])) : r("", !0),
189
+ y("div", D, [
190
+ l.$slots.prefix || e.prefixIcon ? (s(), i("span", O, [
191
+ v(l.$slots, "prefix", {}, () => [
192
+ y("i", {
193
+ class: f(e.prefixIcon)
194
+ }, null, 2)
195
+ ], !0)
196
+ ])) : r("", !0),
197
+ p.value ? (s(), i("textarea", {
198
+ key: 1,
199
+ ref_key: "inputRef",
200
+ ref: u,
201
+ class: f(["scq-input__inner scq-textarea__inner", e.inputClass]),
202
+ style: $(e.inputStyle),
203
+ value: h.value,
204
+ placeholder: e.placeholder,
205
+ disabled: e.disabled,
206
+ readonly: e.readonly,
207
+ maxlength: e.maxlength,
208
+ minlength: e.minlength,
209
+ name: e.name,
210
+ id: e.id,
211
+ onInput: B,
212
+ onChange: w,
213
+ onFocus: C,
214
+ onBlur: I,
215
+ onKeydown: t[0] || (t[0] = (a) => n("keydown", a)),
216
+ onKeyup: t[1] || (t[1] = (a) => n("keyup", a)),
217
+ onCompositionstart: t[2] || (t[2] = (a) => n("compositionstart", a)),
218
+ onCompositionupdate: t[3] || (t[3] = (a) => n("compositionupdate", a)),
219
+ onCompositionend: t[4] || (t[4] = (a) => n("compositionend", a))
220
+ }, null, 46, j)) : (s(), i("input", {
221
+ key: 2,
222
+ ref_key: "inputRef",
223
+ ref: u,
224
+ class: f(["scq-input__inner", e.inputClass]),
225
+ style: $(e.inputStyle),
226
+ type: c.value ? "text" : e.type,
227
+ value: h.value,
228
+ placeholder: e.placeholder,
229
+ disabled: e.disabled,
230
+ readonly: e.readonly,
231
+ maxlength: e.maxlength,
232
+ minlength: e.minlength,
233
+ autocomplete: e.autocomplete,
234
+ name: e.name,
235
+ id: e.id,
236
+ onInput: B,
237
+ onChange: w,
238
+ onFocus: C,
239
+ onBlur: I,
240
+ onKeydown: t[5] || (t[5] = (a) => n("keydown", a)),
241
+ onKeyup: t[6] || (t[6] = (a) => n("keyup", a)),
242
+ onCompositionstart: t[7] || (t[7] = (a) => n("compositionstart", a)),
243
+ onCompositionupdate: t[8] || (t[8] = (a) => n("compositionupdate", a)),
244
+ onCompositionend: t[9] || (t[9] = (a) => n("compositionend", a))
245
+ }, null, 46, A)),
246
+ V.value ? (s(), i("span", {
247
+ key: 3,
248
+ class: "scq-input__clear",
249
+ onMousedown: t[10] || (t[10] = q(() => {
250
+ }, ["prevent"])),
251
+ onClick: F
252
+ }, "×", 32)) : r("", !0),
253
+ z.value ? (s(), i("span", {
254
+ key: 4,
255
+ class: "scq-input__password",
256
+ onMousedown: t[11] || (t[11] = q(() => {
257
+ }, ["prevent"])),
258
+ onClick: K
259
+ }, E(c.value ? "🙈" : "👁"), 33)) : r("", !0),
260
+ l.$slots.suffix || e.suffixIcon ? (s(), i("span", G, [
261
+ v(l.$slots, "suffix", {}, () => [
262
+ y("i", {
263
+ class: f(e.suffixIcon)
264
+ }, null, 2)
265
+ ], !0)
266
+ ])) : r("", !0)
267
+ ]),
268
+ l.$slots.append ? (s(), i("div", H, [
269
+ v(l.$slots, "append", {}, void 0, !0)
270
+ ])) : r("", !0)
271
+ ], 2));
272
+ }
273
+ }), k = /* @__PURE__ */ S(J, [["__scopeId", "data-v-e3e12673"]]);
274
+ k.install = (e) => {
275
+ e.component(k.name, k);
276
+ };
277
+ const L = [b, k], Q = (e) => {
278
+ L.forEach((d) => {
279
+ const o = d.name;
280
+ o && e.component(o, d);
281
+ });
282
+ }, W = {
283
+ install: Q
284
+ };
285
+ export {
286
+ b as Button,
287
+ k as Input,
288
+ W as default,
289
+ Q as install
290
+ };
@@ -0,0 +1 @@
1
+ (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i.ScqVue={},i.Vue))})(this,function(i,e){"use strict";const g=(t,c)=>{const s=t.__vccOpts||t;for(const[l,d]of c)s[l]=d;return s},x=["disabled","type","autofocus"],V={key:0,class:"my-btn__loading","aria-hidden":"true"},f=g(Object.assign({name:"Button"},{__name:"Button",props:{type:{type:String,default:"default",validator:t=>["default","primary","success","warning","info","danger"].includes(t)},size:{type:String,default:"default",validator:t=>["large","default","small"].includes(t)},plain:{type:Boolean,default:!1},round:{type:Boolean,default:!1},circle:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},text:{type:Boolean,default:!1},bg:{type:Boolean,default:!1},link:{type:Boolean,default:!1},nativeType:{type:String,default:"button",validator:t=>["button","submit","reset"].includes(t)},autofocus:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:c}){const s=t,l=c,d=e.computed(()=>s.disabled||s.loading),r=u=>{d.value||l("click",u)};return(u,m)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["my-btn",`my-btn--${t.type}`,`my-btn--${t.size}`,{"is-disabled":d.value,"is-loading":t.loading,"is-plain":t.plain,"is-round":t.round,"is-circle":t.circle,"is-text":t.text,"is-link":t.link,"is-bg":t.bg}]),disabled:d.value,type:t.nativeType,autofocus:t.autofocus,onClick:r},[t.loading?(e.openBlock(),e.createElementBlock("span",V,[...m[0]||(m[0]=[e.createElementVNode("svg",{viewBox:"0 0 50 50",class:"my-btn__loading-svg"},[e.createElementVNode("circle",{class:"my-btn__loading-path",cx:"25",cy:"25",r:"20",fill:"none"})],-1)])])):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(["my-btn__content",{"is-hidden":t.loading&&t.circle}])},[e.renderSlot(u.$slots,"default",{},void 0,!0)],2)],10,x))}}),[["__scopeId","data-v-a92927da"]]);f.install=t=>{t.component(f.name,f)};const w={key:0,class:"scq-input__group-prepend"},S={class:"scq-input__wrapper"},E={key:0,class:"scq-input__prefix"},I=["value","placeholder","disabled","readonly","maxlength","minlength","name","id"],$=["type","value","placeholder","disabled","readonly","maxlength","minlength","autocomplete","name","id"],q={key:5,class:"scq-input__suffix"},N={key:1,class:"scq-input__group-append"},p=g(e.defineComponent({name:"Input",__name:"Input",props:{modelValue:{default:""},type:{default:"text"},size:{default:"default"},placeholder:{default:""},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},prefixIcon:{default:""},suffixIcon:{default:""},maxlength:{},minlength:{},autocomplete:{default:"off"},name:{default:""},id:{default:""},inputStyle:{default:""},inputClass:{default:""}},emits:["update:modelValue","input","change","focus","blur","clear","keydown","keyup","compositionstart","compositionupdate","compositionend"],setup(t,{emit:c}){const s=t,l=c,d=e.ref(),r=e.ref(!1),u=e.ref(!1),m=e.computed(()=>s.type==="textarea"),y=e.computed(()=>String(s.modelValue??"")),T=e.computed(()=>s.clearable&&!s.disabled&&!s.readonly&&r.value&&y.value.length>0),P=e.computed(()=>s.showPassword&&!m.value&&!s.disabled&&!s.readonly),B=o=>{const n=o.target.value;l("update:modelValue",n),l("input",n)},b=o=>{const n=o.target.value;l("change",n)},C=o=>{r.value=!0,l("focus",o)},h=o=>{r.value=!1,l("blur",o)},F=()=>{var o;l("update:modelValue",""),l("input",""),l("change",""),l("clear"),(o=d.value)==null||o.focus()},K=()=>{var o;u.value=!u.value,(o=d.value)==null||o.focus()};return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["scq-input",[`scq-input--${t.size}`,{"is-disabled":t.disabled,"is-focus":r.value,"is-textarea":m.value}]])},[o.$slots.prepend?(e.openBlock(),e.createElementBlock("div",w,[e.renderSlot(o.$slots,"prepend",{},void 0,!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",S,[o.$slots.prefix||t.prefixIcon?(e.openBlock(),e.createElementBlock("span",E,[e.renderSlot(o.$slots,"prefix",{},()=>[e.createElementVNode("i",{class:e.normalizeClass(t.prefixIcon)},null,2)],!0)])):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("textarea",{key:1,ref_key:"inputRef",ref:d,class:e.normalizeClass(["scq-input__inner scq-textarea__inner",t.inputClass]),style:e.normalizeStyle(t.inputStyle),value:y.value,placeholder:t.placeholder,disabled:t.disabled,readonly:t.readonly,maxlength:t.maxlength,minlength:t.minlength,name:t.name,id:t.id,onInput:B,onChange:b,onFocus:C,onBlur:h,onKeydown:n[0]||(n[0]=a=>l("keydown",a)),onKeyup:n[1]||(n[1]=a=>l("keyup",a)),onCompositionstart:n[2]||(n[2]=a=>l("compositionstart",a)),onCompositionupdate:n[3]||(n[3]=a=>l("compositionupdate",a)),onCompositionend:n[4]||(n[4]=a=>l("compositionend",a))},null,46,I)):(e.openBlock(),e.createElementBlock("input",{key:2,ref_key:"inputRef",ref:d,class:e.normalizeClass(["scq-input__inner",t.inputClass]),style:e.normalizeStyle(t.inputStyle),type:u.value?"text":t.type,value:y.value,placeholder:t.placeholder,disabled:t.disabled,readonly:t.readonly,maxlength:t.maxlength,minlength:t.minlength,autocomplete:t.autocomplete,name:t.name,id:t.id,onInput:B,onChange:b,onFocus:C,onBlur:h,onKeydown:n[5]||(n[5]=a=>l("keydown",a)),onKeyup:n[6]||(n[6]=a=>l("keyup",a)),onCompositionstart:n[7]||(n[7]=a=>l("compositionstart",a)),onCompositionupdate:n[8]||(n[8]=a=>l("compositionupdate",a)),onCompositionend:n[9]||(n[9]=a=>l("compositionend",a))},null,46,$)),T.value?(e.openBlock(),e.createElementBlock("span",{key:3,class:"scq-input__clear",onMousedown:n[10]||(n[10]=e.withModifiers(()=>{},["prevent"])),onClick:F},"×",32)):e.createCommentVNode("",!0),P.value?(e.openBlock(),e.createElementBlock("span",{key:4,class:"scq-input__password",onMousedown:n[11]||(n[11]=e.withModifiers(()=>{},["prevent"])),onClick:K},e.toDisplayString(u.value?"🙈":"👁"),33)):e.createCommentVNode("",!0),o.$slots.suffix||t.suffixIcon?(e.openBlock(),e.createElementBlock("span",q,[e.renderSlot(o.$slots,"suffix",{},()=>[e.createElementVNode("i",{class:e.normalizeClass(t.suffixIcon)},null,2)],!0)])):e.createCommentVNode("",!0)]),o.$slots.append?(e.openBlock(),e.createElementBlock("div",N,[e.renderSlot(o.$slots,"append",{},void 0,!0)])):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-e3e12673"]]);p.install=t=>{t.component(p.name,p)};const z=[f,p],k=t=>{z.forEach(c=>{const s=c.name;s&&t.component(s,c)})},M={install:k};i.Button=f,i.Input=p,i.default=M,i.install=k,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .my-btn[data-v-a92927da]{--btn-default-text-color: #606266;--btn-default-bg-color: #ffffff;--btn-default-border-color: #dcdfe6;--btn-hover-text-color: #409eff;--btn-hover-bg-color: #ecf5ff;--btn-hover-border-color: #c6e2ff;--btn-active-bg-color: #3a8ee6;--btn-active-border-color: #3a8ee6;--btn-primary-color: #409eff;--btn-success-color: #67c23a;--btn-warning-color: #e6a23c;--btn-danger-color: #f56c6c;--btn-info-color: #909399;display:inline-flex;align-items:center;justify-content:center;gap:6px;box-sizing:border-box;font-weight:500;line-height:1;text-align:center;white-space:nowrap;-webkit-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:8px 16px;height:32px;color:var(--btn-default-text-color);border:1px solid var(--btn-default-border-color);border-radius:4px;background-color:var(--btn-default-bg-color);cursor:pointer;outline:none;transition:.2s}.my-btn[data-v-a92927da]:hover{color:var(--btn-hover-text-color);border-color:var(--btn-hover-border-color);background-color:var(--btn-hover-bg-color)}.my-btn[data-v-a92927da]:active{border-color:var(--btn-active-border-color);background-color:var(--btn-active-bg-color);color:#fff}.my-btn--primary[data-v-a92927da]{color:#fff;border-color:var(--btn-primary-color);background-color:var(--btn-primary-color)}.my-btn--success[data-v-a92927da]{color:#fff;border-color:var(--btn-success-color);background-color:var(--btn-success-color)}.my-btn--warning[data-v-a92927da]{color:#fff;border-color:var(--btn-warning-color);background-color:var(--btn-warning-color)}.my-btn--info[data-v-a92927da]{color:#fff;border-color:var(--btn-info-color);background-color:var(--btn-info-color)}.my-btn--danger[data-v-a92927da]{color:#fff;border-color:var(--btn-danger-color);background-color:var(--btn-danger-color)}.my-btn.is-plain[data-v-a92927da]{background-color:#fff}.my-btn--primary.is-plain[data-v-a92927da]{color:var(--btn-primary-color);border-color:#a0cfff;background-color:#ecf5ff}.my-btn--success.is-plain[data-v-a92927da]{color:var(--btn-success-color);border-color:#b3e19d;background-color:#f0f9eb}.my-btn--warning.is-plain[data-v-a92927da]{color:var(--btn-warning-color);border-color:#f3d19e;background-color:#fdf6ec}.my-btn--info.is-plain[data-v-a92927da]{color:var(--btn-info-color);border-color:#c8c9cc;background-color:#f4f4f5}.my-btn--danger.is-plain[data-v-a92927da]{color:var(--btn-danger-color);border-color:#fab6b6;background-color:#fef0f0}.my-btn--large[data-v-a92927da]{height:40px;padding:12px 20px;font-size:14px}.my-btn--default[data-v-a92927da]{height:32px;padding:8px 16px;font-size:14px}.my-btn--small[data-v-a92927da]{height:24px;padding:5px 11px;font-size:12px}.my-btn.is-round[data-v-a92927da]{border-radius:20px}.my-btn.is-circle[data-v-a92927da]{width:32px;padding:8px;border-radius:50%}.my-btn--large.is-circle[data-v-a92927da]{width:40px;padding:12px}.my-btn--small.is-circle[data-v-a92927da]{width:24px;padding:5px}.my-btn.is-text[data-v-a92927da],.my-btn.is-link[data-v-a92927da]{border-color:transparent;background-color:transparent;padding-left:4px;padding-right:4px}.my-btn.is-text[data-v-a92927da]{color:#606266}.my-btn.is-text.is-bg[data-v-a92927da]{border-radius:4px;background-color:#f5f7fa}.my-btn.is-link[data-v-a92927da]{color:var(--btn-primary-color)}.my-btn.is-disabled[data-v-a92927da]{opacity:.55;cursor:not-allowed;pointer-events:none}.my-btn__content[data-v-a92927da]{display:inline-flex;align-items:center}.my-btn__content.is-hidden[data-v-a92927da]{display:none}.my-btn__loading[data-v-a92927da]{display:inline-flex;width:14px;height:14px}.my-btn__loading-svg[data-v-a92927da]{animation:btn-spin-a92927da .9s linear infinite;width:14px;height:14px}.my-btn__loading-path[data-v-a92927da]{stroke:currentColor;stroke-width:4;stroke-linecap:round;opacity:.9}@keyframes btn-spin-a92927da{to{transform:rotate(360deg)}}.scq-input[data-v-e3e12673]{display:inline-flex;width:100%;color:#303133}.scq-input__wrapper[data-v-e3e12673]{display:inline-flex;align-items:center;width:100%;border:1px solid #dcdfe6;border-radius:4px;background:#fff;transition:border-color .2s}.scq-input.is-focus .scq-input__wrapper[data-v-e3e12673]{border-color:#409eff}.scq-input.is-disabled .scq-input__wrapper[data-v-e3e12673]{background:#f5f7fa;cursor:not-allowed}.scq-input__inner[data-v-e3e12673]{width:100%;border:none;outline:none;background:transparent;color:inherit;padding:8px 12px;font-size:14px}.scq-textarea__inner[data-v-e3e12673]{resize:vertical;min-height:72px}.scq-input--large .scq-input__inner[data-v-e3e12673]{padding:10px 14px;font-size:16px}.scq-input--small .scq-input__inner[data-v-e3e12673]{padding:6px 10px;font-size:12px}.scq-input__prefix[data-v-e3e12673],.scq-input__suffix[data-v-e3e12673],.scq-input__clear[data-v-e3e12673],.scq-input__password[data-v-e3e12673]{display:inline-flex;align-items:center;justify-content:center;color:#909399;padding:0 8px;-webkit-user-select:none;user-select:none}.scq-input__clear[data-v-e3e12673],.scq-input__password[data-v-e3e12673]{cursor:pointer}.scq-input__group-prepend[data-v-e3e12673],.scq-input__group-append[data-v-e3e12673]{display:inline-flex;align-items:center;padding:0 12px;border:1px solid #dcdfe6;background:#f5f7fa;color:#606266;font-size:14px}.scq-input__group-prepend[data-v-e3e12673]{border-right:none;border-radius:4px 0 0 4px}.scq-input__group-append[data-v-e3e12673]{border-left:none;border-radius:0 4px 4px 0}
@@ -0,0 +1,37 @@
1
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
2
+ export default _default;
3
+ type __VLS_WithSlots<T, S> = T & (new () => {
4
+ $slots: S;
5
+ });
6
+ declare const __VLS_component: import("vue").DefineComponent<{}, {
7
+ $emit: (event: "click", ...args: any[]) => void;
8
+ size: string;
9
+ text: boolean;
10
+ type: string;
11
+ disabled: boolean;
12
+ link: boolean;
13
+ circle: boolean;
14
+ plain: boolean;
15
+ round: boolean;
16
+ loading: boolean;
17
+ bg: boolean;
18
+ nativeType: string;
19
+ autofocus: boolean;
20
+ $props: {
21
+ readonly size?: string | undefined;
22
+ readonly text?: boolean | undefined;
23
+ readonly type?: string | undefined;
24
+ readonly disabled?: boolean | undefined;
25
+ readonly link?: boolean | undefined;
26
+ readonly circle?: boolean | undefined;
27
+ readonly plain?: boolean | undefined;
28
+ readonly round?: boolean | undefined;
29
+ readonly loading?: boolean | undefined;
30
+ readonly bg?: boolean | undefined;
31
+ readonly nativeType?: string | undefined;
32
+ readonly autofocus?: boolean | undefined;
33
+ };
34
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
35
+ type __VLS_Slots = {
36
+ default?: ((props: {}) => any) | undefined;
37
+ };
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from 'vue';
2
+ import Button from './Button.vue';
3
+ type SFCWithInstall<T> = T & Plugin;
4
+ declare const _Button: SFCWithInstall<typeof Button>;
5
+ export default _Button;
@@ -0,0 +1,79 @@
1
+ type InputType = 'text' | 'password' | 'textarea' | 'number' | 'email' | 'tel' | 'url' | 'search';
2
+ type InputSize = 'large' | 'default' | 'small';
3
+ type __VLS_Props = {
4
+ modelValue?: string | number;
5
+ type?: InputType;
6
+ size?: InputSize;
7
+ placeholder?: string;
8
+ disabled?: boolean;
9
+ readonly?: boolean;
10
+ clearable?: boolean;
11
+ showPassword?: boolean;
12
+ prefixIcon?: string;
13
+ suffixIcon?: string;
14
+ maxlength?: number;
15
+ minlength?: number;
16
+ autocomplete?: string;
17
+ name?: string;
18
+ id?: string;
19
+ inputStyle?: string | Record<string, string>;
20
+ inputClass?: string;
21
+ };
22
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {};
23
+ type __VLS_Slots = {} & {
24
+ prepend?: (props: typeof __VLS_1) => any;
25
+ } & {
26
+ prefix?: (props: typeof __VLS_3) => any;
27
+ } & {
28
+ suffix?: (props: typeof __VLS_5) => any;
29
+ } & {
30
+ append?: (props: typeof __VLS_7) => any;
31
+ };
32
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
33
+ clear: () => any;
34
+ "update:modelValue": (value: string) => any;
35
+ input: (value: string) => any;
36
+ change: (value: string) => any;
37
+ focus: (evt: FocusEvent) => any;
38
+ blur: (evt: FocusEvent) => any;
39
+ keydown: (evt: KeyboardEvent) => any;
40
+ keyup: (evt: KeyboardEvent) => any;
41
+ compositionstart: (evt: CompositionEvent) => any;
42
+ compositionupdate: (evt: CompositionEvent) => any;
43
+ compositionend: (evt: CompositionEvent) => any;
44
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
45
+ onClear?: (() => any) | undefined;
46
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
47
+ onInput?: ((value: string) => any) | undefined;
48
+ onChange?: ((value: string) => any) | undefined;
49
+ onFocus?: ((evt: FocusEvent) => any) | undefined;
50
+ onBlur?: ((evt: FocusEvent) => any) | undefined;
51
+ onKeydown?: ((evt: KeyboardEvent) => any) | undefined;
52
+ onKeyup?: ((evt: KeyboardEvent) => any) | undefined;
53
+ onCompositionstart?: ((evt: CompositionEvent) => any) | undefined;
54
+ onCompositionupdate?: ((evt: CompositionEvent) => any) | undefined;
55
+ onCompositionend?: ((evt: CompositionEvent) => any) | undefined;
56
+ }>, {
57
+ size: InputSize;
58
+ name: string;
59
+ modelValue: string | number;
60
+ type: InputType;
61
+ placeholder: string;
62
+ disabled: boolean;
63
+ readonly: boolean;
64
+ clearable: boolean;
65
+ showPassword: boolean;
66
+ prefixIcon: string;
67
+ suffixIcon: string;
68
+ autocomplete: string;
69
+ id: string;
70
+ inputStyle: string | Record<string, string>;
71
+ inputClass: string;
72
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
73
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
74
+ export default _default;
75
+ type __VLS_WithSlots<T, S> = T & {
76
+ new (): {
77
+ $slots: S;
78
+ };
79
+ };
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from 'vue';
2
+ import Input from './Input.vue';
3
+ type SFCWithInstall<T> = T & Plugin;
4
+ declare const _Input: SFCWithInstall<typeof Input>;
5
+ export default _Input;
@@ -0,0 +1,7 @@
1
+ import type { App, Plugin } from 'vue';
2
+ import Button from './components/Button';
3
+ import Input from './components/Input';
4
+ declare const install: (app: App) => void;
5
+ declare const ScqVue: Plugin;
6
+ export default ScqVue;
7
+ export { install, Button, Input };
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "scq-vue",
3
+ "version": "1.0.0",
4
+ "description": "A Vue 3 component library",
5
+ "main": "./dist/scq-vue.umd.js",
6
+ "module": "./dist/scq-vue.es.js",
7
+ "types": "./dist/types/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "styles"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/types/index.d.ts",
15
+ "import": "./dist/scq-vue.es.js",
16
+ "require": "./dist/scq-vue.umd.js"
17
+ },
18
+ "./style.css": "./dist/style.css",
19
+ "./styles/index.css": "./styles/index.css",
20
+ "./styles/button.css": "./styles/button.css",
21
+ "./styles/input.css": "./styles/input.css"
22
+ },
23
+ "scripts": {
24
+ "clean": "rimraf dist",
25
+ "build": "pnpm run clean && vite build && vue-tsc -p tsconfig.build.json",
26
+ "dev": "vite",
27
+ "dev:play": "vite --config playground/vite.config.mjs",
28
+ "build:play": "vite build --config playground/vite.config.mjs",
29
+ "prepublishOnly": "pnpm run build",
30
+ "test": "echo \"Error: no test specified\" && exit 1"
31
+ },
32
+ "keywords": [],
33
+ "author": "",
34
+ "license": "ISC",
35
+ "packageManager": "pnpm@10.33.3",
36
+ "peerDependencies": {
37
+ "vue": "^3.3.0"
38
+ },
39
+ "publishConfig": {
40
+ "registry": "https://registry.npmjs.org/"
41
+ },
42
+ "devDependencies": {
43
+ "@vitejs/plugin-vue": "^6.0.6",
44
+ "rimraf": "^6.0.1",
45
+ "sass": "^1.99.0",
46
+ "typescript": "^5.9.3",
47
+ "vite": "^5.4.21",
48
+ "vue": "^3.5.34",
49
+ "vue-router": "^4.6.4",
50
+ "vue-tsc": "^2.2.12"
51
+ }
52
+ }
@@ -0,0 +1,213 @@
1
+ .my-btn {
2
+ --btn-default-text-color: #606266;
3
+ --btn-default-bg-color: #ffffff;
4
+ --btn-default-border-color: #dcdfe6;
5
+ --btn-hover-text-color: #409eff;
6
+ --btn-hover-bg-color: #ecf5ff;
7
+ --btn-hover-border-color: #c6e2ff;
8
+ --btn-active-bg-color: #3a8ee6;
9
+ --btn-active-border-color: #3a8ee6;
10
+ --btn-primary-color: #409eff;
11
+ --btn-success-color: #67c23a;
12
+ --btn-warning-color: #e6a23c;
13
+ --btn-danger-color: #f56c6c;
14
+ --btn-info-color: #909399;
15
+
16
+ display: inline-flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ gap: 6px;
20
+ box-sizing: border-box;
21
+ font-weight: 500;
22
+ line-height: 1;
23
+ text-align: center;
24
+ white-space: nowrap;
25
+ user-select: none;
26
+ vertical-align: middle;
27
+ -webkit-appearance: none;
28
+ appearance: none;
29
+ padding: 8px 16px;
30
+ height: 32px;
31
+ color: var(--btn-default-text-color);
32
+ border: 1px solid var(--btn-default-border-color);
33
+ border-radius: 4px;
34
+ background-color: var(--btn-default-bg-color);
35
+ cursor: pointer;
36
+ outline: none;
37
+ transition: 0.2s;
38
+ }
39
+
40
+ .my-btn:hover {
41
+ color: var(--btn-hover-text-color);
42
+ border-color: var(--btn-hover-border-color);
43
+ background-color: var(--btn-hover-bg-color);
44
+ }
45
+
46
+ .my-btn:active {
47
+ border-color: var(--btn-active-border-color);
48
+ background-color: var(--btn-active-bg-color);
49
+ color: #ffffff;
50
+ }
51
+
52
+ .my-btn--primary {
53
+ color: #ffffff;
54
+ border-color: var(--btn-primary-color);
55
+ background-color: var(--btn-primary-color);
56
+ }
57
+
58
+ .my-btn--success {
59
+ color: #ffffff;
60
+ border-color: var(--btn-success-color);
61
+ background-color: var(--btn-success-color);
62
+ }
63
+
64
+ .my-btn--warning {
65
+ color: #ffffff;
66
+ border-color: var(--btn-warning-color);
67
+ background-color: var(--btn-warning-color);
68
+ }
69
+
70
+ .my-btn--info {
71
+ color: #ffffff;
72
+ border-color: var(--btn-info-color);
73
+ background-color: var(--btn-info-color);
74
+ }
75
+
76
+ .my-btn--danger {
77
+ color: #ffffff;
78
+ border-color: var(--btn-danger-color);
79
+ background-color: var(--btn-danger-color);
80
+ }
81
+
82
+ .my-btn.is-plain {
83
+ background-color: #ffffff;
84
+ }
85
+
86
+ .my-btn--primary.is-plain {
87
+ color: var(--btn-primary-color);
88
+ border-color: #a0cfff;
89
+ background-color: #ecf5ff;
90
+ }
91
+
92
+ .my-btn--success.is-plain {
93
+ color: var(--btn-success-color);
94
+ border-color: #b3e19d;
95
+ background-color: #f0f9eb;
96
+ }
97
+
98
+ .my-btn--warning.is-plain {
99
+ color: var(--btn-warning-color);
100
+ border-color: #f3d19e;
101
+ background-color: #fdf6ec;
102
+ }
103
+
104
+ .my-btn--info.is-plain {
105
+ color: var(--btn-info-color);
106
+ border-color: #c8c9cc;
107
+ background-color: #f4f4f5;
108
+ }
109
+
110
+ .my-btn--danger.is-plain {
111
+ color: var(--btn-danger-color);
112
+ border-color: #fab6b6;
113
+ background-color: #fef0f0;
114
+ }
115
+
116
+ .my-btn--large {
117
+ height: 40px;
118
+ padding: 12px 20px;
119
+ font-size: 14px;
120
+ }
121
+
122
+ .my-btn--default {
123
+ height: 32px;
124
+ padding: 8px 16px;
125
+ font-size: 14px;
126
+ }
127
+
128
+ .my-btn--small {
129
+ height: 24px;
130
+ padding: 5px 11px;
131
+ font-size: 12px;
132
+ }
133
+
134
+ .my-btn.is-round {
135
+ border-radius: 20px;
136
+ }
137
+
138
+ .my-btn.is-circle {
139
+ width: 32px;
140
+ padding: 8px;
141
+ border-radius: 50%;
142
+ }
143
+
144
+ .my-btn--large.is-circle {
145
+ width: 40px;
146
+ padding: 12px;
147
+ }
148
+
149
+ .my-btn--small.is-circle {
150
+ width: 24px;
151
+ padding: 5px;
152
+ }
153
+
154
+ .my-btn.is-text,
155
+ .my-btn.is-link {
156
+ border-color: transparent;
157
+ background-color: transparent;
158
+ padding-left: 4px;
159
+ padding-right: 4px;
160
+ }
161
+
162
+ .my-btn.is-text {
163
+ color: #606266;
164
+ }
165
+
166
+ .my-btn.is-text.is-bg {
167
+ border-radius: 4px;
168
+ background-color: #f5f7fa;
169
+ }
170
+
171
+ .my-btn.is-link {
172
+ color: var(--btn-primary-color);
173
+ }
174
+
175
+ .my-btn.is-disabled {
176
+ opacity: 0.55;
177
+ cursor: not-allowed;
178
+ pointer-events: none;
179
+ }
180
+
181
+ .my-btn__content {
182
+ display: inline-flex;
183
+ align-items: center;
184
+ }
185
+
186
+ .my-btn__content.is-hidden {
187
+ display: none;
188
+ }
189
+
190
+ .my-btn__loading {
191
+ display: inline-flex;
192
+ width: 14px;
193
+ height: 14px;
194
+ }
195
+
196
+ .my-btn__loading-svg {
197
+ animation: btn-spin 0.9s linear infinite;
198
+ width: 14px;
199
+ height: 14px;
200
+ }
201
+
202
+ .my-btn__loading-path {
203
+ stroke: currentColor;
204
+ stroke-width: 4;
205
+ stroke-linecap: round;
206
+ opacity: 0.9;
207
+ }
208
+
209
+ @keyframes btn-spin {
210
+ to {
211
+ transform: rotate(360deg);
212
+ }
213
+ }
@@ -0,0 +1,2 @@
1
+ @import './button.css';
2
+ @import './input.css';
@@ -0,0 +1,87 @@
1
+ .scq-input {
2
+ display: inline-flex;
3
+ width: 100%;
4
+ color: #303133;
5
+ }
6
+
7
+ .scq-input__wrapper {
8
+ display: inline-flex;
9
+ align-items: center;
10
+ width: 100%;
11
+ border: 1px solid #dcdfe6;
12
+ border-radius: 4px;
13
+ background: #fff;
14
+ transition: border-color 0.2s;
15
+ }
16
+
17
+ .scq-input.is-focus .scq-input__wrapper {
18
+ border-color: #409eff;
19
+ }
20
+
21
+ .scq-input.is-disabled .scq-input__wrapper {
22
+ background: #f5f7fa;
23
+ cursor: not-allowed;
24
+ }
25
+
26
+ .scq-input__inner {
27
+ width: 100%;
28
+ border: none;
29
+ outline: none;
30
+ background: transparent;
31
+ color: inherit;
32
+ padding: 8px 12px;
33
+ font-size: 14px;
34
+ }
35
+
36
+ .scq-textarea__inner {
37
+ resize: vertical;
38
+ min-height: 72px;
39
+ }
40
+
41
+ .scq-input--large .scq-input__inner {
42
+ padding: 10px 14px;
43
+ font-size: 16px;
44
+ }
45
+
46
+ .scq-input--small .scq-input__inner {
47
+ padding: 6px 10px;
48
+ font-size: 12px;
49
+ }
50
+
51
+ .scq-input__prefix,
52
+ .scq-input__suffix,
53
+ .scq-input__clear,
54
+ .scq-input__password {
55
+ display: inline-flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ color: #909399;
59
+ padding: 0 8px;
60
+ user-select: none;
61
+ }
62
+
63
+ .scq-input__clear,
64
+ .scq-input__password {
65
+ cursor: pointer;
66
+ }
67
+
68
+ .scq-input__group-prepend,
69
+ .scq-input__group-append {
70
+ display: inline-flex;
71
+ align-items: center;
72
+ padding: 0 12px;
73
+ border: 1px solid #dcdfe6;
74
+ background: #f5f7fa;
75
+ color: #606266;
76
+ font-size: 14px;
77
+ }
78
+
79
+ .scq-input__group-prepend {
80
+ border-right: none;
81
+ border-radius: 4px 0 0 4px;
82
+ }
83
+
84
+ .scq-input__group-append {
85
+ border-left: none;
86
+ border-radius: 0 4px 4px 0;
87
+ }