@bagelink/vue 0.0.316 → 0.0.322

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 (58) hide show
  1. package/dist/components/Badge.vue.d.ts +2 -2
  2. package/dist/components/Badge.vue.d.ts.map +1 -1
  3. package/dist/components/Card.vue.d.ts +2 -2
  4. package/dist/components/ComboBox.vue.d.ts +13 -2
  5. package/dist/components/ComboBox.vue.d.ts.map +1 -1
  6. package/dist/components/ListView.vue.d.ts.map +1 -1
  7. package/dist/components/Modal.vue.d.ts +1 -0
  8. package/dist/components/Modal.vue.d.ts.map +1 -1
  9. package/dist/components/NavBar.vue.d.ts.map +1 -1
  10. package/dist/components/form/BglField.vue.d.ts.map +1 -1
  11. package/dist/components/form/BglForm.vue.d.ts +50 -27
  12. package/dist/components/form/BglForm.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/DateInput.vue.d.ts +1 -0
  14. package/dist/components/form/inputs/TextInput.vue.d.ts +2 -0
  15. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  16. package/dist/components/index.d.ts +0 -1
  17. package/dist/components/index.d.ts.map +1 -1
  18. package/dist/components/layout/Layout.vue.d.ts +3 -3
  19. package/dist/components/layout/Layout.vue.d.ts.map +1 -1
  20. package/dist/components/layout/SidebarMenu.vue.d.ts +1 -7
  21. package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
  22. package/dist/components/whatsapp/index.d.ts +0 -2
  23. package/dist/components/whatsapp/index.d.ts.map +1 -1
  24. package/dist/index.cjs +417 -568
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.mjs +417 -568
  27. package/dist/style.css +224 -258
  28. package/dist/types/BagelForm.d.ts +1 -1
  29. package/dist/types/BagelForm.d.ts.map +1 -1
  30. package/dist/types/NavLink.d.ts +2 -1
  31. package/dist/types/NavLink.d.ts.map +1 -1
  32. package/dist/types/materialIcons.d.ts +1 -1
  33. package/dist/types/materialIcons.d.ts.map +1 -1
  34. package/dist/utils/BagelFormUtils.d.ts +23 -0
  35. package/dist/utils/BagelFormUtils.d.ts.map +1 -0
  36. package/dist/utils/index.d.ts +1 -0
  37. package/dist/utils/index.d.ts.map +1 -1
  38. package/package.json +2 -2
  39. package/src/components/Badge.vue +2 -2
  40. package/src/components/Carousel.vue +137 -137
  41. package/src/components/ComboBox.vue +72 -49
  42. package/src/components/ListView.vue +28 -27
  43. package/src/components/Modal.vue +25 -23
  44. package/src/components/NavBar.vue +46 -40
  45. package/src/components/form/BglField.vue +33 -48
  46. package/src/components/form/BglForm.vue +34 -15
  47. package/src/components/form/inputs/TextInput.vue +121 -151
  48. package/src/components/index.ts +1 -1
  49. package/src/components/layout/Layout.vue +3 -2
  50. package/src/components/layout/SidebarMenu.vue +5 -12
  51. package/src/components/whatsapp/index.ts +2 -2
  52. package/src/styles/layout.css +24 -1
  53. package/src/styles/text.css +4 -0
  54. package/src/types/BagelForm.ts +7 -7
  55. package/src/types/NavLink.ts +2 -1
  56. package/src/types/materialIcons.ts +1183 -3006
  57. package/src/utils/BagelFormUtils.ts +58 -0
  58. package/src/utils/index.ts +3 -0
@@ -1,107 +1,65 @@
1
1
  <template>
