@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.
Files changed (46) hide show
  1. package/dist/components/Accordion.vue.d.ts +10 -0
  2. package/dist/components/Accordion.vue.d.ts.map +1 -0
  3. package/dist/components/AccordionItem.vue.d.ts +2 -0
  4. package/dist/components/AccordionItem.vue.d.ts.map +1 -1
  5. package/dist/components/Btn.vue.d.ts +3 -3
  6. package/dist/components/{Drop.vue.d.ts → ComboBox.vue.d.ts} +12 -12
  7. package/dist/components/ComboBox.vue.d.ts.map +1 -0
  8. package/dist/components/Popover.vue.d.ts +10 -0
  9. package/dist/components/Popover.vue.d.ts.map +1 -0
  10. package/dist/components/Title.vue.d.ts +1 -1
  11. package/dist/components/form/BglForm.vue.d.ts.map +1 -1
  12. package/dist/components/form/ItemRef.vue.d.ts +0 -1
  13. package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
  14. package/dist/components/form/inputs/CheckInput.vue.d.ts +9 -4
  15. package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
  16. package/dist/components/form/inputs/SelectField.vue.d.ts +4 -1
  17. package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
  18. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  19. package/dist/components/index.d.ts +3 -0
  20. package/dist/components/index.d.ts.map +1 -1
  21. package/dist/index.cjs +6778 -4053
  22. package/dist/index.mjs +6752 -4027
  23. package/dist/plugins/bagel.d.ts.map +1 -1
  24. package/dist/plugins/modal.d.ts +1 -1
  25. package/dist/plugins/modal.d.ts.map +1 -1
  26. package/dist/style.css +706 -678
  27. package/dist/utils/clickOutside.d.ts +7 -0
  28. package/dist/utils/clickOutside.d.ts.map +1 -0
  29. package/package.json +2 -1
  30. package/src/components/Accordion.vue +15 -0
  31. package/src/components/AccordionItem.vue +48 -24
  32. package/src/components/ComboBox.vue +138 -0
  33. package/src/components/form/inputs/CheckInput.vue +55 -53
  34. package/src/components/form/inputs/SelectInput.vue +272 -284
  35. package/src/components/formkit/Toggle.vue +85 -100
  36. package/src/components/index.ts +3 -0
  37. package/src/plugins/bagel.ts +14 -2
  38. package/src/plugins/modal.ts +23 -23
  39. package/src/styles/buttons.css +38 -40
  40. package/src/styles/inputs.css +100 -109
  41. package/src/styles/layout.css +191 -189
  42. package/src/styles/text.css +38 -62
  43. package/src/utils/clickOutside.ts +15 -0
  44. package/dist/components/Drop.vue.d.ts.map +0 -1
  45. package/dist/components/FileUploader.vue.d.ts +0 -60
  46. package/dist/components/FileUploader.vue.d.ts.map +0 -1
@@ -1,164 +1,149 @@
1
1
  <template>
2
- <div
3
- class="bagel-input checkbox"
4
- :class="{ check: context?.attrs.isCheckbox }"
5
- :title="context?.help"
6
- >
2
+ <div class="bagel-input checkbox" :title="label">
7
3
  <label class="switch">
8
- <input
9
- @change="() => props.context?.node.input(inputVal)"
10
- type="checkbox"
11
- v-model="inputVal"
12
- :id="context?.id"
13
- >
4
+ <input type="checkbox" v-model="inputVal" :id="id">
14
5
  <span class="slider round" />
15
6
  </label>
16
7
  </div>
17
8
  </template>
18
9
 
19
10
  <script setup lang="ts">
