@bagelink/vue 0.0.696 → 0.0.702
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/dist/components/Btn.vue.d.ts +1 -1
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/ListItem.vue.d.ts +7 -0
- package/dist/components/ListItem.vue.d.ts.map +1 -1
- package/dist/components/ListView.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +6 -5
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/BglMultiStepForm.vue.d.ts +82 -0
- package/dist/components/form/BglMultiStepForm.vue.d.ts.map +1 -0
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/TelInput.vue.d.ts +3 -3
- package/dist/components/form/inputs/TelInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/layout/TabsNav.vue.d.ts +4 -0
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -1
- package/dist/index.cjs +281 -137
- package/dist/index.mjs +282 -138
- package/dist/style.css +589 -426
- package/dist/types/BagelForm.d.ts +1 -0
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts +346 -0
- package/dist/utils/BagelFormUtils.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/components/Btn.vue +4 -1
- package/src/components/ListItem.vue +54 -2
- package/src/components/ListView.vue +0 -38
- package/src/components/TableSchema.vue +1 -2
- package/src/components/form/BglForm.vue +13 -15
- package/src/components/form/BglMultiStepForm.vue +121 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/form/inputs/FileUploadURL.vue +2 -0
- package/src/components/form/inputs/SelectInput.vue +2 -2
- package/src/components/form/inputs/TelInput.vue +0 -1
- package/src/components/form/inputs/TextInput.vue +0 -1
- package/src/components/layout/TabsNav.vue +64 -1
- package/src/styles/appearance.css +121 -40
- package/src/styles/inputs.css +21 -13
- package/src/styles/layout.css +97 -84
- package/src/styles/mobilLayout.css +181 -168
- package/src/types/BagelForm.ts +1 -0
- package/src/utils/BagelFormUtils.ts +29 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends Record<string, any>">
|
|
2
|
+
import { BagelForm, type BglFormSchemaFnT, Btn, useBglSchema } from '@bagelink/vue'
|
|
3
|
+
import { watch } from 'vue'
|
|
4
|
+
|
|
5
|
+
type BagelFormT = InstanceType<typeof BagelForm>
|
|
6
|
+
|
|
7
|
+
const props = withDefaults(
|
|
8
|
+
defineProps<{
|
|
9
|
+
bagelFormProps?: Omit<
|
|
10
|
+
BagelFormT['$props'],
|
|
11
|
+
(
|
|
12
|
+
'schema' | `${string}modelValue` | `ref${string}` | `onVnode${string}` | 'onSubmit'
|
|
13
|
+
)
|
|
14
|
+
>
|
|
15
|
+
schema: BglFormSchemaFnT<T>
|
|
16
|
+
}>(),
|
|
17
|
+
{
|
|
18
|
+
bagelFormProps: () => ({})
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
const emits = defineEmits(['submit'])
|
|
23
|
+
|
|
24
|
+
const formRef = $ref<InstanceType<typeof BagelForm>>()
|
|
25
|
+
|
|
26
|
+
const formData = defineModel<T>(
|
|
27
|
+
'modelValue',
|
|
28
|
+
{ default: () => {}, required: true }
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
function reportValidity() {
|
|
32
|
+
if (!formRef) return false
|
|
33
|
+
return formRef.validateForm()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const computedSchema = $computed(
|
|
37
|
+
() => useBglSchema({ schema: props.schema })
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const numberOfSteps = $ref(computedSchema.length)
|
|
41
|
+
|
|
42
|
+
let currentStep = $ref(0)
|
|
43
|
+
|
|
44
|
+
const currentStepSchema = $computed(() => computedSchema[currentStep])
|
|
45
|
+
|
|
46
|
+
let isStepping = $ref(false)
|
|
47
|
+
let isSteppingTO: NodeJS.Timeout
|
|
48
|
+
watch(
|
|
49
|
+
() => currentStep,
|
|
50
|
+
() => {
|
|
51
|
+
clearTimeout(isSteppingTO)
|
|
52
|
+
isStepping = true
|
|
53
|
+
isSteppingTO = setTimeout(() => (isStepping = false), 600)
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const canDoNext = $computed(() => currentStep < numberOfSteps - 1)
|
|
58
|
+
|
|
59
|
+
function prevStep() { if (currentStep > 0) currentStep-- }
|
|
60
|
+
|
|
61
|
+
function nextStep() {
|
|
62
|
+
if (reportValidity() === false) return
|
|
63
|
+
if (canDoNext) currentStep++
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function handleSubmit() {
|
|
67
|
+
if (reportValidity() === false) return
|
|
68
|
+
emits('submit', formData.value)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
defineExpose({
|
|
72
|
+
submit: handleSubmit,
|
|
73
|
+
validateForm: formRef?.validateForm,
|
|
74
|
+
deleteItem: formRef?.deleteItem,
|
|
75
|
+
isDirty: formRef?.isDirty,
|
|
76
|
+
clearForm: formRef?.clearForm,
|
|
77
|
+
})
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<transition
|
|
82
|
+
:duration="600"
|
|
83
|
+
name="fade"
|
|
84
|
+
mode="out-in"
|
|
85
|
+
>
|
|
86
|
+
<template v-if="!isStepping">
|
|
87
|
+
<BagelForm
|
|
88
|
+
ref="formRef"
|
|
89
|
+
v-model=" formData"
|
|
90
|
+
:schema="[currentStepSchema]"
|
|
91
|
+
v-bind="bagelFormProps"
|
|
92
|
+
>
|
|
93
|
+
<template #success>
|
|
94
|
+
<slot name="success" />
|
|
95
|
+
</template>
|
|
96
|
+
<template #error>
|
|
97
|
+
<slot name="error" />
|
|
98
|
+
</template>
|
|
99
|
+
</BagelForm>
|
|
100
|
+
</template>
|
|
101
|
+
</transition>
|
|
102
|
+
|
|
103
|
+
<slot name="steppers" v-bind="{ prevStep, nextStep, submit: handleSubmit }">
|
|
104
|
+
<Btn
|
|
105
|
+
:disabled="currentStep === 0"
|
|
106
|
+
value="Back"
|
|
107
|
+
@click="prevStep"
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
<Btn
|
|
111
|
+
v-if="canDoNext"
|
|
112
|
+
value="Next"
|
|
113
|
+
@click="nextStep"
|
|
114
|
+
/>
|
|
115
|
+
<Btn
|
|
116
|
+
v-else
|
|
117
|
+
value="Submit"
|
|
118
|
+
@click="handleSubmit"
|
|
119
|
+
/>
|
|
120
|
+
</slot>
|
|
121
|
+
</template>
|
|
@@ -202,6 +202,7 @@ function drop(e: DragEvent) {
|
|
|
202
202
|
grid-template-columns: 1fr 22px;
|
|
203
203
|
align-items: center;
|
|
204
204
|
padding-inline: 14px;
|
|
205
|
+
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
.previewName p {
|
|
@@ -234,6 +235,7 @@ img.preview {
|
|
|
234
235
|
align-items: center;
|
|
235
236
|
justify-content: center;
|
|
236
237
|
color: var(--bgl-gray);
|
|
238
|
+
width: 100%;
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
.bagel-input .fileUploadWrap.fileDropZone:after {
|
|
@@ -205,7 +205,7 @@ onMounted(() => {
|
|
|
205
205
|
<Btn
|
|
206
206
|
thin
|
|
207
207
|
icon="clear"
|
|
208
|
-
class="color-
|
|
208
|
+
class="color-primary bg-gray-20"
|
|
209
209
|
@click="selectedItems = []; emitUpdate()"
|
|
210
210
|
/>
|
|
211
211
|
</div>
|
|
@@ -341,6 +341,6 @@ onMounted(() => {
|
|
|
341
341
|
border: none;
|
|
342
342
|
/* background: transparent; if anyone is changing this please talk to me first*/
|
|
343
343
|
border-radius: var(--card-border-radius);
|
|
344
|
-
color: var(--input-color);
|
|
344
|
+
/* color: var(--input-color); */
|
|
345
345
|
}
|
|
346
346
|
</style>
|
|
@@ -187,7 +187,6 @@ const phone = defineModel<string>('modelValue', {
|
|
|
187
187
|
|
|
188
188
|
function formatPhone(val: string): string {
|
|
189
189
|
const phoneNumber = parsePhoneNumberFromString(val, parseArgs)
|
|
190
|
-
console.log('Phone Number:', phoneNumber)
|
|
191
190
|
|
|
192
191
|
if (!phoneNumber) {
|
|
193
192
|
const dialCode
|
|
@@ -15,6 +15,8 @@ const props = defineProps<{
|
|
|
15
15
|
modelValue?: string
|
|
16
16
|
sideTabs?: boolean
|
|
17
17
|
group: string
|
|
18
|
+
flat?: boolean
|
|
19
|
+
vertical?: boolean
|
|
18
20
|
}>()
|
|
19
21
|
|
|
20
22
|
const emit = defineEmits(['update:modelValue'])
|
|
@@ -72,7 +74,10 @@ onBeforeUnmount(() => {
|
|
|
72
74
|
</script>
|
|
73
75
|
|
|
74
76
|
<template>
|
|
75
|
-
<div
|
|
77
|
+
<div
|
|
78
|
+
ref="tabsWrap" class="grid auto-flow-columns relative fit-content bgl_tabs_wrap"
|
|
79
|
+
:class="{ 'bgl_flat-tabs': flat, 'bgl_vertical-tabs': vertical }"
|
|
80
|
+
>
|
|
76
81
|
<button
|
|
77
82
|
v-for="(tab, i) in props.tabs"
|
|
78
83
|
:key="i"
|
|
@@ -107,6 +112,8 @@ onBeforeUnmount(() => {
|
|
|
107
112
|
padding-block: calc(var(--btn-padding) / 8);
|
|
108
113
|
border-radius: var(--input-border-radius);
|
|
109
114
|
transition: var(--bgl-transition);
|
|
115
|
+
color: inherit
|
|
116
|
+
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
.bgl_tab:hover {
|
|
@@ -125,4 +132,60 @@ onBeforeUnmount(() => {
|
|
|
125
132
|
transition: var(--bgl-transition);
|
|
126
133
|
z-index: 0;
|
|
127
134
|
}
|
|
135
|
+
.bgl_flat-tabs.bgl_tabs_wrap {
|
|
136
|
+
background: transparent;
|
|
137
|
+
}
|
|
138
|
+
.bgl_flat-tabs.bgl_tabs_wrap::before{
|
|
139
|
+
background: transparent;
|
|
140
|
+
border-bottom: 1px solid var(--bgl-primary);
|
|
141
|
+
border-radius: 0;
|
|
142
|
+
top: calc(var(--btn-padding) * 1.25);
|
|
143
|
+
bottom: unset;
|
|
144
|
+
|
|
145
|
+
}
|
|
146
|
+
.bgl_flat-tabs .active.bgl_tab{
|
|
147
|
+
color: var(--bgl-primary)
|
|
148
|
+
}
|
|
149
|
+
.bgl_flat-tabs .bgl_tab:hover {
|
|
150
|
+
background: rgba(255, 255, 255, .1);
|
|
151
|
+
}
|
|
152
|
+
.bgl_vertical-tabs{
|
|
153
|
+
grid-auto-flow: row;
|
|
154
|
+
align-items: start;
|
|
155
|
+
justify-items: start;
|
|
156
|
+
gap: 1rem
|
|
157
|
+
}
|
|
158
|
+
.bgl_vertical-tabs .bgl_tab{
|
|
159
|
+
padding-inline: 0;
|
|
160
|
+
border-radius: 0;
|
|
161
|
+
border-bottom: 1px solid transparent;
|
|
162
|
+
}
|
|
163
|
+
.bgl_vertical-tabs .bgl_tab:hover{
|
|
164
|
+
background: transparent;
|
|
165
|
+
border-bottom: 1px solid var(--bgl-primary);
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
.bgl_vertical-tabs .bgl_tab.active{
|
|
169
|
+
border-bottom: 1px solid var(--bgl-primary);
|
|
170
|
+
}
|
|
171
|
+
.bgl_vertical-tabs.bgl_tabs_wrap::before{
|
|
172
|
+
border: none;
|
|
173
|
+
}
|
|
174
|
+
@media screen and (max-width: 910px) {
|
|
175
|
+
.bgl_vertical-tabs{
|
|
176
|
+
grid-auto-flow: column;
|
|
177
|
+
overflow: auto;
|
|
178
|
+
max-width: 100vw;
|
|
179
|
+
padding-inline-end: 1rem;
|
|
180
|
+
width: 100%;
|
|
181
|
+
gap: 1rem;
|
|
182
|
+
position: relative;
|
|
183
|
+
}
|
|
184
|
+
.bgl_vertical-tabs::-webkit-scrollbar {
|
|
185
|
+
display: none;
|
|
186
|
+
}
|
|
187
|
+
.bgl_vertical-tabs .bgl_tab{
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
128
191
|
</style>
|