Skip to content

Commit 6a76ef0

Browse files
authored
Merge pull request #284 from US-CBP/bugfix/docs-20250424
Bugfix/docs 20250424
2 parents f7b6823 + 3a222d7 commit 6a76ef0

32 files changed

+251
-188
lines changed

packages/web-components/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ The React components are wrappers generated from this package and will share the
66

77
## [unpublished] TBD
88

9+
* Updated `cbp-drawer` to add the ability to persist its contents in the flow of the page at a certain breakpoint, mobilizing to an overlay below that breakpoint.
10+
* Updated the Passenger List archetype to demonstrate this drawer functionality.
911
* Updated the `cbp-dropdown` faux button so that the chevron can be rotated when opened.
1012
* Updated web components readme and included it Storybook under "Using the web components."
1113

1214
## [0.0.1-develop.20] 04-18-2025
15+
1316
* First cut of the `cbp-slider` component for selecting a single value from a range.
1417
* First cut of the `cbp-code-snippet` component, which is used to display code samples.
1518
* Updates to the `cbp-dropdown` component to:
@@ -25,6 +28,7 @@ The React components are wrappers generated from this package and will share the
2528
* Added tag badges (beta, new, etc.) to stories via plugin.
2629

2730
## [0.0.1-develop.19] 02-12-2025
31+
2832
* First cut of the `cbp-subnav` and `cbp-subnav-item` components.
2933
* First cut of the `cbp-file-input` component, supporting only the native web functionality with enhancements to come later.
3034
* First cut of the `cbp-loader` component.
@@ -35,13 +39,15 @@ The React components are wrappers generated from this package and will share the
3539
* Minor bugfixes/updates to `cbp-radio` and `cbp-checkbox`.
3640

3741
## [0.0.1-develop.18] 01-14-2025
42+
3843
* First cut of the `cbp-toggle` component, which acts like a visual treatment for a checkbox.
3944
* First cut of the `cbp-multicol` component, a component-based implementation of multi-column layout used in checklist and radiolist stories.
4045
* Created stories for horizontal checklists and radio lists using `cbp-flex`.
4146
* Decoupled fonts from `cbp-app` for performance testing. They are now included in the package as assets and should be loaded as external resources from the /assets/css files.
4247
* Minor bugfixes/updates to `cbp-dropdown` and `cbp-checkbox`.
4348

4449
## [0.0.1-develop.17] 12-12-2024
50+
4551
* First cut of the `cbp-nav-item` component for including navigation links in the Application Header.
4652
* BREAKING: updated the `cbp-app-header` implementation. The pattern now uses the new `cbp-nav-item` component for the first "Application Name" link. Code should be updated from Storybook for the latest implementation.
4753
* First cut of the `cbp-table` component.
@@ -55,6 +61,7 @@ The React components are wrappers generated from this package and will share the
5561
* Published Stencil-generated component API docs to Storybook. We will continually revisit these for completion.
5662

5763
## [0.0.1-develop.16] 10-28-2024
64+
5865
* First cut of `cbp-checkbox`.
5966
* First cut of `cbp-radio`.
6067
* First cut of `cbp-toast`.

packages/web-components/assets/css/storybook-canvas.css

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,4 @@ body:has(cbp-app[data-cbp-theme="dark"]) {
2525

2626
.sbdocs table {
2727
width: 100% !important;
28-
}
29-
30-
31-
32-
/* TechDebt: Remove when table component is added to design tokens story */
33-
#design-tokens table {
34-
width: 100%;
35-
border-collapse: collapse;
36-
border: solid 1px #999;
37-
margin-block-end: 2rem;
38-
}
39-
40-
#design-tokens tr {
41-
border-block-end: solid 1px #999;
42-
}
43-
44-
45-
#design-tokens th,
46-
#design-tokens td {
47-
text-align: left;
48-
width: 33.3%;
49-
padding: .5rem;
50-
margin: 0;
51-
border: 0;
52-
border-block-end: solid 1px #999;
53-
}
28+
}
48.5 KB
Loading

packages/web-components/readme.md

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Including the CBP Design System Web Components
1+
# Using the CBP Design System Web Components
2+
3+
## Including the Web Components in Your Application
24

