@bagelink/vue 1.4.48 → 1.4.52

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.4.48",
4
+ "version": "1.4.52",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -41,11 +41,7 @@ onMounted(calcIsOpen)
41
41
  <div :class="{ open: isOpen, closed: !isOpen }">
42
42
  <slot name="top" :isOpen="isOpen" />
43
43
  <div
44
- class="nav-expend"
45
- role="button"
46
- aria-label="Toggle Navigation"
47
- tabindex="0"
48
- @click="toggleMenu"
44
+ class="nav-expend" role="button" aria-label="Toggle Navigation" tabindex="0" @click="toggleMenu"
49
45
  @keypress.enter="toggleMenu"
50
46
  >
51
47
  <Icon icon="chevron_right" class="top-arrow" />
@@ -55,12 +51,8 @@ onMounted(calcIsOpen)
55
51
  <div class="nav-scroll">
56
52
  <div class="nav-links-wrapper">
57
53
  <component
58
- :is="link.to ? 'router-link' : 'div'"
59
- v-for="link in links"
60
- :key="link.label"
61
- class="nav-button"
62
- :to="link.to"
63
- @click="link.onClick?.()"
54
+ :is="link.to ? 'router-link' : 'div'" v-for="link in links" :key="link.label"
55
+ class="nav-button" :to="link.to" @click="link.onClick?.()"
64
56
  >
65
57
  <Icon :icon="link.icon" />
66
58
  <div class="tooltip">
@@ -72,12 +64,8 @@ onMounted(calcIsOpen)
72
64
 
73
65
  <div class="bot-buttons-wrapper">
74
66
  <component
75
- :is="link.to ? 'router-link' : 'div'"
76
- v-for="link in footerLinks"
77
- :key="link.label"
78
- class="nav-button"
79
- :to="link.to"
80
- @click="link.onClick?.()"
67
+ :is="link.to ? 'router-link' : 'div'" v-for="link in footerLinks" :key="link.label"
68
+ class="nav-button" :to="link.to" @click="link.onClick?.()"
81
69
  >
82
70
  <Icon :icon="link.icon" />
83
71
  <div class="tooltip">
@@ -138,7 +126,7 @@ onMounted(calcIsOpen)
138
126
  .nav {
139
127
  color: var(--bgl-light-text);
140
128
  background: var(--bgl-primary);
141
- z-index: 100;
129
+ z-index: 98;
142
130
  width: 70px;
143
131
  transition: all 0.4s cubic-bezier(0.36, 0.02, 0.23, 1);
144
132
  display: flex;
@@ -379,6 +367,7 @@ onMounted(calcIsOpen)
379
367
  display: none;
380
368
  }
381
369
  }
