-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to remove redundant statement
- Loading branch information
Showing
27 changed files
with
526 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import styles from '!!raw-loader!./TableV2.css'; | ||
import varStyles from '!!raw-loader!../../../shared/variables.css'; | ||
import bootstrapStyles from '!!raw-loader!../../../shared/themed-bootstrap.css'; | ||
|
||
class TableV2 extends HTMLElement { | ||
static observedAttributes = []; | ||
|
||
constructor() { | ||
// Always call super first in constructor | ||
super(); | ||
// Create a shadow root | ||
const shadow = this.attachShadow({ mode: 'open' }); | ||
// Add styles | ||
const bootStyles = document.createElement('style'); | ||
bootStyles.textContent = bootstrapStyles; | ||
const variableStyles = document.createElement('style'); | ||
variableStyles.textContent = varStyles; | ||
const itemStyles = document.createElement('style'); | ||
itemStyles.textContent = styles; | ||
shadow.appendChild(bootStyles); | ||
shadow.appendChild(variableStyles); | ||
shadow.appendChild(itemStyles); | ||
} | ||
|
||
connectedCallback() { | ||
// TODO: Add support for: scrollable, | ||
// custom extra classes, dark, hover, and | ||
// striped columns/rows. | ||
this.shadowRoot.append(...this.childNodes); | ||
this._addTableClasses(); | ||
this._slotCells(); | ||
} | ||
|
||
_addTableClasses() { | ||
const table = this.shadowRoot.querySelector('table'); | ||
table.classList.add('table'); | ||
|
||
const isStacked = this.hasAttribute('table-stacked'); | ||
if (isStacked) { | ||
table.classList.add('table-stacked'); | ||
} | ||
} | ||
|
||
_slotCells() { | ||
const cells = this.shadowRoot.querySelectorAll('td'); | ||
const cellHeaders = this.shadowRoot.querySelectorAll('th'); | ||
[...cells, ...cellHeaders].forEach((cellNode, idx) => { | ||
const children = cellNode.childNodes; | ||
const contentDiv = document.createElement('div'); | ||
contentDiv.classList.add('content'); | ||
const slotName = `slot-${idx}`; | ||
contentDiv.setAttribute('slot', slotName); | ||
contentDiv.append(...children); | ||
|
||
const slot = document.createElement('slot'); | ||
slot.setAttribute('name', slotName); | ||
cellNode.appendChild(slot); | ||
|
||
this.appendChild(contentDiv); | ||
}); | ||
} | ||
} | ||
|
||
export { TableV2 as default }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@use '../../../scss/mixins/table'; | ||
@import 'bootstrap/scss/functions'; | ||
@import 'bootstrap/scss/variables'; | ||
@import 'bootstrap/scss/mixins/breakpoints'; | ||
|
||
@include media-breakpoint-down(lg) { | ||
table.table-stacked { | ||
& slot { | ||
display: block; | ||
flex: 1 1 0px; | ||
padding: 0.5em 0.5em; | ||
} | ||
|
||
// Header & body styles. | ||
& thead { | ||
// Move table header off the screen to hide from | ||
// sited viewers but remain enabled for screen readers | ||
// and other AT. | ||
position: absolute; | ||
left: -10000px; | ||
top: auto; | ||
width: 1px; | ||
height: 1px; | ||
overflow: hidden; | ||
} | ||
|
||
// Row styles. | ||
& tr { | ||
display: block; | ||
border-top-width: 0; | ||
width: 100%; | ||
border-bottom: 2px solid var(--bs-black); | ||
|
||
&:nth-child(1) { | ||
border-top: 2px solid var(--bs-black); | ||
} | ||
} | ||
|
||
// Cell header styles. | ||
& th { | ||
@include table.th-td-stacked-inline-styles; | ||
|
||
& div.content { | ||
@include table.cell-content-stacked-inline-styles; | ||
} | ||
} | ||
|
||
& th[data-label] { | ||
@include table.th-td-labeled-stacked-inline-styles; | ||
} | ||
|
||
// Cell styles. | ||
& td { | ||
@include table.th-td-stacked-inline-styles; | ||
|
||
& div.content { | ||
@include table.cell-content-stacked-inline-styles; | ||
} | ||
} | ||
|
||
& td[data-label] { | ||
@include table.th-td-labeled-stacked-inline-styles; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import TableV2 from './TableV2'; | ||
customElements.define('cod-table-v2', TableV2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
const COMMON_STORY_ARGS = { | ||
disabled: { | ||
control: { type: 'boolean' }, | ||
}, | ||
required: { | ||
control: { type: 'boolean' }, | ||
}, | ||
checked: { | ||
control: { type: 'boolean' }, | ||
}, | ||
readOnly: { | ||
control: { type: 'boolean' }, | ||
}, | ||
bootstrapColor: { | ||
control: { type: 'select' }, | ||
options: [ | ||
'primary', | ||
'secondary', | ||
'success', | ||
'info', | ||
'warning', | ||
'danger', | ||
'light', | ||
'dark', | ||
'accent-primary', | ||
'accent-secondary', | ||
], | ||
}, | ||
// TODO: Use bootstrap color names. Issue #202. | ||
numberColor: { | ||
control: { type: 'select' }, | ||
options: [ | ||
'color-1', | ||
'color-2', | ||
'color-3', | ||
'color-4', | ||
'color-5', | ||
'color-light', | ||
'color-dark', | ||
], | ||
}, | ||
order: { | ||
control: { type: 'select' }, | ||
options: ['left', 'right'], | ||
}, | ||
// TODO: Make the following two size attr names/values | ||
// consistent. Issue #202. | ||
size: { | ||
control: { type: 'select' }, | ||
options: ['sm', 'md', 'lg', 'xl'], | ||
}, | ||
longSize: { | ||
control: { type: 'select' }, | ||
options: ['small', 'medium', 'large', 'x-large'], | ||
}, | ||
icon: { | ||
control: { type: 'select' }, | ||
options: [ | ||
'bicycle', | ||
'bounding-box', | ||
'bounding-box-circle', | ||
'building', | ||
'building-fill', | ||
'buildings', | ||
'buildings-fill', | ||
'bus-front', | ||
'bus-front-fill', | ||
'calendar', | ||
'calendar-fill', | ||
'calendar-date', | ||
'calendar-date-fill', | ||
'cash', | ||
'check-circle', | ||
'check-circle-fill', | ||
'chevron-right', | ||
'chevron-right-circle', | ||
'chevron-right-circle-fill', | ||
'chevron-left', | ||
'chevron-left-circle', | ||
'chevron-left-circle-fill', | ||
'chevron-up', | ||
'chevron-up-circle', | ||
'chevron-up-circle-fill', | ||
'chevron-down', | ||
'chevron-down-circle', | ||
'chevron-down-circle-fill', | ||
'currency-dollar', | ||
'exclamation-circle', | ||
'exclamation-circle-fill', | ||
'exclamation-triangle', | ||
'file-earmark', | ||
'funnel', | ||
'funnel-fill', | ||
'house', | ||
'house-fill', | ||
'list-task', | ||
'newspaper', | ||
'no-parking', | ||
'no-parking-fill', | ||
'journals', | ||
'p-circle', | ||
'p-circle-fill', | ||
'toilet', | ||
'universal-access', | ||
'universal-access-circle', | ||
'wifi', | ||
'wifi-off', | ||
].sort(), | ||
}, | ||
}; | ||
|
||
export { COMMON_STORY_ARGS }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.