@bagelink/vue 0.0.164 → 0.0.170

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 (36) hide show
  1. package/dist/components/DataPreview.vue.d.ts +3 -19
  2. package/dist/components/DataPreview.vue.d.ts.map +1 -1
  3. package/dist/components/FileUploader.vue.d.ts.map +1 -1
  4. package/dist/components/FormSchema.vue.d.ts +3 -19
  5. package/dist/components/FormSchema.vue.d.ts.map +1 -1
  6. package/dist/components/PersonPreview.vue.d.ts +1 -1
  7. package/dist/components/PersonPreview.vue.d.ts.map +1 -1
  8. package/dist/components/TabbedLayout.vue.d.ts +1 -1
  9. package/dist/components/TabbedLayout.vue.d.ts.map +1 -1
  10. package/dist/components/formkit/FileUploader.vue.d.ts.map +1 -1
  11. package/dist/components/formkit/index.d.ts +10 -8
  12. package/dist/components/formkit/index.d.ts.map +1 -1
  13. package/dist/components/index.d.ts +0 -1
  14. package/dist/components/index.d.ts.map +1 -1
  15. package/dist/index.cjs +206 -349
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.mjs +206 -349
  19. package/dist/plugins/bagel.d.ts +3 -0
  20. package/dist/plugins/bagel.d.ts.map +1 -1
  21. package/dist/style.css +227 -323
  22. package/package.json +1 -1
  23. package/src/components/DataPreview.vue +5 -6
  24. package/src/components/FormSchema.vue +7 -10
  25. package/src/components/PersonPreview.vue +147 -123
  26. package/src/components/TabbedLayout.vue +50 -59
  27. package/src/components/form/inputs/Checkbox.vue +1 -1
  28. package/src/components/formkit/FileUploader.vue +264 -254
  29. package/src/components/formkit/index.ts +10 -8
  30. package/src/components/index.ts +0 -1
  31. package/src/index.ts +1 -1
  32. package/src/plugins/bagel.ts +17 -1
  33. package/src/styles/dark.css +79 -21
  34. package/src/styles/inputs.css +4 -9
  35. package/src/styles/theme.css +6 -0
  36. package/src/components/FileUploader.vue +0 -345
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.164",
4
+ "version": "0.0.170",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -45,19 +45,18 @@
45
45
  </template>
46
46
 
47
47
  <script lang="ts" setup>
48
- import { keyToLabel } from '@bagelink/vue';
48
+ import { keyToLabel, useI18nT } from '@bagelink/vue';
49
+
50
+ const i18nT = useI18nT();
49
51
 
50
52
  const keysToIgnore = ['id', 'person_id', 'person', 'created_at', 'updated_at'];
51
53
 
52
54
  // const props =
53
- withDefaults(defineProps<{
55
+ defineProps<{
54
56
  data: Record<string, any>,
55
57
  schema?: Record<string, any>[],
56
58
  title?: string,
57
- i18nT: (str: string) => string,
58
- }>(), {
59
- i18nT: (str: string) => str,
60
- });
59
+ }>();
61
60
  </script>
62
61
 
63
62
  <style scoped>
@@ -30,34 +30,31 @@ import { reactive } from 'vue';
30
30
  import { type FormKitSchemaDefinition } from '@formkit/core';
31
31
 
32
32
  import { Btn } from '@bagelink/vue';
33
- import { useModal } from '..';
33
+ import { useModal, useI18nT } from '..';
34
34
 
35
35
  const { showModal } = useModal();
36
+ const i18nT = useI18nT();
36
37
  const emits = defineEmits(['update:modelValue', 'submit']);
37
38
  const handleEmit = (val: any) => emits('update:modelValue', val);
38
39
  const runSubmit = (val: any) => emits('submit', val);
39
40
 
40
- const props = withDefaults(defineProps<{
41
+ const props = defineProps<{
41
42
  modelValue?: any;
42
43
  schema: FormKitSchemaDefinition;
43
44
  // eslint-disable-next-line no-unused-vars
44
45
  onDelete?: ((id: string) => void);
45
- // eslint-disable-next-line no-unused-vars
46
- i18nT?: (key: string) => string;
47
- }>(), {
48
- i18nT: (key: string) => key,
49
- });
46
+ }>();
50
47
 
