refactor: update/fix JSDoc props

This commit is contained in:
Eric Liu 2020-11-04 06:04:25 -08:00
commit d38e6d8be6
204 changed files with 992 additions and 2359 deletions

View file

@ -1,44 +1,29 @@
<script>
/**
* Set the size of the list box
* @type {"sm" | "xl"} [size]
* @type {"sm" | "xl"}
*/
export let size = undefined;
/**
* Set the type of the list box
* @type {"default" | "inline"} [type="default"]
* @type {"default" | "inline"}
*/
export let type = "default";
/**
* Set to `true` to open the list box
* @type {boolean} [open=false]
*/
/** Set to `true` to open the list box */
export let open = false;
/**
* Set to `true` to enable the light variant
* @type {boolean} [light=false]
*/
/** Set to `true` to enable the light variant */
export let light = false;
/**
* Set to `true` to disable the list box
* @type {boolean} [disable=false]
*/
/** Set to `true` to disable the list box */
export let disabled = false;
/**
* Set to `true` to indicate an invalid state
* @type {boolean} [invalid=false]
*/
/** Set to `true` to indicate an invalid state */
export let invalid = false;
/**
* Specify the invalid state text
* @type {string} [invalidText=""]
*/
/** Specify the invalid state text */
export let invalidText = "";
</script>

View file

@ -1,51 +1,38 @@
<script>
/**
* Set to `true` to disable the list box field
* @type {boolean} [disabled=false]
* @typedef {"close" | "open"} ListBoxFieldTranslationId
*/
/** Set to `true` to disable the list box field */
export let disabled = false;
/**
* Specify the role attribute
* @type {string} [role="combobox"]
*/
/** Specify the role attribute */
export let role = "combobox";
/**
* Specify the tabindex
* @type {string} [tabindex="-1"]
*/
/** Specify the tabindex */
export let tabindex = "-1";
/**
* Default translation ids
* @constant
* @type {{ close: "close"; open: "open"; }}
*/
/** Default translation ids */
export const translationIds = { close: "close", open: "open" };
/**
* Override the default translation ids
* @type {(id: ListBoxFieldTranslationId) => string} [translateWithId = (id) => string]
* @type {(id: ListBoxFieldTranslationId) => string}
*/
export let translateWithId = (id) => defaultTranslations[id];
/**
* Set an id for the top-level element
* @type {string} [id]
* @type {string}
*/
export let id = "ccs-" + Math.random().toString(36);
/**
* Obtain a reference to the top-level HTML element
* @type {null | HTMLElement} [ref=null]
* @type {null | HTMLDivElement}
*/
export let ref = null;
/**
* @typedef {"close" | "open"} ListBoxFieldTranslationId
*/
import { getContext } from "svelte";
const defaultTranslations = {

View file

@ -1,13 +1,13 @@
<script>
/**
* Set an id for the top-level element
* @type {string} [id]
* @type {string}
*/
export let id = "ccs-" + Math.random().toString(36);
/**
* Obtain a reference to the input HTML element
* @type {null | HTMLDivElement} [ref=null]
* Obtain a reference to the HTML element
* @type {null | HTMLDivElement}
*/
export let ref = null;
</script>

View file

@ -1,27 +1,20 @@
<script>
/**
* Set to `true` to open the list box menu icon
* @type {boolean} [open=false]
* @typedef {"close" | "open"} ListBoxMenuIconTranslationId
*/
/** Set to `true` to open the list box menu icon */
export let open = false;
/**
* Default translation ids
* @constant
* @type {{ close: "close"; open: "open" }}
*/
/** Default translation ids */
export const translationIds = { close: "close", open: "open" };
/**
* Override the default translation ids
* @type {(id: ListBoxMenuIconTranslationId) => string} [translateWithId = (id) => string]
* @type {(id: ListBoxMenuIconTranslationId) => string}
*/
export let translateWithId = (id) => defaultTranslations[id];
/**
* @typedef {"close" | "open"} ListBoxMenuIconTranslationId
*/
import ChevronDown16 from "carbon-icons-svelte/lib/ChevronDown16";
const defaultTranslations = {

View file

@ -1,14 +1,8 @@
<script>
/**
* Set to `true` to enable the active state
* @type {boolean} [active=false]
*/
/** Set to `true` to enable the active state */
export let active = false;
/**
* Set to `true` to enable the highlighted state
* @type {boolean} [highlighted=false]
*/
/** Set to `true` to enable the highlighted state */
export let highlighted = false;
</script>

View file

@ -1,21 +1,18 @@
<script>
/**
* @typedef {"clearAll" | "clearSelection"} ListBoxSelectionTranslationId
*/
/**
* Specify the number of selected items
* @type {any} [selectionCount]
* @type {any}
*/
export let selectionCount = undefined;
/**
* Set to `true` to disable the list box selection
* @type {boolean} [disabled=false]
*/
/** Set to `true` to disable the list box selection */
export let disabled = false;
/**
* Default translation ids
* @constant
* @type {{ clearAll: "clearAll"; clearSelection: "clearSelection" }}
*/
/** Default translation ids */
export const translationIds = {
clearAll: "clearAll",
clearSelection: "clearSelection",
@ -23,20 +20,16 @@
/**
* Override the default translation ids
* @type {(id: ListBoxSelectionTranslationId) => string} [translateWithId = (id) => string]
* @type {(id: ListBoxSelectionTranslationId) => string}
*/
export let translateWithId = (id) => defaultTranslations[id];
/**
* Obtain a reference to the top-level HTML element
* @type {null | HTMLElement} [ref=null]
* @type {null | HTMLElement}
*/
export let ref = null;
/**
* @typedef {"clearAll" | "clearSelection"} ListBoxSelectionTranslationId
*/
import { createEventDispatcher, getContext } from "svelte";
import Close16 from "carbon-icons-svelte/lib/Close16";