@oottoo-core/oottoo-ui 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.
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # @oottoo-core/oottoo-ui
2
+
3
+ Componentes UI para Vue 3 - Ootto Core.
4
+
5
+ ## 馃摝 Instalaci贸n
6
+
7
+ ```bash
8
+ npm install @oottoo-core/oottoo-ui
9
+ ```
10
+
11
+ ## 馃殌 Uso
12
+
13
+ ```javascript
14
+ import { createApp } from 'vue'
15
+ import oottoUI from '@oottoo-core/oottoo-ui'
16
+ import '@oottoo-core/oottoo-ui/oottoo-ui.css'
17
+
18
+ const app = createApp(App)
19
+ app.use(oottoUI)
20
+ ```
21
+
22
+ ## 馃З Componentes
23
+
24
+ ### OButton
25
+
26
+ ```vue
27
+ <template>
28
+ <o-button variant="primary" @click="handleClick">
29
+ Click me
30
+ </o-button>
31
+ </template>
32
+ ```
33
+
34
+ **Props:**
35
+ - `variant`: 'primary' | 'secondary' | 'ghost'
36
+ - `size`: 'sm' | 'md' | 'lg'
37
+ - `disabled`: boolean
38
+ - `type`: string
39
+
40
+ ### OModal
41
+
42
+ ```vue
43
+ <template>
44
+ <o-modal :is-open="showModal" @close="showModal = false">
45
+ <h2>T铆tulo</h2>
46
+ <p>Contenido</p>
47
+ </o-modal>
48
+ </template>
49
+ ```
50
+
51
+ **Props:**
52
+ - `isOpen`: boolean
53
+ - `zIndex`: number
54
+
55
+ **Events:**
56
+ - `close`: Se emite al cerrar
57
+
58
+ ### OLoading
59
+
60
+ ```vue
61
+ <template>
62
+ <o-loading :loading="isLoading" size="md" color="primary" />
63
+ </template>
64
+ ```
65
+
66
+ **Props:**
67
+ - `loading`: boolean
68
+ - `size`: 'sm' | 'md' | 'lg'
69
+ - `color`: string
70
+
71
+ ### OIcon
72
+
73
+ Requiere `@oottoo-core/oottoo-icons`:
74
+
75
+ ```vue
76
+ <template>
77
+ <o-icon name="home" size="24" color="#3b82f6" />
78
+ </template>
79
+ ```
80
+
81
+ **Props:**
82
+ - `name`: string (requerido)
83
+ - `size`: number | string
84
+ - `color`: string
85
+
86
+ ## 馃搫 Licencia
87
+
88
+ MIT - Ootto Core Team
@@ -0,0 +1 @@
1
+ .o-modal-enter-active[data-v-11d6d987],.o-modal-leave-active[data-v-11d6d987]{transition:opacity var(--o-transition-base)}.o-modal-enter-from[data-v-11d6d987],.o-modal-leave-to[data-v-11d6d987]{opacity:0}
@@ -0,0 +1,228 @@
1
+ import { computed as i, openBlock as a, createElementBlock as c, normalizeClass as y, renderSlot as m, onMounted as g, onUnmounted as h, createBlock as v, Teleport as k, createVNode as _, Transition as z, withCtx as O, withModifiers as b, normalizeStyle as u, createElementVNode as d, createCommentVNode as p, inject as w } from "vue";
2
+ const x = ["disabled", "type"], S = {
3
+ __name: "OButton",
4
+ props: {
5
+ /**
6
+ * Variante visual del bot贸n
7
+ * @values 'primary', 'secondary', 'ghost'
8
+ */
9
+ variant: {
10
+ type: String,
11
+ default: "primary",
12
+ validator: (e) => ["primary", "secondary", "ghost"].includes(e)
13
+ },
14
+ /**
15
+ * Tama帽o del bot贸n
16
+ * @values 'sm', 'md', 'lg'
17
+ */
18
+ size: {
19
+ type: String,
20
+ default: "md",
21
+ validator: (e) => ["sm", "md", "lg"].includes(e)
22
+ },
23
+ /**
24
+ * Estado deshabilitado
25
+ */
26
+ disabled: {
27
+ type: Boolean,
28
+ default: !1
29
+ },
30
+ /**
31
+ * Tipo de bot贸n HTML
32
+ */
33
+ type: {
34
+ type: String,
35
+ default: "button"
36
+ }
37
+ },
38
+ emits: ["click"],
39
+ setup(e, { emit: o }) {
40
+ const t = e, n = o, s = (l) => {
41
+ t.disabled || n("click", l);
42
+ }, r = i(() => [
43
+ "o-button",
44
+ `o-button--${t.variant}`,
45
+ `o-button--${t.size}`
46
+ ]);
47
+ return (l, f) => (a(), c("button", {
48
+ class: y(r.value),
49
+ disabled: e.disabled,
50
+ type: e.type,
51
+ onClick: s
52
+ }, [
53
+ m(l.$slots, "default")
54
+ ], 10, x));
55
+ }
56
+ }, C = (e, o) => {
57
+ const t = e.__vccOpts || e;
58
+ for (const [n, s] of o)
59
+ t[n] = s;
60
+ return t;
61
+ }, $ = { class: "o-modal-content" }, B = {
62
+ __name: "OModal",
63
+ props: {
64
+ /**
65
+ * Controla la visibilidad del modal
66
+ */
67
+ isOpen: {
68
+ type: Boolean,
69
+ default: !1
70
+ },
71
+ /**
72
+ * Z-index del modal
73
+ */
74
+ zIndex: {
75
+ type: Number,
76
+ default: 50
77
+ }
78
+ },
79
+ emits: ["close"],
80
+ setup(e, { emit: o }) {
81
+ const t = e, n = o, s = () => {
82
+ n("close");
83
+ }, r = (l) => {
84
+ l.key === "Escape" && t.isOpen && s();
85
+ };
86
+ return g(() => {
87
+ document.addEventListener("keydown", r);
88
+ }), h(() => {
89
+ document.removeEventListener("keydown", r);
90
+ }), (l, f) => (a(), v(k, { to: "body" }, [
91
+ _(z, { name: "o-modal" }, {
92
+ default: O(() => [
93
+ e.isOpen ? (a(), c("div", {
94
+ key: 0,
95
+ class: "o-modal-overlay",
96
+ style: u({ zIndex: e.zIndex }),
97
+ onClick: b(s, ["self"])
98
+ }, [
99
+ d("div", $, [
100
+ m(l.$slots, "default", {}, void 0, !0)
101
+ ])
102
+ ], 4)) : p("", !0)
103
+ ]),
104
+ _: 3
105
+ })
106
+ ]));
107
+ }
108
+ }, I = /* @__PURE__ */ C(B, [["__scopeId", "data-v-11d6d987"]]), M = ["width", "height"], L = {
109
+ __name: "OLoading",
110
+ props: {
111
+ /**
112
+ * Controla la visibilidad del spinner
113
+ */
114
+ loading: {
115
+ type: Boolean,
116
+ default: !0
117
+ },
118
+ /**
119
+ * Tama帽o del spinner
120
+ * @values 'sm', 'md', 'lg'
121
+ */
122
+ size: {
123
+ type: String,
124
+ default: "md",
125
+ validator: (e) => ["sm", "md", "lg"].includes(e)
126
+ },
127
+ /**
128
+ * Color del spinner
129
+ */
130
+ color: {
131
+ type: String,
132
+ default: "currentColor"
133
+ }
134
+ },
135
+ setup(e) {
136
+ const o = e, t = {
137
+ sm: 16,
138
+ md: 24,
139
+ lg: 32
140
+ }, n = i(() => t[o.size]);
141
+ return (s, r) => e.loading ? (a(), c("div", {
142
+ key: 0,
143
+ class: "o-loading",
144
+ style: u({ color: e.color })
145
+ }, [
146
+ (a(), c("svg", {
147
+ width: n.value,
148
+ height: n.value,
149
+ viewBox: "0 0 24 24",
150
+ fill: "none",
151
+ xmlns: "http://www.w3.org/2000/svg"
152
+ }, [...r[0] || (r[0] = [
153
+ d("circle", {
154
+ cx: "12",
155
+ cy: "12",
156
+ r: "10",
157
+ stroke: "currentColor",
158
+ "stroke-width": "4",
159
+ "stroke-linecap": "round",
160
+ "stroke-dasharray": "60",
161
+ "stroke-dashoffset": "20",
162
+ opacity: "0.25"
163
+ }, null, -1),
164
+ d("path", {
165
+ d: "M12 2C6.477 2 2 6.477 2 12",
166
+ stroke: "currentColor",
167
+ "stroke-width": "4",
168
+ "stroke-linecap": "round"
169
+ }, null, -1)
170
+ ])], 8, M))
171
+ ], 4)) : p("", !0);
172
+ }
173
+ }, E = ["innerHTML"], N = {
174
+ __name: "OIcon",
175
+ props: {
176
+ /**
177
+ * Nombre del icono (debe existir en @oottoo-core/oottoo-icons)
178
+ */
179
+ name: {
180
+ type: String,
181
+ required: !0
182
+ },
183
+ /**
184
+ * Tama帽o del icono en p铆xeles
185
+ */
186
+ size: {
187
+ type: [Number, String],
188
+ default: 24
189
+ },
190
+ /**
191
+ * Color del icono
192
+ */
193
+ color: {
194
+ type: String,
195
+ default: "currentColor"
196
+ }
197
+ },
198
+ setup(e) {
199
+ const o = e, t = i(
200
+ () => typeof o.size == "number" ? `${o.size}px` : o.size
201
+ ), n = w("oIcons", void 0), s = i(() => n ? n(o.name) : "");
202
+ return (r, l) => (a(), c("span", {
203
+ class: "o-icon",
204
+ style: u({
205
+ width: t.value,
206
+ height: t.value,
207
+ color: e.color
208
+ }),
209
+ innerHTML: s.value
210
+ }, null, 12, E));
211
+ }
212
+ }, V = {
213
+ /**
214
+ * Instala el plugin en la aplicaci贸n Vue
215
+ *
216
+ * @param {import('vue').App} app - Instancia de la aplicaci贸n
217
+ */
218
+ install(e) {
219
+ e.component("OButton", S), e.component("OModal", I), e.component("OLoading", L), e.component("OIcon", N);
220
+ }
221
+ };
222
+ export {
223
+ S as OButton,
224
+ N as OIcon,
225
+ L as OLoading,
226
+ I as OModal,
227
+ V as default
228
+ };
@@ -0,0 +1 @@
1
+ (function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.OottoUI={},l.Vue))})(this,(function(l,e){"use strict";const p=["disabled","type"],d={__name:"OButton",props:{variant:{type:String,default:"primary",validator:t=>["primary","secondary","ghost"].includes(t)},size:{type:String,default:"md",validator:t=>["sm","md","lg"].includes(t)},disabled:{type:Boolean,default:!1},type:{type:String,default:"button"}},emits:["click"],setup(t,{emit:n}){const o=t,c=n,s=r=>{o.disabled||c("click",r)},i=e.computed(()=>["o-button",`o-button--${o.variant}`,`o-button--${o.size}`]);return(r,_)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(i.value),disabled:t.disabled,type:t.type,onClick:s},[e.renderSlot(r.$slots,"default")],10,p))}},f=(t,n)=>{const o=t.__vccOpts||t;for(const[c,s]of n)o[c]=s;return o},y={class:"o-modal-content"},a=f({__name:"OModal",props:{isOpen:{type:Boolean,default:!1},zIndex:{type:Number,default:50}},emits:["close"],setup(t,{emit:n}){const o=t,c=n,s=()=>{c("close")},i=r=>{r.key==="Escape"&&o.isOpen&&s()};return e.onMounted(()=>{document.addEventListener("keydown",i)}),e.onUnmounted(()=>{document.removeEventListener("keydown",i)}),(r,_)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"o-modal"},{default:e.withCtx(()=>[t.isOpen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"o-modal-overlay",style:e.normalizeStyle({zIndex:t.zIndex}),onClick:e.withModifiers(s,["self"])},[e.createElementVNode("div",y,[e.renderSlot(r.$slots,"default",{},void 0,!0)])],4)):e.createCommentVNode("",!0)]),_:3})]))}},[["__scopeId","data-v-11d6d987"]]),k=["width","height"],m={__name:"OLoading",props:{loading:{type:Boolean,default:!0},size:{type:String,default:"md",validator:t=>["sm","md","lg"].includes(t)},color:{type:String,default:"currentColor"}},setup(t){const n=t,o={sm:16,md:24,lg:32},c=e.computed(()=>o[n.size]);return(s,i)=>t.loading?(e.openBlock(),e.createElementBlock("div",{key:0,class:"o-loading",style:e.normalizeStyle({color:t.color})},[(e.openBlock(),e.createElementBlock("svg",{width:c.value,height:c.value,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...i[0]||(i[0]=[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-dasharray":"60","stroke-dashoffset":"20",opacity:"0.25"},null,-1),e.createElementVNode("path",{d:"M12 2C6.477 2 2 6.477 2 12",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round"},null,-1)])],8,k))],4)):e.createCommentVNode("",!0)}},h=["innerHTML"],u={__name:"OIcon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:24},color:{type:String,default:"currentColor"}},setup(t){const n=t,o=e.computed(()=>typeof n.size=="number"?`${n.size}px`:n.size),c=e.inject("oIcons",void 0),s=e.computed(()=>c?c(n.name):"");return(i,r)=>(e.openBlock(),e.createElementBlock("span",{class:"o-icon",style:e.normalizeStyle({width:o.value,height:o.value,color:t.color}),innerHTML:s.value},null,12,h))}},g={install(t){t.component("OButton",d),t.component("OModal",a),t.component("OLoading",m),t.component("OIcon",u)}};l.OButton=d,l.OIcon=u,l.OLoading=m,l.OModal=a,l.default=g,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@oottoo-core/oottoo-ui",
3
+ "version": "0.0.1",
4
+ "description": "Componentes UI para Vue 3 - Ootto Core",
5
+ "type": "module",
6
+ "main": "./dist/oottoo-ui.umd.js",
7
+ "module": "./dist/oottoo-ui.es.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/oottoo-ui.es.js",
11
+ "require": "./dist/oottoo-ui.umd.js"
12
+ },
13
+ "./oottoo-ui.css": "./dist/oottoo-core.css"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "vite build"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "keywords": [
25
+ "vue3",
26
+ "components",
27
+ "ui",
28
+ "oottoo-core"
29
+ ],
30
+ "author": "Ootto Core Team",
31
+ "license": "MIT",
32
+ "devDependencies": {
33
+ "@vitejs/plugin-vue": "^5.2.4",
34
+ "vite": "^6.0.11",
35
+ "vite-plugin-vue-devtools": "^7.7.0",
36
+ "vue": "^3.5.13"
37
+ }
38
+ }