edvoyui-component-library-test-flight 0.0.21 → 0.0.23
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/EUIButton.vue.d.ts.map +1 -0
- package/dist/library-vue-ts.cjs.js +4 -3
- package/dist/library-vue-ts.es.js +3 -8
- package/dist/library-vue-ts.umd.js +4 -3
- package/dist/select/EUISelect.vue.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/App.vue +16 -0
- package/src/assets/fonts/gilroy/GilroyBold/font.woff +0 -0
- package/src/assets/fonts/gilroy/GilroyBold/font.woff2 +0 -0
- package/src/assets/fonts/gilroy/GilroyBoldItalic/font.woff +0 -0
- package/src/assets/fonts/gilroy/GilroyBoldItalic/font.woff2 +0 -0
- package/src/assets/fonts/gilroy/GilroyExtraBold/font.woff +0 -0
- package/src/assets/fonts/gilroy/GilroyExtraBold/font.woff2 +0 -0
- package/src/assets/fonts/gilroy/GilroyExtraBoldItalic/font.woff +0 -0
- package/src/assets/fonts/gilroy/GilroyExtraBoldItalic/font.woff2 +0 -0
- package/src/assets/fonts/gilroy/GilroyMedium/font.woff +0 -0
- package/src/assets/fonts/gilroy/GilroyMedium/font.woff2 +0 -0
- package/src/assets/fonts/gilroy/GilroyRegular/font.woff +0 -0
- package/src/assets/fonts/gilroy/GilroyRegular/font.woff2 +0 -0
- package/src/assets/fonts/gilroy/GilroySemiBold/font.woff +0 -0
- package/src/assets/fonts/gilroy/GilroySemiBold/font.woff2 +0 -0
- package/src/assets/fonts/inter/Inter-Bold.woff +0 -0
- package/src/assets/fonts/inter/Inter-Bold.woff2 +0 -0
- package/src/assets/fonts/inter/Inter-Italic.woff +0 -0
- package/src/assets/fonts/inter/Inter-Italic.woff2 +0 -0
- package/src/assets/fonts/inter/Inter-Medium.woff +0 -0
- package/src/assets/fonts/inter/Inter-Medium.woff2 +0 -0
- package/src/assets/fonts/inter/Inter-MediumItalic.woff +0 -0
- package/src/assets/fonts/inter/Inter-MediumItalic.woff2 +0 -0
- package/src/assets/fonts/inter/Inter-Regular.woff +0 -0
- package/src/assets/fonts/inter/Inter-Regular.woff2 +0 -0
- package/src/assets/fonts/inter/Inter-SemiBold.woff +0 -0
- package/src/assets/fonts/inter/Inter-SemiBold.woff2 +0 -0
- package/src/assets/fonts/inter/Inter-SemiBoldItalic.woff +0 -0
- package/src/assets/fonts/inter/Inter-SemiBoldItalic.woff2 +0 -0
- package/src/assets/scss/body.scss +15 -0
- package/src/assets/svg/ChevronDownSolid.vue +19 -0
- package/src/assets/svg/ChevronDownStroke.vue +22 -0
- package/src/assets/svg/SortArrow.vue +24 -0
- package/src/assets/svg/Student.vue +30 -0
- package/src/assets/svg/partner.vue +33 -0
- package/src/assets/svg/people.vue +25 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/HelloWorld.vue +999 -0
- package/src/components/accordion/EUIAccordion.stories.ts +157 -0
- package/src/components/accordion/EUIAccordion.vue +90 -0
- package/src/components/avatar/EUIAvatar.stories.ts +157 -0
- package/src/components/avatar/EUIAvatar.vue +96 -0
- package/src/components/button/EUIButton.stories.ts +252 -0
- package/src/components/button/EUIButton.vue +151 -0
- package/src/components/checkbox/EUICheckbox.stories.ts +58 -0
- package/src/components/checkbox/EUICheckbox.vue +103 -0
- package/src/components/datepicker/EUIDatepicker.stories.ts +236 -0
- package/src/components/datepicker/EUIDatepicker.vue +185 -0
- package/src/components/delete.vue +108 -0
- package/src/components/dropdown/EUIMultiDropdown.stories.ts +187 -0
- package/src/components/dropdown/EUIMultiDropdown.vue +129 -0
- package/src/components/errorMessage/EUIErrorMessage.scss +0 -0
- package/src/components/errorMessage/EUIErrorMessage.stories.ts +41 -0
- package/src/components/errorMessage/EUIErrorMessage.vue +25 -0
- package/src/components/index.ts +46 -0
- package/src/components/input/EUIInput.stories.ts +174 -0
- package/src/components/input/EUIInput.vue +169 -0
- package/src/components/inputNormal/EUIInputNormal.stories.ts +164 -0
- package/src/components/inputNormal/EUIInputNormal.vue +161 -0
- package/src/components/loader/EUICircleLoader.vue +31 -0
- package/src/components/loader/EUICubeLoader.vue +237 -0
- package/src/components/loader/EUILoader.stories.ts +99 -0
- package/src/components/loader/EUILoader.vue +17 -0
- package/src/components/loader/EUISquareLoader.vue +47 -0
- package/src/components/modal/EUIModal.stories.ts +372 -0
- package/src/components/modal/EUIModal.vue +163 -0
- package/src/components/pillSelect/EUIPillSelect.stories.ts +74 -0
- package/src/components/pillSelect/EUIPillSelect.vue +149 -0
- package/src/components/popover/EUIPopover.stories.ts +247 -0
- package/src/components/popover/EUIPopover.vue +159 -0
- package/src/components/radio/EUIRadio.stories.ts +54 -0
- package/src/components/radio/EUIRadio.vue +78 -0
- package/src/components/searchInput/EUISearch.stories.ts +24 -0
- package/src/components/searchInput/EUISearch.vue +215 -0
- package/src/components/select/EUISelect.scss +0 -0
- package/src/components/select/EUISelect.stories.ts +49 -0
- package/src/components/select/EUISelect.vue +682 -0
- package/src/components/selectSearch/EUISelectSearch.vue +23 -0
- package/src/components/slideover/EUISlideover.stories.ts +318 -0
- package/src/components/slideover/EUISlideover.vue +207 -0
- package/src/components/stepperTimeline/EUIStepperHorizontal.vue +112 -0
- package/src/components/stepperTimeline/EUIStepperTimeline.stories.ts +54 -0
- package/src/components/stepperTimeline/EUIStepperTimeline.vue +16 -0
- package/src/components/stepperTimeline/EUIStepperVertical.vue +112 -0
- package/src/components/table/EUIDashboardTable.vue +482 -0
- package/src/components/table/EUIPageLimit.vue +66 -0
- package/src/components/table/EUIPagination.vue +175 -0
- package/src/components/table/EUIStudentPagination.vue +172 -0
- package/src/components/table/EUITable.stories.ts +190 -0
- package/src/components/table/EUITable.vue +508 -0
- package/src/components/table/EUITableCheckbox.vue +97 -0
- package/src/components/tabs/EUITabs.vue +128 -0
- package/src/components/tabs/EUItabs.stories.ts +123 -0
- package/src/components/tag/EUITag.stories.ts +46 -0
- package/src/components/tag/EUITag.vue +46 -0
- package/src/components/telephone/EUITelephone.stories.ts +202 -0
- package/src/components/telephone/EUITelephone.vue +280 -0
- package/src/components/textArea/EUITextArea.stories.ts +82 -0
- package/src/components/textArea/EUITextArea.vue +122 -0
- package/src/components/timeLine/EUITimeLine.stories.ts +247 -0
- package/src/components/timeLine/EUITimeLine.vue +43 -0
- package/src/components/timeLine/EUITimeLineItem.vue +124 -0
- package/src/components/toggle/EUIToggle.stories.ts +63 -0
- package/src/components/toggle/EUIToggle.vue +99 -0
- package/src/components/tooltip/EUITooltip.stories.ts +53 -0
- package/src/components/tooltip/EUITooltip.vue +108 -0
- package/src/data/books.ts +163 -0
- package/src/data/tab.ts +33 -0
- package/src/data/table.ts +5392 -0
- package/src/main.ts +5 -0
- package/src/utils/lodash.ts +9 -0
- package/src/utils/types.ts +9 -0
- package/src/vite-env.d.ts +5 -0
- package/dist/EUISelect.vue.d.ts.map +0 -1
- package/dist/button/EUIButton.vue.d.ts.map +0 -1
- package/dist/library-vue-ts.css +0 -1
- package/dist/style.scss +0 -118
- /package/dist/{button/EUIButton.vue.d.ts → EUIButton.vue.d.ts} +0 -0
- /package/dist/{EUISelect.vue.d.ts → select/EUISelect.vue.d.ts} +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div
|
|
4
|
+
v-if="tabStyle === 'design'"
|
|
5
|
+
class="flex flex-row items-center justify-between w-full p-2 bg-gray-100 rounded-xl"
|
|
6
|
+
>
|
|
7
|
+
<button
|
|
8
|
+
v-for="(tab, tabindex) in tabs"
|
|
9
|
+
:key="tabindex"
|
|
10
|
+
type="button"
|
|
11
|
+
class="[&:not(:focus-visible)]:focus:outline-none relative w-full inline-flex items-center"
|
|
12
|
+
role="tab"
|
|
13
|
+
tabindex="-1"
|
|
14
|
+
@click="selectTab(tabindex)"
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
17
|
+
class="pointer-events-none absolute inset-0 rounded-full transition-transform duration-300 transform z-[1] ease-in-out"
|
|
18
|
+
:class="{
|
|
19
|
+
'translate-x-full':
|
|
20
|
+
tabindex < activeTabIndex,
|
|
21
|
+
'-translate-x-full':
|
|
22
|
+
tabindex > activeTabIndex,
|
|
23
|
+
'translate-x-0 rounded-lg bg-gray-600':
|
|
24
|
+
activeTabIndex === tabindex
|
|
25
|
+
}"
|
|
26
|
+
/>
|
|
27
|
+
<span
|
|
28
|
+
:class="[
|
|
29
|
+
'w-full px-4 py-2 text-sm tracking-wide font-medium capitalize z-10',
|
|
30
|
+
activeTabIndex == tabindex
|
|
31
|
+
? ' text-white'
|
|
32
|
+
: ' text-gray-500 hover:text-gray-600 rounded-lg bg-transparent z-0 transition-colors duration-300 delay-100 ease-in origin-center'
|
|
33
|
+
]"
|
|
34
|
+
>
|
|
35
|
+
<slot name="title" :tab="tab">
|
|
36
|
+
{{ tab?.name }}
|
|
37
|
+
</slot>
|
|
38
|
+
</span>
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div
|
|
43
|
+
v-else-if="tabStyle === 'border'"
|
|
44
|
+
class="flex items-center gap-1 before:bottom-0 before:left-0 before:absolute before:content-[''] before:h-px before:w-full before:bg-gray-200 relative before:-z-[1] z-0 bg-white"
|
|
45
|
+
>
|
|
46
|
+
<button
|
|
47
|
+
v-for="(tab, tabindex) in tabs"
|
|
48
|
+
:key="tabindex"
|
|
49
|
+
role="tab"
|
|
50
|
+
class="px-3 py-1 text-sm font-semibold leading-5 transition-all duration-150 ease-in-out border-b-2 hover:text-gray-800"
|
|
51
|
+
:class="
|
|
52
|
+
activeTabIndex === tabindex
|
|
53
|
+
? 'border-gray-900 text-gray-900'
|
|
54
|
+
: 'border-transparent text-gray-500'
|
|
55
|
+
"
|
|
56
|
+
@click="selectTab(tabindex)"
|
|
57
|
+
>
|
|
58
|
+
<slot name="title" :tab="tab">
|
|
59
|
+
{{ tab?.name }}
|
|
60
|
+
</slot>
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
<div
|
|
64
|
+
v-else
|
|
65
|
+
class="flex items-center gap-1 p-2 transition-all duration-100"
|
|
66
|
+
>
|
|
67
|
+
<button
|
|
68
|
+
v-for="(tab, tabindex) in tabs"
|
|
69
|
+
:key="tabindex"
|
|
70
|
+
role="tab"
|
|
71
|
+
class="px-4 py-1 text-sm font-semibold transition-colors duration-150 ease-in-out border rounded-full"
|
|
72
|
+
:class="
|
|
73
|
+
activeTabIndex === tabindex
|
|
74
|
+
? 'shadow-lg shadow-gray-100 bg-white border-gray-200 focus-within:border-purple-600 text-gray-900'
|
|
75
|
+
: 'border-white hover:bg-gray-50 text-gray-700'
|
|
76
|
+
"
|
|
77
|
+
@click="selectTab(tabindex)"
|
|
78
|
+
>
|
|
79
|
+
<slot name="title" :tab="tab">
|
|
80
|
+
{{ tab?.name }}
|
|
81
|
+
</slot>
|
|
82
|
+
</button>
|
|
83
|
+
</div>
|
|
84
|
+
<div :class="['py-2 text-base font-normal text-gray-700', contentClass]">
|
|
85
|
+
<slot name="content" :active-tab="tabs[activeTabIndex]">
|
|
86
|
+
{{ tabs[activeTabIndex]?.content }}
|
|
87
|
+
</slot>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import { defineProps, ref, watch } from "vue";
|
|
94
|
+
|
|
95
|
+
interface Tab {
|
|
96
|
+
name: string;
|
|
97
|
+
content?: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const props = defineProps<{
|
|
101
|
+
tabs: Tab[];
|
|
102
|
+
defaultActiveIndex?: number;
|
|
103
|
+
tabStyle: "rounded" | "border" | 'design' ,
|
|
104
|
+
contentClass?: string[] | string
|
|
105
|
+
}>();
|
|
106
|
+
|
|
107
|
+
const emit = defineEmits<{
|
|
108
|
+
(event: "update:activeTab", activeTab: Tab): void;
|
|
109
|
+
}>();
|
|
110
|
+
|
|
111
|
+
const activeTabIndex = ref(props.defaultActiveIndex ?? 0);
|
|
112
|
+
|
|
113
|
+
const selectTab = (index: number) => {
|
|
114
|
+
activeTabIndex.value = index;
|
|
115
|
+
emit("update:activeTab", props.tabs[activeTabIndex.value]);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
watch(
|
|
119
|
+
() => props.defaultActiveIndex,
|
|
120
|
+
(newIndex) => {
|
|
121
|
+
activeTabIndex.value = newIndex ?? 0;
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<style scoped>
|
|
127
|
+
/* Add any scoped styles if needed */
|
|
128
|
+
</style>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import EUItabs from "./EUITabs.vue";
|
|
3
|
+
import tabData from "../../data/tab";
|
|
4
|
+
|
|
5
|
+
// Meta configuration for the EUItabs stories
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Example/Tabs",
|
|
8
|
+
component: EUItabs,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
tabStyle: {
|
|
12
|
+
control: "select",
|
|
13
|
+
options: ["rounded", "border", "design"],
|
|
14
|
+
},
|
|
15
|
+
tabs: {
|
|
16
|
+
control: "object",
|
|
17
|
+
},
|
|
18
|
+
defaultActiveIndex: {
|
|
19
|
+
control: "number",
|
|
20
|
+
},
|
|
21
|
+
contentClass: {
|
|
22
|
+
control: "text",
|
|
23
|
+
description: "Required design to add class",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} satisfies Meta<typeof EUItabs>;
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<typeof meta>;
|
|
30
|
+
|
|
31
|
+
// Default story with tabs and an initial active index
|
|
32
|
+
export const DefaultRoundedTab: Story = {
|
|
33
|
+
args: {
|
|
34
|
+
tabs: tabData,
|
|
35
|
+
tabStyle: "rounded",
|
|
36
|
+
defaultActiveIndex: 0, // Set default active index to 1 (second tab)
|
|
37
|
+
},
|
|
38
|
+
render: (args) => ({
|
|
39
|
+
components: { EUItabs },
|
|
40
|
+
setup() {
|
|
41
|
+
return { args };
|
|
42
|
+
},
|
|
43
|
+
template: `
|
|
44
|
+
<EUItabs v-bind="args"></EUItabs>
|
|
45
|
+
`,
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const BorderTab: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
tabStyle: "border",
|
|
52
|
+
tabs: tabData,
|
|
53
|
+
defaultActiveIndex: 1,
|
|
54
|
+
},
|
|
55
|
+
render: (args) => ({
|
|
56
|
+
components: { EUItabs },
|
|
57
|
+
setup() {
|
|
58
|
+
return { args };
|
|
59
|
+
},
|
|
60
|
+
template: `
|
|
61
|
+
<EUItabs v-bind="args" />
|
|
62
|
+
`,
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const DesignTab: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
tabStyle: "design",
|
|
69
|
+
tabs: tabData,
|
|
70
|
+
defaultActiveIndex: 1,
|
|
71
|
+
},
|
|
72
|
+
render: (args) => ({
|
|
73
|
+
components: { EUItabs },
|
|
74
|
+
setup() {
|
|
75
|
+
return { args };
|
|
76
|
+
},
|
|
77
|
+
template: `
|
|
78
|
+
<EUItabs v-bind="args" />
|
|
79
|
+
`,
|
|
80
|
+
}),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Story with a different active tab by default
|
|
84
|
+
export const TemplateUsingTab: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
tabStyle: "rounded",
|
|
87
|
+
tabs: tabData,
|
|
88
|
+
defaultActiveIndex: 1, // Set default active index to 1 (second tab)
|
|
89
|
+
},
|
|
90
|
+
render: (args) => ({
|
|
91
|
+
components: { EUItabs },
|
|
92
|
+
setup() {
|
|
93
|
+
return { args };
|
|
94
|
+
},
|
|
95
|
+
template: `
|
|
96
|
+
<EUItabs v-bind="args">
|
|
97
|
+
<template #title="{tab}">{{ tab.name}}</template>
|
|
98
|
+
<template #content="{ activeTab }">
|
|
99
|
+
{{ activeTab.content }}
|
|
100
|
+
</template>
|
|
101
|
+
</EUItabs>
|
|
102
|
+
`,
|
|
103
|
+
}),
|
|
104
|
+
parameters: {
|
|
105
|
+
docs: {
|
|
106
|
+
description: {
|
|
107
|
+
story:
|
|
108
|
+
"Tab object data to use <code><b>tab</b></code> and <code><b>activeTab</b></code>",
|
|
109
|
+
},
|
|
110
|
+
source: {
|
|
111
|
+
code: `<template>
|
|
112
|
+
<EUITabs tab-style="border" :tabs="tabData" :defaultActiveIndex="0">
|
|
113
|
+
<template #title="{ tab }">{{ tab.name}}</template>
|
|
114
|
+
<template #content="{ activeTab }">
|
|
115
|
+
{{ activeTab.content }}
|
|
116
|
+
</template>
|
|
117
|
+
</EUITabs>
|
|
118
|
+
</template>
|
|
119
|
+
`,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
|
|
3
|
+
import EUITag from "./EUITag.vue";
|
|
4
|
+
|
|
5
|
+
// Meta configuration for the component's stories
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Example/Tag",
|
|
8
|
+
component: EUITag,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
argTypes: {
|
|
11
|
+
closeIcon: {
|
|
12
|
+
control: "boolean",
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
control: "boolean",
|
|
16
|
+
},
|
|
17
|
+
modelValue: {
|
|
18
|
+
control: "boolean",
|
|
19
|
+
},
|
|
20
|
+
errors: {
|
|
21
|
+
control: "object",
|
|
22
|
+
},
|
|
23
|
+
name: {
|
|
24
|
+
control: "text",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
} satisfies Meta<typeof EUITag>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
// Default story with minimum props
|
|
33
|
+
export const Default: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
modelValue: false,
|
|
36
|
+
disabled: false,
|
|
37
|
+
closeIcon: true,
|
|
38
|
+
},
|
|
39
|
+
render: (args) => ({
|
|
40
|
+
components: { EUITag },
|
|
41
|
+
setup() {
|
|
42
|
+
return { args };
|
|
43
|
+
},
|
|
44
|
+
template: `<EUITag v-bind="args">Name</EUITag>`,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="inline-flex items-center gap-x-1 rounded-md bg-gray-50 px-2 py-1 text-sm font-medium text-gray-600 ring-1 ring-inset ring-gray-400/10">
|
|
3
|
+
<slot />
|
|
4
|
+
<button v-if="closeIcon" type="button" class="relative -mr-1 size-3.5 group rounded hover:bg-red-300/50 active:bg-red-300" @click.stop.prevent="removeTag">
|
|
5
|
+
<span class="sr-only">Remove</span>
|
|
6
|
+
<svg viewBox="0 0 14 14" class="size-3.5 stroke-gray-400 group-hover:stroke-red-600/75">
|
|
7
|
+
<path d="M4 4l6 6m0-6l-6 6" />
|
|
8
|
+
</svg>
|
|
9
|
+
</button>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { PropType, toRefs } from "vue";
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
closeIcon: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
errors: { type: Object, required: false, default: () => {} },
|
|
22
|
+
name: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false,
|
|
25
|
+
default: "",
|
|
26
|
+
},
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: Boolean as PropType<boolean>,
|
|
29
|
+
required: true,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
disabled: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
const { closeIcon } = toRefs(props);
|
|
38
|
+
const emit = defineEmits(["remove", "update:modelValue"]);
|
|
39
|
+
|
|
40
|
+
const removeTag = (e: Event) => {
|
|
41
|
+
emit("remove", e);
|
|
42
|
+
emit("update:modelValue", false);
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style scoped></style>
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import EUITelephone from "./EUITelephone.vue";
|
|
3
|
+
import { ref } from "vue";
|
|
4
|
+
import { PhoneIcon } from "@heroicons/vue/24/outline";
|
|
5
|
+
|
|
6
|
+
// Meta configuration for the component's stories
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Forms/Telephone",
|
|
9
|
+
component: EUITelephone,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {
|
|
12
|
+
modelValue: {
|
|
13
|
+
control: "text",
|
|
14
|
+
description:
|
|
15
|
+
"The value of the telephone input, typically the phone number entered.",
|
|
16
|
+
},
|
|
17
|
+
name: {
|
|
18
|
+
control: "text",
|
|
19
|
+
description:
|
|
20
|
+
"Name for the Validation Telephone field, used for identification.",
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
control: "text",
|
|
24
|
+
description:
|
|
25
|
+
"Label for the Telephone field that is displayed above the input.",
|
|
26
|
+
},
|
|
27
|
+
placeholder: {
|
|
28
|
+
control: "text",
|
|
29
|
+
description:
|
|
30
|
+
"Placeholder text that appears inside the telephone input when it's empty.",
|
|
31
|
+
},
|
|
32
|
+
autoFocus: {
|
|
33
|
+
control: "boolean",
|
|
34
|
+
description:
|
|
35
|
+
"Automatically focuses the telephone input when the page loads.",
|
|
36
|
+
},
|
|
37
|
+
length: {
|
|
38
|
+
control: "number",
|
|
39
|
+
description:
|
|
40
|
+
"Sets the maximum allowed length for the mobile number input.",
|
|
41
|
+
},
|
|
42
|
+
errors: {
|
|
43
|
+
control: "object",
|
|
44
|
+
description:
|
|
45
|
+
"Object containing validation errors. The keys are field names, and the values are the corresponding error messages.",
|
|
46
|
+
},
|
|
47
|
+
required: {
|
|
48
|
+
control: "boolean",
|
|
49
|
+
description: "Indicates whether the telephone input field is mandatory.",
|
|
50
|
+
},
|
|
51
|
+
readonly: {
|
|
52
|
+
control: "boolean",
|
|
53
|
+
description:
|
|
54
|
+
"Makes the telephone input field read-only, preventing users from editing the value.",
|
|
55
|
+
},
|
|
56
|
+
disabled: {
|
|
57
|
+
control: "boolean",
|
|
58
|
+
description:
|
|
59
|
+
"Disables the telephone input, making it uneditable and unclickable.",
|
|
60
|
+
},
|
|
61
|
+
isValid: {
|
|
62
|
+
control: "boolean",
|
|
63
|
+
description:
|
|
64
|
+
"Represents the validation state of the telephone input. `true` if the value is valid, otherwise `false`.",
|
|
65
|
+
},
|
|
66
|
+
iconType: {
|
|
67
|
+
control: "select",
|
|
68
|
+
options: ["", "startIcon", "endIcon"],
|
|
69
|
+
description:
|
|
70
|
+
"The position of the icon to be displayed either at the start or end of the input field.",
|
|
71
|
+
},
|
|
72
|
+
icon: {
|
|
73
|
+
control: { type: "text" },
|
|
74
|
+
description:
|
|
75
|
+
"Specifies an SVG icon to be displayed inside the telephone input field.",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
} satisfies Meta<typeof EUITelephone>;
|
|
79
|
+
|
|
80
|
+
export default meta;
|
|
81
|
+
type Story = StoryObj<typeof meta>;
|
|
82
|
+
|
|
83
|
+
// Default story with minimum props
|
|
84
|
+
export const Default: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
placeholder: "Mobile number 0 to 9",
|
|
87
|
+
label: "Contact number",
|
|
88
|
+
modelValue: "",
|
|
89
|
+
name: "telephoneInput",
|
|
90
|
+
autoFocus: false,
|
|
91
|
+
length: 10,
|
|
92
|
+
required: true,
|
|
93
|
+
readonly: false,
|
|
94
|
+
disabled: false,
|
|
95
|
+
isValid: false,
|
|
96
|
+
errors: {
|
|
97
|
+
message: "Enter valid mobile number",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
render: (args) => ({
|
|
101
|
+
components: { EUITelephone },
|
|
102
|
+
setup() {
|
|
103
|
+
const modelValue = ref(args.modelValue);
|
|
104
|
+
const isValid = ref(args.isValid);
|
|
105
|
+
|
|
106
|
+
const onUpdateModelValue = (newValue: string) => {
|
|
107
|
+
modelValue.value = newValue;
|
|
108
|
+
args.modelValue = newValue;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const onUpdateIsValid = (newValue: boolean) => {
|
|
112
|
+
isValid.value = newValue;
|
|
113
|
+
args.isValid = newValue;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return { args, modelValue, isValid, onUpdateModelValue, onUpdateIsValid };
|
|
117
|
+
},
|
|
118
|
+
template: `<div class="max-w-xl min-h-64"><EUITelephone v-bind="args" /></div>`,
|
|
119
|
+
}),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const IconUsingStart: Story = {
|
|
123
|
+
args: {
|
|
124
|
+
iconType: "startIcon",
|
|
125
|
+
icon: PhoneIcon,
|
|
126
|
+
},
|
|
127
|
+
render: (args) => ({
|
|
128
|
+
components: { EUITelephone },
|
|
129
|
+
setup() {
|
|
130
|
+
const modelValue = ref(args.modelValue);
|
|
131
|
+
const isValid = ref(args.isValid);
|
|
132
|
+
|
|
133
|
+
const onUpdateModelValue = (newValue: string) => {
|
|
134
|
+
modelValue.value = newValue;
|
|
135
|
+
args.modelValue = newValue;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const onUpdateIsValid = (newValue: boolean) => {
|
|
139
|
+
isValid.value = newValue;
|
|
140
|
+
args.isValid = newValue;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
return { args, modelValue, isValid, onUpdateModelValue, onUpdateIsValid };
|
|
144
|
+
},
|
|
145
|
+
template: `<div class="max-w-xl min-h-64"><EUITelephone v-bind="args" /></div>`,
|
|
146
|
+
}),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const IconUsingEnd: Story = {
|
|
150
|
+
args: {
|
|
151
|
+
iconType: "endIcon",
|
|
152
|
+
icon: PhoneIcon,
|
|
153
|
+
},
|
|
154
|
+
render: (args) => ({
|
|
155
|
+
components: { EUITelephone },
|
|
156
|
+
setup() {
|
|
157
|
+
const modelValue = ref(args.modelValue);
|
|
158
|
+
const isValid = ref(args.isValid);
|
|
159
|
+
|
|
160
|
+
const onUpdateModelValue = (newValue: string) => {
|
|
161
|
+
modelValue.value = newValue;
|
|
162
|
+
args.modelValue = newValue;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const onUpdateIsValid = (newValue: boolean) => {
|
|
166
|
+
isValid.value = newValue;
|
|
167
|
+
args.isValid = newValue;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return { args, modelValue, isValid, onUpdateModelValue, onUpdateIsValid };
|
|
171
|
+
},
|
|
172
|
+
template: `<div class="max-w-xl min-h-64"><EUITelephone v-bind="args" /></div>`,
|
|
173
|
+
}),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const MobileNumberUsed: Story = {
|
|
177
|
+
args: {
|
|
178
|
+
modelValue: "+919094089456",
|
|
179
|
+
disabled: false,
|
|
180
|
+
isValid: false,
|
|
181
|
+
},
|
|
182
|
+
render: (args) => ({
|
|
183
|
+
components: { EUITelephone },
|
|
184
|
+
setup() {
|
|
185
|
+
const modelValue = ref(args.modelValue);
|
|
186
|
+
const isValid = ref(args.isValid);
|
|
187
|
+
|
|
188
|
+
const onUpdateModelValue = (newValue: string) => {
|
|
189
|
+
modelValue.value = newValue;
|
|
190
|
+
args.modelValue = newValue;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const onUpdateIsValid = (newValue: boolean) => {
|
|
194
|
+
isValid.value = newValue;
|
|
195
|
+
args.isValid = newValue;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
return { args, modelValue, isValid, onUpdateModelValue, onUpdateIsValid };
|
|
199
|
+
},
|
|
200
|
+
template: `<div class="max-w-xl"><EUITelephone v-bind="args" v-model="modelValue" @update:modelValue="onUpdateModelValue" @update:isValid="onUpdateIsValid" /></div>`,
|
|
201
|
+
}),
|
|
202
|
+
};
|