-
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
Showing
27 changed files
with
867 additions
and
89 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
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
77 changes: 77 additions & 0 deletions
77
packages/core/src/components/checkbox/tests/form/index.html
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,77 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Checkbox | Poppy-ui</title> | ||
<link rel="stylesheet" href="/dist/poppy/poppy.css"> | ||
<script type="module" src="/dist/poppy/poppy.esm.js"></script> | ||
<script nomodule src="/dist/poppy/poppy.js"></script> | ||
<style> | ||
main { | ||
width: 100vw; | ||
height: 100dvh; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
padding: 1rem; | ||
|
||
background-color: var(--base-200); | ||
} | ||
|
||
section { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
gap: .35rem; | ||
} | ||
|
||
div, form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: .5rem; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<main> | ||
<section> | ||
<h2>Checkbox - form</h2> | ||
<div> | ||
<form> | ||
<pop-checkbox name="custom" error-text="test error">input label</pop-checkbox> | ||
<pop-checkbox name="custom-value" checked error-text="test error">input label</pop-checkbox> | ||
<pop-checkbox name="custom-value" indeterminate error-text="test error">input label</pop-checkbox> | ||
<input type="checkbox" name="native"> | ||
<pop-button type="submit" color="primary">submit</pop-button> | ||
<pop-button type="reset" color="ghost">reset</pop-button> | ||
</form> | ||
</div> | ||
</section> | ||
</main> | ||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
console.log('load', getData()); | ||
}) | ||
document.querySelector('form').addEventListener('submit', ev => { | ||
ev.preventDefault(); | ||
console.log('submit', getData()); | ||
}); | ||
|
||
function getData() { | ||
const data = new FormData(document.querySelector('form')) | ||
const obj = {}; | ||
|
||
for (const key of data.keys()) { | ||
const values = data.getAll(key); | ||
obj[key] = values.length > 1 ? values : values[0]; | ||
} | ||
return obj; | ||
} | ||
</script> | ||
</body> | ||
|
||
</html> |
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.