-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Woolim Park
committed
Nov 22, 2023
1 parent
d8951e6
commit 3caa367
Showing
15 changed files
with
1,125 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
!.eslintrc.js | ||
drafts | ||
scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
browser: true, | ||
'vue/setup-compiler-macros': true, | ||
}, | ||
extends: [ | ||
'plugin:vue/vue3-recommended', | ||
'eslint:recommended', | ||
'@vue/typescript/recommended', | ||
'@vue/prettier', | ||
'plugin:storybook/recommended', | ||
], | ||
plugins: ['vue', 'simple-import-sort', 'unused-imports'], | ||
rules: { | ||
'no-console': 'warn', | ||
'no-alert': 'error', | ||
'vue/no-v-html': 'off', | ||
'simple-import-sort/imports': 'error', | ||
'simple-import-sort/exports': 'error', | ||
'unused-imports/no-unused-imports': 'error', | ||
'@typescript-eslint/no-unused-vars': [ | ||
'warn', | ||
{ | ||
argsIgnorePattern: '^_', | ||
varsIgnorePattern: '^_', | ||
caughtErrorsIgnorePattern: '^_', | ||
}, | ||
], | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'vue/attributes-order': [ | ||
'error', | ||
{ | ||
order: [ | ||
'LIST_RENDERING', | ||
'CONDITIONALS', | ||
'SLOT', | ||
'RENDER_MODIFIERS', | ||
'TWO_WAY_BINDING', | ||
'DEFINITION', | ||
'GLOBAL', | ||
'UNIQUE', | ||
'ATTR_DYNAMIC', | ||
'ATTR_SHORTHAND_BOOL', | ||
'ATTR_STATIC', | ||
'CONTENT', | ||
'OTHER_DIRECTIVES', | ||
'EVENTS', | ||
], | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules/** | ||
assets/** | ||
drafts/** | ||
dist/** | ||
scripts/** | ||
public/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
trailingComma: 'all', | ||
tabWidth: 2, | ||
semi: true, | ||
singleQuote: true, | ||
endOfLine: 'auto', | ||
arrowParens: 'always', | ||
printWidth: 100, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script setup> | ||
import WPasswordField from "./WPasswordField.vue"; | ||
import { reactive } from "vue"; | ||
const state = reactive({ | ||
label: "Password", | ||
value: "", | ||
}); | ||
</script> | ||
|
||
<template> | ||
<Story title="Form/WPasswordField" :layout="{ type: 'grid', width: 300 }"> | ||
<Variant title="default"> | ||
<WPasswordField v-model="state.value" :label="state.label" /> | ||
</Variant> | ||
</Story> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<script setup lang="ts"> | ||
import { EyeIcon, EyeSlashIcon } from '@heroicons/vue/24/solid'; | ||
import WInput from '@/components/WInput'; | ||
import WLabel from '@/components/WLabel'; | ||
import { useIds } from '@/composables/useIds'; | ||
import { ref, computed } from 'vue'; | ||
import { InputType } from '@/types'; | ||
const props = defineProps({ | ||
modelValue: { type: String, default: '' }, | ||
label: { type: String, default: '' }, | ||
disabled: { type: Boolean, default: false }, | ||
}); | ||
const emit = defineEmits(['update:modelValue']); | ||
const inputType = ref<InputType.TEXT | InputType.PASSWORD>(InputType.PASSWORD); | ||
const id = useIds().get(); | ||
const active = ref(false); | ||
const changeInputType = (type: InputType.TEXT | InputType.PASSWORD) => { | ||
inputType.value = type; | ||
}; | ||
const onInput = (e: InputEvent) => { | ||
const target = e.target as HTMLInputElement; | ||
emit('update:modelValue', target.value); | ||
}; | ||
const validators = [ | ||
{ text: 'At least 1 lowercase', type: 'Lowercase', valid: false, regex: /[a-z]/ }, | ||
{ text: 'At least 1 uppercase', type: 'Uppercase', valid: false, regex: /[A-Z]/ }, | ||
{ text: 'At least 1 digit', type: 'Number', valid: false, regex: /\d/ }, | ||
{ text: 'At least 1 special character', type: 'Special', valid: false, regex: /[^A-Za-z0-9]/ }, | ||
{ text: 'At least 8 characters', type: 'Length', valid: false, regex: /.{8,}/ }, | ||
]; | ||
const grade = computed(() => { | ||
const total = validators.filter((v) => props.modelValue.match(v.regex)).length; | ||
return total - 1; | ||
}); | ||
</script> | ||
<template> | ||
<div> | ||
<WLabel :for="id">{{ label }}</WLabel> | ||
<WInput | ||
:id="id" | ||
:value="modelValue" | ||
:disabled="disabled" | ||
:type="inputType" | ||
@input="onInput" | ||
@focus="active = true" | ||
@blur="active = false" | ||
> | ||
<template #append> | ||
<EyeSlashIcon | ||
v-if="inputType === InputType.PASSWORD" | ||
@click="changeInputType(InputType.TEXT)" | ||
/> | ||
<EyeIcon v-else @click="changeInputType(InputType.PASSWORD)" /> | ||
</template> | ||
</WInput> | ||
|
||
<ul class="flex gap-[1px] border-black ml-6 mr-1 mt-2 flex-1 rounded-lg overflow-hidden"> | ||
<li | ||
v-for="(_, idx) in validators" | ||
class="bg-white flex-1 h-2 transition-colors" | ||
:class="{ | ||
['!bg-rose-300']: 0 === idx && grade === 0, | ||
['!bg-rose-400']: 1 >= idx && grade === 1, | ||
['!bg-orange-300']: 2 >= idx && grade === 2, | ||
['!bg-lime-300']: 3 >= idx && grade === 3, | ||
['!bg-sky-300']: 4 >= idx && grade === 4, | ||
}" | ||
></li> | ||
</ul> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./WPasswordField.vue"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from "./WPhoneField.vue"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.