51
48
  const data = reactive({
52
49
  ...props.modelValue,
53
- t: (val: string) => props.i18nT(val),
50
+ t: (val: string) => i18nT?.(val) || val,
54
51
  });
55
52
 
56
53
  const runDelete = () => {
57
54
  showModal(
58
55
  {
59
56
  class: 'small-modal',
60
- title: props.i18nT('Are you sure?'),
57
+ title: i18nT('Are you sure?'),
61
58
  actions: [
62
59
  {
63
60
  value: 'Confirm',
@@ -67,7 +64,7 @@ const runDelete = () => {
67
64
  { value: 'Cancel', color: 'gray' },
68
65
  ],
69
66
  },
70
- { default: props.i18nT('form.deleteMessage') },
67
+ { default: i18nT('form.deleteMessage') },
71
68
  );
72
69
  };
73
70
  </script>
@@ -1,175 +1,199 @@
1
1
  <template>
2
- <div @click="onClick" class="person-card" v-if="person">
3
- <div class="person-card-edit flex gap-2" v-if="!onClick">
4
- <Btn
5
- round
6
- thin
7
- icon.end="arrow_outward"
8
- value="Profile"
9
- v-if="!$route.path.match('/search')"
10
- is="router-link"
11
- :to="`/search/${person.id}`"
12
- />
13
- <Btn thin flat @click="showEditForm" icon="edit" />
14
- </div>
15
- <div class="person-card-icon-wrap">
16
- <p class="person-card-icon">
17
- {{ initials(person.first_name, person.last_name) }}
18
- </p>
19
- <p class="person-card-name txt20">
20
- {{ person.first_name }} {{ person.last_name }}
21
- </p>
22
- </div>
23
-
24
- <div class="person-card-details-wrap">
25
- <div class="person-card-details" v-if="person.phone?.length">
26
- <MaterialIcon icon="phone" />
27
- <p v-for="phone in person.phone" :key="phone.id">
28
- {{ phone.phone }}
29
- </p>
30
- </div>
31
- <div class="person-card-details" v-if="person.email?.length">
32
- <MaterialIcon icon="email" />
33
- <p v-for="email in person.email" :key="email.id">
34
- {{ email.email }}
35
- </p>
36
- </div>
37
- <div
38
- class="person-card-details badge"
39
- v-if="person.date_of_birth || person.gender"
40
- >
41
- <MaterialIcon icon="badge" />
42
- <p v-if="person.date_of_birth">
43
- {{ person.date_of_birth }}
44
- </p>
45
- <p v-if="person.gender">
46
- {{ person.gender }}
47
- </p>
48
- </div>
49
- </div>
50
- </div>
2
+ <div
3
+ @click="onClick"
4
+ class="person-card"
5
+ v-if="person"
6
+ >
7
+ <div
8
+ class="person-card-edit flex gap-2"
9
+ v-if="!onClick"
10
+ >
11
+ <Btn
12
+ round
13
+ thin
14
+ icon.end="arrow_outward"
15
+ value="Profile"
16
+ v-if="!$route.path.match('/search')"
17
+ is="router-link"
18
+ :to="`/search/${person.id}`"
19
+ />
20
+ <Btn
21
+ thin
22
+ flat
23
+ @click="showEditForm"
24
+ icon="edit"
25
+ />
26
+ </div>
27
+ <div class="person-card-icon-wrap">
28
+ <p class="person-card-icon">
29
+ {{ initials(person.first_name, person.last_name) }}
30
+ </p>
31
+ <p class="person-card-name txt20">
32
+ {{ person.first_name }} {{ person.last_name }}
33
+ </p>
34
+ </div>
35
+
36
+ <div class="person-card-details-wrap">
37
+ <div
38
+ class="person-card-details"
39
+ v-if="person.phone?.length"
40
+ >
41
+ <MaterialIcon icon="phone" />
42
+ <p
43
+ v-for="phone in person.phone"
44
+ :key="phone.id"
45
+ >
46
+ {{ phone.phone }}
47
+ </p>
48
+ </div>
49
+ <div
50
+ class="person-card-details"
51
+ v-if="person.email?.length"
52
+ >
53
+ <MaterialIcon icon="email" />
54
+ <p
55
+ v-for="email in person.email"
56
+ :key="email.id"
57
+ >
58
+ {{ email.email }}
59
+ </p>
60
+ </div>
61
+ <div
62
+ class="person-card-details badge"
63
+ v-if="person.date_of_birth || person.gender"
64
+ >
65
+ <MaterialIcon icon="badge" />
66
+ <p v-if="person.date_of_birth">
67
+ {{ person.date_of_birth }}
68
+ </p>
69
+ <p v-if="person.gender">
70
+ {{ person.gender }}
71
+ </p>
72
+ </div>
73
+ </div>
74
+ </div>
51
75
  </template>
52
76
 
53
77
  <script lang="ts" setup>
54
- import type { FormKitSchemaDefinition } from "@formkit/core";
55
- import type { Person } from "@bagelink/vue";
56
- import { initials, Btn, MaterialIcon } from "@bagelink/vue";
57
- import { useBagel, useModal } from "..";
78
+ import type { FormKitSchemaDefinition } from '@formkit/core';
79
+ import type { Person } from '@bagelink/vue';
80
+ import { initials, Btn, MaterialIcon } from '@bagelink/vue';
81
+ import { useBagel, useModal } from '..';
58
82
 
59
83
  // const toast = useToast(); // TODO: use toast
60
84
  const bagel = useBagel();
61
85
  const { modalForm } = useModal();
62
86
 
63
87
  const props = defineProps<{
64
- person: Person;
65
- // eslint-disable-next-line no-unused-vars
66
- onClick?: (event: MouseEvent) => void;
67
- personSchema: () => FormKitSchemaDefinition;
88
+ person: Person;
89
+ // eslint-disable-next-line no-unused-vars
90
+ onClick?: (event: MouseEvent) => void;
91
+ personSchema: () => FormKitSchemaDefinition;
68
92
  }>();
69
93
 
70
94
  const showEditForm = async () => {
71
- const { first_name, last_name } = props.person;
72
- modalForm({
73
- side: true,
74
- title: `${first_name} ${last_name}`,
75
- schema: props.personSchema(),
76
- modelValue: props.person,
77
- onSubmit: (newPerson) => bagel.put("/person", newPerson),
78
- // .then(() => toast.success(i18nT('updatedSuccessfully'))),
79
- });
95
+ const { first_name, last_name } = props.person;
96
+ modalForm({
97
+ side: true,
98
+ title: `${first_name} ${last_name}`,
99
+ schema: props.personSchema(),
100
+ modelValue: props.person,
101
+ onSubmit: (newPerson) => bagel.put('/person', newPerson),
102
+ // .then(() => toast.success(i18nT('updatedSuccessfully'))),
103
+ });
80
104
  };
81
105
  </script>
82
106
  <style>
83
107
  .person-card {
84
- border: 1.1px solid var(--border-color);
85
- /* background: var(--input-bg); */
86
- border-radius: var(--card-border-radius);
87
- padding: 1rem;
88
- margin-bottom: 0.5rem;
89
- font-size: 1rem;
90
- position: relative;
108
+ border: 1.1px solid var(--border-color);
109
+ /* background: var(--input-bg); */
110
+ border-radius: var(--card-border-radius);
111
+ padding: 1rem;
112
+ margin-bottom: 0.5rem;
113
+ font-size: 1rem;
114
+ position: relative;
91
115
  }
92
116
 
93
117
  .person-card p {
94
- margin: 0;
118
+ margin: 0;
95
119
  }
96
120
 
97
121
  .person-card-details {
98
- font-size: 14px;
99
- margin-bottom: 2px;
100
- line-height: 1.3;
101
- display: flex;
122
+ font-size: 14px;
123
+ margin-bottom: 2px;
124
+ line-height: 1.3;
125
+ display: flex;
102
126
  }
103
127
 
104
128
  .person-card-details p {
105
- color: var(--input-color);
106
- opacity: 0.6;
129
+ color: var(--input-color);
130
+ opacity: 0.6;
107
131
  }
108
132
 
109
133
  .person-card-details.badge p {
110
- opacity: 1;
134
+ opacity: 1;
111
135
  }
112
136
 
113
137
  .person-card-details p:nth-child(2) {
114
- opacity: 1;
115
- padding-inline-end: 0.5rem;
138
+ opacity: 1;
139
+ padding-inline-end: 0.5rem;
116
140
  }
117
141
 
118
142
  .person-card-details .icon-font {
119
- color: var(--bgl-primary);
120
- padding-inline-end: 0.25rem;
143
+ color: var(--bgl-primary);
144
+ padding-inline-end: 0.25rem;
121
145
  }
122
146
 
123
147
  .person-card-edit {
124
- position: absolute;
125
- inset-inline-end: 1rem;
148
+ position: absolute;
149
+ inset-inline-end: 1rem;
126
150
  }
127
151
 
128
152
  .person-card-details-wrap {
129
- display: flex;
130
- gap: 0.5rem;
131
- flex-wrap: wrap;
153
+ display: flex;
154
+ gap: 0.5rem;
155
+ flex-wrap: wrap;
132
156
  }
133
157
 
134
158
  .person-card-icon {
135
- background: var(--bgl-gray);
136
- height: 30px;
137
- width: 30px;
138
- border-radius: 100%;
139
- text-transform: uppercase;
140
- display: flex;
141
- justify-content: center;
142
- align-items: center;
143
- color: white;
144
- font-size: 12px;
159
+ background: var(--bgl-gray);
160
+ height: 30px;
161
+ width: 30px;
162
+ border-radius: 100%;
163
+ text-transform: uppercase;
164
+ display: flex;
165
+ justify-content: center;
166
+ align-items: center;
167
+ color: white;
168
+ font-size: 12px;
145
169
  }
146
170
 
147
171
  .person-card-icon-wrap {
148
- display: flex;
149
- gap: 0.5rem;
150
- align-items: center;
151
- padding-bottom: 0.75rem;
172
+ display: flex;
173
+ gap: 0.5rem;
174
+ align-items: center;
175
+ padding-bottom: 0.75rem;
152
176
  }
153
177
 
154
178
  @media screen and (max-width: 910px) {
155
- .person-card-icon-wrap {
156
- padding-bottom: 0.5rem;
157
- }
158
-
159
- .person-card {
160
- padding: 0.75rem;
161
- position: relative;
162
- }
163
-
164
- .person-card-edit {
165
- /* position: relative; */
166
- inset-inline-end: 0.5rem;
167
- margin-bottom: 1rem;
168
- justify-content: flex-end;
169
- }
170
-
171
- .person-card-name {
172
- max-width: calc(100% - 170px);
173
- }
179
+ .person-card-icon-wrap {
180
+ padding-bottom: 0.5rem;
181
+ }
182
+
183
+ .person-card {
184
+ padding: 0.75rem;
185
+ position: relative;
186
+ }
187
+
188
+ .person-card-edit {
189
+ /* position: relative; */
190
+ inset-inline-end: 0.5rem;
191
+ margin-bottom: 1rem;
192
+ justify-content: flex-end;
193
+ }
194
+
195
+ .person-card-name {
196
+ max-width: calc(100% - 170px);
197
+ }
174
198
  }
175
199
  </style>
@@ -1,83 +1,74 @@
1
1
  <template>
2
- <div class="h-100 grid list-view gap-3">
3
- <div class="card tabs-top">
4
- <slot name="top-section" />
5
- <div class="tabs grid auto-flow-columns fit-content">
6
- <div
7
- v-for="tab in tabs"
8
- :class="{
9
- active:
10
- tab === activeTab ||
11
- tab === router.currentRoute.value.path.split('/').slice(-1)[0],
12
- }"
13
- class="tab"
14
- :key="tab"
15
- @click="changeTab(tab)"
16
- >
17
- {{ tab }}
18
- </div>
19
- </div>
20
- </div>
21
- <!-- <TransitionRouterView v-if="baseRoute" /> -->
22
- <div
23
- class="list-content"
24
- v-for="tab in tabs.filter((item) => item === activeTab)"
25
- :key="tab"
26
- >
27
- <slot
28
- :name="tab"
29
- :key="tab"
30
- />
31
- </div>
32
- </div>
2
+ <div class="h-100 grid list-view gap-3">
3
+ <div class="card tabs-top">
4
+ <slot name="top-section" />
5
+ <div class="tabs grid auto-flow-columns fit-content">
6
+ <div
7
+ v-for="tab in tabs"
8
+ :class="{
9
+ active:
10
+ tab === activeTab ||
11
+ tab === router.currentRoute.value.path.split('/').slice(-1)[0],
12
+ }"
13
+ class="tab"
14
+ :key="tab"
15
+ @click="changeTab(tab)"
16
+ >
17
+ {{ tab }}
18
+ </div>
19
+ </div>
20
+ </div>
21
+ <!-- <TransitionRouterView v-if="baseRoute" /> -->
22
+ <div
23
+ class="list-content"
24
+ v-for="tab in tabs.filter((item) => item === activeTab)"
25
+ :key="tab"
26
+ >
27
+ <slot :name="tab" :key="tab" />
28
+ </div>
29
+ </div>
33
30
  </template>
