@bagelink/vue 0.0.188 → 0.0.192

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 (33) hide show
  1. package/dist/components/Btn.vue.d.ts +11 -7
  2. package/dist/components/Btn.vue.d.ts.map +1 -1
  3. package/dist/components/ListView.vue.d.ts.map +1 -1
  4. package/dist/components/TableSchema.vue.d.ts.map +1 -1
  5. package/dist/components/form/inputs/DatePicker.vue.d.ts +20 -0
  6. package/dist/components/form/inputs/DatePicker.vue.d.ts.map +1 -0
  7. package/dist/components/form/inputs/RadioPillsInput.vue.d.ts +31 -0
  8. package/dist/components/form/inputs/RadioPillsInput.vue.d.ts.map +1 -0
  9. package/dist/components/form/inputs/TextInput.vue.d.ts +5 -0
  10. package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
  11. package/dist/components/form/inputs/index.d.ts +2 -0
  12. package/dist/components/form/inputs/index.d.ts.map +1 -1
  13. package/dist/components/formkit/AddressArray.vue.d.ts.map +1 -1
  14. package/dist/components/formkit/BankDetailsArray.vue.d.ts.map +1 -1
  15. package/dist/components/formkit/ContactArrayFormKit.vue.d.ts.map +1 -1
  16. package/dist/index.cjs +13151 -3614
  17. package/dist/index.mjs +13152 -3615
  18. package/dist/style.css +597 -366
  19. package/package.json +6 -2
  20. package/src/components/Btn.vue +165 -146
  21. package/src/components/ListView.vue +0 -1
  22. package/src/components/PersonPreview.vue +1 -1
  23. package/src/components/TableSchema.vue +79 -70
  24. package/src/components/form/inputs/DatePicker.vue +169 -0
  25. package/src/components/form/inputs/RadioPillsInput.vue +89 -0
  26. package/src/components/form/inputs/TextInput.vue +53 -11
  27. package/src/components/form/inputs/index.ts +2 -0
  28. package/src/components/formkit/AddressArray.vue +173 -150
  29. package/src/components/formkit/BankDetailsArray.vue +197 -174
  30. package/src/components/formkit/ContactArrayFormKit.vue +140 -123
  31. package/src/components/formkit/FileUploader.vue +4 -4
  32. package/src/styles/layout.css +83 -0
  33. package/src/styles/theme.css +45 -16
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.188",
4
+ "version": "0.0.192",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -69,9 +69,13 @@
69
69
  "prosemirror-model": "^1.19.3",
70
70
  "prosemirror-schema-basic": "^1.2.2",
71
71
  "prosemirror-state": "^1.4.3",
72
- "prosemirror-view": "^1.32.4"
72
+ "prosemirror-view": "^1.32.4",
73
+ "@vuepic/vue-datepicker": "^7.4.0"
73
74
  },
74
75
  "peerDependenciesMeta": {
76
+ "@vuepic/vue-datepicker": {
77
+ "optional": true
78
+ },
75
79
  "vue3-charts": {
76
80
  "optional": true
77
81
  },
@@ -1,233 +1,252 @@
1
1
  <template>
2
- <component
3
- :is="to ? 'router-link' : is"
4
- :to="to"
5
- :type="type"
6
- :role="role"
7
- :disabled="disabled"
8
- :class="{
9
- [props.color]: true,
10
- 'btn-icon': icon && !slots['default'] && !value,
11
- btn: !icon || slots['default'] || value,
12
- thin: thin,
13
- round: round,
14
- 'btn-txt': flat,
15
- }"
16
- >
17
- <div class="loading" v-if="loading" />
18
- <div v-else class="btn-flex">
19
- <MaterialIcon v-if="icon" :icon="icon" />
20
- <slot />
21
- <template v-if="!slots['default'] && value">
22
- {{ value }}
23
- </template>
24
- <MaterialIcon v-if="props['icon.end']" :icon="props['icon.end']" />
25
- </div>
26
- </component>
2
+ <component
3
+ :is="to ? 'router-link' : is"
4
+ :to="to"
5
+ :type="type"
6
+ :role="role"
7
+ :disabled="disabled"
8
+ :class="{
9
+ 'btn-icon': icon && !slots['default'] && !value,
10
+ btn: !icon || slots['default'] || value,
11
+ thin,
12
+ round,
13
+ 'btn-txt': flat,
14
+ 'btn-border': border
15
+ }"
16
+ >
17
+ <div
18
+ class="loading"
19
+ v-if="loading"
20
+ />
21
+ <div
22
+ v-else
23
+ class="btn-flex"
24
+ >
25
+ <MaterialIcon
26
+ v-if="icon"
27
+ :icon="icon"
28
+ />
29
+ <slot />
30
+ <template v-if="!slots['default'] && value">
31
+ {{ value }}
32
+ </template>
33
+ <MaterialIcon
34
+ v-if="props['icon.end']"
35
+ :icon="props['icon.end']"
36
+ />
37
+ </div>
38
+ </component>
27
39
  </template>
