Skip to content

Commit

Permalink
feat(components): create SelectInput (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuagraber authored Oct 11, 2024
1 parent 44a9241 commit ad35c57
Show file tree
Hide file tree
Showing 15 changed files with 749 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
[ -n "$CI" ] && exit 0

. "$(dirname -- "$0")/_/husky.sh"

npm run docs
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run docs && npm run test:ci
npm run test:ci
1 change: 1 addition & 0 deletions docs/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Form](../src/components/Form//README.md)
- [Header](../src/components/Header//README.md)
- [Input](../src/components/Input//README.md)
- [InputSelect](../src/components/InputSelect//README.md)
- [Nav](../src/components/Nav//README.md)
- [QuickSearchForm](../src/components/QuickSearchForm//README.md)
- [Spinner](../src/components/Spinner//README.md)
4 changes: 2 additions & 2 deletions scripts/update-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ done

# create a commit, only if there are changes
if git diff --quiet docs/$output_file; then
echo -e "No new component README files detected.\nProceeding with push"
echo -e "No new component README files detected.\nNo new commit will be created."
exit 0
else
commit_msg="chore(docs): auto-update to component docs"

echo "New README files detected, committing updated docs/$output_file file..."
git add docs/$output_file && git commit -m "$commit_msg" --no-verify && echo "Commit finished, proceeding with push"
git add docs/$output_file && git commit -m "$commit_msg" --no-verify && echo "Updated documentation added to the TOC in \`docs/components.md\` and committed."
fi
24 changes: 12 additions & 12 deletions src/components/FormV2/__snapshots__/formv2.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ exports[`PdapFormV2 > calls submit event with form values on valid submission 1`
<form class="pdap-form" id="test" name="test">
<!--v-if-->
<div class="pdap-input">
<label for="name">Name</label>
<!--v-if-->
<input id="name" name="name" placeholder="Name" type="text">
<label for="name">Name</label>
</div>
<div class="pdap-input">
<label for="email">Email</label>
<!--v-if-->
<input id="email" name="email" placeholder="Email" type="text">
<label for="email">Email</label>
</div>
<div class="pdap-input pdap-input-password">
<label for="password">Password</label>
<!--v-if-->
<div class="pdap-input-password-wrapper">
<input id="password" name="password" placeholder="Password" type="password">
Expand All @@ -23,7 +24,6 @@ exports[`PdapFormV2 > calls submit event with form values on valid submission 1`
</svg>
</button>
</div>
<label for="password">Password</label>
</div>
<div class="pdap-input pdap-input-checkbox">
<!--v-if-->
Expand All @@ -37,16 +37,17 @@ exports[`PdapFormV2 > renders default error message when form has errors 1`] = `
<form class="pdap-form" id="test" name="test">
<div class="pdap-form-error-message">Please update this form to correct the errors</div>
<div class="pdap-input pdap-input-error">
<label for="name">Name</label>
<div class="pdap-input-error-message">Value is required</div>
<input id="name" name="name" placeholder="Name" type="text">
<label for="name">Name</label>
</div>
<div class="pdap-input pdap-input-error">
<label for="email">Email</label>
<div class="pdap-input-error-message">Value is required</div>
<input id="email" name="email" placeholder="Email" type="text">
<label for="email">Email</label>
</div>
<div class="pdap-input pdap-input-password">
<label for="password">Password</label>
<!--v-if-->
<div class="pdap-input-password-wrapper">
<input id="password" name="password" placeholder="Password" type="password">
Expand All @@ -56,7 +57,6 @@ exports[`PdapFormV2 > renders default error message when form has errors 1`] = `
</svg>
</button>
</div>
<label for="password">Password</label>
</div>
<div class="pdap-input pdap-input-checkbox">
<!--v-if-->
Expand All @@ -76,16 +76,17 @@ exports[`PdapFormV2 > renders error message when errorMessage prop is provided 1
<form class="pdap-form" id="test" name="test">
<div class="pdap-form-error-message">Form Error</div>
<div class="pdap-input">
<label for="name">Name</label>
<!--v-if-->
<input id="name" name="name" placeholder="Name" type="text">
<label for="name">Name</label>
</div>
<div class="pdap-input">
<label for="email">Email</label>
<!--v-if-->
<input id="email" name="email" placeholder="Email" type="text">
<label for="email">Email</label>
</div>
<div class="pdap-input pdap-input-password">
<label for="password">Password</label>
<!--v-if-->
<div class="pdap-input-password-wrapper">
<input id="password" name="password" placeholder="Password" type="password">
Expand All @@ -95,7 +96,6 @@ exports[`PdapFormV2 > renders error message when errorMessage prop is provided 1
</svg>
</button>
</div>
<label for="password">Password</label>
</div>
<div class="pdap-input pdap-input-checkbox">
<!--v-if-->
Expand All @@ -109,16 +109,17 @@ exports[`PdapFormV2 > renders the form element 1`] = `
<form class="pdap-form" id="test" name="test">
<!--v-if-->
<div class="pdap-input">
<label for="name">Name</label>
<!--v-if-->
<input id="name" name="name" placeholder="Name" type="text">
<label for="name">Name</label>
</div>
<div class="pdap-input">
<label for="email">Email</label>
<!--v-if-->
<input id="email" name="email" placeholder="Email" type="text">
<label for="email">Email</label>
</div>
<div class="pdap-input pdap-input-password">
<label for="password">Password</label>
<!--v-if-->
<div class="pdap-input-password-wrapper">
<input id="password" name="password" placeholder="Password" type="password">
Expand All @@ -128,7 +129,6 @@ exports[`PdapFormV2 > renders the form element 1`] = `
</svg>
</button>
</div>
<label for="password">Password</label>
</div>
<div class="pdap-input pdap-input-checkbox">
<!--v-if-->
Expand Down
4 changes: 3 additions & 1 deletion src/components/InputCheckbox/PdapInputCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
class="pdap-input pdap-input-checkbox"
:class="{ ['pdap-input-error']: error }"
>
<slot v-if="$slots.error" name="error" class="pdap-input-error-message" />
<div v-if="$slots.error && error" class="pdap-input-error-message">
<slot name="error" />
</div>
<div v-else-if="error" class="pdap-input-error-message">{{ error }}</div>

<input
Expand Down
9 changes: 5 additions & 4 deletions src/components/InputPassword/PdapInputPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
class="pdap-input pdap-input-password"
:class="{ ['pdap-input-error']: error }"
>
<slot v-if="$slots.error" name="error" class="pdap-input-error-message" />
<label v-if="$slots.label" :for="id"><slot name="label" /></label>
<label v-else-if="label" :for="id">{{ label }}</label>
<div v-if="$slots.error && error" class="pdap-input-error-message">
<slot name="error" />
</div>
<div v-else-if="error" class="pdap-input-error-message">{{ error }}</div>

<div class="pdap-input-password-wrapper">
Expand All @@ -25,9 +29,6 @@
<FontAwesomeIcon :icon="isMasked ? faEye : faEyeSlash" />
</button>
</div>

<label v-if="$slots.label" :for="id"><slot name="label" /></label>
<label v-else-if="label" :for="id">{{ label }}</label>
</div>
</template>

Expand Down
Loading

0 comments on commit ad35c57

Please sign in to comment.