@bagelink/vue 1.4.79 → 1.4.85

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 (43) 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/Btn.vue.d.ts +10 -4
  4. package/dist/components/Btn.vue.d.ts.map +1 -1
  5. package/dist/components/Modal.vue.d.ts.map +1 -1
  6. package/dist/components/ModalForm.vue.d.ts +3 -1
  7. package/dist/components/ModalForm.vue.d.ts.map +1 -1
  8. package/dist/components/Pill.vue.d.ts.map +1 -1
  9. package/dist/components/Slider.vue.d.ts +4 -4
  10. package/dist/components/Slider.vue.d.ts.map +1 -1
  11. package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
  12. package/dist/index.cjs +6 -6
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.mjs +6 -6
  16. package/dist/style.css +1 -1
  17. package/dist/types/index.d.ts +2 -1
  18. package/dist/types/index.d.ts.map +1 -1
  19. package/dist/utils/elementUtils.d.ts +104 -0
  20. package/dist/utils/elementUtils.d.ts.map +1 -0
  21. package/package.json +1 -1
  22. package/src/components/Avatar.vue +1 -1
  23. package/src/components/Badge.vue +1059 -26
  24. package/src/components/Btn.vue +113 -88
  25. package/src/components/Card.vue +1 -1
  26. package/src/components/Modal.vue +11 -29
  27. package/src/components/ModalForm.vue +8 -24
  28. package/src/components/Pill.vue +203 -8
  29. package/src/components/Slider.vue +2 -2
  30. package/src/components/dataTable/DataTable.vue +1 -1
  31. package/src/components/form/inputs/DatePicker.vue +1 -1
  32. package/src/components/form/inputs/SelectInput.vue +1 -1
  33. package/src/index.ts +1 -0
  34. package/src/styles/appearance.css +202 -1356
  35. package/src/styles/bagel.css +2 -0
  36. package/src/styles/btnColors.css +847 -0
  37. package/src/styles/colors.css +3739 -0
  38. package/src/styles/dark.css +2 -2
  39. package/src/styles/mobileColors.css +3741 -0
  40. package/src/styles/text.css +2294 -783
  41. package/src/styles/theme.css +211 -18
  42. package/src/types/index.ts +46 -11
  43. package/src/utils/elementUtils.ts +531 -0
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
- import type { IconType, ThemeType } from '@bagelink/vue'
2
+ import type { IconType, ExtendedThemeType } from '@bagelink/vue'
3
3
  import type { SetupContext } from 'vue'
4
- import { Icon, Loading } from '@bagelink/vue'
4
+ import { Icon, Loading, useModal } from '@bagelink/vue'
5
5
  import { useSlots, ref, onMounted, onUnmounted } from 'vue'
6
6
  import { RouterLink } from 'vue-router'
7
7
 
