@bagelink/vue 0.0.437 → 0.0.441

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 (57) hide show
  1. package/dist/components/AccordionItem.vue.d.ts.map +1 -1
  2. package/dist/components/DataPreview.vue.d.ts +6 -0
  3. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  4. package/dist/components/Flag.vue.d.ts +16 -0
  5. package/dist/components/Flag.vue.d.ts.map +1 -0
  6. package/dist/components/Modal.vue.d.ts.map +1 -1
  7. package/dist/components/TableSchema.vue.d.ts +32 -5
  8. package/dist/components/TableSchema.vue.d.ts.map +1 -1
  9. package/dist/components/form/inputs/FileUpload.vue.d.ts +164 -2
  10. package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
  11. package/dist/components/form/inputs/SelectInput.vue.d.ts +5 -0
  12. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  13. package/dist/components/form/inputs/TelInput.vue.d.ts +165 -0
  14. package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -0
  15. package/dist/components/form/inputs/TextInput.vue.d.ts +2 -5
  16. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  17. package/dist/components/form/inputs/index.d.ts +1 -0
  18. package/dist/components/form/inputs/index.d.ts.map +1 -1
  19. package/dist/components/index.d.ts +1 -0
  20. package/dist/components/index.d.ts.map +1 -1
  21. package/dist/components/layout/Tabs.vue.d.ts.map +1 -1
  22. package/dist/index.cjs +6536 -1549
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.mjs +6536 -1549
  26. package/dist/style.css +1877 -93
  27. package/dist/utils/BagelFormUtils.d.ts.map +1 -1
  28. package/dist/utils/allCountries.d.ts +11 -0
  29. package/dist/utils/allCountries.d.ts.map +1 -0
  30. package/package.json +3 -4
  31. package/src/components/AccordionItem.vue +8 -5
  32. package/src/components/DataPreview.vue +14 -4
  33. package/src/components/Flag.vue +1349 -0
  34. package/src/components/Modal.vue +26 -9
  35. package/src/components/ModalForm.vue +1 -1
  36. package/src/components/PageTitle.vue +8 -1
  37. package/src/components/TableSchema.vue +50 -6
  38. package/src/components/form/inputs/FileUpload.vue +28 -11
  39. package/src/components/form/inputs/SelectInput.vue +29 -14
  40. package/src/components/form/inputs/TelInput.vue +401 -0
  41. package/src/components/form/inputs/TextInput.vue +15 -53
  42. package/src/components/form/inputs/index.ts +1 -0
  43. package/src/components/index.ts +1 -0
  44. package/src/components/layout/Tabs.vue +1 -0
  45. package/src/index.ts +1 -0
  46. package/src/styles/appearance.css +610 -0
  47. package/src/styles/buttons.css +8 -0
  48. package/src/styles/layout.css +46 -1
  49. package/src/styles/mobilLayout.css +37 -0
  50. package/src/styles/modal.css +5 -2
  51. package/src/styles/text.css +39 -0
  52. package/src/utils/BagelFormUtils.ts +2 -0
  53. package/src/utils/allCountries.ts +337 -0
  54. package/src/components/whatsapp/form/MsgTemplate.vue +0 -224
  55. package/src/components/whatsapp/form/TextVariableExamples.vue +0 -79
  56. package/src/components/whatsapp/index.ts +0 -2
  57. package/src/components/whatsapp/interfaces.ts +0 -58
@@ -3,17 +3,30 @@
3
3
  class="bg-dark"
4
4
  :class="{ 'is-side': side, 'is-active': isVisible, 'bg-lignt': false }"
5
5
  @click="() => (dismissable ? closeModal() : '')"
6
- @keydown.esc="closeModal">
6
+ @keydown.esc="closeModal"
7
+ >
7
8
  <Card class="modal" @click.stop :style="{ ...maxWidth }">
8
- <header class="tool-bar">
9
+ <header v-if="slots['toolbar'] || title" class="tool-bar">
9
10
  <slot name="toolbar" />
10
11
  <Btn
11
12
  :style="{ float: side ? 'left' : 'right' }"
12
13
  flat
13
14
  icon="close"
14
- @click="closeModal" />
15
+ @click="closeModal"
16
+ />
15
17
  <Title class="modal-title" tag="h3" v-if="title" :label="title" />
16
18
  </header>