34
31
 
35
32
  <script setup lang="ts">
36
- import { onMounted } from 'vue';
37
- import type { Router } from 'vue-router';
33
+ import { onMounted } from "vue";
34
+ import type { Router } from "vue-router";
38
35
 
39
- const emit = defineEmits(['update:modelValue']);
36
+ const emit = defineEmits(["update:modelValue"]);
40
37
 
41
38
  let activeTab = $ref<string>();
42
39
  const props = defineProps<{
43
- title?: string;
44
- tabs: string[];
45
- modelValue?: string;
46
- router: Router
40
+ title?: string;
41
+ tabs: string[];
42
+ modelValue?: string;
43
+ router: Router;
47
44
  }>();
48
45
 
49
46
  function changeTab(tab: string) {
50
- const { router } = props;
51
- activeTab = tab;
52
- void router.push({
53
- path: router.currentRoute.value.path,
54
- query: { ...router.currentRoute.value.query, t: tab },
55
- hash: router.currentRoute.value.hash,
56
- });
57
- emit('update:modelValue', activeTab);
47
+ const { router } = props;
48
+ activeTab = tab;
49
+ void router.push({
50
+ path: router.currentRoute.value.path,
51
+ query: { ...router.currentRoute.value.query, t: tab },
52
+ hash: router.currentRoute.value.hash,
53
+ });
54
+ emit("update:modelValue", activeTab);
58
55
  }