20
- import { watch } from 'vue';
21
-
22
- const props = defineProps({
23
- context: Object,
11
+ defineProps<{
12
+ helpText?: string;
13
+ id: string;
14
+ label?: string;
15
+ }>();
16
+ const inputVal = defineModel('modelValue', {
17
+ type: Boolean,
18
+ default: false,
24
19
  });
25
-
26
- let inputVal = $ref(false);
27
-
28
- watch(
29
- () => props.context?.value,
30
- (newVal) => {
31
- inputVal = newVal;
32
- },
33
- { immediate: true },
34
- );
35
20
  </script>
36
21
 
37
22
  <style>
38
23
  .checkbox-label {
39
- display: flex;
40
- gap: 0.5rem;
41
- flex-direction: row-reverse;
42
- justify-content: flex-end;
43
- align-items: center;
44
- cursor: pointer;
24
+ display: flex;
25
+ gap: 0.5rem;
26
+ flex-direction: row-reverse;
27
+ justify-content: flex-end;
28
+ align-items: center;
29
+ cursor: pointer;
45
30
  }
46
31
  </style>
47
32
 
48
33
  <style scoped>
49
34
  .no-edit {
50
- pointer-events: none;
35
+ pointer-events: none;
51
36
  }
52
37
 
53
38
  .radio-wrap p {
54
- display: inline-block;
55
- color: var(--input-bg);
56
- font-size: var(--input-font-size);
57
- margin-inline-end: 10px;
39
+ display: inline-block;
40
+ color: var(--input-bg);
41
+ font-size: var(--input-font-size);
42
+ margin-inline-end: 10px;
58
43
  }
59
44
 
60
45
  .radio-wrap label {
61
- padding: 3px 5px;
62
- display: inline-block;
63
- border-radius: var(--input-border-radius);
64
- font-size: var(--input-font-size);
65
- background: var(--input-bg);
66
- color: var(--bgl-black);
67
- text-align: center;
68
- margin: 8px 5px;
69
- cursor: pointer;
70
- user-select: none;
46
+ padding: 3px 5px;
47
+ display: inline-block;
48
+ border-radius: var(--input-border-radius);
49
+ font-size: var(--input-font-size);
50
+ background: var(--input-bg);
51
+ color: var(--bgl-black);
52
+ text-align: center;
53
+ margin: 8px 5px;
54
+ cursor: pointer;
55
+ user-select: none;
71
56
  }
72
57
 
73
58
  .bagel-input .radio-wrap label::after {
74
- background: transparent;
59
+ background: transparent;
75
60
  }
76
61
 
77
62
  .radio-wrap input {
78
- display: none;
63
+ display: none;
79
64
  }
80
65
 
81
- .radio-wrap input:checked:checked + label {
82
- background: var(--bgl-primary);
83
- color: var(--bgl-white);
66
+ .radio-wrap input:checked:checked+label {
67
+ background: var(--bgl-primary);
68
+ color: var(--bgl-white);
84
69
  }
85
70
 
86
71
  .checkbox {
87
- position: relative;
72
+ position: relative;
88
73
  }
89
74
 
90
75
  .switch {
91
- position: relative;
92
- display: inline-block;
93
- height: calc(var(--input-height) / 2);
94
- width: var(--input-height);
95
- border-radius: var(--input-height);
76
+ position: relative;
77
+ display: inline-block;
78
+ height: calc(var(--input-height) / 2);
79
+ width: var(--input-height);
80
+ border-radius: var(--input-height);
96
81
  }
97
82
 
98
83
  .switch input {
99
- opacity: 0;
100
- width: 0;
101
- height: 0;
84
+ opacity: 0;
85
+ width: 0;
86
+ height: 0;
102
87
  }
103
88
 
104
89
  .bagel-input.checkbox.check {
105
- margin: 0;
90
+ margin: 0;
106
91
  }
107
92
 
108
93
  .bagel-input.checkbox.check .switch {
109
- width: calc(var(--input-height) / 2);
110
- height: calc(var(--input-height) / 2);
111
- transition: 0.2s;
94
+ width: calc(var(--input-height) / 2);
95
+ height: calc(var(--input-height) / 2);
96
+ transition: 0.2s;
112
97
  }
113
98
 
114
99
  .bagel-input.checkbox.check .slider:before {
115
- position: absolute;
116
- font-family: "Material Symbols Outlined", serif;
117
- content: "";
118
- color: var(--bgl-white);
119
- background: transparent;
120
- display: flex;
121
- align-items: center;
122
- justify-content: center;
100
+ position: absolute;
101
+ font-family: "Material Symbols Outlined", serif;
102
+ content: "";
103
+ color: var(--bgl-white);
104
+ background: transparent;
105
+ display: flex;
106
+ align-items: center;
107
+ justify-content: center;
123
108
  }
124
109
 
125
- .bagel-input.checkbox.check input:checked + .slider:before {
126
- transform: none;
127
- content: "check";
110
+ .bagel-input.checkbox.check input:checked+.slider:before {
111
+ transform: none;
112
+ content: "check";
128
113
  }
129
114
 
130
115
  .slider {
131
- position: absolute;
132
- cursor: pointer;
133
- top: 0;
134
- left: 0;
135
- right: 0;
136
- bottom: 0;
137
- background: var(--input-bg);
138
- -webkit-transition: 0.4s;
139
- transition: 0.4s;
140
- border-radius: calc(var(--input-height) / 2);
141
- box-shadow: inset 0 0 10px #00000020;
116
+ position: absolute;
117
+ cursor: pointer;
118
+ top: 0;
119
+ left: 0;
120
+ right: 0;
121
+ bottom: 0;
122
+ background: var(--input-bg);
123
+ -webkit-transition: 0.4s;
124
+ transition: 0.4s;
125
+ border-radius: calc(var(--input-height) / 2);
126
+ box-shadow: inset 0 0 10px #00000020;
142
127
  }
143
128
 
144
129
  .slider:before {
145
- position: absolute;
146
- content: "";
147
- height: calc(var(--input-height) / 2 - 4px);
148
- width: calc(var(--input-height) / 2 - 4px);
149
- left: 2px;
150
- bottom: 2px;
151
- border-radius: 50%;
152
- background: var(--bgl-white);
153
- -webkit-transition: 0.4s;
154
- transition: 0.4s;
130
+ position: absolute;
131
+ content: "";
132
+ height: calc(var(--input-height) / 2 - 4px);
133
+ width: calc(var(--input-height) / 2 - 4px);
134
+ left: 2px;
135
+ bottom: 2px;
136
+ border-radius: 50%;
137
+ background: var(--bgl-white);
138
+ -webkit-transition: 0.4s;
139
+ transition: 0.4s;
155
140
  }
156
141
 
157
- input:checked + .slider {
158
- background: var(--bgl-primary);
142
+ input:checked+.slider {
143
+ background: var(--bgl-primary);
159
144
  }
160
145
 
161
- input:checked + .slider:before {
162
- transform: translateX(calc(var(--input-height) / 2));
146
+ input:checked+.slider:before {
147
+ transform: translateX(calc(var(--input-height) / 2));
163
148
  }
164
149
  </style>
@@ -1,6 +1,7 @@
1
1
  export { default as LangText } from './LangText.vue';
2
2
  export { default as RTXEditor } from './RTXEditor.vue';
3
3
  export { default as MaterialIcon } from './MaterialIcon.vue';
4
+ export { default as Icon } from './MaterialIcon.vue';
4
5
  export { default as NavBar } from './NavBar.vue';
5
6
  export { default as Btn } from './Btn.vue';
6
7
  export { default as Modal } from './Modal.vue';
@@ -18,6 +19,8 @@ export { default as DataPreview } from './DataPreview.vue';
18
19
  export { default as Card } from './Card.vue';
19
20
  export { default as Avatar } from './Avatar.vue';
20
21
  export { default as Title } from './Title.vue';
22
+ export { default as Accordion } from './Accordion.vue';
23
+ export { default as ComboBox } from './ComboBox.vue';
21
24
 
22
25
  export * from './charts';
23
26
  export * from './form';
@@ -1,6 +1,9 @@
1
+ // import { vTooltip } from 'floating-vue';
2
+ import FloatingVue from 'floating-vue';
1
3
  import { inject } from 'vue';
2
4
  import type { InjectionKey, Plugin } from 'vue';
3
5
  import { Bagel } from '@bagelink/sdk';
6
+ import clickOutside from '../utils/clickOutside';
4
7
 
5
8
  export const bagelInjectionKey = Symbol('bagel') as InjectionKey<Bagel>;
6
9
  export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<
@@ -29,11 +32,20 @@ export interface BagelOptions {
29
32
  // eslint-disable-next-line no-unused-vars
30
33
  i18nT?: (key: string) => string
31
34
  }
32
-
33
35
  export const BagelVue: Plugin = {
34
36
  install: (app, options: BagelOptions) => {
35
37
  const bagel = new Bagel({ host: options.host, onError: options.onError });
36
-
38
+ app.directive('click-outside', clickOutside);
39
+
40
+ app.use(FloatingVue, {
41
+ themes: {
42
+ 'bgl-theme': {
43
+ triggers: ['click'],
44
+ autoHide: true,
45
+ placement: 'bottom',
46
+ },
47
+ },
48
+ });
37
49
  app.config.globalProperties.$bagel = bagel;
38
50
  app.provide(bagelInjectionKey, bagel);
39
51
  app.config.globalProperties.$i18T = options?.i18nT || ((key?: string) => key);
@@ -6,39 +6,39 @@ import type { BglFormSchemaT, BtnOptions } from '@bagelink/vue';
6
6
  import { Modal, ModalForm } from '@bagelink/vue';
7
7
 
8
8
  export interface ModalOptions {
9
- title?: string;
10
- dismissable?: boolean;
11
- side?: boolean;
12
- actions?: BtnOptions[];
13
- class?: string;
9
+ title?: string;
10
+ dismissable?: boolean;
11
+ side?: boolean;
12
+ actions?: BtnOptions[];
13
+ class?: string;
14
14
  }
15
15
 
16
16
  export interface ModalFormOptions {
17
- side?: boolean;
18
- title?: string;
19
- dismissable?: boolean;
20
- schema: BglFormSchemaT<any> | (() => BglFormSchemaT) | BglFormSchemaT
21
- onSubmit?: (formData: any) => Promise<any>;
22
- onDelete?: (id: string) => Promise<void>;
23
- onError?: ((err: any) => void);
24
- modelValue?: Record<string, any>;
25
- 'onUpdate:modelValue'?: (val: any) => void;
17
+ side?: boolean;
18
+ title?: string;
19
+ dismissable?: boolean;
20
+ schema: BglFormSchemaT<any> | (() => BglFormSchemaT) | BglFormSchemaT
21
+ onSubmit?: (formData: any) => Promise<void>;
22
+ onDelete?: (id: string) => Promise<void>;
23
+ onError?: ((err: any) => void);
24
+ modelValue?: Record<string, any>;
25
+ 'onUpdate:modelValue'?: (val: any) => void;
26
26
  }
27
27
 
28
28
  export interface ModalComponentProps {
29
- componentSlots: Record<string, any>,
30
- modalType: 'modal' | 'modalForm',
31
- modalOptions: ModalOptions | ModalFormOptions
29
+ componentSlots: Record<string, any>,
30
+ modalType: 'modal' | 'modalForm',
31
+ modalOptions: ModalOptions | ModalFormOptions
32
32
  }
33
33
  export interface ModalFormComponentProps {
34
- componentSlots: Record<string, any>,
35
- modalType: 'modalForm',
36
- modalOptions: ModalFormOptions
34
+ componentSlots: Record<string, any>,
35
+ modalType: 'modalForm',
36
+ modalOptions: ModalFormOptions
37
37
  }
38
38
  export interface ModalApi {
39
- showModal: (options: ModalOptions, slots?: Record<string, any>) => void;
40
- showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => ModalFormComponentProps | undefined;
41
- hideModal: (index?: number) => void;
39
+ showModal: (options: ModalOptions, slots?: Record<string, any>) => void;
40
+ showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => ModalFormComponentProps | undefined;
41
+ hideModal: (index?: number) => void;
42
42
  }
43
43
 
44
44
  export const ModalSymbol: InjectionKey<ModalApi> = Symbol('modal');
@@ -1,61 +1,59 @@
1
- button,
2
1
  .bgl_btn,
3
2
  .bgl_flatBtn,
4
3
  .bgl_btn-icon {
5
- font-family: inherit;
6
- white-space: nowrap;
7
- cursor: pointer;
8
- box-sizing: border-box;
9
- user-select: none;
10
- border: none;
11
- transition: var(--bgl-transition);
12
- border-radius: var(--btn-border-radius);
13
- line-height: var(--btn-height);
14
- font-size: var(--input-font-size);
15
- display: inline-block;
16
- height: var(--btn-height);
17
- padding: 0
4
+ font-family: inherit;
5
+ white-space: nowrap;
6
+ cursor: pointer;
7
+ box-sizing: border-box;
8
+ user-select: none;
9
+ border: none;
10
+ transition: var(--bgl-transition);
11
+ border-radius: var(--btn-border-radius);
12
+ line-height: var(--btn-height);
13
+ font-size: var(--input-font-size);
14
+ display: inline-block;
15
+ height: var(--btn-height);
16
+ padding: 0;
18
17
  }
19
18
 
20
19
  .btn-close {
21
- margin-top: -20px;
22
- margin-inline-end: -20px;
23
- margin-inline-start: auto;
24
- margin-bottom: 15px;
25
- transition: var(--bgl-transition);
26
- height: 30px;
27
- width: 30px;
28
- opacity: 0.6;
29
- cursor: pointer;
30
- border-radius: 100%;
31
- outline: 2px solid transparent;
32
- display: flex;
33
- align-items: center;
34
- justify-content: center;
20
+ margin-top: -20px;
21
+ margin-inline-end: -20px;
22
+ margin-inline-start: auto;
23
+ margin-bottom: 15px;
24
+ transition: var(--bgl-transition);
25
+ height: 30px;
26
+ width: 30px;
27
+ opacity: 0.6;
28
+ cursor: pointer;
29
+ border-radius: 100%;
30
+ outline: 2px solid transparent;
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
35
34
  }
36
35
 
37
36
  .btn-close:hover {
38
- background: var(--bgl-gray-light);
39
- opacity: 1;
37
+ background: var(--bgl-gray-light);
38
+ opacity: 1;
40
39
  }
41
40
 
42
41
  .btn-close:active {
43
- background: var(--bgl-gray);
42
+ background: var(--bgl-gray);
44
43
  }
45
44
 
46
45
  .btn-close::before {
47
- content: "close";
48
- font-family: "Material Symbols Outlined", serif;
46
+ content: "close";
47
+ font-family: "Material Symbols Outlined", serif;
49
48
  }
50
49
 
51
-
52
50
  .bgl_btn.thin {
53
- height: calc(var(--btn-height) * 0.7);
54
- line-height: calc(var(--btn-height) * 0.7);
51
+ height: calc(var(--btn-height) * 0.7);
52
+ line-height: calc(var(--btn-height) * 0.7);
55
53
  }
56
54
 
57
55
  @media screen and (max-width: 910px) {
58
- .bgl_btn {
59
- padding: 0 20px;
60
- }
61
- }
56
+ .bgl_btn {
57
+ padding: 0 20px;
58
+ }
59
+ }