2
- <div
3
- class="bagel-input text-input"
4
- :class="{
5
- dense, small, shrink, toggleEdit, editMode, code,
6
- textInputIconWrap: icon,
7
- txtInputIconStart: iconStart,
8
- }"
9
- :title="title"
10
- >
11
- <label :for="id">
12
- {{ label }}
13
- <input
14
- v-if="!multiline && !autoheight && !code"
15
- :title="title"
16
- :autocomplete="autocomplete"
17
- :id="id"
18
- v-model="inputVal"
19
- :type="type"
20
- :rows="1"
21
- ref="input"
22
- :placeholder="placeholder || label"
23
- :disabled="!editMode"
24
- :required="required"
25
- :pattern="pattern"
26
- v-bind="nativeInputAttrs"
27
- @dblclick="toggleEditAction"
28
- >
29
- <textarea
30
- v-else
31
- :title="title"
32
- :id="id"
33
- v-model="inputVal"
34
- :type="type"
35
- :rows="rows"
36
- ref="input"
37
- :placeholder="placeholder || label"
38
- :disabled="!editMode"
39
- :required="required"
40
- :pattern="pattern"
41
- v-bind="nativeInputAttrs"
42
- @dblclick="toggleEditAction"
43
- />
44
- <p v-if="helptext">{{ helptext }}</p>
45
- </label>
46
-
47
- <MaterialIcon
48
- class="iconStart"
49
- v-if="iconStart"
50
- :icon="iconStart"
51
- />
52
- <MaterialIcon
53
- v-if="icon"
54
- :icon="icon"
55
- />
56
- <Btn
57
- class="toggleEditBtn"
58
- v-if="toggleEdit"
59
- thin
60
- @click="toggleEditAction"
61
- :icon="editMode ? 'check'
62
- : 'edit'"
63
- flat
64
- />
65
- </div>
2
+ <div class="bagel-input text-input" :class="{
3
+ dense, small, shrink, toggleEdit, editMode, code,
4
+ textInputIconWrap: icon,
5
+ txtInputIconStart: iconStart,
6
+ }" :title="title">
7
+ <label :for="id">
8
+ {{ label }}
9
+ <input v-if="!multiline && !autoheight && !code" :title="title" :autocomplete="autocomplete" :id="id"
10
+ v-model="inputVal" :type="type" :rows="1" ref="input" :placeholder="placeholder || label" :disabled="!editMode"
11
+ :required="required" :pattern="pattern" v-bind="nativeInputAttrs" @dblclick="toggleEditAction">
12
+ <textarea v-else :title="title" :id="id" v-model="inputVal" :type="type" :rows="rows" ref="input"
13
+ :placeholder="placeholder || label" :disabled="!editMode" :required="required" :pattern="pattern"
14
+ v-bind="nativeInputAttrs" @dblclick="toggleEditAction" />
15
+ <p v-if="helptext">{{ helptext }}</p>
16
+ </label>
17
+
18
+ <MaterialIcon class="iconStart" v-if="iconStart" :icon="iconStart" />
19
+ <MaterialIcon v-if="icon" :icon="icon" />
20
+ <Btn class="toggleEditBtn" v-if="toggleEdit" thin @click="toggleEditAction" :icon="editMode ? 'check'
21
+ : 'edit'" flat />
22
+ </div>
66
23
  </template>
67
24
 
68
25
  <script setup lang="ts">
69
- import { watch } from 'vue';
26
+ import { onMounted, watch } from 'vue';
70
27
  import {
71
- debounce, Btn, type MaterialIcons, MaterialIcon,
28
+ debounce, Btn, type MaterialIcons, MaterialIcon,
72
29
  } from '@bagelink/vue';
73
30
 
74
31
  const emit = defineEmits(['update:modelValue', 'debounce']);
75
32
  const props = withDefaults(
76
- defineProps<{
77
- id?: string;
78
- title?: string;
79
- helptext?: string;
80
- placeholder?: string;
81
- modelValue?: string | number;
82
- label?: string;
83
- small?: boolean;
84
- dense?: boolean;
85
- required?: boolean;
86
- pattern?: string;
87
- shrink?: boolean;
88
- toggleEdit?: boolean;
89
- type?: string;
90
- nativeInputAttrs?: Record<string, any>;
91
- icon?: MaterialIcons;
92
- iconStart?: MaterialIcons;
93
- multiline?: boolean;
94
- autoheight?: boolean;
95
- code?: boolean;
96
- lines?: number;
97
- autocomplete?: string;
98
- }>(),
99
- {
100
- type: 'text',
101
- toggleEdit: false,
102
- modelValue: '',
103
- autocomplete: 'off',
104
- },
33
+ defineProps<{
34
+ id?: string;
35
+ title?: string;
36
+ helptext?: string;
37
+ placeholder?: string;
38
+ modelValue?: string | number;
39
+ label?: string;
40
+ small?: boolean;
41
+ dense?: boolean;
42
+ required?: boolean;
43
+ pattern?: string;
44
+ shrink?: boolean;
45
+ toggleEdit?: boolean;
46
+ type?: string;
47
+ nativeInputAttrs?: Record<string, any>;
48
+ icon?: MaterialIcons;
49
+ iconStart?: MaterialIcons;
50
+ multiline?: boolean;
51
+ autoheight?: boolean;
52
+ code?: boolean;
53
+ lines?: number;
54
+ autocomplete?: string;
55
+ autofocus?: boolean;
56
+ }>(),
57
+ {
58
+ type: 'text',
59
+ toggleEdit: false,
60
+ modelValue: '',
61
+ autocomplete: 'off',
62
+ },
105
63
  );
