cleek 1.1.4 → 1.1.8
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 +11 -0
- package/dist/cleek.es.js +4741 -0
- package/dist/cleek.umd.js +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/style.css +1 -0
- package/package.json +13 -62
- package/dist/cleek.esm.js +0 -239
- package/dist/cleek.min.js +0 -1
- package/dist/cleek.ssr.js +0 -283
- package/dist/styles/ck-button.css +0 -132
- package/dist/styles/globalStyle.css +0 -110
- package/dist/styles/templateStyle.css +0 -0
- package/dist/styles/test.css +0 -3
- package/dist/types/src/entry.esm.d.ts +0 -4
- package/dist/types/src/lib-components/cleek-sample.vue.d.ts +0 -16
- package/dist/types/src/lib-components/functions.d.ts +0 -8
- package/dist/types/src/lib-components/index.d.ts +0 -2
- package/src/lib-components/ck-button.vue +0 -66
- package/src/lib-components/ck-icon.vue +0 -61
- package/src/lib-components/ck-input-text.vue +0 -59
- package/src/lib-components/ck-label.vue +0 -41
- package/src/lib-components/ck-select.vue +0 -131
- package/src/lib-components/ck-switch.vue +0 -73
- package/src/lib-components/ck-textarea.vue +0 -40
- package/src/lib-components/cleek-sample.vue +0 -88
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<template lang="pug">
|
|
2
|
-
.ck-input-text
|
|
3
|
-
//- label
|
|
4
|
-
ck-label(v-if="label" :align="labelAlign") {{ label }}
|
|
5
|
-
//- input
|
|
6
|
-
input(
|
|
7
|
-
v-model="value"
|
|
8
|
-
type="text"
|
|
9
|
-
:placeholder="placeholder"
|
|
10
|
-
:class="computedClass"
|
|
11
|
-
)
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
import functions from './functions.ts';
|
|
16
|
-
|
|
17
|
-
export default {
|
|
18
|
-
props: {
|
|
19
|
-
modelValue: { type: String, required: true },
|
|
20
|
-
label: { type: String, default: '' },
|
|
21
|
-
placeholder: { type: String, default: '' },
|
|
22
|
-
'label-align': { type: String, default: '' },
|
|
23
|
-
// group
|
|
24
|
-
group: { type: String, default: '' },
|
|
25
|
-
groupBreak: { type: String, default: 's' },
|
|
26
|
-
groupVertical: { type: String, default: '' },
|
|
27
|
-
},
|
|
28
|
-
computed: {
|
|
29
|
-
value: {
|
|
30
|
-
get() { return this.modelValue; },
|
|
31
|
-
set(val) { this.$emit('update:modelValue', val); },
|
|
32
|
-
},
|
|
33
|
-
computedClass() {
|
|
34
|
-
const classList = [];
|
|
35
|
-
// group
|
|
36
|
-
classList.push(functions.getGroupClass(this));
|
|
37
|
-
return classList;
|
|
38
|
-
},
|
|
39
|
-
}, // computed
|
|
40
|
-
}; // export default
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<style lang="stylus" scoped>
|
|
44
|
-
json('./styles/StylusVars.json')
|
|
45
|
-
|
|
46
|
-
.ck-input-text
|
|
47
|
-
display inline-block
|
|
48
|
-
> input
|
|
49
|
-
padding globalPadding
|
|
50
|
-
font-size globalFontSize
|
|
51
|
-
border-radius globalBorderRadius
|
|
52
|
-
border 1px solid globalBorderColor
|
|
53
|
-
min-height 40px
|
|
54
|
-
box-sizing border-box
|
|
55
|
-
&:focus-visible
|
|
56
|
-
outline-color primary
|
|
57
|
-
|
|
58
|
-
@require './styles/globalStyle'
|
|
59
|
-
</style>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<template lang="pug">
|
|
2
|
-
label.ck-label(
|
|
3
|
-
:class="computedClass"
|
|
4
|
-
)
|
|
5
|
-
slot
|
|
6
|
-
</template>
|
|
7
|
-
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
props: {
|
|
11
|
-
align: { type: String, default: '' },
|
|
12
|
-
},
|
|
13
|
-
computed: {
|
|
14
|
-
computedClass() {
|
|
15
|
-
const list = [];
|
|
16
|
-
// align
|
|
17
|
-
let align = 'left';
|
|
18
|
-
if (this.align === 'center' || this.align === 'right') align = this.align;
|
|
19
|
-
list.push(`ck-align--${align}`);
|
|
20
|
-
return list;
|
|
21
|
-
},
|
|
22
|
-
}, // computed
|
|
23
|
-
}; // export default
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<style lang="stylus" scoped>
|
|
27
|
-
@require './styles/templateStyle'
|
|
28
|
-
|
|
29
|
-
.ck-label
|
|
30
|
-
width 100%
|
|
31
|
-
padding-x .5rem
|
|
32
|
-
display flex
|
|
33
|
-
margin-bottom .1rem
|
|
34
|
-
font-size .85rem
|
|
35
|
-
&.ck-align--left
|
|
36
|
-
justify-content flex-start
|
|
37
|
-
&.ck-align--right
|
|
38
|
-
justify-content flex-end
|
|
39
|
-
&.ck-align--center
|
|
40
|
-
justify-content center
|
|
41
|
-
</style>
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
<template lang="pug">
|
|
2
|
-
.ck-select(
|
|
3
|
-
:style="computedStyle"
|
|
4
|
-
)
|
|
5
|
-
ck-label(v-if="label" :label-align="labelAlign") {{ label }}
|
|
6
|
-
v-select.ck-select__v-select(
|
|
7
|
-
ref="vSelect"
|
|
8
|
-
v-model="value"
|
|
9
|
-
:label="prop"
|
|
10
|
-
:options="options"
|
|
11
|
-
:disabled="!!disabled"
|
|
12
|
-
:reduce="realReduceFunction"
|
|
13
|
-
:clearable="!notClearable && !valueIsDefault"
|
|
14
|
-
:searchable="realSearchable"
|
|
15
|
-
)
|
|
16
|
-
span(slot="no-options") {{ noDataText }}
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script>
|
|
20
|
-
import vSelect from 'vue-select';
|
|
21
|
-
import functions from './functions.ts';
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
components: {
|
|
25
|
-
vSelect,
|
|
26
|
-
},
|
|
27
|
-
props: {
|
|
28
|
-
modelValue: { required: true },
|
|
29
|
-
prop: { type: String, default: 'name' }, // prop of the object showed in HTML
|
|
30
|
-
autofocus: { type: Boolean, default: false }, // CHECK
|
|
31
|
-
noDataText: { type: String, default: 'No se encontró nada' },
|
|
32
|
-
notReduce: { type: Boolean, default: false },
|
|
33
|
-
options: { type: Array, default: () => [] },
|
|
34
|
-
reduceFunction: { type: Function, default: Option => Option.id },
|
|
35
|
-
notClearable: { type: Boolean, default: false },
|
|
36
|
-
clearValue: { default: 'auto' },
|
|
37
|
-
searchable: { type: [Boolean, String], default: 'auto' },
|
|
38
|
-
'min-width': { type: String, default: '180px' }, // min-width in px
|
|
39
|
-
noBorder: { type: Boolean, default: false },
|
|
40
|
-
bgTransparent: { type: Boolean, default: false },
|
|
41
|
-
disabled: { type: [Boolean, Number], default: false },
|
|
42
|
-
// group
|
|
43
|
-
group: { type: String, default: '' },
|
|
44
|
-
groupBreak: { type: String, default: '' },
|
|
45
|
-
groupVertical: { type: String, default: '' },
|
|
46
|
-
// label
|
|
47
|
-
label: { type: String, default: '' },
|
|
48
|
-
'label-align': { type: String, default: '' },
|
|
49
|
-
},
|
|
50
|
-
computed: {
|
|
51
|
-
value: {
|
|
52
|
-
get() { return this.modelValue; },
|
|
53
|
-
set(val) {
|
|
54
|
-
if (val === null) val = this.realClearValue;
|
|
55
|
-
this.$emit('update:modelValue', val);
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
computedClass() {
|
|
59
|
-
const classList = [];
|
|
60
|
-
// group
|
|
61
|
-
classList.push(functions.getGroupClass(this));
|
|
62
|
-
return classList;
|
|
63
|
-
},
|
|
64
|
-
computedStyle() {
|
|
65
|
-
const list = [];
|
|
66
|
-
if (this.minWidth) list.push({ 'min-width': this.minWidth });
|
|
67
|
-
return list;
|
|
68
|
-
},
|
|
69
|
-
realSearchable() {
|
|
70
|
-
if (this.searchable === 'auto') {
|
|
71
|
-
if (this.options.length < 5) return false;
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
return this.searchable;
|
|
75
|
-
},
|
|
76
|
-
realClearValue() {
|
|
77
|
-
switch (typeof this.modelValue) {
|
|
78
|
-
case 'number': return 0;
|
|
79
|
-
case 'string': return '';
|
|
80
|
-
case 'object': // array is also object
|
|
81
|
-
if (this.modelValue.constructor === Array) return [];
|
|
82
|
-
return {};
|
|
83
|
-
default: return null;
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
valueIsDefault() {
|
|
87
|
-
switch (typeof this.modelValue) {
|
|
88
|
-
case 'number': return this.modelValue === 0;
|
|
89
|
-
case 'string': return this.modelValue === '';
|
|
90
|
-
case 'object': // array is also object
|
|
91
|
-
if (this.modelValue.constructor === Array) {
|
|
92
|
-
return this.modelValue.length() === 0;
|
|
93
|
-
}
|
|
94
|
-
return Object.keys(this.modelValue).length === 0;
|
|
95
|
-
default: return this.modelValue === null;
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
}, // computed
|
|
99
|
-
methods: {
|
|
100
|
-
// reduceFunction
|
|
101
|
-
// setFocus [ CALLED BY OUTSIDE ]
|
|
102
|
-
|
|
103
|
-
realReduceFunction(Option) {
|
|
104
|
-
if (this.notReduce) return Option;
|
|
105
|
-
return this.reduceFunction(Option);
|
|
106
|
-
},
|
|
107
|
-
setFocus() {
|
|
108
|
-
const el = this.$refs.vSelect.$el.children[0].children[0].children[1];
|
|
109
|
-
setTimeout(() => {
|
|
110
|
-
el.focus();
|
|
111
|
-
}, 100);
|
|
112
|
-
},
|
|
113
|
-
}, // methods
|
|
114
|
-
}; // export default
|
|
115
|
-
</script>
|
|
116
|
-
|
|
117
|
-
<style lang="stylus" scoped>
|
|
118
|
-
@require '../../node_modules/vue-select/dist/vue-select.css';
|
|
119
|
-
json('./styles/StylusVars.json')
|
|
120
|
-
|
|
121
|
-
.ck-select
|
|
122
|
-
display inline-flex
|
|
123
|
-
flex-wrap wrap
|
|
124
|
-
> .ck-select__v-select
|
|
125
|
-
width 100%
|
|
126
|
-
/deep/ .vs__dropdown-toggle
|
|
127
|
-
border-radius globalBorderRadius
|
|
128
|
-
border 1px solid globalBorderColor
|
|
129
|
-
height 40px
|
|
130
|
-
background-color white
|
|
131
|
-
</style>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<template lang="pug">
|
|
2
|
-
label.rv-switch
|
|
3
|
-
input(
|
|
4
|
-
v-model="localValue"
|
|
5
|
-
type="checkbox"
|
|
6
|
-
@change="$emit('change', $event)"
|
|
7
|
-
)
|
|
8
|
-
span.rv-switch__slider(:class="{ 'is-round': type !== 'square' }")
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<script>
|
|
12
|
-
export default {
|
|
13
|
-
props: {
|
|
14
|
-
value: { type: Boolean, required: true },
|
|
15
|
-
type: { type: String, default: 'round' }, // square
|
|
16
|
-
},
|
|
17
|
-
computed: {
|
|
18
|
-
localValue: {
|
|
19
|
-
get() { return this.value; },
|
|
20
|
-
set(val) { this.$emit('input', val); },
|
|
21
|
-
},
|
|
22
|
-
}, // computed
|
|
23
|
-
}; // export default
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<style lang="stylus" scoped>
|
|
27
|
-
json('./styles/StylusVars.json')
|
|
28
|
-
|
|
29
|
-
.rv-switch
|
|
30
|
-
position relative
|
|
31
|
-
display inline-block
|
|
32
|
-
width 60px
|
|
33
|
-
height 34px
|
|
34
|
-
// Hide default HTML checkbox
|
|
35
|
-
input
|
|
36
|
-
opacity 0
|
|
37
|
-
width 0
|
|
38
|
-
height 0
|
|
39
|
-
&:checked + .rv-switch__slider
|
|
40
|
-
background-color primary
|
|
41
|
-
&:focus + .rv-switch__slider
|
|
42
|
-
box-shadow 0 0 1px primary
|
|
43
|
-
&:checked + .rv-switch__slider:before
|
|
44
|
-
-webkit-transform translateX(26px)
|
|
45
|
-
-ms-transform translateX(26px)
|
|
46
|
-
transform translateX(26px)
|
|
47
|
-
/* The slider */
|
|
48
|
-
.rv-switch__slider
|
|
49
|
-
position absolute
|
|
50
|
-
cursor pointer
|
|
51
|
-
top 0
|
|
52
|
-
left 0
|
|
53
|
-
right 0
|
|
54
|
-
bottom 0
|
|
55
|
-
background-color #ccc
|
|
56
|
-
-webkit-transition .4s
|
|
57
|
-
transition .4s
|
|
58
|
-
&:before
|
|
59
|
-
position absolute
|
|
60
|
-
content ""
|
|
61
|
-
height 26px
|
|
62
|
-
width 26px
|
|
63
|
-
left 4px
|
|
64
|
-
bottom 4px
|
|
65
|
-
background-color white
|
|
66
|
-
-webkit-transition .4s
|
|
67
|
-
transition .4s
|
|
68
|
-
// Rounded sliders
|
|
69
|
-
&.is-round
|
|
70
|
-
border-radius: 34px;
|
|
71
|
-
&:before
|
|
72
|
-
border-radius 50%
|
|
73
|
-
</style>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<template lang="pug">
|
|
2
|
-
.ck-textarea
|
|
3
|
-
ck-label(v-if="label" :label-align="labelAlign") {{ label }}
|
|
4
|
-
textarea(v-model="value")
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script>
|
|
8
|
-
export default {
|
|
9
|
-
props: {
|
|
10
|
-
modelValue: { type: String, required: true },
|
|
11
|
-
// label
|
|
12
|
-
label: { type: String, default: '' },
|
|
13
|
-
'label-align': { type: String, default: '' },
|
|
14
|
-
},
|
|
15
|
-
computed: {
|
|
16
|
-
value: {
|
|
17
|
-
get() { return this.modelValue; },
|
|
18
|
-
set(val) { this.$emit('update:modelValue', val); },
|
|
19
|
-
},
|
|
20
|
-
}, // computed
|
|
21
|
-
}; // export default
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<style lang="stylus" scoped>
|
|
25
|
-
json('./styles/StylusVars.json')
|
|
26
|
-
|
|
27
|
-
.ck-textarea
|
|
28
|
-
> textarea
|
|
29
|
-
min-width 100%
|
|
30
|
-
max-width 100%
|
|
31
|
-
min-height 6rem
|
|
32
|
-
box-sizing border-box
|
|
33
|
-
font-family inherit
|
|
34
|
-
padding globalPadding
|
|
35
|
-
font-size globalFontSize * (85/100)
|
|
36
|
-
border-radius globalBorderRadius
|
|
37
|
-
border 1px solid globalBorderColor
|
|
38
|
-
&:focus-visible
|
|
39
|
-
outline-color primary
|
|
40
|
-
</style>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { defineComponent } from 'vue';
|
|
3
|
-
|
|
4
|
-
interface SampleData {
|
|
5
|
-
counter: number;
|
|
6
|
-
initCounter: number;
|
|
7
|
-
message: {
|
|
8
|
-
action: string | null;
|
|
9
|
-
amount: number | null;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default /*#__PURE__*/defineComponent({
|
|
14
|
-
name: 'CleekSample', // vue component name
|
|
15
|
-
data(): SampleData {
|
|
16
|
-
return {
|
|
17
|
-
counter: 5,
|
|
18
|
-
initCounter: 5,
|
|
19
|
-
message: {
|
|
20
|
-
action: null,
|
|
21
|
-
amount: null,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
computed: {
|
|
26
|
-
changedBy() {
|
|
27
|
-
const { message } = this as SampleData;
|
|
28
|
-
if (!message.action) return 'initialized';
|
|
29
|
-
return `${message.action} ${message.amount || ''}`.trim();
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
increment(arg: Event | number): void {
|
|
34
|
-
const amount = (typeof arg !== 'number') ? 1 : arg;
|
|
35
|
-
this.counter += amount;
|
|
36
|
-
this.message.action = 'incremented by';
|
|
37
|
-
this.message.amount = amount;
|
|
38
|
-
},
|
|
39
|
-
decrement(arg: Event | number): void {
|
|
40
|
-
const amount = (typeof arg !== 'number') ? 1 : arg;
|
|
41
|
-
this.counter -= amount;
|
|
42
|
-
this.message.action = 'decremented by';
|
|
43
|
-
this.message.amount = amount;
|
|
44
|
-
},
|
|
45
|
-
reset(): void {
|
|
46
|
-
this.counter = this.initCounter;
|
|
47
|
-
this.message.action = 'reset';
|
|
48
|
-
this.message.amount = null;
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
</script>
|
|
53
|
-
|
|
54
|
-
<template>
|
|
55
|
-
<div class="cleek-sample">
|
|
56
|
-
<p>The counter was {{ changedBy }} to <b>{{ counter }}</b>.</p>
|
|
57
|
-
<button @click="increment">
|
|
58
|
-
Click +1
|
|
59
|
-
</button>
|
|
60
|
-
<button @click="decrement">
|
|
61
|
-
Click -1
|
|
62
|
-
</button>
|
|
63
|
-
<button @click="increment(5)">
|
|
64
|
-
Click +5
|
|
65
|
-
</button>
|
|
66
|
-
<button @click="decrement(5)">
|
|
67
|
-
Click -5
|
|
68
|
-
</button>
|
|
69
|
-
<button @click="reset">
|
|
70
|
-
Reset
|
|
71
|
-
</button>
|
|
72
|
-
</div>
|
|
73
|
-
</template>
|
|
74
|
-
|
|
75
|
-
<style scoped>
|
|
76
|
-
.cleek-sample {
|
|
77
|
-
display: block;
|
|
78
|
-
width: 400px;
|
|
79
|
-
margin: 25px auto;
|
|
80
|
-
border: 1px solid #ccc;
|
|
81
|
-
background: #eaeaea;
|
|
82
|
-
text-align: center;
|
|
83
|
-
padding: 25px;
|
|
84
|
-
}
|
|
85
|
-
.cleek-sample p {
|
|
86
|
-
margin: 0 0 1em;
|
|
87
|
-
}
|
|
88
|
-
</style>
|