59
56
 
60
57
  onMounted(() => {
61
- const firstTab = props.modelValue || props.router.currentRoute.value.query.t || props.tabs[0];
62
- activeTab = firstTab as string;
58
+ const firstTab =
59
+ props.modelValue ||
60
+ props.router.currentRoute.value.query.t ||
61
+ props.tabs[0];
62
+ activeTab = firstTab as string;
63
63
  });
64
64
  </script>
65
65
 
66
66
  <style scoped>
67
67
  .tab {
68
- text-transform: capitalize;
68
+ text-transform: capitalize;
69
69
  }
70
70
 
71
- /* .top-section {
72
- grid-area: top-section;
73
- font-size: 10px;
74
- }
75
-
76
- .detail-section {
77
- grid-area: detail-section;
78
- } */
79
71
  .card.tabs-top {
80
- width: 99%;
81
-
72
+ /* width: 99%; */
82
73
  }
83
74
  </style>
@@ -52,7 +52,7 @@ watch(
52
52
  border-radius: 100%;
53
53
  width: 26px;
54
54
  height: 26px;
55
- background: white;
55
+ background: var(--bgl-white);
56
56
  border: 4px solid var(--bgl-gray-light);
57
57
  cursor: pointer;
58
58
  transition: var(--bgl-transition);