3-
There are a couple strategies for including the CBP Design System web components in your site or application, detailed below.
5+
There are a couple strategies for including the CBP Design System web components in your site or application, detailed below.
46

5-
## Node Modules
7+
### Node Modules
68

79
The CBP Design System [web components](https://www.npmjs.com/package/@cbpds/web-components) (and [React wrappers](https://www.npmjs.com/package/@cbpds/react-components)) are published to npm.
810

@@ -18,14 +20,14 @@ import { defineCustomElements } from '@cbpds/web-components/dist/esm/loader.js';
1820
defineCustomElements();
1921
```
2022

21-
## Script tag
23+
### Script tag
2224

2325
For sites not running in a node.js environment or requiring a build step, the web components may be included via script tag:
2426

2527
- Put a script tag referencing the loader module in the head of your index.html or template file.
26-
- This file is a loader, which registers all of the design system components and lazy-loads individual components as needed.
27-
- Note: ESM modules must be delivered over SSL/https.
28-
- Then you can use the web components (custom elements) anywhere in your template, JSX, html, etc.
28+
- This file is a loader, which registers all of the design system components and lazy-loads individual components as needed.
29+
- Note: ESM modules must be delivered over SSL/https.
30+
- Then you can use the web components (custom elements) anywhere in your template, JSX, html, etc.
2931

3032
You can use UNPKG (an open source global content delivery network that mirrors npm) for testing, but it should never be used for production apps.
3133

@@ -47,15 +49,27 @@ Ideally, your application should reference an central, organization-hosted copy
4749
<script type="module" src="./assets/cbp-web-components/cbp-web-components.esm.js"></script>
4850
```
4951

50-
# Using the CBP Design System Web Components
52+
## Using the Web Components
5153

5254
Once the CBP Design System web components have been included in your site or application, the are used like any other HTML elements - they are custom elements, after all.
5355

5456
It is recommended that the [`cbp-app` web component](https://us-cbp.github.io/design-system/?path=/docs/components-app-specifications--docs) is used to wrap the entire contents of your application or site template to include the global CSS variables (design tokens) that are used throughout the design system for styling the components.
5557

5658
To get started quickly, you may copy the markup from one of our ["template" stories](https://us-cbp.github.io/design-system/?path=/story/patterns-page-templates--internal) to wrap your application or site content.
5759

58-
# Fonts and Assets
60+
Here's an example of a button component:
61+
62+
```
63+
<cbp-button
64+
type="button"
65+
fill="solid"
66+
color="primary"
67+
>
68+
Default
69+
</cbp-button>
70+
```
71+
72+
## Fonts and Assets
5973

6074
Regardless of how you include the web components (either method above), you'll still need some assets that are part of the CBP Design System package but are not encapsulated in the `cbp-app` web component or any others:
6175

@@ -71,4 +85,15 @@ Copy and paste the following into your index.html or template file:
7185
<link rel="stylesheet" type="text/css" href="./assets/css/roboto_mono.css">
7286
```
7387

74-
If the path to your application's assets folder is different than `"./assets"`, you may need to provide the paths as properties of the `cbp-universal-header` component as part of your site/application template.
88+
These CSS files assume a directory structure of:
89+
90+
- webroot
91+
- assets
92+
- css
93+
- fonts
94+
- roboto
95+
- roboto-mono
96+
97+
Any deviations from this structure may require editing of the linked CSS files and paths to the fonts.
98+
99+
If the path to your application's assets folder is different than `"./assets"`, you may also need to provide the paths as properties of the `cbp-universal-header` component as part of your site/application template.

packages/web-components/src/components/cbp-accordion/cbp-accordion.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Component, Prop, Element, Host, h } from '@stencil/core';
22
import { setCSSProps } from '../../utils/utils';
33

4+
/**
5+
* @slot - Accordion Items shall be slotted in the default slot. While other content may be included within the default slot, it is not recommended.
6+
*/
47
@Component({
58
tag: 'cbp-accordion',
69
styleUrl: 'cbp-accordion.scss',
710
})
811

9-
/**
10-
* @slot - Accordion Items shall be slotted in the default slot. While other content may be included within the default slot, it is not recommended.
11-
*/
1212
export class CbpAccordion {
1313
private items: HTMLCbpAccordionItemElement[];
1414

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
/**
2+
* @prop --cbp-action-bar-color-dark: var(--cbp-color-text-lightest);
23
* @prop --cbp-action-bar-color-background: var(--cbp-color-grey-cool-70);
3-
* @prop--cbp-action-bar-color-background-dark: var(--cbp-color-grey-cool-5);
4-
*/
5-
//todo: swap light and dark values so context works correctly
4+
* @prop --cbp-action-bar-color-background-dark: var(--cbp-color-grey-cool-5);
5+
* @prop --cbp-action-bar-color: var(--cbp-color-text-darkest);
6+
*/
67
:root {
7-
--cbp-action-bar-color-background: var(--cbp-color-gray-cool-5);
8-
--cbp-action-bar-color-background-dark: var(--cbp-color-gray-cool-70);
9-
10-
--cbp-action-bar-color: var(--cbp-color-text-darkest);
11-
--cbp-action-bar-color-dark: var(--cbp-color-text-lightest);
12-
8+
--cbp-action-bar-color: var(--cbp-color-text-darkest);
9+
--cbp-action-bar-color-dark: var(--cbp-color-text-lightest);
10+
--cbp-action-bar-color-background: var(--cbp-color-gray-cool-5);
11+
--cbp-action-bar-color-background-dark: var(--cbp-color-gray-cool-70);
1312
}
1413

15-
[data-cbp-theme=light] cbp-action-bar[context*=dark]:not([context=light-always]),
16-
[data-cbp-theme=dark] cbp-action-bar:not([context=dark-inverts]):not([context=light-always]) {
17-
--cbp-action-bar-color-background: var(--cbp-action-bar-color-background-dark);
14+
[data-cbp-theme='light'] cbp-action-bar[context*='dark']:not([context='light-always']),
15+
[data-cbp-theme='dark'] cbp-action-bar:not([context='dark-inverts']):not([context='light-always']) {
1816
--cbp-action-bar-color: var(--cbp-action-bar-color-dark);
19-
17+
--cbp-action-bar-color-background: var(--cbp-action-bar-color-background-dark);
2018
}
2119

2220
cbp-action-bar {
2321
display: flex;
22+
flex-wrap: wrap;
2423
align-items: center;
2524
justify-content: right;
2625
min-height: var(--cbp-space-14x);
@@ -30,17 +29,15 @@ cbp-action-bar {
3029
background-color: var(--cbp-action-bar-color-background);
3130
gap: var(--cbp-space-3x);
3231

33-
& > *[slot="cbp-action-bar-info"]{
32+
& > *[slot=cbp-action-bar-info] {
3433
margin-inline-end: auto;
35-
}
36-
/*
37-
*** Sticky variant position
38-
*/
39-
&[variant=floating] {
34+
}
35+
36+
&[variant=floating] {
4037
position: fixed;
4138
bottom: 0;
4239
left: 0;
4340
padding-inline: var(--cbp-responsive-spacing-outer);
4441
box-shadow: var(--cbp-shadow-level-3-up);
45-
}
42+
}
4643
}

packages/web-components/src/components/cbp-action-bar/cbp-action-bar.specs.mdx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,29 @@ import { Meta } from '@storybook/addon-docs';
66

77
## Purpose
88

9-
The Action bar serves several purposes, the most common use case is a submission bar in a form page. Alternatively the bar can be used to
10-
contain tools that affect the content of the page the user is on.
9+
The Action Bar acts as a container for form controls (buttons) or other tools to affect the content of the page.
1110

1211
## Functional Requirements
1312

14-
* The Action bar is a container with slots for a status or text description of the action bar and a slot for the buttons/links to be displayed
15-
* Action bar comes with 2 variants, inline & floating.
16-
*inline: is rendered inplace. Primarily for supporting Forms, strucutred list footer, grids, etc
17-
*floating: is rendered at bottom of viewport, used for containing tools that affect the content of the whole page the user is viewing
13+
* The Action Bar is a container with slots for a status or text description as well as controls.
14+
* The descriptive text in the named slot is aligned left.
15+
* The controls are aligned to the right.
16+
* The Action Bar has two variants - inline and floating.
17+
* The inline variant is teh default and renders in the flow of the document.
18+
* The floating variant is rendered at bottom of viewport, primarily tools that affect the content of the whole page.
1819

1920
### Responsiveness
2021

21-
* Since content is slotted into the action bar the end user can alter/add items to hide, alter as needed for Responsiveness
22-
* Inline variant is designed to follow the overall responsiveness of the control/container it is in so that behavior does not conflict
23-
with these other controls
24-
* Sticky variant utilizes responsive padding variables to adjust as per overall design system breakpoints
22+
* The Action Bar will fill 100% of the screen (floating) or parent (inline).
23+
* The Action Bar will wrap as needed at smaller screen sizes, but...
24+
* It is up to the developer to make sure its contents are fully responsive.
25+
* The sticky variant uses the responsive padding token to adjust outer padding at the same ratio as other template elements.
2526

2627
### Accessibility
2728

28-
* Action bar as a container does not recieve focus, it also does not inhibit the native Accessibility of any of the slotted content.
29-
Thus consumers will need to ensure that any slotted content is accessibile (CBP components will come with this natively)
29+
* The action bar itself does not receive focus and the accessibility of its slotted contents are the responsibility of those components.
30+
* When using the floating variant, it is important that the component be placed logically in the source code order so that its controls and content exist in the proper place in the document and tab order.
3031

3132
### Additional Notes and Considerations
3233

33-
* it is not advised to use both inline and floating action bar on the same page to avoid user confusion
34+
* In order to avoid user confusion, it is not advised to use both inline and floating action bar on the same page.

packages/web-components/src/components/cbp-action-bar/cbp-action-bar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { Component, Host, Element, Prop, h } from '@stencil/core';
22
import { setCSSProps } from '../../utils/utils';
33

4+
/**
5+
* @slot - Any controls or content may be slotted into the default slot and will be aligned to the right of the bar.
6+
* @slot cbp-action-bar-info - This named slot is intended for information placed before the default slot content, aligned to the left of the bar.
7+
*/
48
@Component({
59
tag: 'cbp-action-bar',
610
styleUrl: 'cbp-action-bar.scss',
711
})
812
export class CbpActionBar {
913
@Element() host: HTMLElement;
1014

11-
/** variant for type: floating/inline */
15+
/** Specifies whether the action bar is inline or floating. Defaults to inline. */
1216
@Prop({ reflect: true }) variant: 'inline' | 'floating' = 'inline'
1317

1418
/** Specifies the context of the component as it applies to the visual design and whether it inverts when light/dark mode is toggled. Default behavior is "light-inverts" and does not have to be specified. */
@@ -34,5 +38,4 @@ export class CbpActionBar {
3438
</Host>
3539
);
3640
}
37-
3841
}

packages/web-components/src/components/cbp-app/cbp-app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Component, Prop, Host, h, Env } from '@stencil/core';
66
*/
77

88
/**
9-
* @slot - All application markup should be placed within the default slot to inherit the base CSS, fonts, and dark mode styling.
9+
* @slot - All application markup should be placed within the default slot to inherit the base CSS, design tokens, and dark mode styling.
1010
*/
1111
@Component({
1212
tag: 'cbp-app',

packages/web-components/src/components/cbp-badge/cbp-badge.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/**
2-
* @prop --cbp-badge-color: var(--cbp-color-text-lightest);
32
* @prop --cbp-badge-color: var(--cbp-color-text-lightest);
43
* @prop --cbp-badge-color-dark: var(--cbp-color-text-darkest);
54
* @prop --cbp-badge-color-background: var(--cbp-color-info-base);
@@ -16,8 +15,6 @@
1615
[data-cbp-theme=dark] cbp-badge:not([context=dark-inverts]):not([context=light-always]) {
1716
--cbp-badge-color: var(--cbp-badge-color-dark);
1817
--cbp-badge-color-background: var(--cbp-badge-color-background-dark);
19-
20-
--cbp-badge-color-background-danger: var(--cbp-badge-color-background-danger-dark);
2118
}
2219

2320
cbp-badge {

0 commit comments

Comments
 (0)