106
64
  let inputVal = $ref<string | number>();
107
65
  let editMode = $ref<boolean>(!props.toggleEdit);
@@ -109,118 +67,130 @@ let editMode = $ref<boolean>(!props.toggleEdit);
109
67
  const input = $ref<HTMLInputElement>();
110
68
 
111
69
  const toggleEditAction = () => {
112
- if (!props.toggleEdit) return;
113
- if (editMode) {
114
- editMode = false;
115
- emit('debounce', inputVal);
116
- emit('update:modelValue', inputVal as string);
117
- } else {
118
- editMode = true;
119
- setTimeout(() => input?.focus(), 10);
120
- }
70
+ if (!props.toggleEdit) return;
71
+ if (editMode) {
72
+ editMode = false;
73
+ emit('debounce', inputVal);
74
+ emit('update:modelValue', inputVal as string);
75
+ } else {
76
+ editMode = true;
77
+ setTimeout(() => input?.focus(), 10);
78
+ }
121
79
  };
122
80
 
123
81
  const rows = $computed(() => {
124
- if (props.lines) return props.lines;
125
- if (props.autoheight) return `${inputVal}`?.split('\n').length || 1;
126
- if (props.multiline || props.code) return 4;
127
- return 1;
82
+ if (props.lines) return props.lines;
83
+ if (props.autoheight) return `${inputVal}`?.split('\n').length || 1;
84
+ if (props.multiline || props.code) return 4;
85
+ return 1;
128
86
  });
129
87
 
130
88
  watch(
131
- () => inputVal,
132
- (newVal) => {
133
- if (props.toggleEdit) return;
134
- if (newVal === props.modelValue) return;
135
- emit('update:modelValue', newVal as string);
136
- debounce(() => emit('debounce', newVal));
137
- },
89
+ () => inputVal,
90
+ (newVal) => {
91
+ if (props.toggleEdit) return;
92
+ if (newVal === props.modelValue) return;
93
+ emit('update:modelValue', newVal as string);
94
+ debounce(() => emit('debounce', newVal));
95
+ },
138
96
  );
139
97
 
140
98
  watch(
141
- () => props.modelValue,
142
- (newVal) => {
143
- if (newVal !== inputVal) inputVal = newVal;
144
- },
145
- { immediate: true },
99
+ () => props.modelValue,
100
+ (newVal) => {
101
+ if (newVal !== inputVal) inputVal = newVal;
102
+ },
103
+ { immediate: true },
146
104
  );
105
+
106
+ onMounted(() => {
107
+ if (props.autofocus) setTimeout(() => input?.focus(), 10);
108
+ });
147
109
  </script>
148
110
 
149
111
  <style>
150
112
  .bagel-input.shrink,
151
113
  .bagel-input.shrink input {
152
- min-width: unset !important;
153
- /* width: auto; */
114
+ min-width: unset !important;
115
+ /* width: auto; */
116
+ }
117
+ .bagel-input label {
118
+ font-size: var(--label-font-size);
154
119
  }
155
120
  </style>
156
121
 
157
122
  <style scoped>
158
123
  .bagel-input textarea {
159
- min-height: unset;
124
+ min-height: unset;
125
+ font-size: var(--input-font-size);
160
126
  }
161
127
 
162
128
  .bagel-input.text-input textarea {
163
- resize: none;
129
+ resize: none;
164
130
  }
165
131
 
166
132
  .code textarea {
167
- font-family: 'Inconsolata', monospace;
168
- background: var(--bgl-black) !important;
169
- color: var(--bgl-white) !important;
133
+ font-family: 'Inconsolata', monospace;
134
+ background: var(--bgl-black) !important;
135
+ color: var(--bgl-white) !important;
170
136
  }
171
137
 
172
138
  .bagel-input.toggleEdit:hover {
173
- background-color: var(--input-bg);
139
+ background-color: var(--input-bg);
174
140
  }
175
141
 
176
142
  .bagel-input.small {
177
- margin-bottom: 0;
178
- height: 30px;
143
+ margin-bottom: 0;
144
+ height: 30px;
179
145
  }
180
146
 
181
147
  .bagel-input.dense label {
182
- display: flex;
183
- align-items: center;
184
- gap: 0.5rem;
148
+ display: flex;
149
+ align-items: center;
150
+ gap: 0.5rem;
151
+ }
152
+
153
+ .bagel-input label {
154
+ font-size: var(--label-font-size);
185
155
  }