@@ -12,12 +12,13 @@ const props = withDefaults(
12
12
  iconEnd?: IconType
13
13
  iconSize?: number | string
14
14
  iconMobileSize?: number | string
15
- color?: ThemeType
16
- theme?: ThemeType
15
+ color?: ExtendedThemeType
16
+ theme?: ExtendedThemeType
17
17
  flat?: boolean
18
18
  border?: boolean
19
19
  outline?: boolean
20
20
  thin?: boolean
21
+ size?: 'xs' | 's' | 'm' | 'l' | 'xl'
21
22
  type?: 'button' | 'submit' | 'reset'
22
23
  loading?: boolean
23
24
  role?: string
@@ -28,6 +29,7 @@ const props = withDefaults(
28
29
  is?: string
29
30
  ripple?: boolean
30
31
  onClick?: (e: MouseEvent) => void
32
+ confirm?: boolean | string
31
33
  }>(),
32
34
  {
33
35
  onClick: () => '',
@@ -43,9 +45,15 @@ const props = withDefaults(
43
45
  },
44
46
  )
45
47
 
48
+ const emit = defineEmits<{
49
+ confirmed: [event: MouseEvent]
50
+ }>()
51
+
52
+ const { confirmModal } = useModal()
53
+
46
54
  const isMobileScreen = ref(false)
47
55
 
48
- const checkMobile = () => {
56
+ function checkMobile() {
49
57
  isMobileScreen.value = window.innerWidth <= 910
50
58
  }
51
59
 
@@ -58,6 +66,23 @@ onUnmounted(() => {
58
66
  window.removeEventListener('resize', checkMobile)
59
67
  })
60
68
 
69
+ async function handleClick(event: MouseEvent) {
70
+ if (props.confirm) {
71
+ const message = typeof props.confirm === 'string' ? props.confirm : 'Are you sure?'
72
+ const confirmed = await confirmModal({
73
+ title: 'Confirm',
74
+ message
75
+ })
76
+
77
+ if (!confirmed) return
78
+
79
+ props.onClick(event)
80
+ emit('confirmed', event)
81
+ } else {
82
+ props.onClick(event)
83
+ }
84
+ }
85
+
61
86
  const iconSizeComputed = $computed(() => {
62
87
  if (props.iconSize !== undefined) return props.iconSize
63
88
  return isMobileScreen.value ? 1 : 1.2
@@ -94,7 +119,7 @@ const slots: SetupContext['slots'] = useSlots()
94
119
  'bgl_btn-border': border || outline,
95
120
  [`bgl_btn-${color}`]: color,
96
121
  [`bgl_btn-${theme}`]: theme,
97
- }" :tabindex="disabled ? -1 : 0" @click.stop="onClick" @keydown.enter="onClick" @keydown.space="onClick">
122
+ }" :tabindex="disabled ? -1 : 0" @click.stop="handleClick" @keydown.enter="handleClick" @keydown.space="handleClick">
98
123
  <Loading v-if="loading" class="h-100p" size="15" />
99
124
  <div v-else class="bgl_btn-flex">
100
125
  <Icon v-if="icon" :icon="icon" class="transition-400" :size="iconSizeComputed" :mobile-size="iconMobileSize" />
@@ -108,174 +133,174 @@ const slots: SetupContext['slots'] = useSlots()
108
133
  </template>
109
134
 
110
135
  <style scoped>
111
- .bgl_btn {
112
- --btn-bg: var(--bgl-primary);
113
- --btn-color: var(--bgl-light-text);
114
- --btn-flat-color: var(--bgl-text-color);
115
- }
136
+ @import '../styles/btnColors.css';
116
137
 
117
138
  .bgl_btn-green {
118
- --btn-bg: var(--bgl-green);
119
- --btn-color: var(--bgl-light-text);
120
- --btn-flat-color: var(--bgl-green);
139
+ --btn-bg: var(--bgl-green);
140
+ --btn-color: var(--bgl-light-text);
141
+ --btn-flat-color: var(--bgl-green);
121
142
  }
122
143
 
123
144
  .bgl_btn-yellow {
124
- --btn-bg: var(--bgl-yellow);
125
- --btn-color: var(--bgl-black);
126
- --btn-flat-color: var(--bgl-yellow);
145
+ --btn-bg: var(--bgl-yellow);
146
+ --btn-color: var(--bgl-black);
147
+ --btn-flat-color: var(--bgl-yellow);
127
148
  }
128
149
 
129
150
  .bgl_btn-blue {
130
- --btn-bg: var(--bgl-blue);
131
- --btn-color: var(--bgl-light-text);
132
- --btn-flat-color: var(--bgl-blue);
151
+ --btn-bg: var(--bgl-blue);
152
+ --btn-color: var(--bgl-light-text);
153
+ --btn-flat-color: var(--bgl-blue);
133
154
  }
134
155
 
135
156
  .bgl_btn-primary {
136
- --btn-bg: var(--bgl-primary);
137
- --btn-color: var(--bgl-light-text);
138
- --btn-flat-color: var(--bgl-primary);
157
+ --btn-bg: var(--bgl-primary);
158
+ --btn-color: var(--bgl-light-text);
159
+ --btn-flat-color: var(--bgl-primary);
139
160
  }
140
161
 
141
162
  .bgl_btn-red {
142
- --btn-bg: var(--bgl-red);
143
- --btn-color: var(--bgl-light-text);
144
- --btn-flat-color: var(--bgl-red);
163
+ --btn-bg: var(--bgl-red);
164
+ --btn-color: var(--bgl-light-text);
165
+ --btn-flat-color: var(--bgl-red);
145
166
  }
146
167
 
147
168
  .bgl_btn-white {
148
- --btn-bg: var(--bgl-white);
149
- --btn-color: var(--bgl-black);
150
- --btn-flat-color: var(--bgl-white);
169
+ --btn-bg: var(--bgl-white);
170
+ --btn-color: var(--bgl-black);
171
+ --btn-flat-color: var(--bgl-white);
151
172
  }
152
173
 
153
174
  .bgl_btn-black {
154
- --btn-bg: var(--bgl-black);
155
- --btn-color: var(--bgl-light-text);
156
- --btn-flat-color: var(--bgl-black);
175
+ --btn-bg: var(--bgl-black);
176
+ --btn-color: var(--bgl-light-text);
177
+ --btn-flat-color: var(--bgl-black);
157
178
  }
158
179
 
159
180
  .bgl_btn-gray {
160
- --btn-bg: var(--bgl-gray-light);
161
- --btn-color: var(--bgl-black);
162
- --btn-flat-color: var(--bgl-gray);
181
+ --btn-bg: var(--bgl-gray-light);
182
+ --btn-color: var(--bgl-black);
183
+ --btn-flat-color: var(--bgl-gray);
163
184
  }
164
185
 
165
186
  .bgl_btn-light {
166
- --btn-bg: var(--bgl-primary-light);
167
- --btn-color: var(--bgl-primary);
168
- --btn-flat-color: var(--bgl-primary-light);
187
+ --btn-bg: var(--bgl-primary-light);
188
+ --btn-color: var(--bgl-primary);
189
+ --btn-flat-color: var(--bgl-primary-light);
169
190
  }
170
191
 
171
192
  .bgl_btn-gray-light {
172
- --btn-bg: var(--bgl-gray-light);
173
- --btn-color: var(--bgl-gray);
174
- --btn-flat-color: var(--bgl-gray-light);
193
+ --btn-bg: var(--bgl-gray-light);
194
+ --btn-color: var(--bgl-gray);
195
+ --btn-flat-color: var(--bgl-gray-light);
175
196
  }
176
197
 
177
198
  .bgl_btn {
178
- padding-left: var(--btn-padding);
179
- padding-right: var(--btn-padding);
180
- transition: var(--bgl-transition);
181
- background: var(--btn-bg);
182
- color: var(--btn-color);
183
- text-decoration: none;
199
+ padding-left: var(--btn-padding);
200
+ padding-right: var(--btn-padding);
201
+ transition: var(--bgl-transition);
202
+ background: var(--btn-bg);
203
+ color: var(--btn-color);
204
+ text-decoration: none;
184
205
  }
185
206
 
186
207
  .bgl_btn.bgl_btn-icon {
187
- padding-left: 0;
188
- padding-right: 0;
189
- height: var(--btn-height);
190
- width: var(--btn-height);
191
- border-radius: 100%;
192
- font-size: 1rem;
193
- flex-shrink: 0;
208
+ padding-left: 0;
209
+ padding-right: 0;
210
+ height: var(--btn-height);
211
+ width: var(--btn-height);
212
+ border-radius: 100%;
213
+ font-size: 1rem;
214
+ flex-shrink: 0;
194
215
  }
195
216
 
196
217
  a {
197
- text-decoration: none;
218
+ text-decoration: none;
198
219
  }
199
220
 
200
221
  .bgl_btn-flex {
201
- display: flex;
202
- align-items: center;
203
- gap: 0.5rem;
204
- justify-content: center;
205
- height: 100%;
222
+ display: flex;
223
+ align-items: center;
224
+ gap: 0.5rem;
225
+ justify-content: center;
226
+ height: 100%;
206
227
  }
207
228
 
208
- .bgl_btn .bgl_btn-icon{
209
- font-size: calc(var(--input-font-size) * 1.3);
229
+ .bgl_btn .bgl_btn-icon {
230
+ font-size: calc(var(--input-font-size) * 1.3);
210
231
  }
211
232
 
212
233
  .bgl_btn:hover,
213
234
  .bgl_btn-icon:hover {
214
- filter: var(--bgl-hover-filter);
235
+ filter: var(--bgl-hover-filter);
215
236
  }
216
237
 
217
238
  .bgl_btn:active:not(:disabled),
218
239
  .bgl_btn-icon:active:not(:disabled) {
219
- filter: var(--bgl-active-filter);
240
+ filter: var(--bgl-active-filter);
220
241
  }
221
242
 
222
243
  .bgl_btn.bgl_btn_flat {
223
- background: transparent;
224
- color: var(--btn-flat-color);
244
+ background: transparent;
245
+ color: var(--btn-flat-color);
225
246
  }
226
247
 
227
248
  .bgl_btn_flat:hover:not(:disabled),
228
249
  .bgl_btn-icon.bgl_btn_flat:hover:not(:disabled) {
229
- background: var(--bgl-gray-20);
250
+ background: var(--bgl-gray-tint);
230
251
  }
231
252
 
232
253
  .bgl_btn.bgl_btn_flat:active:not(:disabled),
233
254
  .bgl_btn-icon.bgl_btn_flat:active:not(:disabled) {
234
- background: var(--bgl-gray-40);
255
+ background: var(--bgl-gray-tint-dark);
235
256
  }
236
257
 
237
258
  .bgl_btn.thin {
238
- padding-inline: calc(var(--btn-padding) / 3);
239
- border-radius: calc(var(--btn-border-radius) / 1.5);
259
+ padding-inline: calc(var(--btn-padding) / 3);
260
+ border-radius: calc(var(--btn-border-radius) / 1.5);
240
261
  }
241
262
 
242
263
  .bgl_btn.round {
243
- border-radius: 1000px;
264
+ border-radius: 1000px;
244
265
  }
245
266
 
246
267
  .bgl_btn-icon.thin {
247
- height: calc(var(--btn-height) / 1.5);
248
- width: calc(var(--btn-height) / 1.5);
249
- line-height: normal;
268
+ height: calc(var(--btn-height) / 1.5);
269
+ width: calc(var(--btn-height) / 1.5);
270
+ line-height: normal;
250
271
  }
272
+
251
273
  .bgl_btn-icon.thin .bgl_btn-flex {
252
274
  height: 100%;
253
275
  }
254
276
 
255
- [dir="rtl"] .bgl_btn-icon{
256
- transform: rotateY(180deg);
277
+ [dir="rtl"] .bgl_btn-icon {
278
+ transform: rotateY(180deg);
257
279
  }
258
- [dir="rtl"] .ltr .bgl_btn-icon{
259
- transform: rotateY(0deg);
280
+
281
+ [dir="rtl"] .ltr .bgl_btn-icon {
282
+ transform: rotateY(0deg);
260
283
  }
261
284
 
262
- .bgl_btn-border, .bgl_btn-icon.bgl_btn_flat.bgl_btn-border {
263
- border: 1px solid var(--btn-flat-color);
264
- background: transparent;
265
- color: var(--btn-flat-color);
285
+ .bgl_btn-border,
286
+ .bgl_btn-icon.bgl_btn_flat.bgl_btn-border {
287
+ border: 1px solid var(--btn-flat-color);
288
+ background: transparent;
289
+ color: var(--btn-flat-color);
266
290
  }
267
291
 
268
292
  .bgl_btn-border:hover {
269
- color: var(--btn-flat-color);
293
+ color: var(--btn-flat-color);
270
294
  }
271
295
 
272
296
  .bgl_btn-border:active:not(:disabled) {
273
- filter: brightness(80%);
297
+ filter: brightness(80%);
274
298
  }
275
299
 
276
- .bgl_btn:disabled, .bgl_btn[disabled=true] {
277
- opacity: 0.7;
278
- filter: grayscale(0.3);
279
- cursor: not-allowed;
300
+ .bgl_btn:disabled,
301
+ .bgl_btn[disabled=true] {
302
+ opacity: 0.7;
303
+ filter: grayscale(0.3);
304
+ cursor: not-allowed;
280
305
  }
281
306
  </style>
@@ -87,7 +87,7 @@ const is = $computed(() => {
87
87
  }
88
88
 
89
89
  .bgl_card.gray {
90
- background: var(--bgl-gray-20);
90
+ background: var(--bgl-gray-tint);
91
91
  }
92
92
 
93
93
  .bgl_card.border {
@@ -78,22 +78,14 @@ onUnmounted(() => {
78
78
 
79
79
  <template>
80
80
  <div
81
- class="bg-dark"
82
- :style="{ zIndex }"
83
- :class="{ 'is-side': side, 'is-active': isVisible, 'bg-lignt': false }"
84
- @click="() => (dismissable ? closeModal() : '')"
85
- @keydown.esc="closeModal"
81
+ class="bg-dark" :style="{ zIndex }" :class="{ 'is-side': side, 'is-active': isVisible, 'bg-lignt': false }"
82
+ @click="() => (dismissable ? closeModal() : '')" @keydown.esc="closeModal"
86
83
  >
87
84
  <Card class="modal" :style="{ ...maxWidth }" :thin="thin" @click.stop>
88
85
  <header v-if="slots.toolbar || title" class="tool-bar">
89
86
  <slot name="toolbar" />
90
87
  <Btn
91
- v-if="dismissable"
92
- :style="{ float: side ? 'left' : 'right' }"
93
- flat
94
- icon="close"
95
- thin
96
- icon-mobile-size="1.4"
88
+ v-if="dismissable" :style="{ float: side ? '' : '' }" flat icon="close" thin icon-mobile-size="1.4"
97
89
  @click="closeModal"
98
90
  />
99
91
  <Title v-if="title" class="modal-title" tag="h3" :label="title" />
@@ -101,25 +93,13 @@ onUnmounted(() => {
101
93
 
102
94
  <div v-else class="sticky z-index-999 -mt-1 -ms-1 px-025 h-30px pt-025 modal-no-title">
103
95
  <Btn
104
- v-if="dismissable"
105
- class="position-start"
106
- icon="close"
107
- thin
108
- round
109
- color="white"
110
- icon-mobile-size="1.4"
111
- @click="closeModal"
96
+ v-if="dismissable" class="position-start" icon="close" thin round color="white"
97
+ icon-mobile-size="1.4" @click="closeModal"
112
98
  />
113
99
  </div>
114
100
  <slot />
115
101
  <footer v-if="slots.footer || actions?.length" class="modal-footer mt-1">
116
- <Btn
117
- v-for="(action, i) in actions"
118
- :key="i"
119
- color="gray"
120
- v-bind="action"
121
- @click="closeModal"
122
- />
102
+ <Btn v-for="(action, i) in actions" :key="i" color="gray" v-bind="action" @click="closeModal" />
123
103
  <slot name="footer" />
124
104
  </footer>
125
105
  </Card>
@@ -127,11 +107,12 @@ onUnmounted(() => {
127
107
  </template>
128
108
 
129
109
  <style>
130
- .modal{
110
+ .modal {
131
111
  color: var(--bgl-popup-text);
132
112
  /* display: flex;
133
113
  flex-direction: column; */
134
114
  }
115
+
135
116
  .modal-title {
136
117
  text-align: center;
137
118
  font-weight: 600;
@@ -156,13 +137,14 @@ onUnmounted(() => {
156
137
  align-items: center;
157
138
  }
158
139
 
159
- .modal-footer > div {
140
+ .modal-footer>div {
160
141
  gap: 1rem;
161
142
  display: flex;
162
143
  justify-content: space-between;
163
144
  align-items: center;
164
145
  }
165
- .modal-no-title{
146
+
147
+ .modal-no-title {
166
148
  width: calc(100% + 2rem);
167
149
  border-radius: var(--card-border-radius);
168
150
 
@@ -55,43 +55,27 @@ defineExpose({ setFormValues })
55
55
 
56
56
  <template>
57
57
  <Modal
58
- ref="modal"
59
- :side
60
- :width
61
- :visible="visible"
62
- :dismissable
63
- :title
58
+ ref="modal" :side :width :visible="visible" :dismissable :title
64
59
  @update:visible="($event: boolean) => emit('update:visible', $event)"
65
60
  >
61
+ <template #toolbar>
62
+ <slot name="toolbar" />
63
+ </template>
66
64
  <BagelForm
67
- v-if="visible"
68
- ref="form"
69
- v-model="formData"
70
- :schema="schema"
71
- @update:modelValue="emit('update:modelValue', $event)"
72
- @submit="runSubmit"
65
+ v-if="visible" ref="form" v-model="formData" :schema="schema"
66
+ @update:modelValue="emit('update:modelValue', $event)" @submit="runSubmit"
73
67
  />
74
68
  <template v-if="onDelete || onSubmit" #footer>
75
69
  <div class="flex gap-0">
76
70
  <Btn thin flat :value="cancelText || 'Cancel'" @click="closeModal" />
77
71
  <Btn
78
- v-if="onDelete"
79
- thin
80
- icon="delete"
81
- flat
82
- :value="deleteText || 'Delete'"
83
- color="red"
72
+ v-if="onDelete" thin icon="delete" flat :value="deleteText || 'Delete'" color="red"
84
73
  @click="runDelete"
85
74
  />
86
75
  </div>
87
76
  <div class="flex gap-05">
88
77
  <Btn
89
- v-if="onDuplicate"
90
- outline
91
- class="px-1"
92
- icon="copy_all"
93
- flat
94
- :value="duplicateText || 'Duplicate'"
78
+ v-if="onDuplicate" outline class="px-1" icon="copy_all" flat :value="duplicateText || 'Duplicate'"
95
79
  @click="onDuplicate?.(formData)"
96
80
  />
97
81
  <Btn v-if="onSubmit" :value="submitText || 'Submit'" @click="runSubmit" />