-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from US-CBP/feature/table
Feature/table
- Loading branch information
Showing
11 changed files
with
385 additions
and
20 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
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
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
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
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
6 changes: 6 additions & 0 deletions
6
packages/web-components/src/components/cbp-table/api-docs.mdx
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,6 @@ | ||
import { Meta, Markdown } from "@storybook/blocks"; | ||
import Docs from './readme.md?raw'; | ||
|
||
<Meta title="Components/Table/API Docs" /> | ||
|
||
<Markdown>{Docs}</Markdown> |
144 changes: 144 additions & 0 deletions
144
packages/web-components/src/components/cbp-table/cbp-table.scss
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,144 @@ | ||
/** | ||
* @prop --cbp-table-color: var(--cbp-color-text-darkest); | ||
* @prop --cbp-table-color-dark: var(--cbp-color-text-lightest); | ||
* @prop --cbp-table-header-color-bg: var(--cbp-color-gray-cool-20); | ||
* @prop --cbp-table-header-color-bg-dark: var(--cbp-color-gray-cool-60); | ||
* @prop --cbp-table-row-color-bg: var(--cbp-color-white); | ||
* @prop --cbp-table-row-color-bg-dark: var(--cbp-color-gray-cool-70); | ||
* @prop --cbp-table-row-color-bg-striped: var(--cbp-color-gray-cool-4); | ||
* @prop --cbp-table-row-color-bg-striped-dark: var(--cbp-color-gray-cool-80); | ||
* @prop --cbp-table-row-color-bg-hover: var(--cbp-color-gray-cool-10); | ||
* @prop --cbp-table-row-color-bg-hover-dark: var(--cbp-color-gray-cool-90); | ||
* @prop --cbp-table-row-color-bg-selected: var(--cbp-color-interactive-selected-light); | ||
* @prop --cbp-table-row-color-bg-selected-dark: var(--cbp-color-interactive-selected-dark); | ||
* @prop --cbp-table-row-color-border: var(--cbp-color-gray-cool-30); | ||
* @prop --cbp-table-row-color-border-dark: var(--cbp-color-gray-cool-50); | ||
* @prop --cbp-table-row-border-size: var(--cbp-border-size-md); | ||
*/ | ||
:root { | ||
--cbp-table-color: var(--cbp-color-text-darkest); | ||
--cbp-table-color-dark: var(--cbp-color-text-lightest); | ||
|
||
--cbp-table-header-color-bg: var(--cbp-color-gray-cool-20); | ||
--cbp-table-header-color-bg-dark: var(--cbp-color-gray-cool-60); | ||
|
||
--cbp-table-row-color-bg: var(--cbp-color-white); | ||
--cbp-table-row-color-bg-dark: var(--cbp-color-gray-cool-70); | ||
--cbp-table-row-color-bg-striped: var(--cbp-color-gray-cool-4); | ||
--cbp-table-row-color-bg-striped-dark: var(--cbp-color-gray-cool-80); | ||
--cbp-table-row-color-bg-hover: var(--cbp-color-gray-cool-10); | ||
--cbp-table-row-color-bg-hover-dark: var(--cbp-color-gray-cool-90); | ||
--cbp-table-row-color-bg-selected: var(--cbp-color-interactive-selected-light); | ||
--cbp-table-row-color-bg-selected-dark: var(--cbp-color-interactive-selected-dark); | ||
|
||
--cbp-table-row-color-border: var(--cbp-color-gray-cool-30); | ||
--cbp-table-row-color-border-dark: var(--cbp-color-gray-cool-50); | ||
--cbp-table-row-border-size: var(--cbp-border-size-md); | ||
} | ||
|
||
|
||
/* | ||
* Dark Mode - display dark design based on mode or context | ||
*/ | ||
[data-cbp-theme=light] cbp-table[context*=dark], | ||
[data-cbp-theme=dark] cbp-table:not([context=dark-inverts]):not([context=light-always]){ | ||
--cbp-table-color: var(--cbp-table-color-dark); | ||
|
||
--cbp-table-header-color: var(--cbp-table-header-color-dark); | ||
--cbp-table-header-color-bg: var(--cbp-table-header-color-bg-dark); | ||
|
||
--cbp-table-row-color-bg: var(--cbp-table-row-color-bg-dark); | ||
--cbp-table-row-color-bg-striped: var(--cbp-table-row-color-bg-striped-dark); | ||
--cbp-table-row-color-bg-hover: var(--cbp-table-row-color-bg-hover-dark); | ||
--cbp-table-row-color-bg-selected: var(--cbp-table-row-color-bg-selected-dark); | ||
|
||
--cbp-table-row-color-border: var(--cbp-table-row-color-border-dark); | ||
} | ||
|
||
cbp-table { | ||
display: block; | ||
max-width: 100%; | ||
overflow-x: auto; | ||
|
||
// Striped rows | ||
&[striped=odd] { | ||
tbody { | ||
tr:nth-child(odd) { | ||
background-color: var(--cbp-table-row-color-bg-striped); | ||
} | ||
} | ||
} | ||
|
||
&[striped=even] { | ||
tbody { | ||
tr:nth-child(even) { | ||
background-color: var(--cbp-table-row-color-bg-striped); | ||
} | ||
} | ||
} | ||
|
||
|
||
table { | ||
margin: 0; | ||
padding: 0; | ||
max-width: 100%; | ||
border-collapse: collapse; | ||
|
||
caption { | ||
text-align: left; | ||
font-size: var(--cbp-font-size-heading-xl); | ||
line-height: var(--cbp-line-height-xl); | ||
} | ||
|
||
th, td { | ||
text-align: left; | ||
padding: var(--cbp-space-3x) var(--cbp-space-4x); | ||
|
||
// TechDebt: may need to do these sorts of overrides for additional components inside of tables and reevaluate where the selectors belong. | ||
&:has(input[type=checkbox]) { | ||
padding-block: 0; | ||
} | ||
|
||
cbp-checkbox { | ||
--cbp-checkbox-min-height: 0; | ||
--cbp-checkbox-margin: 0; | ||
} | ||
|
||
} | ||
|
||
// thead, tfoot | ||
|
||
tbody { | ||
tr { | ||
background-color: var(--cbp-table-row-color-bg); | ||
|
||
&:has(input[type=checkbox]:checked) { | ||
background-color: var(--cbp-table-row-color-bg-selected); | ||
} | ||
|
||
&:hover td { | ||
background-color: var(--cbp-table-row-color-bg-hover); | ||
} | ||
} | ||
} | ||
|
||
tr { | ||
border-bottom: solid var(--cbp-table-row-border-size) var(--cbp-table-row-color-border); | ||
} | ||
|
||
th { | ||
background-color: var(--cbp-table-header-color-bg); | ||
font-weight: var(--cbp-font-weight-medium); | ||
} | ||
|
||
td { | ||
text-wrap: pretty; | ||
} | ||
|
||
} | ||
|
||
|
||
} |
Oops, something went wrong.