28
40
 
29
41
  <script setup lang="ts">
30
- import { useSlots } from "vue";
42
+ import { useSlots } from 'vue';
31
43
 
32
44
  const slots = useSlots();
33
- import type { MaterialIcons } from "@bagelink/vue";
34
- import { MaterialIcon } from "@bagelink/vue";
45
+ import type { MaterialIcons } from '@bagelink/vue';
46
+ import { MaterialIcon } from '@bagelink/vue';
47
+
48
+ type ThemeTypes = 'light' | 'red' | 'gray' | 'gray-light' | 'black' | 'green';
35
49
 
36
50
  const props = withDefaults(
37
- defineProps<{
38
- disabled?: boolean;
39
- icon?: MaterialIcons;
40
- "icon.end"?: MaterialIcons;
41
- color?:
42
- | "light"
43
- | "red"
44
- | "gray"
45
- | "gray-light"
46
- | "black"
47
- | "blue"
48
- | "green";
49
- flat?: boolean;
50
- thin?: boolean;
51
- type?: "button" | "submit" | "reset";
52
- loading?: boolean;
53
- role?: string;
54
- value?: string;
55
- to?: string;
56
- round?: boolean;
57
- is?: string;
58
- }>(),
59
- {
60
- loading: false,
61
- round: false,
62
- color: "gray",
63
- disabled: false,
64
- type: "button",
65
- role: "button",
66
- is: "button",
67
- }
51
+ defineProps<{
52
+ disabled?: boolean;
53
+ icon?: MaterialIcons;
54
+ 'icon.end'?: MaterialIcons;
55
+ color?: ThemeTypes;
56
+ theme?: ThemeTypes;
57
+ flat?: boolean;
58
+ border?: boolean;
59
+ thin?: boolean;
60
+ type?: 'button' | 'submit' | 'reset';
61
+ loading?: boolean;
62
+ role?: string;
63
+ value?: string;
64
+ to?: string;
65
+ round?: boolean;
66
+ is?: string;
67
+ borderColor?: string
68
+ }>(),
69
+ {
70
+ loading: false,
71
+ round: false,
72
+ disabled: false,
73
+ type: 'button',
74
+ role: 'button',
75
+ is: 'button',
76
+ },
77
+ );
78
+
79
+ const computedTheme = $computed(() => (props?.color || props?.theme));
80
+
81
+ const defaultColors = { backgroundColor: 'var(--bgl-primary)', color: 'var(--bgl-white)' };
82
+
83
+ const themes: { [key in ThemeTypes]: typeof defaultColors } = {
84
+ red: { ...defaultColors, backgroundColor: 'var(--bgl-red)', },
85
+ black: { ...defaultColors, backgroundColor: 'var(--bgl-black)' },
86
+ green: { ...defaultColors, backgroundColor: 'var(--bgl-green)', color: 'var(--bgl-white)' },
87
+ gray: { ...defaultColors, backgroundColor: 'var(--bgl-gray-light)', color: 'var(--bgl-black)' },
88
+ light: { ...defaultColors, backgroundColor: 'var(--bgl-primary-light)', color: 'var(--bgl-primary)' },
89
+ 'gray-light': { ...defaultColors, backgroundColor: 'var(--bgl-gray-light)', color: 'var(--bgl-gray)' },
90
+ };
91
+
92
+ const cumputedTextColor = $computed(
93
+ () => (themes?.[computedTheme as ThemeTypes]?.color || defaultColors.color),
94
+ );
95
+
96
+ const computedBackgroundColor = $computed(
97
+ () => (themes?.[computedTheme as ThemeTypes]?.backgroundColor || defaultColors.backgroundColor),
68
98
  );