19
+
20
+ <div v-else class="sticky h-10 bg-white z-index-999 -mt-1 -me-075 h-40px pt-025 round">
21
+ <Btn
22
+ class="color-black"
23
+ :style="{ float: side ? 'left' : 'right' }"
24
+ icon="close"
25
+ thin
26
+ color="white"
27
+ @click="closeModal"
28
+ />
29
+ </div>
17
30
  <slot />
18
31
  <footer v-if="slots['footer'] || actions?.length" class="modal-footer mt-3">
19
32
  <Btn
@@ -21,7 +34,8 @@
21
34
  :key="i"
22
35
  @click="closeModal"
23
36
  color="gray"
24
- v-bind="action" />
37
+ v-bind="action"
38
+ />
25
39
  <slot name="footer" />
26
40
  </footer>
27
41
  </Card>
@@ -29,8 +43,12 @@
29
43
  </template>
30
44
 
31
45
  <script lang="ts" setup>
32
- import { onMounted, onUnmounted, watch, useSlots } from 'vue';
33
- import { type BtnOptions, Btn, useEscape, Title, Card } from '@bagelink/vue';
46
+ import {
47
+ onMounted, onUnmounted, watch, useSlots,
48
+ } from 'vue';
49
+ import {
50
+ type BtnOptions, Btn, useEscape, Title, Card,
51
+ } from '@bagelink/vue';
34
52
  import '../styles/modal.css';
35
53
 
36
54
  const props = defineProps<{
@@ -53,7 +71,7 @@ watch(
53
71
  if (val) openModal();
54
72
  else closeModal();
55
73
  },
56
- { immediate: true }
74
+ { immediate: true },
57
75
  );
58
76
 
