Skip to content

Commit

Permalink
Merge branch '2.0.0-alpha1' into issue.199
Browse files Browse the repository at this point in the history
  • Loading branch information
maxatdetroit committed Apr 29, 2024
2 parents 72fe6ca + 8effe22 commit b5aa2c3
Show file tree
Hide file tree
Showing 53 changed files with 1,734 additions and 1,190 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"start-server-and-test": "^1.14.0",
"storybook": "^7.3.2",
"style-loader": "^3.3.1",
"suppress-eslint-errors": "^3.0.1",
"terser-webpack-plugin": "^5.2.4",
"url-loader": "^4.1.1",
"webpack": "^5.61.0",
Expand Down
22 changes: 9 additions & 13 deletions src/components/atoms/AccordionBody/AccordionBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ export default class AccordionBody extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.accordionBody = document.createElement('div');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
this.shadowRoot.addEventListener('slotchange', (ev) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempElements = Array.from(this.children);

this.shadowRoot.addEventListener('slotchange', () => {
const tempElements = Array.from(this.children);
tempElements.forEach((node) => {
this.accordionBody.append(node);
});
Expand All @@ -42,16 +39,15 @@ export default class AccordionBody extends HTMLElement {
connectedCallback() {
// Nav attributes
// TODO: Refactor attribute and class handling.
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let extraClasses = this.getAttribute('data-extra-classes');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let accordionBodyClasses = ['accordion-body'];

const extraClasses = this.getAttribute('data-extra-classes');

const accordionBodyClasses = ['accordion-body'];
if (this.getAttribute('data-li') !== null) {
accordionBodyClasses.push('data-li');
}
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
extraClasses != undefined && extraClasses != null
? accordionBodyClasses.push(extraClasses)
Expand Down
51 changes: 24 additions & 27 deletions src/components/atoms/AccordionItem/AccordionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export default class AccordionItem extends HTMLElement {
this.accordionHeader = document.createElement('div');
this.accordionBody = document.createElement('div');
this.shadowRoot.addEventListener('slotchange', (ev) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempElements = ev.target.assignedElements();
const tempElements = ev.target.assignedElements();
tempElements.forEach((node) => {
// TODO: Refactor attribute and class handling.
node.setAttribute(
Expand All @@ -33,12 +31,14 @@ export default class AccordionItem extends HTMLElement {
'data-index',
)}`,
);
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
this.getAttribute('data-expanded') == 'true'
? node.setAttribute('data-expanded', true)
: 0;
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (node.tagName == 'COD-ACCORDION-HEADER') {
if (this.getAttribute('data-li') !== null) {
Expand Down Expand Up @@ -75,16 +75,16 @@ export default class AccordionItem extends HTMLElement {
this.accordionBody
.querySelector('cod-accordion-body')
.setAttribute('data-expanded', newValue);
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempClasses = this.accordionBody.className.split(' ');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let popValue = tempClasses.pop();
// TODO: See CityOfDetroit/detroitmi#1099

const tempClasses = this.accordionBody.className.split(' ');

const popValue = tempClasses.pop();

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
popValue != 'show' ? tempClasses.push(popValue) : 0;
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (newValue == 'true') {
tempClasses.push('show');
Expand All @@ -95,20 +95,17 @@ export default class AccordionItem extends HTMLElement {
connectedCallback() {
// Nav attributes
// TODO: Refactor attribute and class handling.
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let parentID = this.getAttribute('data-parent-id');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let index = this.getAttribute('data-index');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let expanded = this.getAttribute('data-expanded');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let accordionHeaderClasses = ['accordion-header'];

const parentID = this.getAttribute('data-parent-id');

const index = this.getAttribute('data-index');

const expanded = this.getAttribute('data-expanded');

const accordionHeaderClasses = ['accordion-header'];
let accordionBodyClasses = ['accordion-collapse collapse'];
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
expanded == 'true' ? accordionBodyClasses.push('show') : 0;
if (this.getAttribute('data-li') !== null) {
Expand Down Expand Up @@ -157,7 +154,7 @@ export default class AccordionItem extends HTMLElement {
}

_onClick(e) {
// TODO: See CityOfDetroit/detroitmi#1099
// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (e.target.getAttribute('data-expanded') == 'true') {
this.getRootNode().host.setAttribute('data-expanded', 'false');
Expand Down
51 changes: 20 additions & 31 deletions src/components/atoms/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,11 @@ export default class Alert extends HTMLElement {
const alertContent = document.createElement('div');
alertContent.id = 'alert-content';
this.alert.appendChild(alertContent);
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempElements = Array.from(this.children);

shadow.addEventListener('slotchange', () => {
const tempElements = Array.from(this.children);
tempElements.forEach((node) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let nodeClasses = node.className.split(' ');
const nodeClasses = node.className.split(' ');
nodeClasses.includes('no-wc')
? node.remove()
: this.alert.querySelector('#alert-content').append(node);
Expand All @@ -47,35 +42,29 @@ export default class Alert extends HTMLElement {
this.shadowRoot.appendChild(variableStyles);
this.shadowRoot.appendChild(alertStyles);
// alert attributes
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let icon = this.getAttribute('data-icon');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let iconOrder = this.getAttribute('data-icon-order');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let iconSize = this.getAttribute('data-icon-size');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let backgroundColor = this.getAttribute('data-background-color');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let extraClasses = this.getAttribute('data-extra-classes');

const icon = this.getAttribute('data-icon');

const iconOrder = this.getAttribute('data-icon-order');

const iconSize = this.getAttribute('data-icon-size');

const backgroundColor = this.getAttribute('data-background-color');

const extraClasses = this.getAttribute('data-extra-classes');
this.alert.role = 'alert';
let iconClass = '';
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (icon != undefined && icon != null) {
this.alert.querySelector('#alert-content').className = 'col';
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let activeIcon = document.createElement('cod-icon');

const activeIcon = document.createElement('cod-icon');
activeIcon.setAttribute('data-icon', icon);
activeIcon.setAttribute('data-size', iconSize);
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let iconContainer = document.createElement('div');

const iconContainer = document.createElement('div');
iconContainer.appendChild(activeIcon);
iconClass = 'd-flex';
switch (iconOrder) {
Expand Down
43 changes: 19 additions & 24 deletions src/components/atoms/Badge/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ export default class Badge extends HTMLElement {
// Always call super first in constructor
super();
// Create a shadow root
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
const shadow = this.attachShadow({ mode: 'open' });
this.attachShadow({ mode: 'open' });
}

connectedCallback() {
Expand All @@ -22,30 +20,26 @@ export default class Badge extends HTMLElement {
this.shadowRoot.appendChild(variableStyles);
this.shadowRoot.appendChild(badgeStyles);
// badge attributes
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tag = this.getAttribute('data-tag');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let backgroundColor = this.getAttribute('data-background-color');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let text = this.getAttribute('data-text');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let hiddenText = this.getAttribute('data-hidden-text');

const tag = this.getAttribute('data-tag');

const backgroundColor = this.getAttribute('data-background-color');

const text = this.getAttribute('data-text');

const hiddenText = this.getAttribute('data-hidden-text');
let pill = this.getAttribute('data-pill');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let url = this.getAttribute('data-url');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let extraClasses = this.getAttribute('data-extra-classes');

const url = this.getAttribute('data-url');

const extraClasses = this.getAttribute('data-extra-classes');
let badge = null;
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
pill == 'true' ? (pill = 'rounded-pill') : (pill = '');
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (url != undefined || url != null) {
badge = document.createElement('a');
Expand All @@ -54,7 +48,8 @@ export default class Badge extends HTMLElement {
badge = document.createElement(tag);
}
badge.innerText = text;
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (hiddenText != undefined || hiddenText != null) {
const hiddenBadge = document.createElement('span');
Expand Down
33 changes: 13 additions & 20 deletions src/components/atoms/Breadcrumb/Breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,15 @@ export default class Container extends HTMLElement {
shadow.appendChild(template.content.cloneNode(true));
this.nav = shadow.querySelector('nav');
this.breadcrumb = shadow.querySelector('ol');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempElements = Array.from(this.children);

shadow.addEventListener('slotchange', () => {
const tempElements = Array.from(this.children);
tempElements.forEach((node) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let nodeClasses = node.className.split(' ');
const nodeClasses = node.className.split(' ');
if (nodeClasses.includes('no-wc')) {
node.remove();
} else {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let crumb = this.querySelector('li');
const crumb = this.querySelector('li');
crumb && this.breadcrumb.append(crumb);
}
});
Expand All @@ -54,18 +47,18 @@ export default class Container extends HTMLElement {

connectedCallback() {
// Breadcrumb attributes
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let noDivider = this.getAttribute('data-no-divider');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let svg = this.getAttribute('data-svg-divider');
// TODO: See CityOfDetroit/detroitmi#1099

const noDivider = this.getAttribute('data-no-divider');

const svg = this.getAttribute('data-svg-divider');

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (noDivider == 'true') {
this.nav.style.cssText = "--bs-breadcrumb-divider: '';";
}
// TODO: See CityOfDetroit/detroitmi#1099

// TODO: Fix old ESLint errors - see issue #1099
// eslint-disable-next-line eqeqeq
if (svg != undefined || svg != null) {
this.nav.style.cssText = `--bs-breadcrumb-divider: url(${svg});`;
Expand Down
9 changes: 3 additions & 6 deletions src/components/atoms/CardBody/CardBody.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ export default class CardBody extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.cardBody = document.createElement('div');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempElements = Array.from(this.children);

shadow.addEventListener('slotchange', () => {
const tempElements = Array.from(this.children);
tempElements.forEach((node) => {
this.cardBody.append(node);
});
Expand Down
13 changes: 5 additions & 8 deletions src/components/atoms/CardFooter/CardFooter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styles from '!!raw-loader!./CardFooter.css';
import varStyles from '!!raw-loader!../../../shared/variables.css';
import bootstrapStyles from '!!raw-loader!../../../shared/themed-bootstrap.css';
import varStyles from '!!raw-loader!../../../shared/variables.css';
import styles from '!!raw-loader!./CardFooter.css';

const template = document.createElement('template');

Expand All @@ -16,12 +16,9 @@ export default class CardFooter extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.cardFooter = document.createElement('div');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempElements = Array.from(this.children);

shadow.addEventListener('slotchange', () => {
const tempElements = Array.from(this.children);
tempElements.forEach((node) => {
this.cardFooter.append(node);
});
Expand Down
9 changes: 3 additions & 6 deletions src/components/atoms/CardHeader/CardHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ export default class CardHeader extends HTMLElement {
const shadow = this.attachShadow({ mode: 'open' });
shadow.appendChild(template.content.cloneNode(true));
this.cardHeader = document.createElement('div');
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line no-unused-vars
shadow.addEventListener('slotchange', (ev) => {
// TODO: See CityOfDetroit/detroitmi#1099
// eslint-disable-next-line prefer-const
let tempElements = Array.from(this.children);

shadow.addEventListener('slotchange', () => {
const tempElements = Array.from(this.children);
tempElements.forEach((node) => {
this.cardHeader.append(node);
});
Expand Down
Loading

0 comments on commit b5aa2c3

Please sign in to comment.