Skip to content

Commit

Permalink
docs(jsdocs): update documentation on api page
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanjones243 committed Apr 2, 2024
1 parent 28852ba commit bf1b1bb
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
17 changes: 17 additions & 0 deletions demo/api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../api.md) -->
<!-- The below content is automatically added from ./../api.md -->

# auro-checkbox-group

## Properties

| Property | Attribute | Type | Default |
|---------------------------------|---------------------------------|-----------|-------------|
| [disabled](#disabled) | `disabled` | `boolean` | false |
| [error](#error) | `error` | `string` | |
| [horizontal](#horizontal) | `horizontal` | `boolean` | false |
| [noValidate](#noValidate) | `noValidate` | `boolean` | |
| [required](#required) | `required` | `boolean` | false |
| [setCustomValidity](#setCustomValidity) | `setCustomValidity` | `string` | |
| [setCustomValidityCustomError](#setCustomValidityCustomError) | `setCustomValidityCustomError` | `string` | |
| [setCustomValidityValueMissing](#setCustomValidityValueMissing) | `setCustomValidityValueMissing` | `string` | |
| [validity](#validity) | `validity` | `string` | "undefined" |
| [value](#value) | `value` | `array` | "undefined" |

# auro-checkbox

Custom element for the purpose of allowing users to select one or more options of a limited number of choices.
Expand Down
18 changes: 18 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# auro-checkbox-group

## Properties

| Property | Attribute | Type | Default |
|---------------------------------|---------------------------------|-----------|-------------|
| `disabled` | `disabled` | `boolean` | false |
| `error` | `error` | `string` | |
| `horizontal` | `horizontal` | `boolean` | false |
| `noValidate` | `noValidate` | `boolean` | |
| `required` | `required` | `boolean` | false |
| `setCustomValidity` | `setCustomValidity` | `string` | |
| `setCustomValidityCustomError` | `setCustomValidityCustomError` | `string` | |
| `setCustomValidityValueMissing` | `setCustomValidityValueMissing` | `string` | |
| `validity` | `validity` | `string` | "undefined" |
| `value` | `value` | `array` | "undefined" |


# auro-checkbox

Custom element for the purpose of allowing users to select one or more options of a limited number of choices.
Expand Down
4 changes: 2 additions & 2 deletions scripts/generateDocs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function processDemo() {
* Compiles `./docTemplates/api.md` -> `./demo/api.md`
*/

function processApiExamples() {
function processApi() {
const callback = function(updatedContent, outputConfig) {
if (fs.existsSync('./demo/api.md')) {
fs.readFile('./demo/api.md', 'utf8', function(err, data) {
Expand Down Expand Up @@ -206,5 +206,5 @@ function copyReadmeLocally() {
* Run all the actual document generation
*/
copyReadmeLocally();
processApiExamples();
processApi();
processDemo();
25 changes: 25 additions & 0 deletions src/auro-checkbox-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
* @attr {Boolean} horizontal - If set, checkboxes will be aligned horizontally.
* @event auroCheckboxGroup-validated - Notifies that the `validity` value has changed.
* @event auroCheckboxGroup-helpText - Notifies that the `setCustomValidity` value has changed.
* @slot {HTMLSlotElement} legend - Allows for the legend to be overridden.
* @slot {HTMLSlotElement} optionalLabel - Allows for the optional label to be overridden.
* @slot {HTMLSlotElement} helpText - Allows for the helper text to be overridden.
*/

import { LitElement, html } from "lit";
Expand Down Expand Up @@ -104,6 +107,13 @@ export class AuroCheckboxGroup extends LitElement {
this.handleItems();
}

/**
* Helper method to handle checkbox value changing.
* @private
* @param {String} value - The value of the checkbox.
* @param {Boolean} selected - The checked state of the checkbox.
* @returns {void}
*/
handleValueUpdate(value, selected) {
if (selected) {
// add if it isn't already in the value list
Expand Down Expand Up @@ -168,6 +178,11 @@ export class AuroCheckboxGroup extends LitElement {
});
}

/**
* Helper method that handles the state of preselected checkboxes.
* @private
* @returns {void}
*/
handlePreselectedItems() {
let preSelectedValues = false;

Expand All @@ -188,6 +203,11 @@ export class AuroCheckboxGroup extends LitElement {
}
}

/**
* Helper method that handles the state of checkboxes.
* @private
* @returns {void}
*/
handleItems() {
const groupTagName = this.tagName.toLowerCase();
const checkboxTagName = groupTagName.substring(0, groupTagName.indexOf('-group'));
Expand All @@ -200,6 +220,11 @@ export class AuroCheckboxGroup extends LitElement {
this.validation.validate(this);
}

/**
* Helper method that handles attributes of checkboxes.
* @private
* @returns {void}
*/
handleCheckboxAttributes() {
this.items.forEach((el) => {
if (this.error) {
Expand Down

0 comments on commit bf1b1bb

Please sign in to comment.