59
77
  const maxWidth = $computed(() => {
@@ -72,8 +90,7 @@ const closeModal = () => {
72
90
 
73
91
  defineExpose({ closeModal });
74
92
 
75
- const escapeKeyClose = (e: KeyboardEvent) =>
76
- props?.dismissable && useEscape(e, () => closeModal());
93
+ const escapeKeyClose = (e: KeyboardEvent) => props?.dismissable && useEscape(e, () => closeModal());
77
94
 
78
95
  function openModal() {
79
96
  setTimeout(() => (isVisible = true), 1);
@@ -6,7 +6,7 @@
6
6
  :width
7
7
  :visible="visible"
8
8
  :dismissable
9
- :title="title">
9
+ :title >
10
10
  <BagelForm
11
11
  @submit="runSubmit"
12
12
  ref="form"
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="page-top">
3
- <h1 class="top-title">
3
+ <h1 class="top-title m-0">
4
4
  <slot /> {{ value }}
5
5
  </h1>
6
6
  </div>
@@ -19,6 +19,7 @@ defineProps({
19
19
  .top-title {
20
20
  font-weight: 600;
21
21
  font-size: 20px;
22
+ line-height: 1;
22
23
  }
23
24
 
24
25
  .page-top {
@@ -26,4 +27,10 @@ defineProps({
26
27
  align-items: center;
27
28
  gap: 1rem;
28
29
  }
30
+
31
+ @media screen and (max-width: 910px) {
32
+ .top-title {
33
+ font-size: 16px;
34
+ }
35
+ }
29
36
  </style>
@@ -71,22 +71,53 @@ const slots = useSlots();
71
71
  const loading = $ref(true);
72
72
 
73
73
  const props = defineProps<{
74
+ selecteItems?: string[];
74
75
  data: any[];
75
76
  schema?: BglFormSchemaT | (() => BglFormSchemaT);
77
+ showFields?: string[];
76
78
  }>();
77
79
 
80
+ const emit = defineEmits(['update:selecteItems', 'orderBy', 'select']);
81
+
82
+ let selecteItems = $ref<string[]>(props.selecteItems || []);
83
+ let selected = $computed({
84
+ get: () => selecteItems,
85
+ set: (value: string[]) => {
86
+ selecteItems = value;
87
+ emit('update:selecteItems', value);
88
+ },
89
+ });
90
+
91
+ function selectAll(event: PointerEvent) {
92
+ const value = (event.target as HTMLInputElement).checked;
93
+ if (!value) {
94
+ selected = [];
95
+ return;
96
+ }
97
+ selected.push(...computedData.map((d) => d.id));
98
+ }
99
+
78
100
  const computedSchema = $computed(() => {
79
101
  if (typeof props.schema === 'function') {
80
102
  return props.schema();
81
103
  }
82
- if (props.schema) return props.schema;
83
- const keys = [...new Set((props.data || []).map(Object.keys).flat())] as string[];
84
- const schema: BglFormSchemaT = keys.map((id) => ({ id, label: keyToLabel(id) }));
85
- return schema;
104
+ if (props.schema) {
105
+ return props.showFields
106
+ ? props.schema.filter((f) => props.showFields?.includes(f.id as string))
107
+ : props.schema;
108
+ }
109
+ const keys = [
110
+ ...new Set((props.data || []).map(Object.keys).flat()),
111
+ ] as string[];
112
+ const schema: BglFormSchemaT = keys.map((id) => ({
113
+ id,
114
+ label: keyToLabel(id),
115
+ }));
116
+ return props.showFields
117
+ ? schema.filter((f) => props.showFields?.includes(f.id as string) || !f.id)
118
+ : schema;
86
119
  });
87
120
 
88
- const emit = defineEmits(['select', 'orderBy']);
89
-
90
121
  const selectElement = (item: Record<string, any>) => emit('select', item);
91
122
 
92
123
  let sortDirection = $ref('ASC');
@@ -119,6 +150,12 @@ const computedData = $computed(() => {
119
150
  return dta.sort((a, b) => {
120
151
  const aValue = a[sortField];
121
152
  const bValue = b[sortField];
153
+ const numAValue = parseInt(aValue);
154
+ const numBValue = parseInt(bValue);
155
+ if (!isNaN(numAValue) && !isNaN(numBValue)) {
156
+ if (sortDirection === 'ASC') return numAValue - numBValue;
157
+ return numBValue - numAValue;
158
+ }
122
159
  if (typeof aValue === 'string') {
123
160
  if (sortDirection === 'ASC') return aValue.localeCompare(bValue);
124
161
  return bValue.localeCompare(aValue);
@@ -185,6 +222,9 @@ th {
185
222
  height: 50px;
186
223
  vertical-align: bottom;
187
224
  }
225
+ .row.first-row input[type=checkbox]{
226
+ margin-bottom: 0.7rem;
227
+ }
188
228
 
189
229
  .row.first-row::after {
190
230
  content: '';
@@ -255,6 +295,10 @@ th {
255
295
  .row-item:hover {
256
296
  background: var(--bgl-gray-light);
257
297
  }
298
+ .row-item input[type=checkbox]{
299
+ margin-top: 0.45rem !important;
300
+ accent-color: var(--bgl-primary);
301
+ }
258
302
 
259
303
  .infinite-wrapper {
260
304
  overflow-y: auto;
@@ -14,12 +14,16 @@
14
14
  dragover: isDragOver,
15
15
  }"
16
16
  >
17
+ <slot name="files" :files="storageFiles" :fileQueue>
17
18
  <template v-for="file in storageFiles" :key="file.id">
18
- <div class="imagePreviewWrap" v-if="!multiple">
19
- <img class="preview" :src="file.url" alt="" />
19
+ <div class="single-image" v-if="!multiple">
20
+ <img class="single preview" :src="file.url" alt="" />
21
+ <!-- <p class="no-margin">
22
+ {{ file.name }}
23
+ </p> -->
20
24
  </div>
21
- <div class="previewName">
22
- <img v-if="multiple" class="preview" :src="file.url" alt="" />
25
+ <div class="multi-image-item previewName" v-if="multiple">
26
+ <img class="preview" :src="file.url" alt="" />
23
27
  <p class="no-margin">
24
28
  {{ file.name }}
25
29
  </p>
@@ -60,6 +64,10 @@
60
64
  </div>
61
65
  </div>
62
66
  </template>
67
+ </slot>
68
+ <slot v-if="(!storageFiles.length && !fileQueue.length) || multiple" name="placeholder">
69
+ <p>Drop files here or click to upload</p>
70
+ </slot>
63
71
  </div>
64
72
  </div>
65
73
  </template>
@@ -224,8 +232,7 @@ const drop = (e: DragEvent) => {
224
232
  cursor: pointer;
225
233
  transition: var(--bgl-transition);
226
234
  position: relative;
227
- min-height: 132px;
228
- max-height: 500px;
235
+ height: calc(var(--width) / 1.5);
229
236
  font-size: var(--input-font-size);
230
237
  overflow-y: auto;
231
238
  background: var(--input-bg);
@@ -256,11 +263,24 @@ const drop = (e: DragEvent) => {
256
263
  }
257
264
 
258
265
  img.preview {
259
- width: var(--width);
266
+ /* max-height: calc(var(--width) / 2); */
260
267
  /* max-width: calc(var(--width) * 2); */
268
+ width: 40px;
269
+ height: 40px;
261
270
  border-radius: var(--input-border-radius);
262
271
  object-fit: cover;
263
- background: var(--bgl-white);
272
+ background: var(--bgl-gray-light);
273
+ box-shadow: 0 0 10px #00000012;
274
+
275
+ }
276
+
277
+ img.preview.single{
278
+ max-width: var(--width);
279
+ width: auto;
280
+ object-fit: contain;
281
+ height: auto;
282
+ max-height: calc(var(--width) / 2);
283
+ margin: 1rem;
264
284
  }
265
285
 
266
286
  .fileUploadWrap.dragover,
@@ -276,9 +296,6 @@ img.preview {
276
296
  color: var(--bgl-gray);
277
297
  }
278
298
 
279
- .bagel-input .fileUploadWrap.fileDropZone:after {
280
- content: 'Drop files here or click to upload';
281
- }
282
299
 
283
300
  .pie {
284
301
  width: 30px;
@@ -16,9 +16,13 @@
16
16
  class="selectinput-btn"
17
17
  :class="{ isEmpty: selectedItems.length === 0 }"
18
18
  >
19
- <p>{{ selectedLabel }}</p>
19
+ <Icon v-if="icon" :icon="icon" />
20
+ <p v-if="!hideLabel">
21
+ {{ selectedLabel }}
22
+ </p>
20
23
  <Icon
21
24
  v-if="!disabled"
25
+ thin
22
26
  v-bind="{ icon: open ? 'unfold_less' : 'unfold_more' }"
23
27
  />
24
28
  </button>
@@ -29,7 +33,7 @@
29
33
  @input="updateOpen(true)"
30
34
  :value="selectedItems"
31
35
  required
32
- >
36
+ />
33
37
  </label>
34
38
  <template #popper>
35
39
  <Card
@@ -71,7 +75,7 @@
71
75
  import { watch } from 'vue';
72
76
  import { Dropdown } from 'floating-vue';
73
77
  import 'floating-vue/style.css';
74
- import { TextInput, Card, Icon } from '@bagelink/vue';
78
+ import { TextInput, Card, Icon, type MaterialIcons } from '@bagelink/vue';
75
79
 
76
80
  type Option =
77
81
  | string
@@ -91,6 +95,8 @@ const props = defineProps<{
91
95
  label?: string;
92
96
  fullWidth?: boolean;
93
97
  multiselect?: boolean;
98
+ icon?: MaterialIcons;
99
+ hideLabel?: boolean;
94
100
  }>();
95
101
 
96
102
  let selectedItems = $ref<Option[]>([]);
@@ -144,19 +150,22 @@ const getValue = (option?: Option) => {
144
150
  return option.value;
145
151
  };
146
152
 
147
- const isSelected = (option: Option) => !!selectedItems.find((item) => getValue(option) === getValue(item));
148
-
149
- const filteredOptions = $computed(() => props.options.filter((option) => {
150
- const searchTerm = search
151
- .split(/\s+/)
152
- .filter(Boolean)
153
- .map((t) => new RegExp(t, 'gi'));
154
- return (
155
- Boolean(option) &&
153
+ const isSelected = (option: Option) =>
154
+ !!selectedItems.find((item) => getValue(option) === getValue(item));
155
+
156
+ const filteredOptions = $computed(() =>
157
+ props.options.filter((option) => {
158
+ const searchTerm = search
159
+ .split(/\s+/)
160
+ .filter(Boolean)
161
+ .map((t) => new RegExp(t, 'gi'));
162
+ return (
163
+ Boolean(option) &&
156
164
  (searchTerm.every((s) => getLabel(option).match(s)) ||
157
165
  searchTerm.length === 0)
158
- );
159
- }));
166
+ );
167
+ }),
168
+ );
160
169
 
161
170
  const select = (option: Option) => {
162
171
  const existingIndex = selectedItems.findIndex(
@@ -274,6 +283,12 @@ watch(
274
283
  width: 100%;
275
284
  font-family: inherit;
276
285
  font-size: var(--input-font-size);
286
+
287
+ }
288
+ .selectinput-btn p{
289
+ white-space: nowrap;
290
+ overflow: hidden;
291
+ text-overflow: ellipsis;
277
292
  }
278
293
 
279
294
  .selectinput-btn:disabled {