370
+
382
371
  @media screen and (max-height: 550px) {
383
372
  .nav.open .nav-button {
384
373
  margin-top: 4px;
@@ -11,7 +11,7 @@ const props = withDefaults(
11
11
  bagelFormProps?: Omit<
12
12
  ComponentProps<typeof BagelForm<T, P>>,
13
13
  (
14
- 'schema' | `${string}modelValue` | `ref${string}` | `onVnode${string}` | 'onSubmit'
14
+ 'schema' | `${string}modelValue` | `ref${string}` | `onVnode${string}` | 'onSubmit'
15
15
  )
16
16
  >
17
17
  schema?: MaybeRefOrGetter<BglFormSchemaT<T>>
@@ -174,22 +174,46 @@ async function nextStep() {
174
174
  checkCurrentStepValidity()
175
175
  }
176
176
 
177
- function goToStep(stepIndex: number) {
177
+ async function goToStep(stepIndex: number) {
178
178
  // Can always go back, or to already validated steps
179
179
  if (stepIndex < currentStep.value || validatedSteps.value.includes(stepIndex)) {
180
180
  currentStep.value = stepIndex
181
181
  return true
182
182
  }
183
183
 
184
- // For forward navigation to non-validated steps, validate current step first if needed
185
- // This will show validation errors to the user
186
- if (props.validateOnSteps && reportValidity() === false) {
187
- return false
188
- }
184
+ // For forward navigation, validate each step sequentially until target or invalid step
185
+ if (stepIndex > currentStep.value) {
186
+ // Validate current step first
187
+ if (props.validateOnSteps && reportValidity() === false) {
188
+ return false
189
+ }
190
+
191
+ // Move forward step by step, validating each one
192
+ for (let step = currentStep.value + 1; step <= stepIndex; step++) {
193
+ // Move to the next step
194
+ currentStep.value = step
195
+
196
+ // Wait for the form to update with new step's fields
197
+ await nextTick()
198
+ await sleep(100) // Give time for form to render
199
+
200
+ // Validate this step if validation is enabled
201
+ if (props.validateOnSteps) {
202
+ // Check if the step is valid without showing validation errors for intermediate steps
203
+ const isValid = formRef.value?.checkValidity() ?? false
204
+
205
+ if (!isValid) {
206
+ // If this step is invalid, stop here
207
+ return false
208
+ } else {
209
+ // Mark this step as validated
210
+ if (!validatedSteps.value.includes(step)) {
211
+ validatedSteps.value.push(step)
212
+ }
213
+ }
214
+ }
215
+ }
189
216
 
190
- // Can only move one step forward at a time (prevent skipping)
191
- if (stepIndex === currentStep.value + 1) {
192
- currentStep.value = stepIndex
193
217
  return true
194
218
  }
195
219
 
@@ -247,14 +271,11 @@ defineExpose({
247
271
  >
248
272
  <div class="bgl-steps-indicator">
249
273
  <div
250
- v-for="(_, index) in numberOfSteps"
251
- :key="index"
252
- class="bgl-step-indicator" :class="[
274
+ v-for="(_, index) in numberOfSteps" :key="index" class="bgl-step-indicator" :class="[
253
275
  { active: index === currentStep },
254
276
  { completed: index < currentStep || isStepValidated(index) },
255
277
  { clickable: props.allowStepNavigation },
256
- ]"
257
- @click="props.allowStepNavigation && goToStep(index)"
278
+ ]" @click="props.allowStepNavigation && goToStep(index)"
258
279
  >
259
280
  <span>{{ index + 1 }}</span>
260
281
  <span v-if="props.stepLabels && props.stepLabels[index]" class="bgl-step-label">
@@ -266,17 +287,9 @@ defineExpose({
266
287
  </div>
267
288
 
268
289
  <div class="bgl-form-wrapper">
269
- <transition
270
- :name="slideDirection === 'right' ? 'slide-right' : 'slide-left'"
271
- mode="out-in"
272
- >
290
+ <transition :name="slideDirection === 'right' ? 'slide-right' : 'slide-left'" mode="out-in">
273
291
  <div :key="currentStep" ref="formContainer" class="bgl-form-container">
274
- <BagelForm
275
- ref="formRef"
276
- v-model="formData"
277
- :schema="currentStepSchema"
278
- v-bind="bagelFormProps"
279
- >
292
+ <BagelForm ref="formRef" v-model="formData" :schema="currentStepSchema" v-bind="bagelFormProps">
280
293
  <template v-if="$slots.success" #success>
281
294
  <slot name="success" />
282
295
  </template>
@@ -302,9 +315,7 @@ defineExpose({
302
315
  >
303
316
  <Btn v-if="currentStep !== 0" color="gray" icon="arrow_back" @click="prevStep" />
304
317
  <Btn
305
- v-if="!isLastStep"
306
- icon="arrow_forward"
307
- :disabled="props.validateOnSteps && !isStepValid"
318
+ v-if="!isLastStep" icon="arrow_forward" :disabled="props.validateOnSteps && !isStepValid"
308
319
  @click="nextStep"
309
320
  />
310
321
  <Btn v-else value="Submit" @click="handleSubmit" />
@@ -356,7 +367,7 @@ defineExpose({
356
367
  display: none;
357
368
  }
358
369
 
359
- .bgl-step-indicator > span:first-child {
370
+ .bgl-step-indicator>span:first-child {
360
371
  width: 30px;
361
372
  height: 30px;
362
373
  border-radius: 50%;
@@ -368,12 +379,12 @@ defineExpose({
368
379
  margin-bottom: 0.5rem;
369
380
  }
370
381
 
371
- .bgl-step-indicator.active > span:first-child {
382
+ .bgl-step-indicator.active>span:first-child {
372
383
  background: var(--primary-color, #4CAF50);
373
384
  color: white;
374
385
  }
375
386
 
376
- .bgl-step-indicator.completed > span:first-child {
387
+ .bgl-step-indicator.completed>span:first-child {
377
388
  background: var(--success-color, #8BC34A);
378
389
  color: white;
379
390
  }
@@ -396,7 +407,7 @@ defineExpose({
396
407
  interpolate-size: allow-keywords;
397
408
  }
398
409
 
399
- .bgl-form-wrapper > div {
410
+ .bgl-form-wrapper>div {
400
411
  grid-area: 1 / 1;
401
412
 
402
413
  }
@@ -418,12 +429,12 @@ defineExpose({
418
429
  /* Slide Left Animation (going forward) */
419
430
  .slide-left-enter-active {
420
431
  transition: opacity var(--transition-duration) var(--ease-in),
421
- transform var(--transition-duration) var(--ease-in);
432
+ transform var(--transition-duration) var(--ease-in);
422
433
  }
423
434
 
424
435
  .slide-left-leave-active {
425
436
  transition: opacity var(--transition-duration) var(--ease-out),
426
- transform var(--transition-duration) var(--ease-out);
437
+ transform var(--transition-duration) var(--ease-out);
427
438
  }
428
439
 
429
440
  .slide-left-enter-from {
@@ -439,12 +450,12 @@ defineExpose({
439
450
  /* Slide Right Animation (going back) */
440
451
  .slide-right-enter-active {
441
452
  transition: opacity var(--transition-duration) var(--ease-in),
442
- transform var(--transition-duration) var(--ease-in);
453
+ transform var(--transition-duration) var(--ease-in);
443
454
  }
444
455
 
445
456
  .slide-right-leave-active {
446
457
  transition: opacity var(--transition-duration) var(--ease-out),
447
- transform var(--transition-duration) var(--ease-out);
458
+ transform var(--transition-duration) var(--ease-out);
448
459
  }
449
460
 
450
461
  .slide-right-enter-from {
@@ -126,12 +126,14 @@ function inputHandler() {
126
126
 
127
127
  watch(() => numberValue, () => {
128
128
  nextTick(() => {
129
+ // Don't reformat if user is currently typing a decimal
130
+ if (formattedValue.endsWith('.')) return
129
131
  formattedValue = numberValue !== undefined ? formatNumber(numberValue) : ''
130
132
  })
131
133
  })
132
134
 
133
135
  watch(() => modelValue, (newVal) => {
134
- if (newVal !== numberValue) {
136
+ if (newVal !== numberValue) {
135
137
  if (typeof newVal === 'string' && (newVal === '-' || newVal.endsWith('.'))) {
136
138
  formattedValue = newVal
137
139
  return
@@ -143,8 +145,7 @@ watch(() => modelValue, (newVal) => {
143
145
 
144
146
  <template>
145
147
  <div
146
- class="bagel-input num-input"
147
- :class="{
148
+ class="bagel-input num-input" :class="{
148
149
  textInputSpinnerWrap: icon || spinner,
149
150
  txtInputIconStart: iconStart,
150
151
  }"
@@ -154,47 +155,39 @@ watch(() => modelValue, (newVal) => {
154
155
  {{ label }}
155
156
  </label>
156
157
  <div class="gap-025" :class="{ 'column flex': layout === 'vertical', 'flex': layout === 'horizontal' }">
157
- <Btn v-if="layout && btnLayouts.includes(layout)" flat icon="add" class="radius" :class="[{ 'bgl-big-ctrl-num-btn': layout === 'vertical' }]" tabindex="-1" @click="increment" />
158
+ <Btn
159
+ v-if="layout && btnLayouts.includes(layout)" flat icon="add" class="radius"
160
+ :class="[{ 'bgl-big-ctrl-num-btn': layout === 'vertical' }]" tabindex="-1" @click="increment"
161
+ />
158
162
  <input
159
- :id
160
- v-model.trim="formattedValue"
161
- v-pattern.number
162
- type="text"
163
- :class="{
163
+ :id v-model.trim="formattedValue" v-pattern.number type="text" :class="{
164
164
  'txt-center': center,
165
165
  'min0': layout,
166
166
  'bgl-number-input': layout !== 'vertical' && layout !== 'horizontal',
167
- }"
168
- :placeholder="placeholder || label"
169
- :disabled
170
- :required
171
- :readonly="disabled"
172
- inputmode="decimal"
173
- autocomplete="off"
174
- :pattern="useGrouping ? '^-?\\d{1,3}(,\\d{3})*(\.\\d+)?$' : '^-?\\d*\.?\d*$'"
175
- autocorrect="off"
176
- spellcheck="false"
177
- @input="inputHandler"
178
- @keydown.up.prevent="increment"
167
+ }" :placeholder="placeholder || label" :disabled :required :readonly="disabled" inputmode="decimal"
168
+ autocomplete="off" :pattern="useGrouping ? '^-?\\d{1,3}(,\\d{3})*(\.\\d+)?$' : '^-?\\d*\.?\d*$'"
169
+ autocorrect="off" spellcheck="false" @input="inputHandler" @keydown.up.prevent="increment"
179
170
  @keydown.down.prevent="decrement"
180
171
  >
181
172
  <p v-if="helptext" class="opacity-7 light">
182
173
  {{ helptext }}
183
174
  </p>
184
- <Icon
185
- v-if="iconStart"
186
- class="iconStart"
187
- :icon="iconStart"
188
- />
189
- <Icon
190
- v-if="icon"
191
- :icon
175
+ <Icon v-if="iconStart" class="iconStart" :icon="iconStart" />
176
+ <Icon v-if="icon" :icon />
177
+ <Btn
178
+ v-if="layout && btnLayouts.includes(layout)" flat icon="remove" class="radius"
179
+ :class="[{ 'bgl-big-ctrl-num-btn': layout === 'vertical' }]" tabindex="-1" @click="decrement"
192
180
  />
193
- <Btn v-if="layout && btnLayouts.includes(layout)" flat icon="remove" class="radius" :class="[{ 'bgl-big-ctrl-num-btn': layout === 'vertical' }]" tabindex="-1" @click="decrement" />
194
181
 
195
182
  <div v-if="spinner && (!layout || !btnLayouts.includes(layout))" class="flex column spinner">
196
- <Btn icon="add" flat thin class="bgl-ctrl-num-btn ctrl-add top-bgl-ctrl-num-btn" :disabled="!canAdd" tabindex="-1" @click="increment" />
197
- <Btn icon="remove" flat thin class="bgl-ctrl-num-btn ctrl-remove" :disabled="!canDecrement" tabindex="-1" @click="decrement" />
183
+ <Btn
184
+ icon="add" flat thin class="bgl-ctrl-num-btn ctrl-add top-bgl-ctrl-num-btn" :disabled="!canAdd"
185
+ tabindex="-1" @click="increment"
186
+ />
187
+ <Btn
188
+ icon="remove" flat thin class="bgl-ctrl-num-btn ctrl-remove" :disabled="!canDecrement"
189
+ tabindex="-1" @click="decrement"
190
+ />
198
191
  </div>
199
192
  </div>
200
193
  </div>
@@ -202,14 +195,15 @@ watch(() => modelValue, (newVal) => {
202
195
  </template>
203
196
 
204
197
  <style scoped>
205
- .txtInputIconStart input{
198
+ .txtInputIconStart input {
206
199
  padding-inline-start: calc(var(--input-height) / 1.5);
207
200
  }
201
+
208
202
  .txtInputIconStart .iconStart {
209
203
  color: var(--input-color);
210
204
  position: absolute;
211
- inset-inline-start:calc(var(--input-height) / 3 - 0.25rem);
212
- margin-top: calc(var(--input-height) / 2 );
205
+ inset-inline-start: calc(var(--input-height) / 3 - 0.25rem);
206
+ margin-top: calc(var(--input-height) / 2);
213
207
  line-height: 0;
214
208
  }
215
209
 
@@ -226,19 +220,21 @@ watch(() => modelValue, (newVal) => {
226
220
  gap: 0;
227
221
  }
228
222
 
229
- .top-bgl-ctrl-num-btn{
223
+ .top-bgl-ctrl-num-btn {
230
224
  margin-top: calc(var(--input-height) / 10) !important;
231
225
  }
232
- .bgl-ctrl-num-btn{
226
+
227
+ .bgl-ctrl-num-btn {
233
228
  height: calc(var(--input-height) / 2.5) !important;
234
229
  isolation: isolate;
235
230
  }
236
231
 
237
- .bgl-big-ctrl-num-btn{
232
+ .bgl-big-ctrl-num-btn {
238
233
  width: 100% !important;
239
234
  isolation: isolate;
240
235
  }
241
- .bgl-number-input{
236
+
237
+ .bgl-number-input {
242
238
  padding-inline-end: 1.75rem !important;
243
239
  }
244
240
  </style>