lkt-menu 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 +250 -0
- package/dist/build.d.ts +21 -0
- package/dist/build.js +103 -0
- package/dist/classes/MenuEntry.d.ts +9 -0
- package/dist/components/EntryContent.vue.d.ts +30 -0
- package/dist/components/MenuItem.vue.d.ts +30 -0
- package/dist/index.d.ts +6 -0
- package/dist/lib-components/LktMenu.vue.d.ts +30 -0
- package/dist/settings/Settings.d.ts +4 -0
- package/dist/style.css +1 -0
- package/package.json +63 -0
- package/src/components/EntryContent.vue +27 -0
- package/src/components/MenuItem.vue +40 -0
- package/src/lib-components/LktMenu.vue +23 -0
- package/theme/default.css +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# LKT Button
|
|
2
|
+
A simple button component for Vue.js 3.0.
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
### With npm
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm i -S lkt-button
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Typical use:
|
|
13
|
+
In your main.js
|
|
14
|
+
```js
|
|
15
|
+
import LktButton from 'lkt-button';
|
|
16
|
+
|
|
17
|
+
app.use(LktButton);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
App use options:
|
|
21
|
+
|
|
22
|
+
* `defaultState` string (default: undefined) => Set a default state for all buttons
|
|
23
|
+
|
|
24
|
+
In your component:
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<lkt-button v-on:click="doSomething" v-bind:disabled="disabledChecker"></lkt-button>
|
|
28
|
+
```
|
|
29
|
+
```js
|
|
30
|
+
export default {
|
|
31
|
+
methods: {
|
|
32
|
+
doSomething() {
|
|
33
|
+
console.log('May the force be with you');
|
|
34
|
+
},
|
|
35
|
+
disabledChecker() {
|
|
36
|
+
return false;
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Props
|
|
44
|
+
|
|
45
|
+
### type
|
|
46
|
+
Type: `String`<br>
|
|
47
|
+
Required: `false`<br>
|
|
48
|
+
Default: `button` <br>
|
|
49
|
+
Options: `button`, `submit`, `reset`
|
|
50
|
+
|
|
51
|
+
Determines which kind of button will be.
|
|
52
|
+
```html
|
|
53
|
+
<lkt-button type="submit"></lkt-button>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### name
|
|
57
|
+
Type: `String`<br>
|
|
58
|
+
Required: `false`<br>
|
|
59
|
+
Default: `a random string is generated` <br>
|
|
60
|
+
|
|
61
|
+
An identifier emitted on click.
|
|
62
|
+
```html
|
|
63
|
+
<lkt-button name="sendMessage"></lkt-button>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### value
|
|
67
|
+
Type: `String`<br>
|
|
68
|
+
Required: `false`<br>
|
|
69
|
+
Default: `'`
|
|
70
|
+
|
|
71
|
+
Set a value for form buttons. Emitted on click.
|
|
72
|
+
```html
|
|
73
|
+
<lkt-button v-bind:value="myButton"></lkt-button>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### palette
|
|
77
|
+
Type: `String`<br>
|
|
78
|
+
Required: `false`<br>
|
|
79
|
+
Default: `''`
|
|
80
|
+
|
|
81
|
+
Appends a palette classname. It's useful for palette control and styling.
|
|
82
|
+
```html
|
|
83
|
+
<lkt-button palette="calculating"></lkt-button>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### disabled
|
|
87
|
+
Type: `Boolean`<br>
|
|
88
|
+
Required: `false`<br>
|
|
89
|
+
Default: `false`
|
|
90
|
+
|
|
91
|
+
Determines if button is disabled or not.
|
|
92
|
+
```html
|
|
93
|
+
<lkt-button disabled></lkt-button>
|
|
94
|
+
<lkt-button v-bind:disabled="disabledChecker"></lkt-button>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Events
|
|
99
|
+
|
|
100
|
+
* LktButton emits these events:
|
|
101
|
+
|
|
102
|
+
- `click`
|
|
103
|
+
|
|
104
|
+
HTML:
|
|
105
|
+
```HTML
|
|
106
|
+
<lkt-button v-on:click="doSomething"></lkt-button>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Slots
|
|
110
|
+
|
|
111
|
+
#### default slot
|
|
112
|
+
This slot allows you to fill the button with whatever you want.
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<lkt-button name="testButton" v-on:click="doSomething">
|
|
116
|
+
Click, me!
|
|
117
|
+
</lkt-button>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### prev/next slot
|
|
121
|
+
These slots are designed to add something before/after the text, like an icon.
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<lkt-button name="testButton" v-on:click="doSomething">
|
|
125
|
+
Click, me!
|
|
126
|
+
<template v-slot:prev>
|
|
127
|
+
<i class="font-icon"></i>
|
|
128
|
+
</template>
|
|
129
|
+
<template v-slot:next>
|
|
130
|
+
<i class="font-icon2"></i>
|
|
131
|
+
</template>
|
|
132
|
+
</lkt-button>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
#### prev-loading/next-loading slot
|
|
136
|
+
Same as prev/next but only appears if button is loading
|
|
137
|
+
|
|
138
|
+
```html
|
|
139
|
+
<lkt-button name="testButton" v-on:click="doSomething">
|
|
140
|
+
Click, me!
|
|
141
|
+
<template v-slot:prev-loading>
|
|
142
|
+
<i class="font-icon"></i>
|
|
143
|
+
</template>
|
|
144
|
+
<template v-slot:next-loading>
|
|
145
|
+
<i class="font-icon2"></i>
|
|
146
|
+
</template>
|
|
147
|
+
</lkt-button>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Styling
|
|
151
|
+
|
|
152
|
+
### Style configuration
|
|
153
|
+
|
|
154
|
+
If you want to modify the default style without having to override styles in CSS, you can use the configurator like this:
|
|
155
|
+
|
|
156
|
+
```scss
|
|
157
|
+
@use "node_modules/lkt-button/lkt-button";
|
|
158
|
+
|
|
159
|
+
@include lkt-button.configure((border-width: 2px)); //opts list
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Available style options
|
|
163
|
+
| Option | Default value |
|
|
164
|
+
|---------------|---------------------------------------|
|
|
165
|
+
| border-width | 1px |
|
|
166
|
+
| border-style | solid |
|
|
167
|
+
| border-color | #ddd |
|
|
168
|
+
| color | #333 |
|
|
169
|
+
| background | transparent |
|
|
170
|
+
| height | 35px |
|
|
171
|
+
| min-width | 150px |
|
|
172
|
+
| padding | 7px |
|
|
173
|
+
| slot-gap | 5px |
|
|
174
|
+
| font-weight | 300 |
|
|
175
|
+
| line-height | 1 |
|
|
176
|
+
| text-align | center |
|
|
177
|
+
| cursor | default |
|
|
178
|
+
| box-shadow | none |
|
|
179
|
+
| border-radius | lkt-theme.$primary-border-radius |
|
|
180
|
+
| transition | lkt-theme.$primary-transition |
|
|
181
|
+
| font-size | lkt-theme.$primary-button-font-size |
|
|
182
|
+
| font-family | lkt-theme.$primary-button-font-family |
|
|
183
|
+
|
|
184
|
+
### Style generation
|
|
185
|
+
|
|
186
|
+
The following example will show you how to generate styles.
|
|
187
|
+
|
|
188
|
+
```scss
|
|
189
|
+
@use "node_modules/lkt-button/lkt-button";
|
|
190
|
+
|
|
191
|
+
@include lkt-button.generate();
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Theme modifiers
|
|
195
|
+
|
|
196
|
+
If ```lkt-theme``` is configured, the ```generate``` mixin also will generate some colored styles if colors were configured in ```lkt-theme```.
|
|
197
|
+
|
|
198
|
+
These modifiers will be the way:
|
|
199
|
+
|
|
200
|
+
lkt-button--<color>
|
|
201
|
+
lkt-button--<color>-dark
|
|
202
|
+
lkt-button--<color>-darker
|
|
203
|
+
lkt-button--<color>-light
|
|
204
|
+
lkt-button--<color>-lighter
|
|
205
|
+
|
|
206
|
+
For example, if you already set up info color and info color dark, it will generate the following modifiers:
|
|
207
|
+
|
|
208
|
+
lkt-button--info
|
|
209
|
+
lkt-button--info-dark
|
|
210
|
+
|
|
211
|
+
All ```lkt-theme``` colors can generate a modifier but disabled (which generates styles if button is disabled) and focus (which is not intended for this component).
|
|
212
|
+
|
|
213
|
+
Some example could be:
|
|
214
|
+
|
|
215
|
+
lkt-button--info
|
|
216
|
+
lkt-button--info-dark
|
|
217
|
+
lkt-button--info-darker
|
|
218
|
+
lkt-button--info-light
|
|
219
|
+
lkt-button--info-lighter
|
|
220
|
+
|
|
221
|
+
lkt-button--success
|
|
222
|
+
lkt-button--success-dark
|
|
223
|
+
lkt-button--success-darker
|
|
224
|
+
lkt-button--success-light
|
|
225
|
+
lkt-button--success-lighter
|
|
226
|
+
|
|
227
|
+
lkt-button--warning
|
|
228
|
+
lkt-button--warning-dark
|
|
229
|
+
lkt-button--warning-darker
|
|
230
|
+
lkt-button--warning-light
|
|
231
|
+
lkt-button--warning-lighter
|
|
232
|
+
|
|
233
|
+
#### Using CSS Selectors in HTML
|
|
234
|
+
```html
|
|
235
|
+
<lkt-button class="lkt-button--info">More info</lkt-button>
|
|
236
|
+
|
|
237
|
+
<lkt-button class="lkt-button--success-light">Confirm action</lkt-button>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
#### The ```palette``` prop
|
|
241
|
+
You can apply ```lkt-theme``` modifiers with the palette prop this way:
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
```html
|
|
245
|
+
<lkt-button palette="info">More info</lkt-button>
|
|
246
|
+
|
|
247
|
+
<!-- Is the same as: -->
|
|
248
|
+
|
|
249
|
+
<lkt-button class="lkt-button--info">More info</lkt-button>
|
|
250
|
+
```
|
package/dist/build.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare function j(n: any, o: any, e: any): {
|
|
2
|
+
key: any;
|
|
3
|
+
href: any;
|
|
4
|
+
text: any;
|
|
5
|
+
isOpened: boolean;
|
|
6
|
+
children: any[];
|
|
7
|
+
setChildren: (o: any) => h;
|
|
8
|
+
};
|
|
9
|
+
declare namespace b {
|
|
10
|
+
function install(n: any): void;
|
|
11
|
+
}
|
|
12
|
+
declare class h {
|
|
13
|
+
constructor(o: any, e: any, s: any);
|
|
14
|
+
key: any;
|
|
15
|
+
href: any;
|
|
16
|
+
text: any;
|
|
17
|
+
isOpened: boolean;
|
|
18
|
+
children: any[];
|
|
19
|
+
setChildren(o: any): this;
|
|
20
|
+
}
|
|
21
|
+
export { j as createMenuEntry, b as default };
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { defineComponent as p, ref as _, openBlock as t, createElementBlock as l, toDisplayString as U, createCommentVNode as d, createElementVNode as i, resolveComponent as V, createBlock as m, withCtx as $, createVNode as y, normalizeClass as E, Fragment as g, renderList as x, reactive as M } from "vue";
|
|
2
|
+
class h {
|
|
3
|
+
constructor(o, e, s) {
|
|
4
|
+
this.key = "", this.href = "", this.text = "", this.isOpened = !1, this.children = [], this.key = o, this.href = e, this.text = s;
|
|
5
|
+
}
|
|
6
|
+
setChildren(o) {
|
|
7
|
+
return this.children = o, this;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const O = { class: "lkt-entry-content" }, w = /* @__PURE__ */ i("div", { class: "lkt-menu-entry-icon" }, " icn ", -1), B = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "lkt-menu-entry-text"
|
|
13
|
+
}, f = /* @__PURE__ */ p({
|
|
14
|
+
__name: "EntryContent",
|
|
15
|
+
props: {
|
|
16
|
+
modelValue: { default: () => new h("", "", "") }
|
|
17
|
+
},
|
|
18
|
+
setup(n) {
|
|
19
|
+
const e = _(n.modelValue);
|
|
20
|
+
return (s, v) => (t(), l("div", O, [
|
|
21
|
+
w,
|
|
22
|
+
e.value.text !== "" ? (t(), l("div", B, U(e.value.text), 1)) : d("", !0)
|
|
23
|
+
]));
|
|
24
|
+
}
|
|
25
|
+
}), L = { class: "lkt-menu-entry" }, N = { class: "lkt-menu-entry-main" }, z = {
|
|
26
|
+
key: 1,
|
|
27
|
+
class: "lkt-anchor"
|
|
28
|
+
}, D = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "lkt-menu-entry-children"
|
|
31
|
+
}, F = /* @__PURE__ */ p({
|
|
32
|
+
__name: "MenuItem",
|
|
33
|
+
props: {
|
|
34
|
+
modelValue: { default: () => new h("", "", "") }
|
|
35
|
+
},
|
|
36
|
+
setup(n) {
|
|
37
|
+
const e = _(n.modelValue), s = () => {
|
|
38
|
+
e.value.isOpened = !e.value.isOpened;
|
|
39
|
+
};
|
|
40
|
+
return (v, u) => {
|
|
41
|
+
const a = V("lkt-anchor"), c = V("menu-item", !0);
|
|
42
|
+
return t(), l("div", L, [
|
|
43
|
+
i("div", N, [
|
|
44
|
+
e.value.href !== "" ? (t(), m(a, {
|
|
45
|
+
key: 0,
|
|
46
|
+
to: e.value.href
|
|
47
|
+
}, {
|
|
48
|
+
default: $(() => [
|
|
49
|
+
y(f, {
|
|
50
|
+
modelValue: e.value,
|
|
51
|
+
"onUpdate:modelValue": u[0] || (u[0] = (r) => e.value = r)
|
|
52
|
+
}, null, 8, ["modelValue"])
|
|
53
|
+
]),
|
|
54
|
+
_: 1
|
|
55
|
+
}, 8, ["to"])) : (t(), l("div", z, [
|
|
56
|
+
y(f, {
|
|
57
|
+
modelValue: e.value,
|
|
58
|
+
"onUpdate:modelValue": u[1] || (u[1] = (r) => e.value = r),
|
|
59
|
+
onClick: s
|
|
60
|
+
}, null, 8, ["modelValue"])
|
|
61
|
+
])),
|
|
62
|
+
e.value.children.length > 0 ? (t(), l("div", {
|
|
63
|
+
key: 2,
|
|
64
|
+
class: "lkt-menu-entry-toggle",
|
|
65
|
+
onClick: s
|
|
66
|
+
}, [
|
|
67
|
+
i("div", {
|
|
68
|
+
class: E(["lkt-menu-entry-toggle-triangle", e.value.isOpened ? "is-opened" : ""])
|
|
69
|
+
}, null, 2)
|
|
70
|
+
])) : d("", !0)
|
|
71
|
+
]),
|
|
72
|
+
e.value.isOpened ? (t(), l("div", D, [
|
|
73
|
+
(t(!0), l(g, null, x(e.value.children, (r, k) => (t(), m(c, {
|
|
74
|
+
modelValue: e.value.children[k],
|
|
75
|
+
"onUpdate:modelValue": (C) => e.value.children[k] = C
|
|
76
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]))), 256))
|
|
77
|
+
])) : d("", !0)
|
|
78
|
+
]);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}), I = { class: "lkt-menu" }, S = /* @__PURE__ */ p({
|
|
82
|
+
__name: "LktMenu",
|
|
83
|
+
props: {
|
|
84
|
+
modelValue: { default: () => [] }
|
|
85
|
+
},
|
|
86
|
+
setup(n) {
|
|
87
|
+
const e = _(n.modelValue);
|
|
88
|
+
return (s, v) => (t(), l("div", I, [
|
|
89
|
+
(t(!0), l(g, null, x(e.value, (u, a) => (t(), m(F, {
|
|
90
|
+
modelValue: e.value[a],
|
|
91
|
+
"onUpdate:modelValue": (c) => e.value[a] = c
|
|
92
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"]))), 256))
|
|
93
|
+
]));
|
|
94
|
+
}
|
|
95
|
+
}), b = {
|
|
96
|
+
install: (n) => {
|
|
97
|
+
n.component("lkt-menu") === void 0 && n.component("lkt-menu", S);
|
|
98
|
+
}
|
|
99
|
+
}, j = (n, o, e) => M(new h(n, o, e));
|
|
100
|
+
export {
|
|
101
|
+
j as createMenuEntry,
|
|
102
|
+
b as default
|
|
103
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MenuEntry } from "../classes/MenuEntry";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
modelValue?: MenuEntry | undefined;
|
|
4
|
+
}>, {
|
|
5
|
+
modelValue: () => MenuEntry;
|
|
6
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
7
|
+
modelValue?: MenuEntry | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
modelValue: () => MenuEntry;
|
|
10
|
+
}>>>, {
|
|
11
|
+
modelValue: MenuEntry;
|
|
12
|
+
}, {}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
16
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
+
} : {
|
|
19
|
+
type: import('vue').PropType<T[K]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type __VLS_WithDefaults<P, D> = {
|
|
24
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
25
|
+
default: D[K];
|
|
26
|
+
}> : P[K];
|
|
27
|
+
};
|
|
28
|
+
type __VLS_Prettify<T> = {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} & {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MenuEntry } from "../classes/MenuEntry";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
modelValue?: MenuEntry | undefined;
|
|
4
|
+
}>, {
|
|
5
|
+
modelValue: () => MenuEntry;
|
|
6
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
7
|
+
modelValue?: MenuEntry | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
modelValue: () => MenuEntry;
|
|
10
|
+
}>>>, {
|
|
11
|
+
modelValue: MenuEntry;
|
|
12
|
+
}, {}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
16
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
+
} : {
|
|
19
|
+
type: import('vue').PropType<T[K]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type __VLS_WithDefaults<P, D> = {
|
|
24
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
25
|
+
default: D[K];
|
|
26
|
+
}> : P[K];
|
|
27
|
+
};
|
|
28
|
+
type __VLS_Prettify<T> = {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} & {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MenuEntry } from "../classes/MenuEntry";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
modelValue?: MenuEntry[] | undefined;
|
|
4
|
+
}>, {
|
|
5
|
+
modelValue: () => never[];
|
|
6
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
7
|
+
modelValue?: MenuEntry[] | undefined;
|
|
8
|
+
}>, {
|
|
9
|
+
modelValue: () => never[];
|
|
10
|
+
}>>>, {
|
|
11
|
+
modelValue: MenuEntry[];
|
|
12
|
+
}, {}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
16
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
+
} : {
|
|
19
|
+
type: import('vue').PropType<T[K]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
type __VLS_WithDefaults<P, D> = {
|
|
24
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
25
|
+
default: D[K];
|
|
26
|
+
}> : P[K];
|
|
27
|
+
};
|
|
28
|
+
type __VLS_Prettify<T> = {
|
|
29
|
+
[K in keyof T]: T[K];
|
|
30
|
+
} & {};
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.lkt-menu-entry-toggle-triangle{width:0px;height:0px;border-style:solid;border-width:10px 10px 0 10px;border-color:#FF4532 transparent transparent transparent;transform:rotate(0);transition:all linear .2s}.lkt-menu-entry-toggle-triangle.is-opened{transform:rotate(180deg)}.lkt-entry-content{display:inline-flex;flex-direction:row;gap:10px}.lkt-menu-entry-toggle{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lkt-menu",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"lkt",
|
|
7
|
+
"lkt-web-tech",
|
|
8
|
+
"ts",
|
|
9
|
+
"typescript",
|
|
10
|
+
"vue",
|
|
11
|
+
"vue3",
|
|
12
|
+
"js",
|
|
13
|
+
"javascript"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"module": "./dist/build.js",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./dist/build.js"
|
|
20
|
+
},
|
|
21
|
+
"./styles": "./dist/style.css",
|
|
22
|
+
"./theme": "./theme/default.css",
|
|
23
|
+
"./theme/default": "./theme/default.css"
|
|
24
|
+
},
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist/*",
|
|
28
|
+
"src/**/*.vue",
|
|
29
|
+
"theme/**/*.css"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "rm -rf dist/*; vue-tsc --declaration --emitDeclarationOnly; vite build; tsc --project tsconfig.build.json; cp build/* dist/"
|
|
35
|
+
},
|
|
36
|
+
"author": "Antonio Ibáñez",
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@babel/types": "^7.23.6",
|
|
39
|
+
"@types/node": "^20.11.19",
|
|
40
|
+
"@types/rollup": "^0.54.0",
|
|
41
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
42
|
+
"rollup": "^4.9.6",
|
|
43
|
+
"typescript": "^5.3.3",
|
|
44
|
+
"vite": "^5.1.3",
|
|
45
|
+
"vue": "^3.3.0",
|
|
46
|
+
"vue-tsc": "^1.8.27"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=18"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"lkt-anchor": "^1.1.4",
|
|
53
|
+
"lkt-control-tools": "^1.0.3",
|
|
54
|
+
"lkt-events": "^1.0.2",
|
|
55
|
+
"lkt-http-client": "^1.0.21",
|
|
56
|
+
"lkt-loader": "^1.0.1",
|
|
57
|
+
"lkt-modal-confirm": "^1.0.0",
|
|
58
|
+
"lkt-string-tools": "^1.0.1",
|
|
59
|
+
"lkt-ts-interfaces": "^1.0.0",
|
|
60
|
+
"vue": "^3.3.0",
|
|
61
|
+
"vue-router": "^4.3.3"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {MenuEntry} from "../classes/MenuEntry";
|
|
3
|
+
import {ref} from "vue";
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<{
|
|
6
|
+
modelValue?: MenuEntry
|
|
7
|
+
}>(), {
|
|
8
|
+
modelValue: () => (new MenuEntry('', '', ''))
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const entry = ref(props.modelValue);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="lkt-entry-content">
|
|
16
|
+
<div class="lkt-menu-entry-icon">
|
|
17
|
+
icn
|
|
18
|
+
</div>
|
|
19
|
+
<div class="lkt-menu-entry-text" v-if="entry.text !== ''">
|
|
20
|
+
{{entry.text}}
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<style scoped>
|
|
26
|
+
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {MenuEntry} from "../classes/MenuEntry";
|
|
3
|
+
import {ref} from "vue";
|
|
4
|
+
import EntryContent from "./EntryContent.vue";
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<{
|
|
7
|
+
modelValue?: MenuEntry
|
|
8
|
+
}>(), {
|
|
9
|
+
modelValue: () => (new MenuEntry('', '', ''))
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const entry = ref(props.modelValue);
|
|
13
|
+
|
|
14
|
+
const onClickToggle = () => {
|
|
15
|
+
entry.value.isOpened = !entry.value.isOpened;
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="lkt-menu-entry">
|
|
21
|
+
<div class="lkt-menu-entry-main">
|
|
22
|
+
<lkt-anchor v-if="entry.href !== ''" :to="entry.href">
|
|
23
|
+
<entry-content v-model="entry"/>
|
|
24
|
+
</lkt-anchor>
|
|
25
|
+
<div class="lkt-anchor" v-else>
|
|
26
|
+
<entry-content v-model="entry" @click="onClickToggle"/>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="lkt-menu-entry-toggle" v-if="entry.children.length > 0" @click="onClickToggle">
|
|
29
|
+
<div class="lkt-menu-entry-toggle-triangle" :class="entry.isOpened ? 'is-opened' : '' "/>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="lkt-menu-entry-children" v-if="entry.isOpened">
|
|
33
|
+
<menu-item v-for="(_, i) in entry.children" v-model="entry.children[i]"/>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import {MenuEntry} from "../classes/MenuEntry";
|
|
3
|
+
import MenuItem from "../components/MenuItem.vue";
|
|
4
|
+
import {ref} from "vue";
|
|
5
|
+
|
|
6
|
+
const props = withDefaults(defineProps<{
|
|
7
|
+
modelValue?: MenuEntry[]
|
|
8
|
+
}>(), {
|
|
9
|
+
modelValue: () => []
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const entries = ref(props.modelValue);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="lkt-menu">
|
|
17
|
+
<menu-item v-for="(_, i) in entries" v-model="entries[i]"/>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<style scoped>
|
|
22
|
+
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/** Font */
|
|
3
|
+
--lkt-menu-font-family: system-ui, Helvetica;
|
|
4
|
+
--lkt-menu-font-size: 17px;
|
|
5
|
+
--lkt-menu-font-weight: 400;
|
|
6
|
+
--lkt-menu-line-height: 1;
|
|
7
|
+
--lkt-menu-text-align: left;
|
|
8
|
+
--lkt-menu-text-decoration: none;
|
|
9
|
+
--lkt-menu-text-decoration-hover: none;
|
|
10
|
+
|
|
11
|
+
/** Sizing */
|
|
12
|
+
--lkt-menu-width: 100%;
|
|
13
|
+
--lkt-menu-min-width: 150px;
|
|
14
|
+
--lkt-menu-min-height: 35px;
|
|
15
|
+
--lkt-menu-padding: 7px;
|
|
16
|
+
--lkt-menu-gap: 5px;
|
|
17
|
+
|
|
18
|
+
/** Border */
|
|
19
|
+
--lkt-menu-border-radius: 5px;
|
|
20
|
+
--lkt-menu-border-width: 1px;
|
|
21
|
+
--lkt-menu-border-width-hover: 1px;
|
|
22
|
+
--lkt-menu-border-style: solid;
|
|
23
|
+
|
|
24
|
+
/** Colors */
|
|
25
|
+
--lkt-menu-color: #ffffff;
|
|
26
|
+
--lkt-menu-bg: #007ebc;
|
|
27
|
+
--lkt-menu-border-color: #ddd;
|
|
28
|
+
|
|
29
|
+
/** Effects */
|
|
30
|
+
--lkt-menu-shadow: none;
|
|
31
|
+
--lkt-menu-transition: all linear 100ms;
|
|
32
|
+
|
|
33
|
+
/** State: hover */
|
|
34
|
+
--lkt-menu-color-hover: #ffffff;
|
|
35
|
+
--lkt-menu-bg-hover: #007ebc;
|
|
36
|
+
--lkt-menu-border-color-hover: #ddd;
|
|
37
|
+
|
|
38
|
+
/** State: Focus */
|
|
39
|
+
--lkt-menu-border-color-focus: var(--focus-color);
|
|
40
|
+
--lkt-menu-shadow-focus: 0 0 0 2px var(--focus-color);
|
|
41
|
+
|
|
42
|
+
/** State: Disabled */
|
|
43
|
+
--lkt-menu-color-disabled: var(--disabled-contrast);
|
|
44
|
+
--lkt-menu-bg-disabled: var(--disabled-color);
|
|
45
|
+
--lkt-menu-border-color-disabled: var(--disabled-color);
|
|
46
|
+
|
|
47
|
+
/** Internal image */
|
|
48
|
+
--lkt-button-img-max-width: 50px;
|
|
49
|
+
--lkt-button-img-max-height: 50px;
|
|
50
|
+
|
|
51
|
+
/** Split Button */
|
|
52
|
+
--lkt-button-split-arrow-width: 40px;
|
|
53
|
+
--lkt-button-split-arrow-bg: transparent;
|
|
54
|
+
}
|