69
99
  </script>
70
100
 
71
101
  <style scoped>
72
102
  .loading {
73
- border: 1px solid var(--bgl-white);
74
- border-bottom: 2px solid var(--bgl-white);
75
- animation: spin 1s linear infinite;
76
- border-radius: 100px;
77
- width: 1rem;
78
- height: 1rem;
79
- margin: auto;
103
+ border: 1px solid var(--bgl-white);
104
+ border-bottom: 2px solid var(--bgl-white);
105
+ animation: spin 1s linear infinite;
106
+ border-radius: 100px;
107
+ width: 1rem;
108
+ height: 1rem;
109
+ margin: auto;
80
110
  }
81
111
 
82
112
  @keyframes spin {
83
- 0% {
84
- transform: rotate(0deg);
85
- }
113
+ 0% {
114
+ transform: rotate(0deg);
115
+ }
86
116
 
87
- 100% {
88
- transform: rotate(360deg);
89
- }
117
+ 100% {
118
+ transform: rotate(360deg);
119
+ }
90
120
  }
91
121
 
92
122
  .btn-icon {
93
- height: var(--btn-height);
94
- width: var(--btn-height);
95
- border-radius: 100%;
96
- font-size: 1rem;
97
- background: var(--bgl-primary);
98
- color: var(--bgl-white);
99
- flex-shrink: 0;
100
- transition: var(--bgl-transition);
123
+ height: var(--btn-height);
124
+ width: var(--btn-height);
125
+ border-radius: 100%;
126
+ font-size: 1rem;
127
+ background: var(--bgl-primary);
128
+ color: var(--bgl-white);
129
+ flex-shrink: 0;
130
+ transition: var(--bgl-transition);
101
131
  }
102
132
 
103
133
  .btn {
104
- background: var(--bgl-primary);
105
- color: var(--bgl-white);
106
- padding-left: var(--btn-padding);
107
- padding-right: var(--btn-padding);
108
- transition: var(--bgl-transition);
109
- text-decoration: none;
134
+ background: var(--bgl-primary);
135
+ color: var(--bgl-white);
136
+ padding-left: var(--btn-padding);
137
+ padding-right: var(--btn-padding);
138
+ transition: var(--bgl-transition);
139
+ text-decoration: none;
110
140
  }
111
141
 
112
142
  .btn[disabled="true"] {
113
- opacity: 0.5;
114
- cursor: not-allowed;
143
+ opacity: 0.5;
144
+ cursor: not-allowed;
115
145
  }
116
146
 
117
147
  .btn-flex {
118
- display: flex;
119
- align-items: center;
120
- gap: 0.5rem;
121
- justify-content: center;
148
+ display: flex;
149
+ align-items: center;
150
+ gap: 0.5rem;
151
+ justify-content: center;
122
152
  }
123
153
 
124
154
  .btn .icon-font {
125
- font-size: calc(var(--input-font-size) * 1.3);
155
+ font-size: calc(var(--input-font-size) * 1.3);
126
156
  }
127
157
 
128
158
  .btn:hover,
129
159
  .btn-icon:hover {
130
- filter: var(--bgl-hover-filter);
160
+ filter: var(--bgl-hover-filter);
131
161
  }
132
162
 
133
163
  .btn:active,
134
164
  .btn-icon:active {
135
- filter: var(--bgl-active-filter);
136
- }
137
-
138
- .btn.red,
139
- .btn-icon.red {
140
- background: var(--bgl-red);
141
- }
142
-
143
- .btn.light,
144
- .btn-icon.light {
145
- background: var(--bgl-blue-light);
146
- color: var(--bgl-primary);
165
+ filter: var(--bgl-active-filter);
147
166
  }
148
167
 
