chore: add more type docs

This commit is contained in:
Eric Liu 2020-07-25 11:30:45 -07:00
commit c3f924c25a
45 changed files with 517 additions and 50 deletions

View file

@ -1,8 +1,32 @@
<script>
/**
* Set to `true` to toggle the checkbox input
* @type {boolean} [toggled=false]
*/
export let toggled = false;
/**
* Set to `true` to disable checkbox input
* @type {boolean} [disabled=false]
*/
export let disabled = false;
/**
* Specify the label for the untoggled state
* @type {string} [labelA="Off"]
*/
export let labelA = "Off";
/**
* Specify the label for the toggled state
* @type {string} [labelB="On"]
*/
export let labelB = "On";
/**
* Specify the label text
* @type {string} [labelText=""]
*/
export let labelText = "";
/**
@ -10,6 +34,11 @@
* @type {string} [id]
*/
export let id = "ccs-" + Math.random().toString(36);
/**
* Specify a name attribute for the checkbox input
* @type {string} [name]
*/
export let name = undefined;
</script>
@ -33,7 +62,7 @@
toggled = !toggled;
}}
on:keyup
on:keyup={e => {
on:keyup={(e) => {
if (e.key === ' ' || e.key === 'Enter') {
e.preventDefault();
toggled = !toggled;