From 0254713d5e16934eee4d69b7c9c07f21786dccd6 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 12 Sep 2023 14:56:14 -0400 Subject: [PATCH] Suppress all eslint warnings --- package.json | 2 + .../atoms/AccordionBody/AccordionBody.js | 4 ++ .../atoms/AccordionHeader/AccordionHeader.js | 10 ++++ .../atoms/AccordionItem/AccordionItem.js | 20 ++++++++ src/components/atoms/Alert/Alert.js | 4 ++ src/components/atoms/Badge/Badge.js | 8 ++++ src/components/atoms/Breadcrumb/Breadcrumb.js | 6 +++ src/components/atoms/Button/Button.js | 32 +++++++++++++ src/components/atoms/CardBody/CardBody.js | 2 + src/components/atoms/CardFooter/CardFooter.js | 2 + src/components/atoms/CardHeader/CardHeader.js | 2 + .../atoms/CardOverlay/CardOverlay.js | 2 + .../atoms/CarouselCaption/CarouselCaption.js | 4 ++ .../atoms/CarouselItem/CarouselItem.js | 2 + src/components/atoms/Container/Container.js | 2 + .../atoms/DropdownMenu/DropdownMenu.js | 12 +++++ src/components/atoms/FormCheck/FormCheck.js | 21 ++++++++- .../atoms/FormControl/FormControl.js | 24 ++++++++++ src/components/atoms/FormLabel/FormLabel.js | 6 +++ src/components/atoms/FormSelect/FormSelect.js | 12 +++++ src/components/atoms/Icon/Icon.js | 24 ++++++++++ src/components/atoms/Image/Image.js | 2 + .../atoms/ListGroupItem/ListGroupItem.js | 18 ++++++++ src/components/atoms/Loader/Loader.js | 2 + src/components/atoms/ModalBody/ModalBody.js | 4 ++ .../atoms/ModalFooter/ModalFooter.js | 8 ++++ .../atoms/ModalHeader/ModalHeader.js | 8 ++++ .../atoms/NavbarBrand/NavbarBrand.js | 12 +++++ .../atoms/NavbarCollapse/NavbarCollapse.js | 2 + .../atoms/NavbarOffcanvas/NavbarOffcanvas.js | 34 ++++++++++++++ .../atoms/NavbarToggle/NavbarToggle.js | 14 ++++++ .../atoms/OffcanvasBody/OffcanvasBody.js | 4 ++ .../atoms/OffcanvasHeader/OffcanvasHeader.js | 8 ++++ .../atoms/PaginationItem/PaginationItem.js | 14 ++++++ src/components/atoms/Progress/Progress.js | 8 ++++ src/components/atoms/Range/Range.js | 12 +++++ src/components/atoms/Spinner/Spinner.js | 6 +++ src/components/atoms/TableBody/TableBody.js | 12 +++++ src/components/atoms/TableCell/TableCell.js | 12 +++++ .../atoms/TableCellHeader/TableCellHeader.js | 12 +++++ .../atoms/TableHeader/TableHeader.js | 8 ++++ src/components/atoms/TableRow/TableRow.js | 14 ++++++ .../molecules/Accordion/Accordion.js | 10 ++++ .../molecules/ButtonGroup/ButtonGroup.js | 8 ++++ src/components/molecules/Dropdown/Dropdown.js | 8 ++++ .../FormCheckGroup/FormCheckGroup.js | 6 +++ .../molecules/ListGroup/ListGroup.js | 8 ++++ src/components/molecules/Nav/Nav.js | 18 ++++++++ .../molecules/Pagination/Pagination.js | 12 +++++ src/components/organisms/Card/Card.js | 42 +++++++++++++++++ src/components/organisms/Carousel/Carousel.js | 46 +++++++++++++++++++ src/components/organisms/Form/Form.js | 4 ++ src/components/organisms/Geocoder/Geocoder.js | 19 +++++++- src/components/organisms/Map/Map.js | 8 ++++ src/components/organisms/Modal/Modal.js | 30 ++++++++++++ src/components/organisms/Navbar/Navbar.js | 30 ++++++++++++ .../organisms/Offcanvas/Offcanvas.js | 34 ++++++++++++++ src/components/organisms/Table/Table.js | 26 +++++++++++ src/stories/badge.stories.js | 6 +++ src/stories/button.stories.js | 4 ++ src/stories/container.stories.js | 2 + src/stories/formcheck.stories.js | 14 ++++++ src/stories/formcontrol.stories.js | 6 +++ src/stories/formselect.stories.js | 14 ++++++ src/stories/range.stories.js | 6 +++ 65 files changed, 774 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1ec0f8f8..8b3df8a6 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ }, "homepage": "https://jedgar1mx.github.io/COD-Design-System", "scripts": { + "check-lint-config": "npx eslint-config-prettier src/index.js", + "lint": "eslint src && prettier --check src/*", "build": "webpack --mode production", "build-package": "cross-env BABEL_ENV=production babel src -d dist", "start": "webpack-dev-server --mode development", diff --git a/src/components/atoms/AccordionBody/AccordionBody.js b/src/components/atoms/AccordionBody/AccordionBody.js index 00da08f1..25bf10c3 100644 --- a/src/components/atoms/AccordionBody/AccordionBody.js +++ b/src/components/atoms/AccordionBody/AccordionBody.js @@ -16,6 +16,8 @@ export default class AccordionBody extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.accordionBody = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -39,6 +41,8 @@ export default class AccordionBody extends HTMLElement { // Nav attributes let extraClasses = this.getAttribute('data-extra-classes'); let accordionBodyClasses = ['accordion-body']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? accordionBodyClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/AccordionHeader/AccordionHeader.js b/src/components/atoms/AccordionHeader/AccordionHeader.js index d5e5d86e..5cadcbba 100644 --- a/src/components/atoms/AccordionHeader/AccordionHeader.js +++ b/src/components/atoms/AccordionHeader/AccordionHeader.js @@ -22,6 +22,8 @@ export default class AccordionHeader extends HTMLElement { this.accordionHeader = document.createElement('div'); this.accordionBtn = document.createElement('button'); this.accordionHeader.appendChild(this.accordionBtn); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -45,7 +47,11 @@ export default class AccordionHeader extends HTMLElement { this.accordionBtn.setAttribute('aria-expanded', newValue); let tempClasses = this.accordionBtn.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'collapsed' ? tempClasses.push(popValue) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue == 'false') { tempClasses.push('collapsed'); } @@ -62,12 +68,16 @@ export default class AccordionHeader extends HTMLElement { this.accordionBtn.setAttribute('data-bs-toggle', 'collapse'); this.accordionBtn.setAttribute('aria-controls', parentID); this.accordionBtn.setAttribute('data-bs-target', `#${parentID}`); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (expanded == 'true') { this.accordionBtn.setAttribute('aria-expanded', 'true'); } else { accordionBtnClasses.push('collapsed'); this.accordionBtn.setAttribute('aria-expanded', 'false'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? accordionBtnClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/AccordionItem/AccordionItem.js b/src/components/atoms/AccordionItem/AccordionItem.js index 0ee64304..5afde596 100644 --- a/src/components/atoms/AccordionItem/AccordionItem.js +++ b/src/components/atoms/AccordionItem/AccordionItem.js @@ -21,6 +21,8 @@ export default class AccordionItem extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.accordionHeader = document.createElement('div'); this.accordionBody = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -30,9 +32,13 @@ export default class AccordionItem extends HTMLElement { 'data-index', )}`, ); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-expanded') == 'true' ? node.setAttribute('data-expanded', true) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.tagName == 'COD-ACCORDION-HEADER') { this.accordionHeader.append(node); } else { @@ -62,7 +68,11 @@ export default class AccordionItem extends HTMLElement { .setAttribute('data-expanded', newValue); let tempClasses = this.accordionBody.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'show' ? tempClasses.push(popValue) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue == 'true') { tempClasses.push('show'); } @@ -74,15 +84,23 @@ export default class AccordionItem extends HTMLElement { let parentID = this.getAttribute('data-parent-id'); let index = this.getAttribute('data-index'); let expanded = this.getAttribute('data-expanded'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars let alwaysOpen = this.getAttribute('data-always-open'); let headerExtraClasses = this.getAttribute('data-header-extra-classes'); let bodyExtraClasses = this.getAttribute('data-body-extra-classes'); let accordionHeaderClasses = ['accordion-header']; let accordionBodyClasses = ['accordion-collapse collapse']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq expanded == 'true' ? accordionBodyClasses.push('show') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq headerExtraClasses != undefined && headerExtraClasses != null ? accordionHeaderClasses.push(headerExtraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq bodyExtraClasses != undefined && bodyExtraClasses != null ? accordionBodyClasses.push(bodyExtraClasses) : 0; @@ -106,6 +124,8 @@ export default class AccordionItem extends HTMLElement { } _onClick(e) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (e.target.getAttribute('data-expanded') == 'true') { this.getRootNode().host.setAttribute('data-expanded', 'false'); } else { diff --git a/src/components/atoms/Alert/Alert.js b/src/components/atoms/Alert/Alert.js index 9cdb5940..7bc937d8 100644 --- a/src/components/atoms/Alert/Alert.js +++ b/src/components/atoms/Alert/Alert.js @@ -20,6 +20,8 @@ export default class Alert extends HTMLElement { const alertContent = document.createElement('div'); alertContent.id = 'alert-content'; this.alert.appendChild(alertContent); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -52,6 +54,8 @@ export default class Alert extends HTMLElement { let extraClasses = this.getAttribute('data-extra-classes'); this.alert.role = 'alert'; let iconClass = ''; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (icon != undefined && icon != null) { this.alert.querySelector('#alert-content').className = 'col'; let activeIcon = document.createElement('cod-icon'); diff --git a/src/components/atoms/Badge/Badge.js b/src/components/atoms/Badge/Badge.js index 31b86979..d1278362 100644 --- a/src/components/atoms/Badge/Badge.js +++ b/src/components/atoms/Badge/Badge.js @@ -6,6 +6,8 @@ export default class Badge extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } @@ -28,7 +30,11 @@ export default class Badge extends HTMLElement { let url = this.getAttribute('data-url'); let extraClasses = this.getAttribute('data-extra-classes'); let badge = null; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq pill == 'true' ? (pill = 'rounded-pill') : (pill = ''); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (url != undefined || url != null) { badge = document.createElement('a'); badge.href = url; @@ -36,6 +42,8 @@ export default class Badge extends HTMLElement { badge = document.createElement(tag); } badge.innerText = text; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (hiddenText != undefined || hiddenText != null) { const hiddenBadge = document.createElement('span'); hiddenBadge.className = 'visually-hidden'; diff --git a/src/components/atoms/Breadcrumb/Breadcrumb.js b/src/components/atoms/Breadcrumb/Breadcrumb.js index 5900f724..fb1de4c2 100644 --- a/src/components/atoms/Breadcrumb/Breadcrumb.js +++ b/src/components/atoms/Breadcrumb/Breadcrumb.js @@ -21,6 +21,8 @@ export default class Container extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.nav = shadow.querySelector('nav'); this.breadcrumb = shadow.querySelector('ol'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -48,9 +50,13 @@ export default class Container extends HTMLElement { // Breadcrumb attributes let noDivider = this.getAttribute('data-no-divider'); let svg = this.getAttribute('data-svg-divider'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (noDivider == 'true') { this.nav.style.cssText = "--bs-breadcrumb-divider: '';"; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (svg != undefined || svg != null) { this.nav.style.cssText = `--bs-breadcrumb-divider: url(${svg});`; } diff --git a/src/components/atoms/Button/Button.js b/src/components/atoms/Button/Button.js index 43a06e27..9b19c3bc 100644 --- a/src/components/atoms/Button/Button.js +++ b/src/components/atoms/Button/Button.js @@ -7,6 +7,8 @@ export default class Button extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } @@ -25,6 +27,8 @@ export default class Button extends HTMLElement { let hiddenLabel = this.getAttribute('data-hidden-label'); let imgSrc = this.getAttribute('data-img'); let imgAlt = this.getAttribute('data-img-alt'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars, eqeqeq let img = imgAlt != '' ? 'img' : 'not-img'; let size = this.getAttribute('data-size'); let extraClasses = this.getAttribute('data-extra-classes'); @@ -34,29 +38,49 @@ export default class Button extends HTMLElement { const btn = document.createElement('button'); let btnClasses = ['btn']; btn.type = 'button'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (btnID != null && btnID != undefined) { btn.id = btnID; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq disableStatus == 'true' ? (btn.disabled = true) : (btn.disabled = false); btn.setAttribute('aria-label', `${ariaLabel || ''}`); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (primary == 'true') { btnClasses.push(`btn-${backgroundColor}`); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq } else if (primary == 'false') { btnClasses.push(`btn-outline-${backgroundColor}`); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq shape == 'square' ? btnClasses.push('cod-button--square') : btnClasses.push('cod-button-fluid'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq size != undefined && size != null ? btnClasses.push(`btn-${size}`) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? btnClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq imgAlt != '' ? btnClasses.push('cod-button--img') : btnClasses.push('cod-button--not-img'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq close == 'true' ? btnClasses.push('btn-close') : 0; btn.className = btnClasses.join(' '); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (icon != '') { // Loading icon let iconContainer = document.createElement('span'); @@ -65,11 +89,15 @@ export default class Button extends HTMLElement { activeIcon.setAttribute('data-size', iconSize); iconContainer.appendChild(activeIcon); btn.innerText = label; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (iconOrder == 'left') { btn.insertBefore(iconContainer, btn.firstChild); } else { btn.appendChild(iconContainer); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq } else if (imgAlt != '') { // Loading image btn.innerText = label; @@ -81,6 +109,8 @@ export default class Button extends HTMLElement { btn.innerText = label; } // Create hidden label + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (hiddenLabel != undefined && hiddenLabel != null) { let hLabel = document.createElement('span'); hLabel.className = 'visually-hidden'; @@ -98,6 +128,8 @@ export default class Button extends HTMLElement { const btnStyles = document.createElement('style'); btnStyles.textContent = styles; this.shadowRoot.appendChild(btnStyles); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (link == undefined || link == null) { this.shadowRoot.appendChild(btn); let ghostBtn = this.appendChild(document.createElement('button')); diff --git a/src/components/atoms/CardBody/CardBody.js b/src/components/atoms/CardBody/CardBody.js index 973ad771..6857630a 100644 --- a/src/components/atoms/CardBody/CardBody.js +++ b/src/components/atoms/CardBody/CardBody.js @@ -16,6 +16,8 @@ export default class CardBody extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.cardBody = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/CardFooter/CardFooter.js b/src/components/atoms/CardFooter/CardFooter.js index 4483bdf1..ea5f2c2b 100644 --- a/src/components/atoms/CardFooter/CardFooter.js +++ b/src/components/atoms/CardFooter/CardFooter.js @@ -16,6 +16,8 @@ export default class CardFooter extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.cardFooter = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/CardHeader/CardHeader.js b/src/components/atoms/CardHeader/CardHeader.js index 29e3c21a..0a8dc6f9 100644 --- a/src/components/atoms/CardHeader/CardHeader.js +++ b/src/components/atoms/CardHeader/CardHeader.js @@ -16,6 +16,8 @@ export default class CardHeader extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.cardHeader = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/CardOverlay/CardOverlay.js b/src/components/atoms/CardOverlay/CardOverlay.js index 98731210..009d8676 100644 --- a/src/components/atoms/CardOverlay/CardOverlay.js +++ b/src/components/atoms/CardOverlay/CardOverlay.js @@ -16,6 +16,8 @@ export default class CardOverlay extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.cardOverlay = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/CarouselCaption/CarouselCaption.js b/src/components/atoms/CarouselCaption/CarouselCaption.js index 77c85c81..db6f4411 100644 --- a/src/components/atoms/CarouselCaption/CarouselCaption.js +++ b/src/components/atoms/CarouselCaption/CarouselCaption.js @@ -16,6 +16,8 @@ export default class CarouselCaption extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.carouselCaption = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -39,6 +41,8 @@ export default class CarouselCaption extends HTMLElement { // Modal attributes let extraClasses = this.getAttribute('data-extra-classes'); let carouselCaptionClasses = ['carousel-caption d-none d-md-block']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? carouselCaptionClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/CarouselItem/CarouselItem.js b/src/components/atoms/CarouselItem/CarouselItem.js index 3774a5b6..c2e2e3d0 100644 --- a/src/components/atoms/CarouselItem/CarouselItem.js +++ b/src/components/atoms/CarouselItem/CarouselItem.js @@ -16,6 +16,8 @@ export default class CarouselItem extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.carouselItem = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/Container/Container.js b/src/components/atoms/Container/Container.js index a80aa14d..9891c0c4 100644 --- a/src/components/atoms/Container/Container.js +++ b/src/components/atoms/Container/Container.js @@ -16,6 +16,8 @@ export default class Container extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.container = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/DropdownMenu/DropdownMenu.js b/src/components/atoms/DropdownMenu/DropdownMenu.js index 1e58eb81..241f3144 100644 --- a/src/components/atoms/DropdownMenu/DropdownMenu.js +++ b/src/components/atoms/DropdownMenu/DropdownMenu.js @@ -20,6 +20,8 @@ export default class DropdownMenu extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.dropdownMenu = document.createElement('ul'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -43,8 +45,12 @@ export default class DropdownMenu extends HTMLElement { console.log(newValue); let tempClasses = this.dropdownMenu.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'show' ? tempClasses.push(popValue) : 0; console.log(tempClasses); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue == 'true') { tempClasses.push('show'); } @@ -57,10 +63,16 @@ export default class DropdownMenu extends HTMLElement { let alignment = this.getAttribute('data-alignment'); let show = this.getAttribute('data-show'); let classList = ['dropdown-menu']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq darkMode == 'true' ? classList.push('dropdown-menu-dark') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq alignment != undefined && alignment != null ? classList.push(`dropdown-menu-${alignment}`) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq show == 'true' ? classList.push('show') : 0; this.dropdownMenu.className = classList.join(' '); diff --git a/src/components/atoms/FormCheck/FormCheck.js b/src/components/atoms/FormCheck/FormCheck.js index c73216b0..e6d2286d 100644 --- a/src/components/atoms/FormCheck/FormCheck.js +++ b/src/components/atoms/FormCheck/FormCheck.js @@ -12,6 +12,8 @@ export default class FormCheck extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); this.internals = this.attachInternals(); this.container = document.createElement('div'); @@ -24,6 +26,8 @@ export default class FormCheck extends HTMLElement { attributeChangedCallback(name, oldValue, newValue) { let tempClasses = this.formCheck.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'is-invalid' ? tempClasses.push(popValue) : 0; switch (newValue) { @@ -96,21 +100,31 @@ export default class FormCheck extends HTMLElement { this.formCheck.value = value; this.formCheck.name = checkName; this.formCheck.setAttribute('autocomplete', 'off'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (required == 'true') { this.formCheck.setAttribute('required', true); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (checked == 'true') { this.formCheck.checked = true; this.formCheck.setAttribute('aria-checked', 'true'); } else { this.formCheck.setAttribute('aria-checked', 'false'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (disabled == 'true') { this.formCheck.setAttribute('disabled', true); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (mode == 'switch') { this.formCheck.setAttribute('role', mode); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (mode == 'btn' || mode == 'btn-outline') { this.formCheck.className = 'btn-check'; mode = null; @@ -140,12 +154,17 @@ export default class FormCheck extends HTMLElement { this.container.appendChild(this.formCheck); // Adding label to check/radio + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (noLabel != 'true') { const checkLabel = document.createElement('label'); checkLabel.setAttribute('for', id); checkLabel.innerText = labelTxt; if ( - this.getAttribute('data-mode') == 'btn' || + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq + this.getAttribute('data-mode') == 'btn' || // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-mode') == 'btn-outline' ) { checkLabel.className = `btn ${this.getAttribute( diff --git a/src/components/atoms/FormControl/FormControl.js b/src/components/atoms/FormControl/FormControl.js index e0987da1..e36d2e63 100644 --- a/src/components/atoms/FormControl/FormControl.js +++ b/src/components/atoms/FormControl/FormControl.js @@ -12,6 +12,8 @@ export default class FormControl extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); this.internals = this.attachInternals(); this.formControl = null; @@ -22,6 +24,8 @@ export default class FormControl extends HTMLElement { attributeChangedCallback(name, oldValue, newValue) { let tempClasses = this.formControl.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'is-invalid' ? tempClasses.push(popValue) : 0; switch (newValue) { @@ -60,34 +64,54 @@ export default class FormControl extends HTMLElement { const formControl = document.createElement(inputType); formControl.id = id; formControl.placeholder = placeholderTxt; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (required == 'true') { formControl.setAttribute('required', true); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (inputType != 'textarea') { formControl.type = dataType; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (minlength != undefined && minlength != null) { formControl.setAttribute('minlength', minlength); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (maxlength != undefined && maxlength != null) { formControl.setAttribute('maxlength', maxlength); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (pattern != undefined && pattern != null) { formControl.setAttribute('pattern', pattern); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (rows != undefined && rows != null) { formControl.setAttribute('rows', rows); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (value != undefined && value != null) { formControl.value = value; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (readOnly == 'true') { formControl.setAttribute('readonly', true); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (disabled == 'true') { formControl.setAttribute('disabled', true); } let colorPicker; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq dataType == 'color' ? (colorPicker = dataType) : (colorPicker = ''); formControl.className = [ 'form-control', diff --git a/src/components/atoms/FormLabel/FormLabel.js b/src/components/atoms/FormLabel/FormLabel.js index 8a42cb87..d99e34f5 100644 --- a/src/components/atoms/FormLabel/FormLabel.js +++ b/src/components/atoms/FormLabel/FormLabel.js @@ -6,6 +6,8 @@ export default class FormLabel extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } @@ -17,11 +19,15 @@ export default class FormLabel extends HTMLElement { let required = this.getAttribute('data-required'); let text = this.getAttribute('data-text'); let extraClasses = this.getAttribute('data-extra-classes'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (hidden == 'true') { hidden = 'visually-hidden'; } else { hidden = ''; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (required == 'true') { required = 'required-field'; } diff --git a/src/components/atoms/FormSelect/FormSelect.js b/src/components/atoms/FormSelect/FormSelect.js index 9a713809..9880b954 100644 --- a/src/components/atoms/FormSelect/FormSelect.js +++ b/src/components/atoms/FormSelect/FormSelect.js @@ -25,6 +25,8 @@ export default class FormSelect extends HTMLElement { this.internals = this.attachInternals(); // Create select and move options from slot to select this.select = shadow.querySelector('select'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let node = this.querySelector('option'); node && this.select.append(node); @@ -34,6 +36,8 @@ export default class FormSelect extends HTMLElement { attributeChangedCallback(name, oldValue, newValue) { let tempClasses = this.select.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'is-invalid' ? tempClasses.push(popValue) : 0; switch (newValue) { @@ -99,15 +103,23 @@ export default class FormSelect extends HTMLElement { this.setAttribute('tabindex', '0'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (required == 'true') { this.select.setAttribute('required', true); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (disabled == 'true') { this.select.setAttribute('disabled', true); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (multiple == 'true') { this.select.setAttribute('multiple', true); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (displayMultiple != undefined && displayMultiple != null) { this.select.setAttribute('size', displayMultiple); } diff --git a/src/components/atoms/Icon/Icon.js b/src/components/atoms/Icon/Icon.js index 91ff2a66..cedac08c 100644 --- a/src/components/atoms/Icon/Icon.js +++ b/src/components/atoms/Icon/Icon.js @@ -3,6 +3,8 @@ export default class Icon extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } @@ -42,6 +44,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'house-fill': @@ -50,6 +54,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'exclamation-circle': @@ -58,6 +64,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'exclamation-circle-fill': @@ -65,6 +73,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'exclamation-triangle': @@ -73,6 +83,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'check-circle': @@ -81,6 +93,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'check-circle-fill': @@ -88,6 +102,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'calendar': @@ -95,6 +111,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'calendar-fill': @@ -102,6 +120,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'calendar-date': @@ -110,6 +130,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; case 'calendar-date-fill': @@ -118,6 +140,8 @@ export default class Icon extends HTMLElement { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unreachable break; default: diff --git a/src/components/atoms/Image/Image.js b/src/components/atoms/Image/Image.js index 2e12462c..7199a16d 100644 --- a/src/components/atoms/Image/Image.js +++ b/src/components/atoms/Image/Image.js @@ -18,6 +18,8 @@ export default class Image extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); // Create select and move options from slot to select this.picture = shadow.querySelector('picture'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/ListGroupItem/ListGroupItem.js b/src/components/atoms/ListGroupItem/ListGroupItem.js index 23030ffb..4f5d8fd3 100644 --- a/src/components/atoms/ListGroupItem/ListGroupItem.js +++ b/src/components/atoms/ListGroupItem/ListGroupItem.js @@ -36,12 +36,16 @@ export default class ListGroupItem extends HTMLElement { attributeChangedCallback(name, oldValue, newValue) { switch (name) { case 'data-order': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue != null) { this.listGroupItem.className = `${this.listGroupItem.className} ${newValue}`; } break; case 'data-parent-classes': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue != null) { this.listGroupItem.className = `${this.listGroupItem.className} ${newValue}`; } @@ -49,6 +53,8 @@ export default class ListGroupItem extends HTMLElement { case 'data-order-index': console.log(newValue); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue != null) { this.listGroupItem.innerHTML = `${newValue}. ${this.listGroupItem.innerHTML}`; let tempElements = Array.from(this.children); @@ -74,17 +80,27 @@ export default class ListGroupItem extends HTMLElement { let url = this.getAttribute('data-url'); this.listGroupItem = document.createElement(tag); let actionItem = ''; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq tag == 'a' || tag == 'button' ? (actionItem = 'list-group-item-action') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (text != undefined || text != null) { this.listGroupItem.innerText = text; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (url != undefined || url != null) { this.listGroupItem.href = url; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (current == 'true') { this.listGroupItem.setAttribute('aria-current', 'true'); current = 'active'; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (disabled == 'true') { this.listGroupItem.setAttribute('aria-disabled', 'true'); disabled = 'disabled'; @@ -99,6 +115,8 @@ export default class ListGroupItem extends HTMLElement { ].join(' '); if (!this.shadowRoot.querySelector(tag)) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/Loader/Loader.js b/src/components/atoms/Loader/Loader.js index 7d13db57..0ca06959 100644 --- a/src/components/atoms/Loader/Loader.js +++ b/src/components/atoms/Loader/Loader.js @@ -5,6 +5,8 @@ export default class Loader extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } diff --git a/src/components/atoms/ModalBody/ModalBody.js b/src/components/atoms/ModalBody/ModalBody.js index 0f6c3a27..14e7a809 100644 --- a/src/components/atoms/ModalBody/ModalBody.js +++ b/src/components/atoms/ModalBody/ModalBody.js @@ -16,6 +16,8 @@ export default class ModalBody extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.body = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -39,6 +41,8 @@ export default class ModalBody extends HTMLElement { // OffcanvasBody attributes let extraClasses = this.getAttribute('data-extra-classes'); let bodyClasses = ['modal-body']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? bodyClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/ModalFooter/ModalFooter.js b/src/components/atoms/ModalFooter/ModalFooter.js index 5c876bf4..a86a50b4 100644 --- a/src/components/atoms/ModalFooter/ModalFooter.js +++ b/src/components/atoms/ModalFooter/ModalFooter.js @@ -17,6 +17,8 @@ export default class ModalFooter extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.modalFooter = document.createElement('div'); this.closeBtn = document.createElement('cod-button'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -46,9 +48,13 @@ export default class ModalFooter extends HTMLElement { this.closeBtn.setAttribute('data-icon', ''); this.closeBtn.setAttribute('data-label', 'Close'); this.closeBtn.setAttribute('data-bs-dismiss', 'modal'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? modalFooterClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq btnExtraClasses != undefined && btnExtraClasses != null ? this.closeBtn.setAttribute('data-extra-classes', btnExtraClasses) : 0; @@ -63,6 +69,8 @@ export default class ModalFooter extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { this.getRootNode() .host.getRootNode() diff --git a/src/components/atoms/ModalHeader/ModalHeader.js b/src/components/atoms/ModalHeader/ModalHeader.js index f4f21a42..57ea55ac 100644 --- a/src/components/atoms/ModalHeader/ModalHeader.js +++ b/src/components/atoms/ModalHeader/ModalHeader.js @@ -18,6 +18,8 @@ export default class ModalHeader extends HTMLElement { this.modalHeader = document.createElement('div'); this.modalTitle = document.createElement('div'); this.closeBtn = document.createElement('cod-button'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -51,9 +53,13 @@ export default class ModalHeader extends HTMLElement { this.closeBtn.setAttribute('data-icon', ''); this.closeBtn.setAttribute('data-close', 'true'); this.closeBtn.setAttribute('data-bs-dismiss', 'modal'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? modalHeaderClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq btnDark == 'true' ? this.closeBtn.setAttribute('data-extra-classes', 'btn-close-white') : 0; @@ -68,6 +74,8 @@ export default class ModalHeader extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { this.getRootNode() .host.getRootNode() diff --git a/src/components/atoms/NavbarBrand/NavbarBrand.js b/src/components/atoms/NavbarBrand/NavbarBrand.js index ddfa6886..85f2223e 100644 --- a/src/components/atoms/NavbarBrand/NavbarBrand.js +++ b/src/components/atoms/NavbarBrand/NavbarBrand.js @@ -35,27 +35,39 @@ export default class NavbarBrand extends HTMLElement { let brandLink = document.createElement('a'); let cleanURL = encodeURI(url); brandLink.href = decodeURI(cleanURL); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (brandImgURL != undefined && brandImgURL != null) { let brandImg = document.createElement('img'); let cleanImgURL = encodeURI(brandImgURL); brandImg.src = decodeURI(cleanImgURL); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq imgSize != undefined && imgSize != null ? brandImg.setAttribute('width', imgSize) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq imgClasses != undefined && imgClasses != null ? (brandImg.className = imgClasses) : 0; brandImg.setAttribute('alt', brandImgAlt); brandLink.appendChild(brandImg); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (text != undefined && text != null) { let brandText = document.createElement('span'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq textClasses != undefined && textClasses != null ? (brandText.className = textClasses) : 0; brandText.innerText = text; brandLink.appendChild(brandText); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? brandClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/NavbarCollapse/NavbarCollapse.js b/src/components/atoms/NavbarCollapse/NavbarCollapse.js index 2ad37d83..a3b5ddb6 100644 --- a/src/components/atoms/NavbarCollapse/NavbarCollapse.js +++ b/src/components/atoms/NavbarCollapse/NavbarCollapse.js @@ -15,6 +15,8 @@ export default class Navbar extends HTMLElement { // Create a shadow root const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { diff --git a/src/components/atoms/NavbarOffcanvas/NavbarOffcanvas.js b/src/components/atoms/NavbarOffcanvas/NavbarOffcanvas.js index 5238ac3d..0956da77 100644 --- a/src/components/atoms/NavbarOffcanvas/NavbarOffcanvas.js +++ b/src/components/atoms/NavbarOffcanvas/NavbarOffcanvas.js @@ -21,13 +21,21 @@ export default class NavbarOffcanvas extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.offcanvas = document.createElement('div'); this.offcanvasBackdrop = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-show') == 'true' ? node.setAttribute('data-show', true) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.tagName == 'COD-OFFCANVAS-HEADER') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-button-dark') == 'true' ? node.setAttribute('data-button-dark', true) : 0; @@ -52,10 +60,18 @@ export default class NavbarOffcanvas extends HTMLElement { attributeChangedCallback(name, oldValue, newValue) { let tempClasses = this.offcanvas.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'show' ? tempClasses.push(popValue) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue == 'true') { tempClasses.push('show'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-backdrop') != 'false') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-static') != 'true') { this.offcanvasBackdrop.addEventListener('click', this._onClick); } @@ -81,25 +97,41 @@ export default class NavbarOffcanvas extends HTMLElement { let extraClasses = this.getAttribute('data-extra-classes'); let offcanvasClasses = ['offcanvas']; let backdropClasses = ['offcanvas-backdrop fade show']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq show == 'true' ? offcanvasClasses.push('show') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq backdrop == 'false' ? this.offcanvas.setAttribute('data-bs-backdrop', false) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq scroll == 'true' ? this.offcanvas.setAttribute('data-bs-scroll', true) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq bStatic == 'true' ? this.offcanvas.setAttribute('data-bs-backdrop', 'static') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq backdropExtraClasses != undefined && backdropExtraClasses != null ? backdropClasses.push(backdropExtraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? offcanvasClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (placement != undefined && placement != null) { offcanvasClasses.push(`offcanvas-${placement}`); } else { offcanvasClasses.push('offcanvas-start'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (id != undefined && id != null) { this.offcanvas.id = id; this.offcanvas.setAttribute('aria-labelledby', `${id}-label`); @@ -116,6 +148,8 @@ export default class NavbarOffcanvas extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { this.getRootNode().host.setAttribute('data-show', 'false'); } diff --git a/src/components/atoms/NavbarToggle/NavbarToggle.js b/src/components/atoms/NavbarToggle/NavbarToggle.js index 40105375..fe9170e1 100644 --- a/src/components/atoms/NavbarToggle/NavbarToggle.js +++ b/src/components/atoms/NavbarToggle/NavbarToggle.js @@ -28,12 +28,18 @@ export default class NavbarToggle extends HTMLElement { let extraClasses = this.getAttribute('data-extra-classes'); let toggleBtn = document.createElement('button'); let navbarToggleClasses = ['']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (mode == 'default') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq darkBtn == 'true' ? toggleBtn.setAttribute('data-bs-theme', 'dark') : 0; let toggleIcon = document.createElement('span'); navbarToggleClasses.push('navbar-toggler-icon'); toggleBtn.appendChild(toggleIcon); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? navbarToggleClasses.push(extraClasses) : 0; @@ -48,14 +54,22 @@ export default class NavbarToggle extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-show') == 'true') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-target-toggle') == 'offcanvas' ? this.getRootNode() .querySelector('cod-offcanvas') .setAttribute('data-show', 'false') : this.getRootNode().host.setAttribute('data-show', 'false'); } else { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-target-toggle') == 'offcanvas' ? this.getRootNode() .querySelector('cod-offcanvas') diff --git a/src/components/atoms/OffcanvasBody/OffcanvasBody.js b/src/components/atoms/OffcanvasBody/OffcanvasBody.js index c40406b1..56e3988b 100644 --- a/src/components/atoms/OffcanvasBody/OffcanvasBody.js +++ b/src/components/atoms/OffcanvasBody/OffcanvasBody.js @@ -16,6 +16,8 @@ export default class OffcanvasBody extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.body = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -39,6 +41,8 @@ export default class OffcanvasBody extends HTMLElement { // OffcanvasBody attributes let extraClasses = this.getAttribute('data-extra-classes'); let bodyClasses = ['offcanvas-body']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? bodyClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/OffcanvasHeader/OffcanvasHeader.js b/src/components/atoms/OffcanvasHeader/OffcanvasHeader.js index a0ce6718..bd35d72e 100644 --- a/src/components/atoms/OffcanvasHeader/OffcanvasHeader.js +++ b/src/components/atoms/OffcanvasHeader/OffcanvasHeader.js @@ -18,6 +18,8 @@ export default class OffcanvasHeader extends HTMLElement { this.offcanvasHeader = document.createElement('div'); this.offcanvasTitle = document.createElement('div'); this.closeBtn = document.createElement('cod-button'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -51,9 +53,13 @@ export default class OffcanvasHeader extends HTMLElement { this.closeBtn.setAttribute('data-icon', ''); this.closeBtn.setAttribute('data-close', 'true'); this.closeBtn.setAttribute('data-bs-dismiss', parentID); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? offcanvasHeaderClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq btnDark == 'true' ? this.closeBtn.setAttribute('data-extra-classes', 'btn-close-white') : 0; @@ -68,6 +74,8 @@ export default class OffcanvasHeader extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { this.getRootNode() .host.getRootNode() diff --git a/src/components/atoms/PaginationItem/PaginationItem.js b/src/components/atoms/PaginationItem/PaginationItem.js index 9525f547..52c22f36 100644 --- a/src/components/atoms/PaginationItem/PaginationItem.js +++ b/src/components/atoms/PaginationItem/PaginationItem.js @@ -33,7 +33,11 @@ export default class PaginationItem extends HTMLElement { let paginationItemClasses = ['page-link']; let paginationItem = null; let tag = null; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (url != undefined && url != null) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (disabled == 'true') { paginationItemClasses.push('disabled'); paginationItem = document.createElement('span'); @@ -48,14 +52,24 @@ export default class PaginationItem extends HTMLElement { paginationItem = document.createElement('span'); tag = 'span'; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq active == 'true' ? paginationItemClasses.push('active') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? paginationItemClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq special != undefined && special != null ? this.setSpecialItem(special, paginationItem) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq text != undefined && text != null ? (paginationItem.innerText = text) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq label != undefined && label != null ? paginationItem.setAttribute('aria-label', label) : 0; diff --git a/src/components/atoms/Progress/Progress.js b/src/components/atoms/Progress/Progress.js index 89c18f17..bf8a3276 100644 --- a/src/components/atoms/Progress/Progress.js +++ b/src/components/atoms/Progress/Progress.js @@ -6,6 +6,8 @@ export default class Progress extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } @@ -29,6 +31,8 @@ export default class Progress extends HTMLElement { let backgroundColor = this.getAttribute('data-background-color'); let stacked = this.getAttribute('data-multi-bars'); const progressContainer = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (stacked == 'undefined' || stacked == 'null') { const bar = document.createElement('div'); bar.role = 'progressbar'; @@ -37,6 +41,8 @@ export default class Progress extends HTMLElement { bar.className = 'progress'; const barBody = document.createElement('div'); barBody.style = `width: ${value}%`; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (label != 'undefined' && label != 'null') { barBody.innerText = label; } @@ -66,6 +72,8 @@ export default class Progress extends HTMLElement { tempBar.className = 'progress'; const barBody = document.createElement('div'); tempBar.style = `width: ${bar.value}%`; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq bar.label == undefined || bar.label == null ? '' : (barBody.innerText = bar.label); diff --git a/src/components/atoms/Range/Range.js b/src/components/atoms/Range/Range.js index 8bec9219..9de77d14 100644 --- a/src/components/atoms/Range/Range.js +++ b/src/components/atoms/Range/Range.js @@ -6,6 +6,8 @@ export default class Range extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } @@ -21,6 +23,8 @@ export default class Range extends HTMLElement { this.shadowRoot.appendChild(variableStyles); this.shadowRoot.appendChild(rangeStyles); // progress attributes + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars let id = this.getAttribute('data-id'); let disabled = this.getAttribute('data-disabled'); let min = this.getAttribute('data-min'); @@ -29,16 +33,24 @@ export default class Range extends HTMLElement { const range = document.createElement('input'); range.type = 'range'; range.className = 'form-range'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (disabled == 'true') { range.disabled = true; } console.log(min); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (min != undefined || min != null) { range.setAttribute('min', min); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (max != undefined || max != null) { range.setAttribute('max', max); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (step != undefined || step != null) { range.setAttribute('step', step); } diff --git a/src/components/atoms/Spinner/Spinner.js b/src/components/atoms/Spinner/Spinner.js index 6557f679..cbc84030 100644 --- a/src/components/atoms/Spinner/Spinner.js +++ b/src/components/atoms/Spinner/Spinner.js @@ -6,6 +6,8 @@ export default class Image extends HTMLElement { // Always call super first in constructor super(); // Create a shadow root + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const shadow = this.attachShadow({ mode: 'open' }); } @@ -26,12 +28,16 @@ export default class Image extends HTMLElement { let backgroundColor = this.getAttribute('data-background-color'); let displayType = this.getAttribute('data-display-type'); let spinnerSizeClass; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (spinnerSize == 'sm') { spinnerSizeClass = `spinner-${spinnerType}-${spinnerSize}`; } else { spinnerSizeClass = ''; } let spinner; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq displayType == 'inline' ? (spinner = document.createElement('span')) : (spinner = document.createElement('div')); diff --git a/src/components/atoms/TableBody/TableBody.js b/src/components/atoms/TableBody/TableBody.js index e149cb53..90a1fddc 100644 --- a/src/components/atoms/TableBody/TableBody.js +++ b/src/components/atoms/TableBody/TableBody.js @@ -17,21 +17,33 @@ export default class TableBody extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.tableBody = document.createElement('div'); this.tableBody.role = 'rowgroup'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node, index) => { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-row') == 'true' && index % 2 == 0 ? node.setAttribute('data-striped-row', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-hover') == 'true' ? node.setAttribute('data-hover', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-col') == 'true' ? node.setAttribute('data-striped-col', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-vertical-align') == 'true' ? node.setAttribute('data-vertical-align', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-legacy-responsive') == 'true' ? node.setAttribute('data-legacy-responsive', 'true') : 0; diff --git a/src/components/atoms/TableCell/TableCell.js b/src/components/atoms/TableCell/TableCell.js index 7df1131f..ec0b5877 100644 --- a/src/components/atoms/TableCell/TableCell.js +++ b/src/components/atoms/TableCell/TableCell.js @@ -17,6 +17,8 @@ export default class TableCell extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.tableCell = document.createElement('div'); this.tableCell.role = 'cell'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.childNodes); tempElements.forEach((node) => { @@ -46,14 +48,24 @@ export default class TableCell extends HTMLElement { let verticalAlign = this.getAttribute('data-vertical-align'); let extraClasses = this.getAttribute('data-extra-classes'); let tableCellClasses = ['table-cell']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq verticalAlign != undefined && verticalAlign != null ? tableCellClasses.push(verticalAlign) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq legacyResponsive == 'true' ? tableCellClasses.push('table-legacy-responsive') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq stripedRow == 'true' ? tableCellClasses.push('table-striped') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq stripedCol == 'true' ? tableCellClasses.push('table-striped-columns') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? tableCellClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/TableCellHeader/TableCellHeader.js b/src/components/atoms/TableCellHeader/TableCellHeader.js index 9c4a0dff..f25dd0a5 100644 --- a/src/components/atoms/TableCellHeader/TableCellHeader.js +++ b/src/components/atoms/TableCellHeader/TableCellHeader.js @@ -17,6 +17,8 @@ export default class TableCellHeader extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.tableCellHeader = document.createElement('div'); this.tableCellHeader.role = 'columnheader'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.childNodes); tempElements.forEach((node) => { @@ -46,16 +48,26 @@ export default class TableCellHeader extends HTMLElement { let verticalAlign = this.getAttribute('data-vertical-align'); let extraClasses = this.getAttribute('data-extra-classes'); let tableCellHeaderClasses = ['table-cell-header']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq verticalAlign != undefined && verticalAlign != null ? tableCellHeaderClasses.push(verticalAlign) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq legacyResponsive == 'true' ? tableCellHeaderClasses.push('table-legacy-responsive') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq stripedRow == 'true' ? tableCellHeaderClasses.push('table-striped') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq stripedCol == 'true' ? tableCellHeaderClasses.push('table-striped-columns') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? tableCellHeaderClasses.push(extraClasses) : 0; diff --git a/src/components/atoms/TableHeader/TableHeader.js b/src/components/atoms/TableHeader/TableHeader.js index 46bc3bbe..861d3cdf 100644 --- a/src/components/atoms/TableHeader/TableHeader.js +++ b/src/components/atoms/TableHeader/TableHeader.js @@ -17,15 +17,23 @@ export default class TableHeader extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.tableHeader = document.createElement('div'); this.tableHeader.role = 'rowgroup'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-col') == 'true' ? node.setAttribute('data-striped-col', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-vertical-align') == 'true' ? node.setAttribute('data-vertical-align', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-legacy-responsive') == 'true' ? node.setAttribute('data-legacy-responsive', 'true') : 0; diff --git a/src/components/atoms/TableRow/TableRow.js b/src/components/atoms/TableRow/TableRow.js index 4660f42d..e28d0d1d 100644 --- a/src/components/atoms/TableRow/TableRow.js +++ b/src/components/atoms/TableRow/TableRow.js @@ -17,18 +17,28 @@ export default class TableBody extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.tableRow = document.createElement('div'); this.tableRow.role = 'row'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node, index) => { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-row') == 'true' ? node.setAttribute('data-striped-row', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-col') == 'true' && index % 2 != 0 ? node.setAttribute('data-striped-col', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-vertical-align') == 'true' ? node.setAttribute('data-vertical-align', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-legacy-responsive') == 'true' ? node.setAttribute('data-legacy-responsive', 'true') : 0; @@ -55,7 +65,11 @@ export default class TableBody extends HTMLElement { let extraClasses = this.getAttribute('data-extra-classes'); let hover = this.getAttribute('data-hover'); let tableRowClasses = ['table-row']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq hover == 'true' ? tableRowClasses.push('table-hover') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? tableRowClasses.push(extraClasses) : 0; diff --git a/src/components/molecules/Accordion/Accordion.js b/src/components/molecules/Accordion/Accordion.js index ef3dc183..df84e50c 100644 --- a/src/components/molecules/Accordion/Accordion.js +++ b/src/components/molecules/Accordion/Accordion.js @@ -16,11 +16,15 @@ export default class Accordion extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.accordion = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node, index) => { switch (node.tagName) { case 'COD-ACCORDION-ITEM': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let accordionItem = document.createElement('div'); accordionItem.className = 'accordion-item'; node.setAttribute('data-parent-id', this.getAttribute('data-id')); @@ -30,6 +34,8 @@ export default class Accordion extends HTMLElement { break; default: + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let nodeClasses = node.className.split(' '); nodeClasses.includes('no-wc') ? node.remove() @@ -57,7 +63,11 @@ export default class Accordion extends HTMLElement { let id = this.getAttribute('data-id'); let extraClasses = this.getAttribute('data-extra-classes'); let accordionClasses = ['accordion']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq flush == 'true' ? accordionClasses.push('accordion-flush') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? accordionClasses.push(extraClasses) : 0; diff --git a/src/components/molecules/ButtonGroup/ButtonGroup.js b/src/components/molecules/ButtonGroup/ButtonGroup.js index b733b7f7..c8e8efcc 100644 --- a/src/components/molecules/ButtonGroup/ButtonGroup.js +++ b/src/components/molecules/ButtonGroup/ButtonGroup.js @@ -18,6 +18,8 @@ export default class FormCheckGroup extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.btnGroup = shadow.querySelector('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -46,14 +48,20 @@ export default class FormCheckGroup extends HTMLElement { let size = this.getAttribute('data-size'); let vertical = this.getAttribute('data-vertical'); let extraClasses = this.getAttribute('data-extra-classes'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (type == 'group') { this.btnGroup.role = 'group'; } else { this.btnGroup.role = 'toolbar'; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (size != undefined && size != null) { size = `btn-group-${size}`; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (vertical == 'true') { vertical = 'btn-group-vertical'; } diff --git a/src/components/molecules/Dropdown/Dropdown.js b/src/components/molecules/Dropdown/Dropdown.js index f2a1a944..5097e2e5 100644 --- a/src/components/molecules/Dropdown/Dropdown.js +++ b/src/components/molecules/Dropdown/Dropdown.js @@ -20,6 +20,8 @@ export default class Dropdown extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.dropdown = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -49,8 +51,12 @@ export default class Dropdown extends HTMLElement { connectedCallback() { // badge attributes + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars let show = this.getAttribute('data-show'); let split = this.getAttribute('data-split'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq split == 'true' ? (split = 'btn-group') : (split = 'dropdown'); this.dropdown.className = split; if (this.querySelector('cod-button[data-bs-toggle="dropdown"]')) { @@ -71,6 +77,8 @@ export default class Dropdown extends HTMLElement { console.log(this.parentElement.querySelector('cod-dropdown-menu')); if (e.target.getAttribute('data-bs-toggle') === 'dropdown') { console.log('changing dropdown state'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('aria-expanded') == 'true') { this.setAttribute('aria-expanded', 'false'); this.parentElement diff --git a/src/components/molecules/FormCheckGroup/FormCheckGroup.js b/src/components/molecules/FormCheckGroup/FormCheckGroup.js index 70b0061a..07c24ddf 100644 --- a/src/components/molecules/FormCheckGroup/FormCheckGroup.js +++ b/src/components/molecules/FormCheckGroup/FormCheckGroup.js @@ -27,6 +27,8 @@ export default class FormCheckGroup extends HTMLElement { connectedCallback() { // setting up styles if (!this.hasAttribute('role')) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-type') == 'radio') { this.setAttribute('role', 'radiogroup'); } else { @@ -117,6 +119,8 @@ export default class FormCheckGroup extends HTMLElement { while (next) { if ( next.getAttribute('data-type') === 'radio' || + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-undef prev.getAttribute('data-type') === 'checkbox' ) { return next; @@ -201,6 +205,8 @@ export default class FormCheckGroup extends HTMLElement { this._setChecked(e.target); } if (e.target.getAttribute('data-type') === 'checkbox') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-required') == 'true') { this._validateRequired(e.target); } diff --git a/src/components/molecules/ListGroup/ListGroup.js b/src/components/molecules/ListGroup/ListGroup.js index ec1e9c72..f4d832ee 100644 --- a/src/components/molecules/ListGroup/ListGroup.js +++ b/src/components/molecules/ListGroup/ListGroup.js @@ -36,8 +36,14 @@ export default class FormCheckGroup extends HTMLElement { let horizontal = this.getAttribute('data-horizontal'); let extraClasses = this.getAttribute('data-extra-classes'); this.listGroup = document.createElement(tag); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq flushed == 'true' ? (flushed = 'list-group-flush') : (flushed = null); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq numbered == 'true' ? (numbered = 'list-group-numbered') : (numbered = null); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq horizontal == 'true' ? (horizontal = 'list-group-horizontal') : (horizontal = null); @@ -50,6 +56,8 @@ export default class FormCheckGroup extends HTMLElement { ].join(' '); if (!this.shadowRoot.querySelector(tag)) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); let tempLength = tempElements.length; diff --git a/src/components/molecules/Nav/Nav.js b/src/components/molecules/Nav/Nav.js index 137abe83..f3a9ac66 100644 --- a/src/components/molecules/Nav/Nav.js +++ b/src/components/molecules/Nav/Nav.js @@ -16,6 +16,8 @@ export default class Nav extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.nav = document.createElement('ul'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { @@ -53,15 +55,31 @@ export default class Nav extends HTMLElement { let justified = this.getAttribute('data-justified'); let extraClasses = this.getAttribute('data-extra-classes'); let navClasses = ['nav']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq vertical == 'true' ? navClasses.push('flex-column') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq tabs == 'true' ? navClasses.push('nav-tabs') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq pills == 'true' ? navClasses.push('nav-pills') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq underline == 'true' ? navClasses.push('nav-underline') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq fill == 'true' ? navClasses.push('nav-fill') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq justified == 'true' ? navClasses.push('nav-justified') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq hAlignment != undefined && hAlignment != null ? navClasses.push(`justify-content-${hAlignment}`) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? navClasses.push(extraClasses) : 0; diff --git a/src/components/molecules/Pagination/Pagination.js b/src/components/molecules/Pagination/Pagination.js index 12ae3fb1..b1775963 100644 --- a/src/components/molecules/Pagination/Pagination.js +++ b/src/components/molecules/Pagination/Pagination.js @@ -17,15 +17,21 @@ export default class Pagination extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.paginationContainer = document.createElement('nav'); this.pagination = document.createElement('ul'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars this.shadowRoot.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node, index) => { let paginationItem = document.createElement('li'); let paginationItemClasses = ['page-item']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.getAttribute('data-active') == 'true') { paginationItemClasses.push('active'); paginationItem.setAttribute('aria-current', 'page'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.getAttribute('data-disabled') == 'true') { paginationItemClasses.push('disabled'); paginationItem.setAttribute('tabindex', '-1'); @@ -60,12 +66,18 @@ export default class Pagination extends HTMLElement { let size = this.getAttribute('data-size'); let extraClasses = this.getAttribute('data-extra-classes'); let paginationClasses = ['pagination']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq size != undefined && size != null ? paginationClasses.push(`pagination-${size}`) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? paginationClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq id != undefined && id != null ? (this.paginationContainer.id = id) : 0; this.paginationContainer.setAttribute('aria-label', label); this.pagination.className = paginationClasses.join(' '); diff --git a/src/components/organisms/Card/Card.js b/src/components/organisms/Card/Card.js index 4de4a8c4..cfe6711f 100644 --- a/src/components/organisms/Card/Card.js +++ b/src/components/organisms/Card/Card.js @@ -17,14 +17,24 @@ export default class Card extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.card = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (e) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { switch (node.tagName) { case 'COD-CARD-HEADER': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempHeader = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempHeaderClasses = ['card-header']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != undefined && + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != null ? tempHeaderClasses.push(node.getAttribute('data-extra-classes')) : 0; @@ -34,9 +44,17 @@ export default class Card extends HTMLElement { break; case 'COD-CARD-BODY': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempBody = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempBodyClasses = ['card-body']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != undefined && + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != null ? tempHeaderClasses.push(node.getAttribute('data-extra-classes')) : 0; @@ -46,9 +64,17 @@ export default class Card extends HTMLElement { break; case 'COD-CARD-FOOTER': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempFooter = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempFooterClasses = ['card-footer']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != undefined && + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != null ? tempFooterClasses.push(node.getAttribute('data-extra-classes')) : 0; @@ -58,9 +84,17 @@ export default class Card extends HTMLElement { break; case 'COD-CARD-OVERLAY': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempOverlay = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let tempOverlayClasses = ['card-img-overlay']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != undefined && + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-extra-classes') != null ? tempOverlayClasses.push(node.getAttribute('data-extra-classes')) : 0; @@ -70,6 +104,8 @@ export default class Card extends HTMLElement { break; default: + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let nodeClasses = node.className.split(' '); nodeClasses.includes('no-wc') ? node.remove() @@ -97,10 +133,16 @@ export default class Card extends HTMLElement { let id = this.getAttribute('data-id'); let extraClasses = this.getAttribute('data-extra-classes'); let cardClasses = ['card']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? cardClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq width != undefined && width != null ? (this.card.style.width = width) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq id != undefined && id != null ? (this.card.id = id) : 0; this.card.className = cardClasses.join(' '); if (!this.shadowRoot.querySelector('div')) { diff --git a/src/components/organisms/Carousel/Carousel.js b/src/components/organisms/Carousel/Carousel.js index 749bd55a..417ced90 100644 --- a/src/components/organisms/Carousel/Carousel.js +++ b/src/components/organisms/Carousel/Carousel.js @@ -26,7 +26,11 @@ export default class Carousel extends HTMLElement { this.carouselInner.className = 'carousel-inner'; this.carouselPrev = document.createElement('button'); this.carouselNext = document.createElement('button'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-no-controls') != 'true') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-external-controls') == 'true') { this.carouselPrev.className = 'carousel-control-prev position-relative'; this.carouselNext.className = 'carousel-control-next position-relative'; @@ -73,21 +77,31 @@ export default class Carousel extends HTMLElement { this.carousel.appendChild(this.carouselInner); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (e) => { let tempElements = Array.from(this.children); let tempElementsCount = 0; tempElements.forEach((node, index) => { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.tagName == 'COD-CAROUSEL-ITEM') { tempElementsCount += 1; let tempItem = document.createElement('div'); tempItem.setAttribute('data-index', index); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.getAttribute('data-active') == 'true') { tempItem.className = 'carousel-item active'; this.setAttribute('data-active-item', index); } else { tempItem.className = 'carousel-item'; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-interval') != undefined && + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq node.getAttribute('data-interval') != null ? tempItem.setAttribute( 'data-bs-interval', @@ -96,6 +110,8 @@ export default class Carousel extends HTMLElement { : 0; tempItem.appendChild(node); this.carouselInner.appendChild(tempItem); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-indicator') == 'true') { let tempIndicator = document.createElement('button'); tempIndicator.type = 'button'; @@ -105,6 +121,8 @@ export default class Carousel extends HTMLElement { ); tempIndicator.setAttribute('data-bs-slide-to', index); tempIndicator.setAttribute('aria-label', `Slide ${index}`); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.getAttribute('data-active') == 'true') { tempIndicator.className = 'active'; tempIndicator.setAttribute('aria-current', 'true'); @@ -135,6 +153,8 @@ export default class Carousel extends HTMLElement { } attributeChangedCallback(name, oldValue, newValue) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (oldValue != null) { let oldItem = this.carouselInner.querySelector( `[data-index="${oldValue}"`, @@ -142,6 +162,8 @@ export default class Carousel extends HTMLElement { let newItem = this.carouselInner.querySelector( `[data-index="${newValue}"`, ); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-indicator') == 'true') { this.carouselIndicators.querySelector( `[data-bs-slide-to="${oldValue}"`, @@ -150,6 +172,8 @@ export default class Carousel extends HTMLElement { `[data-bs-slide-to="${newValue}"`, ).className = 'active'; } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-direction') == 'next') { oldItem.className = 'carousel-item active carousel-item-start'; newItem.className = @@ -175,19 +199,33 @@ export default class Carousel extends HTMLElement { let extraClasses = this.getAttribute('data-extra-classes'); let externalControls = this.getAttribute('data-external-controls'); let carouselClasses = ['carousel slide']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? carouselClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq crossfade == 'true' ? carouselClasses.push('carousel-fade') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq externalControls == 'true' ? carouselClasses.push('d-flex') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq noTouch == 'false' ? this.carousel.setAttribute('data-bs-touch', 'false') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (autoplay != undefined && autoplay != null) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq autoplay == 'true' ? this.carousel.setAttribute('data-bs-ride', autoplay) : this.carousel.setAttribute('data-bs-ride', 'carousel'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq id != undefined && id != null ? (this.carousel.id = id) : 0; this.carousel.className = carouselClasses.join(' '); if (!this.shadowRoot.querySelector('div')) { @@ -199,9 +237,15 @@ export default class Carousel extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { let activeItem = this.getRootNode().host.getAttribute('data-active-item'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars let totalItems = this.getRootNode().host.getAttribute('data-total-items'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-bs-slide') == undefined) { if (this.getAttribute('data-bs-slide-to') > activeItem) { this.getRootNode().host.setAttribute('data-direction', 'prev'); @@ -219,6 +263,8 @@ export default class Carousel extends HTMLElement { } else { let activeItem = this.getRootNode().host.getAttribute('data-active-item'); let totalItems = this.getRootNode().host.getAttribute('data-total-items'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-bs-slide') == 'prev') { this.getRootNode().host.setAttribute('data-direction', 'prev'); parseInt(activeItem) - 1 >= 0 diff --git a/src/components/organisms/Form/Form.js b/src/components/organisms/Form/Form.js index a9e4b8d7..5e1edc91 100644 --- a/src/components/organisms/Form/Form.js +++ b/src/components/organisms/Form/Form.js @@ -17,6 +17,8 @@ export default class Form extends HTMLElement { const shadow = this.attachShadow({ mode: 'open' }); shadow.appendChild(template.content.cloneNode(true)); this.form = document.createElement('form'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); if (tempElements.length) { @@ -44,6 +46,8 @@ export default class Form extends HTMLElement { let backgroundColor = this.getAttribute('data-background-color'); let extraClasses = this.getAttribute('data-extra-classes'); this.form.id = id; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (customValidation == 'true') { this.form.novalidate = true; customValidation = 'needs-validation'; diff --git a/src/components/organisms/Geocoder/Geocoder.js b/src/components/organisms/Geocoder/Geocoder.js index 5bc99832..e8108976 100644 --- a/src/components/organisms/Geocoder/Geocoder.js +++ b/src/components/organisms/Geocoder/Geocoder.js @@ -28,6 +28,8 @@ export default class Geocoder extends HTMLElement { label.style.fontFamily = 'Montserrat, sans-serif'; label.style.fontWeight = 'bold'; let input = document.createElement('input'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars let suggestions = document.createElement('ul'); let list = document.createElement('datalist'); let icon = document.createElement('i'); @@ -40,11 +42,16 @@ export default class Geocoder extends HTMLElement { label.innerText = 'Property Address:'; try { if (app[0].getAttribute('data-geocoder-label')) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (app[0].getAttribute('data-geocoder-label') != '') { label.innerText = app[0].getAttribute('data-geocoder-label'); } } - } catch (error) {} + } catch (error) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-empty + } label.setAttribute('for', 'geocoder-input'); input.type = 'text'; input.setAttribute('list', 'addresses-list'); @@ -119,6 +126,8 @@ export default class Geocoder extends HTMLElement { } } }); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq parcel == null ? (location = data.candidates[0].location) : (location = null); @@ -192,6 +201,8 @@ export default class Geocoder extends HTMLElement { inputChange(ev, geocoder) { switch (ev.key) { case 'Enter': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq ev.target.value != '' && ev.target.value != undefined ? geocoder.supplementGeocoder(ev.target.value, geocoder, 'submit') : 0; @@ -210,6 +221,8 @@ export default class Geocoder extends HTMLElement { break; case undefined: + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq ev.target.value != '' && ev.target.value != undefined ? geocoder.supplementGeocoder(ev.target.value, geocoder, 'submit') : 0; @@ -249,6 +262,8 @@ export default class Geocoder extends HTMLElement { }, }, ]; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (location != null) { params[0].geometry.x = location.x; params[0].geometry.y = location.y; @@ -265,6 +280,8 @@ export default class Geocoder extends HTMLElement { cache: 'default', }, ); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars fetch(request).then((res) => { // console.log(res); }); diff --git a/src/components/organisms/Map/Map.js b/src/components/organisms/Map/Map.js index bc1468a2..6deb135c 100644 --- a/src/components/organisms/Map/Map.js +++ b/src/components/organisms/Map/Map.js @@ -32,6 +32,8 @@ export default class Map extends HTMLElement { mapContainer.id = 'map'; mapWrapper.appendChild(mapContainer); const closeMapBtn = document.createElement('cod-button'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars closeMapBtn.addEventListener('click', (ev) => { app[0].setAttribute('data-app-state', 'results'); }); @@ -55,6 +57,8 @@ export default class Map extends HTMLElement { app[0].setAttribute('data-map-state', 'init'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars attributeChangedCallback(name, oldValue, newValue) { const app = document.getElementsByTagName('my-home-info'); const parcel = JSON.parse(app[0].getAttribute('data-parcel-id')); @@ -64,6 +68,8 @@ export default class Map extends HTMLElement { this.map.addControl(new maplibregl.NavigationControl()); this.map.on('style.load', () => { this.map.resize(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars const marker = new maplibregl.Marker() .setLngLat(coord) .addTo(this.map); @@ -115,6 +121,8 @@ export default class Map extends HTMLElement { }); }); // Creating this temp variable for workaround with dealing with "this" encapsulation + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations const tempMap = this; this.map.on('click', 'data-points', function (e) { const app = document.getElementsByTagName('my-home-info'); diff --git a/src/components/organisms/Modal/Modal.js b/src/components/organisms/Modal/Modal.js index 005e941c..5e57a8f7 100644 --- a/src/components/organisms/Modal/Modal.js +++ b/src/components/organisms/Modal/Modal.js @@ -28,14 +28,20 @@ export default class Modal extends HTMLElement { this.modalDialog.appendChild(this.modalContent); this.modal.appendChild(this.modalDialog); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (e) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { switch (node.tagName) { case 'COD-MODAL-HEADER': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-show') == 'true' ? node.setAttribute('data-show', true) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-button-dark') == 'true' ? node.setAttribute('data-button-dark', true) : 0; @@ -74,10 +80,16 @@ export default class Modal extends HTMLElement { attributeChangedCallback(name, oldValue, newValue) { let tempClasses = this.modal.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'show' ? tempClasses.push(popValue) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue == 'true') { tempClasses.push('show'); this.modal.style.display = 'block'; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-static') != 'true') { this.modal.addEventListener('click', this._onClick); } @@ -102,30 +114,46 @@ export default class Modal extends HTMLElement { let modalClasses = ['modal fade']; let modalDialogClasses = ['modal-dialog']; let modalContentClasses = ['modal-content']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? modalClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq size != undefined && size != null ? modalDialogClasses.push(`modal-${size}`) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq verticalCentered == 'true' ? modalDialogClasses.push('modal-dialog-centered') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (fullScreen != undefined && fullScreen != null) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq fullScreen == 'always' ? modalDialogClasses.push('modal-fullscreen') : modalDialogClasses.push(`modal-fullscreen-${fullScreen}-down`); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (bStatic == 'true') { this.modal.setAttribute('data-bs-backdrop', 'static'); this.modal.setAttribute('data-bs-keyboard', 'false'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (show == 'true') { this.modalClasses.push('show'); this.modal.setAttribute('aria-modal', `true`); } else { this.modal.setAttribute('aria-modal', `false`); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq id != undefined && id != null ? (this.modal.id = id) : 0; this.modal.setAttribute('tabindex', -1); this.modal.className = modalClasses.join(' '); @@ -140,6 +168,8 @@ export default class Modal extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { this.getRootNode().host.setAttribute('data-show', 'false'); } diff --git a/src/components/organisms/Navbar/Navbar.js b/src/components/organisms/Navbar/Navbar.js index 491fd872..05158738 100644 --- a/src/components/organisms/Navbar/Navbar.js +++ b/src/components/organisms/Navbar/Navbar.js @@ -25,17 +25,25 @@ export default class Navbar extends HTMLElement { this.navbarBrand = document.createElement('div'); this.navbarCollapse = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (e) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { switch (node.tagName) { case 'COD-NAVBAR-TOGGLE': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-target-toggle') == 'offcanvas' ? node.setAttribute('data-target-toggle', 'offcanvas') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-show') == 'true' ? node.setAttribute('data-show', true) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-button-dark') == 'true' ? node.setAttribute('data-button-dark', true) : 0; @@ -58,6 +66,8 @@ export default class Navbar extends HTMLElement { break; default: + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let nodeClasses = node.className.split(' '); nodeClasses.includes('no-wc') ? node.remove() : 0; break; @@ -86,7 +96,11 @@ export default class Navbar extends HTMLElement { if (this.navbarCollapse.querySelector('cod-navbar-collapse')) { let tempClasses = this.navbarCollapse.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'show' ? tempClasses.push(popValue) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue == 'true') { tempClasses.push('show'); } @@ -108,29 +122,45 @@ export default class Navbar extends HTMLElement { let navbarCollapseClasses = ['collapse navbar-collapse']; let navbarBrandClasses = ['navbar-brand']; let navbarToogleClasses = ['navbar-toggler']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq containerClasses != undefined && containerClasses != null ? navbarContainerClasses.push(containerClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? navbarClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq collapseClasses != undefined && collapseClasses != null ? navbarCollapseClasses.push(collapseClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq placement != undefined && placement != null ? navbarClasses.push(placement) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (expand != undefined && expand != null) { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq expand == 'always' ? navbarClasses.push('navbar-expand') : navbarClasses.push(`navbar-expand-${expand}`); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (show == 'true') { this.navbarCollapseClasses.push('show'); this.navbarToggle.setAttribute('aria-expanded', `true`); } else { this.navbarToggle.setAttribute('aria-expanded', `false`); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (id != undefined && id != null) { this.navbar.id = id; this.navbarCollapse.id = `${id}-collapse`; diff --git a/src/components/organisms/Offcanvas/Offcanvas.js b/src/components/organisms/Offcanvas/Offcanvas.js index 4ed56c09..6eee94a0 100644 --- a/src/components/organisms/Offcanvas/Offcanvas.js +++ b/src/components/organisms/Offcanvas/Offcanvas.js @@ -21,13 +21,21 @@ export default class Offcanvas extends HTMLElement { shadow.appendChild(template.content.cloneNode(true)); this.offcanvas = document.createElement('div'); this.offcanvasBackdrop = document.createElement('div'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (ev) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-show') == 'true' ? node.setAttribute('data-show', true) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (node.tagName == 'COD-OFFCANVAS-HEADER') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-button-dark') == 'true' ? node.setAttribute('data-button-dark', true) : 0; @@ -55,10 +63,18 @@ export default class Offcanvas extends HTMLElement { attributeChangedCallback(name, oldValue, newValue) { let tempClasses = this.offcanvas.className.split(' '); let popValue = tempClasses.pop(); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq popValue != 'show' ? tempClasses.push(popValue) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (newValue == 'true') { tempClasses.push('show'); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-backdrop') != 'false') { + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (this.getAttribute('data-static') != 'true') { this.offcanvasBackdrop.addEventListener('click', this._onClick); } @@ -84,25 +100,41 @@ export default class Offcanvas extends HTMLElement { let extraClasses = this.getAttribute('data-extra-classes'); let offcanvasClasses = ['offcanvas']; let backdropClasses = ['offcanvas-backdrop fade show']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq show == 'true' ? offcanvasClasses.push('show') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq backdrop == 'false' ? this.offcanvas.setAttribute('data-bs-backdrop', false) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq scroll == 'true' ? this.offcanvas.setAttribute('data-bs-scroll', true) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq bStatic == 'true' ? this.offcanvas.setAttribute('data-bs-backdrop', 'static') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq backdropExtraClasses != undefined && backdropExtraClasses != null ? backdropClasses.push(backdropExtraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? offcanvasClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (placement != undefined && placement != null) { offcanvasClasses.push(`offcanvas-${placement}`); } else { offcanvasClasses.push('offcanvas-start'); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (id != undefined && id != null) { this.offcanvas.id = id; this.offcanvas.setAttribute('aria-labelledby', `${id}-label`); @@ -119,6 +151,8 @@ export default class Offcanvas extends HTMLElement { this.removeEventListener('click', this._onClick.bind(this)); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars _onClick(e) { this.getRootNode().host.setAttribute('data-show', 'false'); } diff --git a/src/components/organisms/Table/Table.js b/src/components/organisms/Table/Table.js index e1e00807..46eaea20 100644 --- a/src/components/organisms/Table/Table.js +++ b/src/components/organisms/Table/Table.js @@ -20,17 +20,25 @@ export default class Table extends HTMLElement { this.table.role = 'table'; this.tableContainer.appendChild(this.table); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-unused-vars shadow.addEventListener('slotchange', (e) => { let tempElements = Array.from(this.children); tempElements.forEach((node) => { switch (node.tagName) { case 'COD-TABLE-HEADER': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-col') == 'true' ? node.setAttribute('data-striped-col', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-vertical-align') == 'true' ? node.setAttribute('data-vertical-align', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-legacy-responsive') == 'true' ? node.setAttribute('data-legacy-responsive', 'true') : 0; @@ -38,18 +46,28 @@ export default class Table extends HTMLElement { break; case 'COD-TABLE-BODY': + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-hover') == 'true' ? node.setAttribute('data-hover', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-row') == 'true' ? node.setAttribute('data-striped-row', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-striped-col') == 'true' ? node.setAttribute('data-striped-col', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-vertical-align') == 'true' ? node.setAttribute('data-vertical-align', 'true') : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq this.getAttribute('data-legacy-responsive') == 'true' ? node.setAttribute('data-legacy-responsive', 'true') : 0; @@ -57,6 +75,8 @@ export default class Table extends HTMLElement { break; default: + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line no-case-declarations let nodeClasses = node.className.split(' '); nodeClasses.includes('no-wc') ? node.remove() : 0; break; @@ -82,10 +102,16 @@ export default class Table extends HTMLElement { let id = this.getAttribute('data-id'); let extraClasses = this.getAttribute('data-extra-classes'); let tableClasses = ['table']; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq extraClasses != undefined && extraClasses != null ? tableClasses.push(extraClasses) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq id != undefined && id != null ? (this.table.id = id) : 0; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq legacyResponsive == 'true' ? (this.tableContainer.className = 'table-responsive') : 0; diff --git a/src/stories/badge.stories.js b/src/stories/badge.stories.js index cceb4c46..f666b847 100644 --- a/src/stories/badge.stories.js +++ b/src/stories/badge.stories.js @@ -30,12 +30,18 @@ const Template = (args) => { const badge = document.createElement('cod-badge'); badge.setAttribute('data-tag', args.tag); badge.setAttribute('data-background-color', args.backgroundColor); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.url != null) { badge.setAttribute('data-url', args.url); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.hiddenText != null) { badge.setAttribute('data-hidden-text', args.hiddenText); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.pill != null) { badge.setAttribute('data-pill', args.pill); } diff --git a/src/stories/button.stories.js b/src/stories/button.stories.js index 059d16c4..c8577e29 100644 --- a/src/stories/button.stories.js +++ b/src/stories/button.stories.js @@ -1,4 +1,8 @@ +// See CityOfDetroit/detroitmi#1099 +// eslint-disable-next-line no-unused-vars import { userEvent, within } from '@storybook/testing-library'; +// See CityOfDetroit/detroitmi#1099 +// eslint-disable-next-line no-unused-vars import { expect } from '@storybook/jest'; import '../components/atoms/Button/cod-button'; import '../components/atoms/Icon/cod-icon'; diff --git a/src/stories/container.stories.js b/src/stories/container.stories.js index 641f880b..f17393bb 100644 --- a/src/stories/container.stories.js +++ b/src/stories/container.stories.js @@ -33,6 +33,8 @@ export default { const Template = (args) => { const container = document.createElement('cod-container'); container.setAttribute('data-type', args.type); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.elements != null) { container.innerHTML = args.elements; } diff --git a/src/stories/formcheck.stories.js b/src/stories/formcheck.stories.js index 8a40cad3..ea0edb30 100644 --- a/src/stories/formcheck.stories.js +++ b/src/stories/formcheck.stories.js @@ -61,24 +61,38 @@ const Template = (args) => { formCheck.setAttribute('data-type', args.type); formCheck.setAttribute('data-btn-color', args.btnColor); formCheck.setAttribute('data-checked', args.checked); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.extraClasses != null) { formCheck.setAttribute('data-extra-classes', args.extraClasses); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.backgroundColor != null) { formCheck.setAttribute('data-background-color', args.backgroundColor); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.label != null) { formCheck.setAttribute('data-label', args.label); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.nolabel != null) { formCheck.setAttribute('data-nolabel', args.nolabel); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.mode != null) { formCheck.setAttribute('data-mode', args.mode); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.disabled != null) { formCheck.setAttribute('data-disabled', args.disabled); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.required != null) { formCheck.setAttribute('data-required', args.required); } diff --git a/src/stories/formcontrol.stories.js b/src/stories/formcontrol.stories.js index 24d42787..1b1e4681 100644 --- a/src/stories/formcontrol.stories.js +++ b/src/stories/formcontrol.stories.js @@ -47,12 +47,18 @@ export default { const Template = (args) => { const fcontrol = document.createElement('cod-form-control'); fcontrol.setAttribute('data-tag', args.tag); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.size != null) { fcontrol.setAttribute('data-size', args.size); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.rows != null) { fcontrol.setAttribute('data-rows', args.rows); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.value != null) { fcontrol.setAttribute('data-value', args.value); } diff --git a/src/stories/formselect.stories.js b/src/stories/formselect.stories.js index 8418c3b2..7620118b 100644 --- a/src/stories/formselect.stories.js +++ b/src/stories/formselect.stories.js @@ -29,27 +29,41 @@ const Template = (args) => { `; + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.id != null) { select.setAttribute('data-id', args.id); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.value != null) { select.setAttribute('data-value', args.value); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.size != null) { select.setAttribute('data-size', args.size); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.multiple != null) { select.setAttribute('data-multiple', args.multiple); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.displayMultiple != null) { select.setAttribute('data-display-multiple', args.displayMultiple); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.extraClasses != null) { select.setAttribute('data-extra-classes', args.extraClasses); } select.setAttribute('data-aria-label', args.ariaLabel); select.setAttribute('data-disabled', args.disabled); select.setAttribute('data-required', args.required); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.selectChange != null) { select.addEventListener('click', (e) => { args.selectChange(e); diff --git a/src/stories/range.stories.js b/src/stories/range.stories.js index 7523716f..d909c4ed 100644 --- a/src/stories/range.stories.js +++ b/src/stories/range.stories.js @@ -15,12 +15,18 @@ const Template = (args) => { const range = document.createElement('cod-range'); range.setAttribute('data-id', args.id); range.setAttribute('data-disable', args.disable); + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.min != null) { range.setAttribute('data-min', args.min); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.max != null) { range.setAttribute('data-max', args.max); } + // See CityOfDetroit/detroitmi#1099 + // eslint-disable-next-line eqeqeq if (args.step != null) { range.setAttribute('data-step', args.step); }