149
- .btn.gray,
150
- .btn-icon.gray {
151
- background: var(--bgl-gray-light);
152
- color: var(--bgl-black);
153
- }
154
-
155
- .btn.green,
156
- .btn-icon.green {
157
- background: var(--bgl-green);
158
- color: var(--bgl-white);
159
- }
160
-
161
- .btn.gray-light,
162
- .btn-icon.gray-light {
163
- background: var(--bgl-gray-light);
164
- color: var(--bgl-gray);
165
- }
168
+ .btn,
169
+ .btn-icon {
170
+ background-color: v-bind(computedBackgroundColor);
171
+ color: v-bind(cumputedTextColor);
166
172
 
167
- .btn.black,
168
- .btn-icon.black {
169
- background: var(--bgl-black);
170
173
  }
171
174
 
172
175
  .btn.btn-txt {
173
- color: var(--bgl-primary);
174
- padding-left: var(--btn-padding);
175
- padding-right: var(--btn-padding);
176
- background: transparent;
176
+ color: var(--bgl-primary);
177
+ padding-left: var(--btn-padding);
178
+ padding-right: var(--btn-padding);
179
+ background: transparent;
177
180
  }
178
181
 
179
182
  .btn-icon.btn-txt {
180
- color: var(--bgl-primary);
181
- background: transparent;
183
+ color: var(--bgl-primary);
184
+ background: transparent;
182
185
  }
183
186
 
184
187
  .btn.btn-txt:hover,
185
188
  .btn-icon.btn-txt:hover {
186
- filter: var(--bgl-active-filter);
189
+ filter: var(--bgl-active-filter);
187
190
  }
188
191
 
189
192
  .btn.btn-txt:active,
190
193
  .btn-icon.btn-txt:active {
191
- background: var(--bgl-white);
192
- filter: var(--bgl-hover-filter);
194
+ background: var(--bgl-white);
195
+ filter: var(--bgl-hover-filter);
193
196
  }
194
197
 
195
198
  .btn.btn-txt.red,
196
199
  .btn-icon.btn-txt.red {
197
- color: var(--bgl-red);
200
+ color: var(--bgl-red);
198
201
  }
199
202
 
200
203
  .btn.btn-txt.light,
201
204
  .btn-icon.btn-txt.light {
202
- color: var(--bgl-primary-tint);
205
+ color: var(--bgl-primary-tint);
203
206
  }
204
207
 
205
208
  .btn.btn-txt.black,
206
209
  .btn-icon.btn-txt.black {
207
- color: var(--bgl-black);
210
+ color: var(--bgl-black);
208
211
  }
209
212
 
210
213
  .btn.btn-txt.gray,
211
214
  .btn-icon.btn-txt.gray {
212
- color: var(--bgl-gray);
215
+ color: var(--bgl-gray);
213
216
  }
214
217
 
215
218
  .btn.thin {
216
- padding-left: calc(var(--btn-padding) / 2);
217
- padding-right: calc(var(--btn-padding) / 2);
219
+ padding-left: calc(var(--btn-padding) / 2);
220
+ padding-right: calc(var(--btn-padding) / 2);
218
221
  }
219
222
 
220
223
  .btn.round {
221
- border-radius: calc(var(--btn-border-radius) * 2);
224
+ border-radius: calc(var(--btn-border-radius) * 2);
222
225
  }
223
226
 
224
227
  .btn-icon.thin {
225
- height: calc(var(--btn-height) / 1.5);
226
- width: calc(var(--btn-height) / 1.5);
227
- line-height: 1;
228
+ height: calc(var(--btn-height) / 1.5);
229
+ width: calc(var(--btn-height) / 1.5);
230
+ line-height: 1;
228
231
  }
229
232
 
230
233
  [dir="rtl"] .icon-font {
231
- transform: rotateY(180deg);
234
+ transform: rotateY(180deg);
235
+ }
236
+
237
+ .btn-border {
238
+ outline: 1px solid v-bind(computedBackgroundColor);
239
+ color: v-bind(computedBackgroundColor);
240
+ background: var(--bgl-white);
241
+ }
242
+
243
+ .btn-border:hover {
244
+ color: v-bind(cumputedTextColor);
245
+ background: v-bind(computedBackgroundColor);
246
+ filter: brightness(100%);
247
+ }
248
+
249
+ .btn-border:active {
250
+ filter: brightness(80%);
232
251
  }
233
252
  </style>
@@ -16,7 +16,6 @@
16
16
  />
17
17
  </div>
18
18
  <Btn
19
- color="blue"
20
19
  v-if="enableAdd"
21
20
  icon="add"
22
21
  @click="emit('add')"
@@ -91,7 +91,7 @@ const props = defineProps<{
91
91
  personSchema: () => FormKitSchemaDefinition;
92
92
  }>();
93
93
 
94
- const showEditForm = async () => {
94
+ const showEditForm = () => {
95
95
  const { first_name, last_name } = props.person;
96
96
  modalForm({
97
97
  side: true,
@@ -22,7 +22,11 @@
22
22
  </div>
23
23
  </th>
24
24
  </thead>
25
- <tbody ref="infinite" class="rows infinite" :class="{ loading }">
25
+ <tbody
26
+ ref="infinite"
27
+ class="rows infinite"
28
+ :class="{ loading }"
29
+ >
26
30
  <tr
27
31
  @click="selectElement(row)"
28
32
  class="row row-item position-relative"
@@ -46,7 +50,7 @@
46
50
  v-if="field['v-if'] ? field['v-if'](row[field.id], row) : true"
47
51
  v-bind="bindAttrs(field.attrs, row[field.id], row)"
48
52
  :src="field.$el === 'img' ? row[field.id]?.url : ''"
49
- @update:modelValue="($event:any)=>field?.onUpdate?.($event, row[field.id], row)"
53
+ @update:modelValue="($event: any) => field?.onUpdate?.($event, row[field.id], row)"
50
54
  :modelValue="row[field.id]"
51
55
  >
52
56
  {{
@@ -70,10 +74,12 @@ const slots = useSlots();
70
74
  const loading = $ref(true);
71
75
 
72
76
  const props = defineProps<{
73
- data: any[];
74
- schema?: () => any[];
77
+ data: any[];
78
+ schema?: () => any[];
75
79
  }>();
76
80
 
81
+
82
+
77
83
  const emit = defineEmits(['select']);
78
84
 
79
85
  const selectElement = (data: Record<string, any>) => {
@@ -104,135 +110,138 @@ const sort = (fieldname: string) => {
104
110
  };
105
111
 
106
112
  const columns = $computed(
107
- () => props.schema?.() ||
108
- Object.keys(props.data[0]).map((k: string) => ({ id: k, inputType: 'PlainText' })),
113
+ () => props.schema?.()?.map((field) => ({
114
+ ...field,
115
+ id: field?.relationshipObjKey || field.id,
116
+ })) ||
117
+ Object.keys(props.data[0]).map((k: string) => ({ id: k, inputType: 'PlainText' })),
109
118
  );
110
119
  </script>
111
120
 
112
121
  <style scoped>
113
122
  .list-arrows {
114
- opacity: 0;
123
+ opacity: 0;
115
124
  }
116
125
 
117
126
  .list-arrows .icon-font {
118
- transition: all ease-in-out 0.2s;
127
+ transition: all ease-in-out 0.2s;
119
128
  }
120
129
 
121
130
  .list-arrows.sorted {
122
- opacity: 1;
131
+ opacity: 1;
123
132
  }
124
133
 
125
134
  .col img {
126
- height: 35px;
127
- margin-top: -14px;
128
- margin-bottom: -14px;
129
- border-radius: 5px;
135
+ height: 35px;
136
+ margin-top: -14px;
137
+ margin-bottom: -14px;
138
+ border-radius: 5px;
130
139
  }
131
140
 
132
141
  .list-arrows.sorted .desc {
133
- transform: rotate(180deg);
142
+ transform: rotate(180deg);
134
143
  }
135
144
 
136
145
  table {
137
- border-collapse: separate;
138
- border-spacing: 0 15px;
139
- border-collapse: collapse;
146
+ border-collapse: separate;
147
+ border-spacing: 0 15px;
148
+ border-collapse: collapse;
140
149
  }
141
150
 
142
151
  th {
143
- font-weight: 400;
152
+ font-weight: 400;
144
153
  }
145
154
 
146
155
  .row {
147
- border-bottom: 1px solid var(--border-color);
148
- cursor: pointer;
156
+ border-bottom: 1px solid var(--border-color);
157
+ cursor: pointer;
149
158
  }
150
159
 
151
160
  .row.first-row {
152
- font-size: 0.8rem;
153
- color: var(--bgl-black-tint);
154
- position: sticky;
155
- top: 0;
156
- z-index: 2;
157
- background: var(--bgl-white);
158
- height: 50px;
159
- vertical-align: bottom;
161
+ font-size: 0.8rem;
162
+ color: var(--bgl-black-tint);
163
+ position: sticky;
164
+ top: 0;
165
+ z-index: 2;
166
+ background: var(--bgl-white);
167
+ height: 50px;
168
+ vertical-align: bottom;
160
169
  }
161
170
 
162
171
  .row.first-row::after {
163
- content: "";
164
- border-bottom: 1px solid var(--border-color);
165
- position: absolute;
166
- left: 0;
167
- right: 0;
168
- bottom: -1px;
172
+ content: "";
173
+ border-bottom: 1px solid var(--border-color);
174
+ position: absolute;
175
+ left: 0;
176
+ right: 0;
177
+ bottom: -1px;
169
178
  }
170
179
 
171
180
  .first-row .col {
172
- cursor: pointer;
173
- background: var(--bgl-white);
181
+ cursor: pointer;
182
+ background: var(--bgl-white);
174
183
  }
175
184
 
176
185
  .col {
177
- white-space: nowrap;
178
- padding: 14px;
179
- transition: var(--bgl-transition);
180
- line-height: 1;
181
- padding-left: 1rem;
182
- padding-right: 1rem;
183
- align-items: center;
186
+ white-space: nowrap;
187
+ padding: 14px;
188
+ transition: var(--bgl-transition);
189
+ line-height: 1;
190
+ padding-left: 1rem;
191
+ padding-right: 1rem;
192
+ align-items: center;
184
193
  }
185
194
 
186
- .col > div {
187
- display: flex;
188
- gap: 0.5rem;
195
+ .col>div {
196
+ display: flex;
197
+ gap: 0.5rem;
189
198
  }
190
199
 
191
200
  .max-col-width {
192
- max-width: 30vw;
193
- overflow: hidden;
194
- text-overflow: ellipsis;
201
+ max-width: 30vw;
202
+ overflow: hidden;
203
+ text-overflow: ellipsis;
195
204
  }
196
205
 
197
206
  .col.check .icon-font {
198
- border-radius: 100%;
199
- background: var(--bgl-blue-20);
200
- color: var(--bgl-primary);
201
- width: 20px;
202
- height: 20px;
203
- display: flex;
204
- align-items: center;
205
- justify-content: center;
206
- margin-top: -2px;
207
+ border-radius: 100%;
208
+ background: var(--bgl-blue-20);
209
+ color: var(--bgl-primary);
210
+ width: 20px;
211
+ height: 20px;
212
+ display: flex;
213
+ align-items: center;
214
+ justify-content: center;
215
+ margin-top: -2px;
207
216
  }
208
217
 
209
218
  .rows {
210
- font-size: 0.8125em;
219
+ font-size: 0.8125em;
211
220
  }
212
221
 
213
222
  .table-list {
214
- height: 100%;
215
- position: relative;
216
- padding-left: 0 !important;
217
- padding-right: 0 !important;
218
- overflow: auto;
223
+ height: 100%;
224
+ position: relative;
225
+ padding-left: 0 !important;
226
+ padding-right: 0 !important;
227
+ overflow: auto;
219
228
  }
220
229
 
221
230
  .BagelTable .table-list {
222
- overflow: unset;
231
+ overflow: unset;
223
232
  }
224
233
 
225
234
  .row-item {
226
- height: 50px;
227
- transition: all 200ms ease;
235
+ height: 50px;
236
+ transition: all 200ms ease;
228
237
  }
229
238
 
230
239
  .row-item:hover {
231
- background: var(--bgl-gray-light);
240
+ background: var(--bgl-gray-light);
232
241
  }
233
242
 
234
243
  .infinite-wrapper {
235
- overflow-y: auto;
236
- width: 100%;
244
+ overflow-y: auto;
245
+ width: 100%;
237
246
  }
238
247
  </style>