@zap-wunschlachen/wl-shared-components 1.0.0
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/.github/workflows/playwright.yml +215 -0
- package/.github/workflows/static.yml +62 -0
- package/.prettierrc +5 -0
- package/.storybook/main.ts +18 -0
- package/.storybook/preview.ts +37 -0
- package/.storybook/storyWrapper.vue +18 -0
- package/.storybook/withVuetifyTheme.decorator.ts +21 -0
- package/App.vue +95 -0
- package/README.md +56 -0
- package/heroicons.ts +75 -0
- package/index.html +19 -0
- package/package.json +66 -0
- package/playwright.config.ts +35 -0
- package/public/audio/dummy_pink_noise.wav +0 -0
- package/public/background.svg +60 -0
- package/public/javascript.svg +1 -0
- package/public/style.css +187 -0
- package/public/technologies.svg +22 -0
- package/src/assets/css/base.css +235 -0
- package/src/assets/css/variables.css +96 -0
- package/src/assets/fonts/Outfit-Black.ttf +0 -0
- package/src/assets/fonts/Outfit-Bold.ttf +0 -0
- package/src/assets/fonts/Outfit-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Outfit-ExtraLight.ttf +0 -0
- package/src/assets/fonts/Outfit-Light.ttf +0 -0
- package/src/assets/fonts/Outfit-Medium.ttf +0 -0
- package/src/assets/fonts/Outfit-Regular.ttf +0 -0
- package/src/assets/fonts/Outfit-SemiBold.ttf +0 -0
- package/src/assets/fonts/Outfit-Thin.ttf +0 -0
- package/src/components/Accordion/Accordion.css +59 -0
- package/src/components/Accordion/AccordionGroup.vue +51 -0
- package/src/components/Accordion/AccordionItem.vue +66 -0
- package/src/components/Appointment/Card/Actions.css +30 -0
- package/src/components/Appointment/Card/Actions.vue +66 -0
- package/src/components/Appointment/Card/Card.css +49 -0
- package/src/components/Appointment/Card/Card.vue +55 -0
- package/src/components/Appointment/Card/Details.css +51 -0
- package/src/components/Appointment/Card/Details.vue +44 -0
- package/src/components/Audio/Audio.vue +188 -0
- package/src/components/Audio/Waveform.vue +118 -0
- package/src/components/Button/Button.vue +119 -0
- package/src/components/CheckBox/CheckBox.css +185 -0
- package/src/components/CheckBox/Checkbox.vue +130 -0
- package/src/components/DateInput/DateInput.css +3 -0
- package/src/components/DateInput/DateInput.vue +263 -0
- package/src/components/Dialog/Dialog.css +6 -0
- package/src/components/Dialog/Dialog.vue +29 -0
- package/src/components/EditField/EditField.css +20 -0
- package/src/components/EditField/EditField.vue +202 -0
- package/src/components/IconBullet/IconBullet.vue +86 -0
- package/src/components/IconBullet/IconBulletList.vue +41 -0
- package/src/components/Icons/Audio/CloudFailed.vue +21 -0
- package/src/components/Icons/Audio/CloudSaved.vue +22 -0
- package/src/components/Icons/Audio/Delete.vue +16 -0
- package/src/components/Icons/Audio/Pause.vue +19 -0
- package/src/components/Icons/Audio/Play.vue +16 -0
- package/src/components/Icons/CalendarNotification.vue +126 -0
- package/src/components/Icons/Chair.vue +32 -0
- package/src/components/Icons/ChairNotification.vue +35 -0
- package/src/components/Icons/Circle.vue +66 -0
- package/src/components/Icons/FavIcon.vue +22 -0
- package/src/components/Icons/FilledCircle.vue +11 -0
- package/src/components/Icons/Group3.vue +46 -0
- package/src/components/Icons/RingNotification.vue +54 -0
- package/src/components/Icons/SolidArrowRight.vue +14 -0
- package/src/components/Icons/calendar.vue +17 -0
- package/src/components/Icons/checkbox.vue +19 -0
- package/src/components/Icons/outlineChecked.vue +27 -0
- package/src/components/Icons/play.vue +6 -0
- package/src/components/Input/Input.css +187 -0
- package/src/components/Input/Input.vue +247 -0
- package/src/components/Laboratory/AppointmentCard/AppointmentCard.css +7 -0
- package/src/components/Laboratory/AppointmentCard/AppointmentCard.vue +116 -0
- package/src/components/Laboratory/ChatBoxImage/ChatBoxImage.vue +81 -0
- package/src/components/Laboratory/ChatMessage/ChatMessage.vue +113 -0
- package/src/components/Laboratory/ChatMessage/ChatMessageBadge.css +4 -0
- package/src/components/Laboratory/ChatMessage/ChatMessageBadge.vue +99 -0
- package/src/components/Laboratory/ChatNotification/ChatNotification.vue +130 -0
- package/src/components/Laboratory/DocumentCard/DocumentCard.css +3 -0
- package/src/components/Laboratory/DocumentCard/DocumentCard.vue +50 -0
- package/src/components/Laboratory/DocumentCard/DocumentCardItem.vue +53 -0
- package/src/components/Laboratory/InfoCard/InfoCard.vue +162 -0
- package/src/components/Laboratory/MainColumnsBar/MainColumnsBar.vue +102 -0
- package/src/components/Laboratory/ProgressCircle/ProgressCircle.vue +152 -0
- package/src/components/Laboratory/ProgressLinear/ProgressLinear.css +33 -0
- package/src/components/Laboratory/ProgressLinear/ProgressLinear.vue +75 -0
- package/src/components/Laboratory/SelectionColumnBar/SelectionColumnBar.vue +92 -0
- package/src/components/Laboratory/StatusNotification/StatusNotification.vue +49 -0
- package/src/components/Laboratory/TagLabel/TagLabel.vue +126 -0
- package/src/components/Laboratory/TagLabelGroup/TagLabelGroup.vue +97 -0
- package/src/components/Laboratory/TicketCard/TicketCard.css +3 -0
- package/src/components/Laboratory/TicketCard/TicketCard.vue +143 -0
- package/src/components/Laboratory/TimeLine/TimeLineEvent.css +18 -0
- package/src/components/Laboratory/TimeLine/TimeLineEvent.vue +119 -0
- package/src/components/Laboratory/TimeLine/Timeline.css +4 -0
- package/src/components/Laboratory/TimeLine/Timeline.vue +30 -0
- package/src/components/Modal/Modal.css +6 -0
- package/src/components/Modal/Modal.vue +23 -0
- package/src/components/NotificationBubble/NotificationBubble.css +4 -0
- package/src/components/NotificationBubble/NotificationBubble.vue +90 -0
- package/src/components/OtpInput/OtpInput.css +39 -0
- package/src/components/OtpInput/OtpInput.vue +144 -0
- package/src/components/PhoneInput/PhoneInput.css +32 -0
- package/src/components/PhoneInput/PhoneInput.vue +114 -0
- package/src/components/Select/Select.css +150 -0
- package/src/components/Select/Select.vue +304 -0
- package/src/components/TextArea/TextArea.css +3 -0
- package/src/components/TextArea/TextArea.vue +126 -0
- package/src/components/TickBox/TickBox.css +49 -0
- package/src/components/TickBox/TickBox.vue +126 -0
- package/src/components/index.ts +20 -0
- package/src/constants/buttonEnums.ts +0 -0
- package/src/constants/iconEnums.ts +4 -0
- package/src/i18n/i18n.ts +16 -0
- package/src/i18n/locales/de.json +19 -0
- package/src/i18n/locales/en.json +19 -0
- package/src/index.ts +31 -0
- package/src/main.ts +11 -0
- package/src/plugins/vuetify.ts +131 -0
- package/src/shims-vue.d.ts +10 -0
- package/src/stories/Accordion.stories.ts +650 -0
- package/src/stories/Audio.stories.ts +29 -0
- package/src/stories/Button.stories.ts +263 -0
- package/src/stories/CheckBox.stories.ts +348 -0
- package/src/stories/DateInput.stories.ts +54 -0
- package/src/stories/Dialog.stories.ts +147 -0
- package/src/stories/EditField.stories.ts +79 -0
- package/src/stories/IconBullet/IconBullet.stories.ts +201 -0
- package/src/stories/IconBullet/IconBulletList.stories.ts +275 -0
- package/src/stories/Input.stories.ts +351 -0
- package/src/stories/Laboratory/Cards/AppointmentCard/AppointmentCard.stories.ts +260 -0
- package/src/stories/Laboratory/Cards/DocumentCard/DocumentCard.stories.ts +176 -0
- package/src/stories/Laboratory/Cards/DocumentCard/DocumentCardItem.stories.ts +119 -0
- package/src/stories/Laboratory/Cards/InfoCard/InfoCard.stories.ts +320 -0
- package/src/stories/Laboratory/Cards/TicketCard/TicketCard.stories.ts +335 -0
- package/src/stories/Laboratory/Chat/ChatBoxImage.stories.ts +82 -0
- package/src/stories/Laboratory/Chat/ChatMessage.stories.ts +198 -0
- package/src/stories/Laboratory/Chat/ChatMessageBadge.stories.ts +204 -0
- package/src/stories/Laboratory/Chat/ChatNotification.stories.ts +144 -0
- package/src/stories/Laboratory/Chat/ProgressLinear.stories.ts +186 -0
- package/src/stories/Laboratory/Chat/StatusNotification.stories.ts +111 -0
- package/src/stories/Laboratory/MainColumnsBar.stories.ts +48 -0
- package/src/stories/Laboratory/ProgressCircle.stories.ts +261 -0
- package/src/stories/Laboratory/SelectionColumnBar.stories.ts +234 -0
- package/src/stories/Laboratory/TagLabel.stories.ts +418 -0
- package/src/stories/Laboratory/TagLabelGroup.stories.ts +234 -0
- package/src/stories/Laboratory/Timeline.stories.ts +403 -0
- package/src/stories/NotificationBubble.stories.ts +194 -0
- package/src/stories/OtpInput.stories.ts +101 -0
- package/src/stories/PhoneInput.stories.ts +53 -0
- package/src/stories/Select.stories.ts +419 -0
- package/src/stories/TextArea.stories.ts +112 -0
- package/src/stories/TickBox.stories.ts +294 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/v-icon.stories.ts +91 -0
- package/src/types/index.ts +21 -0
- package/src/vite-env.d.ts +1 -0
- package/tests/e2e/README.md +221 -0
- package/tests/e2e/accessibility.spec.ts +639 -0
- package/tests/e2e/accordion.spec.ts +42 -0
- package/tests/e2e/additional-components.spec.ts +438 -0
- package/tests/e2e/all-components.spec.ts +135 -0
- package/tests/e2e/button-fixed.spec.ts +59 -0
- package/tests/e2e/button.spec.ts +76 -0
- package/tests/e2e/checkbox.spec.ts +50 -0
- package/tests/e2e/date-input.spec.ts +46 -0
- package/tests/e2e/debug.spec.ts +52 -0
- package/tests/e2e/dialog.spec.ts +58 -0
- package/tests/e2e/input.spec.ts +55 -0
- package/tests/e2e/laboratory-components.spec.ts +321 -0
- package/tests/e2e/otp-input.spec.ts +50 -0
- package/tests/e2e/select.spec.ts +52 -0
- package/tests/e2e/storybook-utils.ts +59 -0
- package/tests/e2e/test-basic.spec.ts +34 -0
- package/tests/e2e/visual-regression.spec.ts +351 -0
- package/tests/unit/components/Accordion/AccordionGroup.spec.ts +343 -0
- package/tests/unit/components/Accordion/AccordionItem.spec.ts +384 -0
- package/tests/unit/components/Audio/Audio.spec.ts +404 -0
- package/tests/unit/components/Audio/Waveform.spec.ts +484 -0
- package/tests/unit/components/Core/Button.spec.ts +337 -0
- package/tests/unit/components/Core/Checkbox.spec.ts +545 -0
- package/tests/unit/components/Core/DateInput.spec.ts +691 -0
- package/tests/unit/components/Core/Dialog.spec.ts +486 -0
- package/tests/unit/components/Core/EditField.spec.ts +783 -0
- package/tests/unit/components/Core/Input.spec.ts +513 -0
- package/tests/unit/components/Core/Modal.spec.ts +519 -0
- package/tests/unit/components/Core/NotificationBubble.spec.ts +607 -0
- package/tests/unit/components/Core/OtpInput.spec.ts +709 -0
- package/tests/unit/components/Core/PhoneInput.spec.ts +620 -0
- package/tests/unit/components/Core/Select.spec.ts +713 -0
- package/tests/unit/components/Core/TextArea.spec.ts +566 -0
- package/tests/unit/components/Core/TickBox.spec.ts +780 -0
- package/tests/unit/components/IconBullet/IconBullet.spec.ts +357 -0
- package/tests/unit/components/IconBullet/IconBulletList.spec.ts +372 -0
- package/tests/unit/components/Icons/Audio/CloudFailed.spec.ts +109 -0
- package/tests/unit/components/Icons/Audio/CloudSaved.spec.ts +150 -0
- package/tests/unit/components/Icons/Audio/Delete.spec.ts +159 -0
- package/tests/unit/components/Icons/Audio/Pause.spec.ts +209 -0
- package/tests/unit/components/Icons/Audio/Play.spec.ts +218 -0
- package/tests/unit/components/Icons/CalendarNotification.spec.ts +187 -0
- package/tests/unit/components/Icons/Chair.spec.ts +235 -0
- package/tests/unit/components/Icons/ChairNotification.spec.ts +312 -0
- package/tests/unit/components/Icons/Circle.spec.ts +256 -0
- package/tests/unit/components/Icons/FavIcon.spec.ts +252 -0
- package/tests/unit/components/Icons/FilledCircle.spec.ts +275 -0
- package/tests/unit/components/Icons/Group3.spec.ts +356 -0
- package/tests/unit/components/Icons/RingNotification.spec.ts +394 -0
- package/tests/unit/components/Icons/calendar.spec.ts +287 -0
- package/tests/unit/components/Icons/checkbox.spec.ts +316 -0
- package/tests/unit/components/Icons/outlineChecked.spec.ts +435 -0
- package/tests/unit/components/Icons/play.spec.ts +309 -0
- package/tests/unit/components/Laboratory/AppointmentCard.spec.ts +168 -0
- package/tests/unit/components/Laboratory/ChatBoxImage.spec.ts +180 -0
- package/tests/unit/components/Laboratory/ChatMessage.spec.ts +264 -0
- package/tests/unit/components/Laboratory/ChatMessageBadge.spec.ts +283 -0
- package/tests/unit/components/Laboratory/ChatNotification.spec.ts +257 -0
- package/tests/unit/components/Laboratory/DocumentCard.spec.ts +229 -0
- package/tests/unit/components/Laboratory/DocumentCardItem.spec.ts +237 -0
- package/tests/unit/components/Laboratory/InfoCard.spec.ts +309 -0
- package/tests/unit/components/Laboratory/MainColumnsBar.spec.ts +252 -0
- package/tests/unit/components/Laboratory/ProgressCircle.spec.ts +291 -0
- package/tests/unit/components/Laboratory/ProgressLinear.spec.ts +276 -0
- package/tests/unit/components/Laboratory/SelectionColumnBar.spec.ts +289 -0
- package/tests/unit/components/Laboratory/StatusNotification.spec.ts +297 -0
- package/tests/unit/components/Laboratory/TagLabel.spec.ts +354 -0
- package/tests/unit/components/Laboratory/TagLabelGroup.spec.ts +378 -0
- package/tests/unit/components/Laboratory/TicketCard.spec.ts +352 -0
- package/tests/unit/components/Laboratory/TimeLineEvent.spec.ts +382 -0
- package/tests/unit/components/Laboratory/Timeline.spec.ts +420 -0
- package/tests/unit/constants/iconEnums.spec.ts +40 -0
- package/tests/unit/i18n/i18n.spec.ts +89 -0
- package/tests/unit/plugins/vuetify.spec.ts +221 -0
- package/tests/unit/setup.ts +190 -0
- package/tests/unit/src/components/index.spec.ts +193 -0
- package/tests/unit/src/index.spec.ts +183 -0
- package/tests/unit/src/main.spec.ts +152 -0
- package/tsconfig.json +26 -0
- package/vite.config.ts +29 -0
- package/vitest.config.ts +84 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<form class="wl-otp-input" @submit.prevent="props.submitFn" aria-labelledby="page-heading"
|
|
3
|
+
:aria-describedby="error ? 'form-error' : undefined" data-testid="root">
|
|
4
|
+
<div class="title-container">
|
|
5
|
+
<h2 id="page-heading" ref="heading">{{ t('wl.otp_input.enter_sms_code') }}</h2>
|
|
6
|
+
<p>{{ t('wl.otp_input.code_was_sent', { phoneNumber }) }}</p>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div class="input-container">
|
|
10
|
+
<v-otp-input
|
|
11
|
+
v-model="internalValue"
|
|
12
|
+
autofocus
|
|
13
|
+
rounded="lg"
|
|
14
|
+
:loading="loading"
|
|
15
|
+
:error="error"
|
|
16
|
+
:focus-all="error"
|
|
17
|
+
:focused="error"
|
|
18
|
+
@update:model-value="onResetError"
|
|
19
|
+
type="number"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<div class="message-container">
|
|
24
|
+
<p :id="error ? 'form-error' : 'form-success'" :style="statusMessageStyle"
|
|
25
|
+
:role="error ? 'alert' : 'status'"
|
|
26
|
+
:aria-live="error ? 'assertive' : 'polite'" aria-atomic="true">
|
|
27
|
+
{{ message }}
|
|
28
|
+
</p>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="button-container">
|
|
32
|
+
<slot name="buttons">
|
|
33
|
+
<Button :label="t('wl.otp_input.confirm')" :disabled="disableSubmitBtn" width="226" @click="onSubmit" type="submit" />
|
|
34
|
+
<Button :label="t('wl.otp_input.resend')" variant='outlined' :disabled="disableResendBtn" width="226" @click="onResend" />
|
|
35
|
+
</slot>
|
|
36
|
+
</div>
|
|
37
|
+
</form>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import { ref, computed, watch, type CSSProperties, PropType } from 'vue';
|
|
42
|
+
import './OtpInput.css';
|
|
43
|
+
import Button from '../Button/Button.vue';
|
|
44
|
+
import { useI18n } from 'vue-i18n';
|
|
45
|
+
|
|
46
|
+
const { t } = useI18n();
|
|
47
|
+
|
|
48
|
+
const props = defineProps({
|
|
49
|
+
phoneNumber: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: true
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
message: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
otpState: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: 'default'
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
submitFn: {
|
|
65
|
+
type: Function,
|
|
66
|
+
required: true
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
resendFn: {
|
|
70
|
+
type: Function,
|
|
71
|
+
required: true
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
loading: {
|
|
75
|
+
type: Boolean,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
colors: {
|
|
80
|
+
type: Object as PropType<{
|
|
81
|
+
error?: string;
|
|
82
|
+
success?: string;
|
|
83
|
+
}>,
|
|
84
|
+
default: () => ({
|
|
85
|
+
error: 'var(--Error-Red-0)',
|
|
86
|
+
success: 'var(--Success-Green-0)'
|
|
87
|
+
})
|
|
88
|
+
},
|
|
89
|
+
disableSubmitBtn: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
disableResendBtn: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
enum ValidationState {
|
|
100
|
+
DEFAULT = "default",
|
|
101
|
+
ERROR = "error",
|
|
102
|
+
SUCCESS = "success",
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const emit = defineEmits([
|
|
106
|
+
'update:modelValue'
|
|
107
|
+
]);
|
|
108
|
+
|
|
109
|
+
const state = computed(() => localOtpState.value as ValidationState);
|
|
110
|
+
const error = computed(() => state.value === ValidationState.ERROR);
|
|
111
|
+
const loading = computed(() => props.loading);
|
|
112
|
+
const internalValue = ref('')
|
|
113
|
+
const localOtpState = ref(props.otpState)
|
|
114
|
+
|
|
115
|
+
const statusMessageStyle = computed<CSSProperties>(() => ({
|
|
116
|
+
visibility: state.value === ValidationState.DEFAULT ? 'hidden' : 'visible',
|
|
117
|
+
color: state.value === ValidationState.ERROR
|
|
118
|
+
? `${props.colors.error} !important`
|
|
119
|
+
: `${props.colors.success} !important`,
|
|
120
|
+
minHeight: '1.5em'
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
watch(() => props.otpState, (newVal) => {
|
|
124
|
+
localOtpState.value = newVal;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
watch(internalValue, () => {
|
|
128
|
+
emit('update:modelValue', internalValue.value)
|
|
129
|
+
}, { immediate: true })
|
|
130
|
+
|
|
131
|
+
function onSubmit() {
|
|
132
|
+
props.submitFn();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function onResend() {
|
|
136
|
+
internalValue.value = '';
|
|
137
|
+
props.resendFn();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function onResetError(){
|
|
141
|
+
localOtpState.value = ValidationState.DEFAULT;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.wl-phone-input {
|
|
2
|
+
width: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.wl-phone-input.border-on-hover .v-phone-input__country__input .v-field__outline__end {
|
|
6
|
+
border-top-right-radius: 0 !important;
|
|
7
|
+
border-bottom-right-radius: 0 !important;
|
|
8
|
+
border-top-left-radius: 8px !important;
|
|
9
|
+
border-bottom-left-radius: 8px !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.wl-phone-input.border-on-hover .v-phone-input__phone__input .v-field__outline__start {
|
|
13
|
+
border-top-right-radius: 8px !important;
|
|
14
|
+
border-bottom-right-radius: 8px !important;
|
|
15
|
+
border-top-left-radius: 0 !important;
|
|
16
|
+
border-bottom-left-radius: 0 !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.wl-phone-input.border-on-hover :deep(.v-field__outline) {
|
|
20
|
+
opacity: 0;
|
|
21
|
+
--v-field-border-opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.wl-phone-input.border-on-hover:hover :deep(.v-field__outline) {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
--v-field-border-opacity: 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.wl-phone-input.border-on-hover.v-field--focused :deep(.v-field__outline) {
|
|
30
|
+
opacity: 1;
|
|
31
|
+
--v-field-border-opacity: 1;
|
|
32
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<VPhoneInput
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
ref="inputRef"
|
|
5
|
+
id="phone"
|
|
6
|
+
class="wl-phone-input"
|
|
7
|
+
:class="{
|
|
8
|
+
'border-on-hover': borderOnHover
|
|
9
|
+
}"
|
|
10
|
+
:include-countries="countriesCodes"
|
|
11
|
+
:aria-label="placeholder"
|
|
12
|
+
:variant="variant"
|
|
13
|
+
label=""
|
|
14
|
+
:appendInnerIcon="appendInnerIcon"
|
|
15
|
+
:placeHolder="placeholder"
|
|
16
|
+
display-format="international"
|
|
17
|
+
:default-country="defaultCountryCode"
|
|
18
|
+
hide-details
|
|
19
|
+
:aria-invalid="state === ValidationState.ERROR"
|
|
20
|
+
:countryIconMode="'svg'"
|
|
21
|
+
@update:model-value="(value) => emit('update:phone', value)"
|
|
22
|
+
data-testid="root"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { defineProps, PropType, ref, nextTick } from 'vue';
|
|
28
|
+
import { VPhoneInput } from 'v-phone-input';
|
|
29
|
+
import './PhoneInput.css'
|
|
30
|
+
|
|
31
|
+
import "flag-icons/css/flag-icons.min.css";
|
|
32
|
+
import "v-phone-input/dist/v-phone-input.css";
|
|
33
|
+
|
|
34
|
+
enum ValidationState {
|
|
35
|
+
DEFAULT = "default",
|
|
36
|
+
ERROR = "error",
|
|
37
|
+
SUCCESS = "success",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const props = defineProps({
|
|
41
|
+
state: {
|
|
42
|
+
type: String as PropType<ValidationState>,
|
|
43
|
+
default: ValidationState.DEFAULT
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
placeholder: {
|
|
47
|
+
type: String,
|
|
48
|
+
default: ''
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
countriesCodes: {
|
|
52
|
+
type: Array as PropType<string[]>,
|
|
53
|
+
default: []
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
defaultCountryCode: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'DE'
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
appendInnerIcon: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: 'heroicons:phone'
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
variant: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'outlined'
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
borderOnHover: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: false
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const emit = defineEmits<{
|
|
78
|
+
(e: 'update:phone', value: string): void
|
|
79
|
+
}>();
|
|
80
|
+
|
|
81
|
+
const inputRef = ref(null)
|
|
82
|
+
|
|
83
|
+
const getNativeInput = () => {
|
|
84
|
+
return inputRef.value?.phoneInputRef?.$el?.querySelector('input');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const blur = () => {
|
|
88
|
+
nextTick(() => {
|
|
89
|
+
getNativeInput()?.blur();
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const select = () => {
|
|
94
|
+
nextTick(() => {
|
|
95
|
+
getNativeInput()?.select();
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const focus = () => {
|
|
100
|
+
nextTick(() => {
|
|
101
|
+
getNativeInput()?.focus();
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
defineExpose({
|
|
106
|
+
blur,
|
|
107
|
+
select,
|
|
108
|
+
focus
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<style scoped>
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
.wl-select .v-field__outline {
|
|
2
|
+
opacity: 1 !important; /* Set the opacity to 1 */
|
|
3
|
+
--v-field-border-opacity: 1 !important; /* Ensure full opacity for the border */
|
|
4
|
+
color: var(--Soft-Concrete-2) !important; /* border color */
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Active state border color */
|
|
8
|
+
.wl-select .v-field--active .v-field__outline {
|
|
9
|
+
color: var(--Soft-Concrete-2) !important; /* Active border color */
|
|
10
|
+
opacity: 1 !important;
|
|
11
|
+
--v-field-border-opacity: 1 !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.wl-select .v-label.v-field-label {
|
|
15
|
+
color: var(--Dental-Blue--3) !important;
|
|
16
|
+
opacity: 1 !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Default input text color */
|
|
20
|
+
.wl-select .v-field__input {
|
|
21
|
+
color: var(--Dental-Blue-0);
|
|
22
|
+
opacity: 1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.wl-select .v-field--focused .v-field__input {
|
|
26
|
+
color: var(--Dental-Blue-0);
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.v-combobox__content .v-list-item:hover,
|
|
31
|
+
.v-combobox__content .v-list-item.v-list-item--active {
|
|
32
|
+
color: var(--Dental-Blue-0);
|
|
33
|
+
border-left: 4px solid var(--Dental-Blue-0); /* Blue border */
|
|
34
|
+
padding-left: 12px; /* Adjust padding to make space for the border */
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.v-combobox__content .v-list-item__overlay {
|
|
38
|
+
background: var(--Dental-Light-Blue--1) !important;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.v-combobox__content .v-list-item__content {
|
|
42
|
+
color: var(--Dental-Blue-0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Focused state border color */
|
|
46
|
+
.v-field[aria-expanded='true'] .v-field__outline {
|
|
47
|
+
color: var(--Soft-Concrete-2) !important;
|
|
48
|
+
opacity: 1 !important;
|
|
49
|
+
|
|
50
|
+
border-bottom-left-radius: 0;
|
|
51
|
+
border-bottom-right-radius: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.v-combobox__content {
|
|
55
|
+
border: 2px solid var(--Soft-Concrete-2);
|
|
56
|
+
border-bottom-left-radius: 8px !important;
|
|
57
|
+
border-bottom-right-radius: 8px !important;
|
|
58
|
+
border-top-left-radius: 0 !important;
|
|
59
|
+
border-top-right-radius: 0 !important;
|
|
60
|
+
box-shadow: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.v-combobox__selection .v-chip {
|
|
64
|
+
background: var(--Dental-Light-Blue-0);
|
|
65
|
+
color: var(--Dental-Blue-1);
|
|
66
|
+
border-radius: 8px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.wl-select .v-icon {
|
|
70
|
+
color: var(--Dental-Blue-0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Disabled state styles */
|
|
74
|
+
.wl-select .v-field--disabled,
|
|
75
|
+
.wl-select .v-field--disabled .v-label.v-field-label,
|
|
76
|
+
.wl-select .v-field--disabled .v-field__input,
|
|
77
|
+
.wl-select .v-field--disabled .v-icon {
|
|
78
|
+
color: #bdbdbd !important; /* Grey text and icon */
|
|
79
|
+
background-color: #f5f5f5 !important; /* Light grey background */
|
|
80
|
+
opacity: 1 !important; /* Ensure full opacity */
|
|
81
|
+
cursor: not-allowed !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.wl-select .v-field--disabled .v-field__outline {
|
|
85
|
+
border-color: #e0e0e0 !important; /* Lighter grey border */
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.wl-select .v-field--disabled .v-combobox__selection .v-chip {
|
|
89
|
+
background: #e0e0e0 !important;
|
|
90
|
+
color: #bdbdbd !important;
|
|
91
|
+
border: 1px solid #bdbdbd !important;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Optionally, dim the dropdown if open while disabled */
|
|
95
|
+
.wl-select .v-field--disabled .v-combobox__content {
|
|
96
|
+
background: #f5f5f5 !important;
|
|
97
|
+
color: #bdbdbd !important;
|
|
98
|
+
pointer-events: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Error state styles */
|
|
102
|
+
.wl-select .v-field--error,
|
|
103
|
+
.wl-select .v-field--error .v-label.v-field-label,
|
|
104
|
+
.wl-select .v-field--error .v-field__input,
|
|
105
|
+
.wl-select .v-field--error .v-icon {
|
|
106
|
+
background-color: #fdeaea !important; /* Light red background */
|
|
107
|
+
color: #b71c1c !important; /* Dark red text and icon */
|
|
108
|
+
border-color: #b71c1c !important; /* Dark red border */
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.wl-select .v-field--error .v-field__outline {
|
|
112
|
+
--v-field-border-opacity: 1 !important;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.wl-select .v-field--error .v-combobox__selection .v-chip {
|
|
116
|
+
background: #fdeaea !important; /* Light red background */
|
|
117
|
+
color: #b71c1c !important; /* Dark red text */
|
|
118
|
+
border: 1px solid #b71c1c !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.wl-select .v-field--error .v-combobox__content {
|
|
122
|
+
background: #fdeaea !important;
|
|
123
|
+
color: #b71c1c !important;
|
|
124
|
+
border-color: #b71c1c !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.wl-select .v-field--error .v-field__input {
|
|
128
|
+
color: #b71c1c !important;
|
|
129
|
+
background: #fdeaea !important;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.wl-select .v-field--disabled .v-field__input {
|
|
133
|
+
color: #bdbdbd !important;
|
|
134
|
+
background: #f5f5f5 !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.wl-select.border-on-hover .v-field__outline {
|
|
138
|
+
opacity: 0 !important;
|
|
139
|
+
--v-field-border-opacity: 0 !important;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.wl-select.border-on-hover:hover .v-field__outline {
|
|
143
|
+
opacity: 1 !important;
|
|
144
|
+
--v-field-border-opacity: 1 !important;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.wl-select.border-on-hover .v-field--focused .v-field__outline {
|
|
148
|
+
opacity: 1 !important;
|
|
149
|
+
--v-field-border-opacity: 1 !important;
|
|
150
|
+
}
|