186
156
 
187
157
  .toggleEditBtn {
188
- position: absolute;
189
- right: -24px;
190
- top: 4;
191
- opacity: 0;
158
+ position: absolute;
159
+ right: -24px;
160
+ top: 4;
161
+ opacity: 0;
192
162
  }
193
163
 
194
164
  .textInputIconWrap {
195
- position: relative;
165
+ position: relative;
196
166
  }
197
167
 
198
168
  .textInputIconWrap .bgl_icon-font {
199
- position: absolute;
200
- inset-inline-end: 0.7rem;
201
- bottom: 50%;
202
- line-height: 0;
203
- color: var(--bgl-gray);
169
+ position: absolute;
170
+ inset-inline-end: 0.7rem;
171
+ bottom: 50%;
172
+ line-height: 0;
173
+ color: var(--bgl-gray);
204
174
  }
205
175
 
206
176
  .txtInputIconStart .iconStart {
207
- position: absolute;
208
- inset-inline-start: 0.7rem;
209
- top: 50%;
210
- line-height: 0;
211
- color: var(--bgl-gray);
177
+ position: absolute;
178
+ inset-inline-start: 0.7rem;
179
+ top: 50%;
180
+ line-height: 0;
181
+ color: var(--bgl-gray);
212
182
  }
213
183
 
214
184
  .txtInputIconStart textarea {
215
- padding-inline-start: 2rem;
185
+ padding-inline-start: 2rem;
216
186
  }
217
187
 
218
188
  .bagel-input:hover .toggleEditBtn,
219
189
  .bagel-input.editMode .toggleEditBtn {
220
- opacity: 1;
190
+ opacity: 1;
221
191
  }
222
192
 
223
193
  .bagel-input.small textarea {
224
- height: 30px;
194
+ height: 30px;
225
195
  }
226
196
  </style>
@@ -27,5 +27,5 @@ export { default as Carousel } from './Carousel.vue';
27
27
 
28
28
  export * from './form';
29
29
  export * from './dashboard';
30
- export * from './whatsapp';
30
+ // export * from './whatsapp';
31
31
  export * from './layout';
@@ -5,13 +5,14 @@
5
5
  </template>
6
6
 
7
7
  <script lang="ts" setup>
