vui-toolkit 0.0.1

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.
@@ -0,0 +1,289 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.VuiToolkit = {}, global.Vue));
5
+ })(this, (function (exports, vue) { 'use strict';
6
+
7
+ const _hoisted_1$3 = { class: "vui-accordion" };
8
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
9
+ __name: "VuiAccordion",
10
+ props: {
11
+ modelValue: { default: void 0 },
12
+ multiple: { type: Boolean, default: false }
13
+ },
14
+ emits: ["update:modelValue"],
15
+ setup(__props, { emit: __emit }) {
16
+ const props = __props;
17
+ const emit = __emit;
18
+ const internalValue = vue.ref(
19
+ props.multiple ? [] : null
20
+ );
21
+ const isControlled = vue.computed(() => props.modelValue !== void 0);
22
+ const active = vue.computed({
23
+ get() {
24
+ return isControlled.value ? props.modelValue : internalValue.value;
25
+ },
26
+ set(val) {
27
+ if (isControlled.value) {
28
+ emit("update:modelValue", val);
29
+ } else {
30
+ internalValue.value = val ?? null;
31
+ }
32
+ }
33
+ });
34
+ function toggleItem(id) {
35
+ if (props.multiple) {
36
+ const current = Array.isArray(active.value) ? [...active.value] : [];
37
+ const index = current.indexOf(id);
38
+ if (index > -1) {
39
+ current.splice(index, 1);
40
+ } else {
41
+ current.push(id);
42
+ }
43
+ active.value = current;
44
+ } else {
45
+ active.value = active.value === id ? null : id;
46
+ }
47
+ }
48
+ vue.provide("vuiAccordion", {
49
+ active,
50
+ toggleItem,
51
+ multiple: props.multiple
52
+ });
53
+ return (_ctx, _cache) => {
54
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
55
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
56
+ ]);
57
+ };
58
+ }
59
+ });
60
+
61
+ const _export_sfc = (sfc, props) => {
62
+ const target = sfc.__vccOpts || sfc;
63
+ for (const [key, val] of props) {
64
+ target[key] = val;
65
+ }
66
+ return target;
67
+ };
68
+
69
+ const VuiAccordion = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-b0532c49"]]);
70
+
71
+ const _hoisted_1$2 = ["aria-valuenow"];
72
+ const _hoisted_2$2 = {
73
+ key: 1,
74
+ class: "vui-progressbar-fill"
75
+ };
76
+ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
77
+ __name: "VuiProgressBar",
78
+ props: {
79
+ modelValue: {
80
+ type: Number,
81
+ default: 0
82
+ },
83
+ indeterminate: Boolean,
84
+ variant: {
85
+ type: String,
86
+ default: "primary"
87
+ },
88
+ size: {
89
+ type: String,
90
+ default: "md"
91
+ },
92
+ striped: Boolean,
93
+ animated: Boolean
94
+ },
95
+ emits: ["update:modelValue"],
96
+ setup(__props, { emit: __emit }) {
97
+ const props = __props;
98
+ const normalizedValue = vue.computed(() => {
99
+ return Math.min(Math.max(props.modelValue, 0), 100);
100
+ });
101
+ return (_ctx, _cache) => {
102
+ return vue.openBlock(), vue.createElementBlock("div", {
103
+ class: vue.normalizeClass(["vui-progressbar", [
104
+ `vui-progressbar--size-${__props.size}`,
105
+ `vui-progressbar--${__props.variant}`,
106
+ { "vui-progressbar--indeterminate": __props.indeterminate },
107
+ { "vui-progressbar--striped": __props.striped },
108
+ { "vui-progressbar--animated": __props.animated }
109
+ ]]),
110
+ role: "progressbar",
111
+ "aria-valuenow": !__props.indeterminate ? __props.modelValue : void 0,
112
+ "aria-valuemin": "0",
113
+ "aria-valuemax": "100"
114
+ }, [
115
+ !__props.indeterminate ? (vue.openBlock(), vue.createElementBlock("div", {
116
+ key: 0,
117
+ class: "vui-progressbar-fill",
118
+ style: vue.normalizeStyle({ width: normalizedValue.value + "%" })
119
+ }, null, 4)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2))
120
+ ], 10, _hoisted_1$2);
121
+ };
122
+ }
123
+ });
124
+
125
+ const VuiProgressBar = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-551d3aec"]]);
126
+
127
+ const _hoisted_1$1 = {
128
+ key: 0,
129
+ class: "vui-meter-bar-bg"
130
+ };
131
+ const _hoisted_2$1 = {
132
+ key: 1,
133
+ class: "vui-meter-bar-bg vertical"
134
+ };
135
+ const _hoisted_3 = ["viewBox"];
136
+ const _hoisted_4 = ["cy"];
137
+ const _hoisted_5 = ["cy"];
138
+ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
139
+ __name: "VuiStatusMeter",
140
+ props: {
141
+ modelValue: {
142
+ type: Number,
143
+ default: 0
144
+ },
145
+ variant: {
146
+ type: String,
147
+ default: "horizontal"
148
+ },
149
+ color: {
150
+ type: String,
151
+ default: "primary"
152
+ },
153
+ size: {
154
+ type: String,
155
+ default: "md"
156
+ },
157
+ thickness: {
158
+ type: Number,
159
+ default: 8
160
+ },
161
+ max: {
162
+ type: Number,
163
+ default: 100
164
+ }
165
+ },
166
+ emits: ["update:modelValue"],
167
+ setup(__props, { emit: __emit }) {
168
+ const props = __props;
169
+ const normalizedValue = vue.computed(() => {
170
+ const v = Math.min(props.modelValue, props.max);
171
+ return v / props.max * 100;
172
+ });
173
+ const colorClass = vue.computed(() => `vui-meter--${props.color}`);
174
+ const variantClass = vue.computed(() => `vui-meter--${props.variant}`);
175
+ const circumference = 2 * Math.PI * 45;
176
+ const offset = vue.computed(() => {
177
+ if (props.variant === "semi") {
178
+ const semiCirc = Math.PI * 45;
179
+ return semiCirc * (1 - normalizedValue.value / 100);
180
+ }
181
+ return circumference * (1 - normalizedValue.value / 100);
182
+ });
183
+ return (_ctx, _cache) => {
184
+ return vue.openBlock(), vue.createElementBlock("div", {
185
+ class: vue.normalizeClass(["vui-meter", [variantClass.value, colorClass.value, `vui-meter--size-${__props.size}`]])
186
+ }, [
187
+ props.variant === "horizontal" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
188
+ vue.createElementVNode("div", {
189
+ class: "vui-meter-bar-fg",
190
+ style: vue.normalizeStyle({ width: normalizedValue.value + "%" })
191
+ }, null, 4)
192
+ ])) : vue.createCommentVNode("", true),
193
+ props.variant === "vertical" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
194
+ vue.createElementVNode("div", {
195
+ class: "vui-meter-bar-fg",
196
+ style: vue.normalizeStyle({ height: normalizedValue.value + "%" })
197
+ }, null, 4)
198
+ ])) : vue.createCommentVNode("", true),
199
+ props.variant === "circular" || props.variant === "semi" ? (vue.openBlock(), vue.createElementBlock("svg", {
200
+ key: 2,
201
+ class: "vui-meter-svg",
202
+ viewBox: props.variant === "circular" ? "0 0 100 100" : "0 0 100 50"
203
+ }, [
204
+ vue.createElementVNode("circle", {
205
+ class: "vui-meter-bg-circle",
206
+ cx: "50",
207
+ cy: props.variant === "circular" ? 50 : 50,
208
+ r: "45"
209
+ }, null, 8, _hoisted_4),
210
+ vue.createElementVNode("circle", {
211
+ class: vue.normalizeClass(["vui-meter-fg-circle", variantClass.value]),
212
+ cx: "50",
213
+ cy: props.variant === "circular" ? 50 : 50,
214
+ r: "45",
215
+ style: vue.normalizeStyle({
216
+ strokeDasharray: circumference,
217
+ strokeDashoffset: offset.value
218
+ })
219
+ }, null, 14, _hoisted_5)
220
+ ], 8, _hoisted_3)) : vue.createCommentVNode("", true)
221
+ ], 2);
222
+ };
223
+ }
224
+ });
225
+
226
+ const _hoisted_1 = {
227
+ key: 0,
228
+ class: "vui-badge__icon"
229
+ };
230
+ const _hoisted_2 = { class: "vui-badge__label" };
231
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
232
+ __name: "VuiBadge",
233
+ props: {
234
+ type: {
235
+ type: String,
236
+ default: "info"
237
+ },
238
+ variant: {
239
+ type: String,
240
+ default: "solid"
241
+ },
242
+ size: {
243
+ type: String,
244
+ default: "md"
245
+ },
246
+ rounded: {
247
+ type: Boolean,
248
+ default: true
249
+ }
250
+ },
251
+ setup(__props) {
252
+ const props = __props;
253
+ const classes = vue.computed(() => [
254
+ "vui-badge",
255
+ `vui-badge--${props.type}`,
256
+ `vui-badge--${props.variant}`,
257
+ `vui-badge--${props.size}`,
258
+ { "vui-badge--rounded": props.rounded }
259
+ ]);
260
+ return (_ctx, _cache) => {
261
+ return vue.openBlock(), vue.createElementBlock("span", {
262
+ class: vue.normalizeClass(classes.value)
263
+ }, [
264
+ _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, [
265
+ vue.renderSlot(_ctx.$slots, "icon")
266
+ ])) : vue.createCommentVNode("", true),
267
+ vue.createElementVNode("span", _hoisted_2, [
268
+ vue.renderSlot(_ctx.$slots, "default")
269
+ ])
270
+ ], 2);
271
+ };
272
+ }
273
+ });
274
+
275
+ const index = {
276
+ install(app) {
277
+ app.component("VuiBadge", _sfc_main);
278
+ }
279
+ };
280
+
281
+ exports.VuiAccordion = VuiAccordion;
282
+ exports.VuiBadge = _sfc_main;
283
+ exports.VuiProgressBar = VuiProgressBar;
284
+ exports.VuiStatusMeter = _sfc_main$1;
285
+ exports.default = index;
286
+
287
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
288
+
289
+ }));
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "vui-toolkit",
3
+ "private": false,
4
+ "type": "module",
5
+ "version": "0.0.1",
6
+ "main": "./dist/vui-toolkit.umd.cjs",
7
+ "module": "./dist/vui-toolkit.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/vui-toolkit.es.js",
13
+ "require": "./dist/vui-toolkit.umd.js"
14
+ },
15
+ "./dist/vui-toolkit.css": "./dist/vui-toolkit.css"
16
+ },
17
+
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "peerDependencies": {
22
+ "vue": "^3.3.0"
23
+ },
24
+ "scripts": {
25
+ "dev": "vite",
26
+ "types": "vue-tsc -p tsconfig.build.json --emitDeclarationOnly",
27
+ "build": "rm -rf dist && vite build && npm run types",
28
+ "preview": "vite preview"
29
+ },
30
+ "dependencies": {
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^24.10.1",
34
+ "@vitejs/plugin-vue": "^6.0.2",
35
+ "@vue/tsconfig": "^0.8.1",
36
+ "typescript": "~5.9.3",
37
+ "vite": "^7.3.1",
38
+ "vue-tsc": "^3.1.5"
39
+ }
40
+ }