@bagelink/vue 0.0.270 → 0.0.280
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/dist/components/Accordion.vue.d.ts +10 -0
- package/dist/components/Accordion.vue.d.ts.map +1 -0
- package/dist/components/AccordionItem.vue.d.ts +2 -0
- package/dist/components/AccordionItem.vue.d.ts.map +1 -1
- package/dist/components/Btn.vue.d.ts +3 -3
- package/dist/components/{Drop.vue.d.ts → ComboBox.vue.d.ts} +12 -12
- package/dist/components/ComboBox.vue.d.ts.map +1 -0
- package/dist/components/Popover.vue.d.ts +10 -0
- package/dist/components/Popover.vue.d.ts.map +1 -0
- package/dist/components/Title.vue.d.ts +1 -1
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/ItemRef.vue.d.ts +0 -1
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts +9 -4
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +4 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +6778 -4053
- package/dist/index.mjs +6752 -4027
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/plugins/modal.d.ts +1 -1
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +706 -678
- package/dist/utils/clickOutside.d.ts +7 -0
- package/dist/utils/clickOutside.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/components/Accordion.vue +15 -0
- package/src/components/AccordionItem.vue +48 -24
- package/src/components/ComboBox.vue +138 -0
- package/src/components/form/inputs/CheckInput.vue +55 -53
- package/src/components/form/inputs/SelectInput.vue +272 -284
- package/src/components/formkit/Toggle.vue +85 -100
- package/src/components/index.ts +3 -0
- package/src/plugins/bagel.ts +14 -2
- package/src/plugins/modal.ts +23 -23
- package/src/styles/buttons.css +38 -40
- package/src/styles/inputs.css +100 -109
- package/src/styles/layout.css +191 -189
- package/src/styles/text.css +38 -62
- package/src/utils/clickOutside.ts +15 -0
- package/dist/components/Drop.vue.d.ts.map +0 -1
- package/dist/components/FileUploader.vue.d.ts +0 -60
- package/dist/components/FileUploader.vue.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickOutside.d.ts","sourceRoot":"","sources":["../../src/utils/clickOutside.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAC;;oBAG3B,GAAG,WAAW,gBAAgB;kBAQhC,GAAG;;AATlB,wBAYE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.280",
|
|
5
5
|
"description": "Bagel core sdk packages",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Neveh Allon",
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
+
"floating-vue": "^5.2.2",
|
|
116
117
|
"type-fest": "^4.10.2",
|
|
117
118
|
"vue-multiselect": "3.0.0-beta.3"
|
|
118
119
|
},
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="accordion-item">
|
|
3
|
-
<
|
|
4
|
-
{
|
|
5
|
-
<
|
|
3
|
+
<button @click="toggle()" :aria-expanded="open ? 'true' : 'false'" class="accordion-head"
|
|
4
|
+
:aria-controls="`accordion-body-${id}`">
|
|
5
|
+
<span class="accordion-label">{{ label }}</span>
|
|
6
|
+
<div class="accordion-icon" :class="{ open }">
|
|
6
7
|
<MaterialIcon icon="expand_more" />
|
|
7
8
|
</div>
|
|
8
|
-
</
|
|
9
|
+
</button>
|
|
9
10
|
<Transition name="expand">
|
|
10
|
-
<div v-if="open" class="accordion-body">
|
|
11
|
+
<div v-if="open" class="accordion-body" :id="`accordion-body-${id}`" :aria-hidden="open ? 'false' : 'true'">
|
|
11
12
|
<slot />
|
|
12
13
|
</div>
|
|
13
14
|
</Transition>
|
|
@@ -16,57 +17,80 @@
|
|
|
16
17
|
|
|
17
18
|
<script lang="ts" setup>
|
|
18
19
|
import { MaterialIcon } from '@bagelink/vue';
|
|
20
|
+
import { watch, inject } from 'vue';
|
|
19
21
|
|
|
20
|
-
defineProps<{
|
|
21
|
-
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
label: string,
|
|
24
|
+
id?: string,
|
|
22
25
|
}>();
|
|
23
|
-
|
|
24
26
|
let open = $ref(false);
|
|
25
27
|
|
|
28
|
+
const accordionState = inject('accordionState') as { openItem: string | null };
|
|
29
|
+
const id = props.id || Math.random().toString(36).substring(7);
|
|
30
|
+
|
|
31
|
+
watch(() => accordionState.openItem, (currentOpenId) => {
|
|
32
|
+
if (currentOpenId !== id) {
|
|
33
|
+
open = false;
|
|
34
|
+
}
|
|
35
|
+
}, { immediate: true });
|
|
36
|
+
|
|
26
37
|
function toggle() {
|
|
27
38
|
open = !open;
|
|
28
|
-
|
|
39
|
+
if (open) accordionState.openItem = id;
|
|
40
|
+
else if (accordionState.openItem === id) accordionState.openItem = null;
|
|
29
41
|
}
|
|
30
42
|
</script>
|
|
31
43
|
|
|
32
44
|
<style scoped>
|
|
33
45
|
.accordion-item {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
border-bottom: 1px solid var(--border-color);
|
|
47
|
+
transition: all 0.2s;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
overflow: hidden;
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
.accordion-head {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
53
|
+
height: var(--input-height);
|
|
54
|
+
background: transparent;
|
|
55
|
+
display: flex;
|
|
56
|
+
width: 100%;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: space-between;
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
.accordion-icon {
|
|
48
|
-
|
|
62
|
+
transition: all 0.2s ease;
|
|
49
63
|
}
|
|
64
|
+
|
|
50
65
|
.accordion-icon.open {
|
|
51
|
-
|
|
66
|
+
transform: rotate(180deg);
|
|
52
67
|
}
|
|
68
|
+
|
|
69
|
+
.accordion-label {
|
|
70
|
+
font-weight: bold;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.accordion-head:hover .accordion-label {
|
|
74
|
+
text-decoration: underline;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.accordion-body {}
|
|
53
78
|
</style>
|
|
54
79
|
|
|
55
80
|
<style>
|
|
56
81
|
.expand-enter-active,
|
|
57
82
|
.expand-leave-active {
|
|
58
|
-
|
|
83
|
+
transition: all 0.5s;
|
|
84
|
+
transition-delay: 0ms;
|
|
59
85
|
}
|
|
60
86
|
|
|
61
87
|
.expand-enter-from,
|
|
62
88
|
.expand-leave-to {
|
|
63
|
-
|
|
64
|
-
opacity: 0.5;
|
|
89
|
+
max-height: 0;
|
|
65
90
|
}
|
|
66
91
|
|
|
67
92
|
.expand-enter-to,
|
|
68
93
|
.expand-leave-from {
|
|
69
|
-
|
|
70
|
-
opacity: 1;
|
|
94
|
+
max-height: 300px;
|
|
71
95
|
}
|
|
72
96
|
</style>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Dropdown placement="auto-start" class="bagel-input combobox">
|
|
3
|
+
<button class="combobox-btn" @click="toggle">
|
|
4
|
+
{{
|
|
5
|
+
valueToLabel(selectedItem) ||
|
|
6
|
+
placeholder || 'Select' }}
|
|
7
|
+
<MaterialIcon v-bind="{ 'icon': open ? 'unfold_less' : 'unfold_more' }" />
|
|
8
|
+
</button>
|
|
9
|
+
<input type="hidden" v-if="required">
|
|
10
|
+
<template #popper="{ hide }">
|
|
11
|
+
<Card thin class="combobox-options">
|
|
12
|
+
<TextInput v-if="searchable" ref="searchInput" dense :placeholder="'Search'" icon="search" v-model="search" />
|
|
13
|
+
<div class="combobox-option" v-for="(option, i) in filteredOptions" :key="`${option}${i}`" @click="() => {
|
|
14
|
+
select(option)
|
|
15
|
+
hide();
|
|
16
|
+
}" :class="{ selected: option === selectedItem }">
|
|
17
|
+
<span>
|
|
18
|
+
{{ label(option) }}
|
|
19
|
+
</span>
|
|
20
|
+
<Icon v-if="isSelected(option)" icon="check" />
|
|
21
|
+
</div>
|
|
22
|
+
</Card>
|
|
23
|
+
</template>
|
|
24
|
+
</Dropdown>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import { Dropdown } from 'floating-vue';
|
|
29
|
+
import 'floating-vue/style.css';
|
|
30
|
+
import {
|
|
31
|
+
TextInput, Card, Icon, MaterialIcon,
|
|
32
|
+
} from '@bagelink/vue';
|
|
33
|
+
|
|
34
|
+
type Option = string | number | Record<string, any> | { label: string, value: string | number };
|
|
35
|
+
let open = $ref(false);
|
|
36
|
+
let selectedItem = $ref<Option>();
|
|
37
|
+
|
|
38
|
+
const searchInput = $ref<HTMLInputElement | null>(null);
|
|
39
|
+
|
|
40
|
+
const props = defineProps<{
|
|
41
|
+
options: Option[];
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
modelValue?: Option;
|
|
45
|
+
searchable?: boolean;
|
|
46
|
+
required?: boolean;
|
|
47
|
+
}>();
|
|
48
|
+
let search = $ref('');
|
|
49
|
+
|
|
50
|
+
const toggle = () => {
|
|
51
|
+
open = !open;
|
|
52
|
+
if (!open) search = '';
|
|
53
|
+
if (open) setTimeout(() => (searchInput as any)?.$el?.querySelector('input')?.focus(), 100);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const valueToLabel = (value?: Option) => {
|
|
57
|
+
if (!value) return '';
|
|
58
|
+
const option = props.options.find((option) => {
|
|
59
|
+
if (typeof option === 'string' || typeof option === 'number') return option === value;
|
|
60
|
+
return option.value === value;
|
|
61
|
+
});
|
|
62
|
+
if (!option) return value;
|
|
63
|
+
return label(option);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const emit = defineEmits(['update:modelValue']);
|
|
67
|
+
|
|
68
|
+
const label = (option: Option) => {
|
|
69
|
+
if (typeof option === 'string') return option;
|
|
70
|
+
if (typeof option === 'number') return `${option}`;
|
|
71
|
+
return option.label;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const isSelected = (option: Option) => {
|
|
75
|
+
if (typeof option === 'string' || typeof option === 'number') return option === selectedItem;
|
|
76
|
+
return option.value === selectedItem;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const filteredOptions = $computed(() => props.options.filter((option) => {
|
|
80
|
+
const searchTerm = new RegExp(search, 'gi');
|
|
81
|
+
if (typeof option === 'string') return option.match(searchTerm);
|
|
82
|
+
if (typeof option === 'number') return `${option}`.match(searchTerm);
|
|
83
|
+
return option.label.match(searchTerm);
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
const select = (option: Option) => {
|
|
87
|
+
if (typeof option === 'string') selectedItem = option;
|
|
88
|
+
else if (typeof option === 'number') selectedItem = option;
|
|
89
|
+
else selectedItem = option.value;
|
|
90
|
+
emit('update:modelValue', selectedItem);
|
|
91
|
+
open = false;
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style scoped>
|
|
96
|
+
.combobox {
|
|
97
|
+
width: 100%;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.combobox-option {
|
|
101
|
+
padding: 6px 12px;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
border-radius: 5px;
|
|
104
|
+
transition: all 0.2s;
|
|
105
|
+
display: flex;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
width: 100%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.combobox-options {
|
|
111
|
+
max-height: 300px;
|
|
112
|
+
overflow-y: auto;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.combobox-option:hover {
|
|
116
|
+
background: var(--bgl-gray-20);
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
119
|
+
|
|
120
|
+
<style>
|
|
121
|
+
.combobox-btn {
|
|
122
|
+
display: flex;
|
|
123
|
+
justify-content: space-between;
|
|
124
|
+
align-items: center;
|
|
125
|
+
height: var(--input-height);
|
|
126
|
+
border-radius: var(--input-border-radius);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.v-popper__arrow-container {
|
|
130
|
+
display: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.v-popper--theme-dropdown .v-popper__inner {
|
|
134
|
+
border: none;
|
|
135
|
+
background: transparent;
|
|
136
|
+
border-radius: var(--card-border-radius);
|
|
137
|
+
}
|
|
138
|
+
</style>
|
|
@@ -1,95 +1,97 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
<div class="bagel-input bgl-checkbox" :title="title" :class="{ small: small }">
|
|
3
|
+
<div class="check-square" :class="{ checked: checked }" @click="checked = !checked">
|
|
4
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24">
|
|
5
|
+
<path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z" />
|
|
6
|
+
</svg>
|
|
7
|
+
</div>
|
|
8
|
+
<label>
|
|
9
|
+
<input :required="required" :id="id" type="checkbox" v-model="checked">
|
|
10
|
+
<slot name="label">
|
|
11
|
+
{{ label }}
|
|
12
|
+
</slot>
|
|
13
|
+
</label>
|
|
14
|
+
</div>
|
|
13
15
|
</template>
|
|
14
16
|
|
|
15
17
|
<script setup lang="ts">
|
|
16
18
|
defineProps<{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
label?: string;
|
|
20
|
+
id?: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
small?: boolean;
|
|
23
|
+
required?: boolean
|
|
22
24
|
}>();
|
|
23
25
|
|
|
24
26
|
const checked = defineModel<boolean>('modelValue', { default: false });
|
|
25
27
|
</script>
|
|
26
28
|
<style>
|
|
27
29
|
:root {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
--bgl-white: #fff;
|
|
31
|
+
--input-height: 40px;
|
|
32
|
+
--input-border-radius: 7px;
|
|
33
|
+
--bgl-transition: all 200ms ease;
|
|
34
|
+
--bgl-primary: #19b8ea;
|
|
33
35
|
|
|
34
36
|
}
|
|
35
37
|
</style>
|
|
36
38
|
<style scoped>
|
|
37
39
|
.bgl-checkbox {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
position: relative;
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: row;
|
|
43
|
+
align-items: center;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
.bgl-checkbox input[type=checkbox] {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
position: absolute;
|
|
48
|
+
opacity: 0;
|
|
49
|
+
z-index: -1;
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
.bgl-checkbox label {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
padding-inline-start: 0.5rem;
|
|
54
|
+
transition: var(--bgl-transition);
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
user-select: none;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
.bgl-checkbox:hover {
|
|
58
|
-
|
|
60
|
+
filter: brightness(95%);
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
.bgl-checkbox:active {
|
|
62
|
-
|
|
64
|
+
filter: var(--bgl-active-filter);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
.bgl-checkbox .check-square {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
width: calc(var(--input-height) / 2.5);
|
|
69
|
+
height: calc(var(--input-height) / 2.5);
|
|
70
|
+
background: var(--bgl-white);
|
|
71
|
+
border-radius: calc(var(--input-border-radius) / 2);
|
|
72
|
+
border: var(--bgl-primary) 1px solid;
|
|
73
|
+
position: relative;
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
.check-square.checked {
|
|
78
|
-
|
|
80
|
+
background: var(--bgl-primary);
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
.bgl-checkbox svg {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
width: calc(var(--input-height) / 2.5);
|
|
85
|
+
height: calc(var(--input-height) / 2.5);
|
|
86
|
+
position: absolute;
|
|
87
|
+
z-index: 2;
|
|
88
|
+
fill: var(--bgl-white);
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
transform: scale(0);
|
|
91
|
+
transition: var(--bgl-transition);
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
.check-square.checked svg {
|
|
93
|
-
|
|
95
|
+
transform: scale(1);
|
|
94
96
|
}
|
|
95
97
|
</style>
|