8
- type Props = {
8
+ type LayoutProrps = {
9
9
  gap?: number,
10
10
  h100?: boolean,
11
11
  columns?: string[]
12
12
  rows?: string[],
13
13
  }
14
- const props = withDefaults(defineProps<Props>(), {
14
+
15
+ const props = withDefaults(defineProps<LayoutProrps>(), {
15
16
  gap: 1,
16
17
  h100: false,
17
18
  columns: () => [],
@@ -6,7 +6,7 @@
6
6
  <slot v-if="isOpen" name="brand-open" />
7
7
  <slot v-if="!navLinks" />
8
8
  <Btn
9
- v-for="(nav, i) in navLinks" :key="i" :to="nav.to" class="nav-button"
9
+ v-for="(nav, i) in navLinks" :key="i" :to="nav.to" class="nav-button px-075"
10
10
  v-tooltip.right="{ content: nav.label, disabled: open, class: ['nav-tooltip'] }"
11
11
  >
12
12
  <template #default >
@@ -23,16 +23,10 @@
23
23
  <script lang="ts" setup>
24
24
  import { useSlots } from 'vue';
25
25
  import { Btn, Icon } from '@bagelink/vue';
26
- import type { MaterialIcons } from '@bagelink/vue';
26
+ import type { NavLink } from '@bagelink/vue';
27
27
 
28
28
  const slots = useSlots();
29
29
 
30
- type NavLink = {
31
- to?: string;
32
- icon: MaterialIcons;
33
- label: string;
34
- children?: NavLink[];
35
- };
36
30
  const props = defineProps<{ navLinks?: NavLink[], expandable?: boolean, open: boolean }>();
37
31
 
38
32
  let isOpen = $ref(props.open);
@@ -56,13 +50,12 @@ function toggleMenu() {
56
50
  .wideNav .nav-button .bgl_btn-flex {
57
51
  justify-content: flex-start !important;
58
52
  }
59
- </style>
60
-
61
- <style scoped>
62
53
  .nav-button.router-link-active {
63
- background-color: #40b884 !important;
54
+ background-color: var(--bgl-primary-tint) !important;
64
55
  }
56
+ </style>
65
57
 
58
+ <style scoped>
66
59
  .bgl_sidebar {
67
60
  background-color: var(--bgl-primary);
68
61
  color: var(--bgl-white);
@@ -1,2 +1,2 @@
1
- export { default as MsgTemplate } from './form/MsgTemplate.vue';
2
- export { default as TextVariableExamples } from './form/TextVariableExamples.vue';
1
+ // export { default as MsgTemplate } from './form/MsgTemplate.vue';
2
+ // export { default as TextVariableExamples } from './form/TextVariableExamples.vue';
@@ -150,6 +150,14 @@
150
150
  width: 98%;
151
151
  }
152
152
 
153
+ .w100 {
154
+ max-width: 100px;
155
+ }
156
+
157
+ .w200 {
158
+ max-width: 200px;
159
+ }
160
+
153
161
  .w300 {
154
162
  max-width: 300px;
155
163
  }
@@ -1034,7 +1042,7 @@
1034
1042
  }
1035
1043
 
1036
1044
  .absolute {
1037
- position: absolute;
1045
+ position: absolute !important;
1038
1046
  }
1039
1047
 
1040
1048
  .flex {
@@ -1061,6 +1069,14 @@
1061
1069
  width: 100%;
1062
1070
  }
1063
1071
 
1072
+ .inline {
1073
+ display: inline;
1074
+ }
1075
+
1076
+ .inline-block {
1077
+ display: inline-block;
1078
+ }
1079
+
1064
1080
  .flex-wrap {
1065
1081
  flex-wrap: wrap;
1066
1082
  }
@@ -1406,6 +1422,13 @@
1406
1422
  overflow-y: hidden;
1407
1423
  }
1408
1424
 
1425
+ .line {
1426
+ background: var(--border-color);
1427
+ height: 1px;
1428
+ width: 100%;
1429
+ }
1430
+
1431
+
1409
1432
  @media screen and (max-width: 910px) {
1410
1433
  .grid-wrap-2 {
1411
1434
  grid-template-columns: repeat(1, 1fr);
@@ -147,6 +147,10 @@
147
147
  font-family: "Material Symbols Outlined", serif;
148
148
  }
149
149
 
150
+ .nowrap {
151
+ white-space: nowrap;
152
+ }
153
+
150
154
  @media screen and (max-width: 910px) {
151
155
 
152
156
  .txt20,
@@ -5,7 +5,7 @@ export type AttributeValue = string | number | boolean | null | undefined | Reco
5
5
  export type AttributeFn<T = Record<string, any>> = (field: any, row: T) => AttributeValue;
6
6
 
7
7
  export interface Attributes<T = any> {
8
- [key: string]: AttributeValue | AttributeFn<T>
8
+ [key: string]: AttributeValue | AttributeFn<T>
9
9
  }
10
10
 
11
11
  export type BaseBagelField<T = Record<string, any>> = {
@@ -18,7 +18,7 @@ export type BaseBagelField<T = Record<string, any>> = {
18
18
  attrs?: Attributes<T>;
19
19
  required?: boolean;
20
20
  helptext?: string;
21
- options?: string | ({ label?: string; value: string | number } | string | number | Record<string, any>)[],
21
+ options?: string | ({ label?: string; value: string | number } | string | number | Record<string, any>)[] | ((val: any, rowData?: Record<string, any>) => void);
22
22
  defaultValue?: any;
23
23
  transform?: (val?: any, rowData?: Record<string, any>) => any;
24
24
  onUpdate?: (val: any, rowData?: Record<string, any>) => void;
@@ -26,14 +26,14 @@ export type BaseBagelField<T = Record<string, any>> = {
26
26
  }
27
27
 
28
28
  export interface InputBagelField<T> extends BaseBagelField<T> {
29
- $el: 'text' | typeof TextInput;
30
- id: string;
31
- type?: string;
29
+ $el: 'text' | typeof TextInput;
30
+ id: string;
31
+ type?: string;
32
32
  }
33
33
 
34
34
  export interface SelectBagelField<T> extends BaseBagelField<T> {
35
- $el: 'select' | typeof SelectInput;
36
- id: string;
35
+ $el: 'select' | typeof SelectInput;
36
+ id: string;
37
37
  }
38
38
 
39
39
  export type Field<T = Record<string, any>> = BaseBagelField<T> | InputBagelField<T> | SelectBagelField<T>;
@@ -3,7 +3,8 @@ import { MaterialIcons } from './materialIcons';
3
3
  export type NavLink = {
4
4
  label: string;
5
5
  to?: string;
6
- materialIcon: MaterialIcons;
6
+ icon: MaterialIcons;
7
7
  localized?: string;
8
+ children?: NavLink[];
8
9
  onClick?: () => void;
9
10
  }