2.2.0 • Published 6 months ago

@brightspace-ui-labs/checkbox-drawer v2.2.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

@brightspace-ui-labs/checkbox-drawer

NPM version

Note: this is a "labs" component. While functional, these tasks are prerequisites to promotion to BrightspaceUI "official" status:

The d2l-labs-checkbox-drawer element can be used to get a checkbox with a description. When checked, drawer contents are revealed underneath.

Installation

Install from NPM:

npm install @brightspace-ui-labs/checkbox-drawer

Usage

<script type="module">
    import '@brightspace-ui-labs/checkbox-drawer/checkbox-drawer.js';
</script>
<d2l-labs-checkbox-drawer>
  <p>My drawer content.</p>
</d2l-labs-checkbox-drawer>

Properties:

PropertyTypeDescription
aria-labelStringProvides context for the component. Must be used if label is not used. Cannot be used with label.
checkedBooleanTrue if the checkbox is checked. False if not checked.
descriptionStringExtra information that is displayed beneath the label. Optionally used when label is used. Cannot be used with aria-label.
labelStringProvides visible information about the component. Must be used if aria-label is not used. Cannot be used with aria-label.

Accessibility:

To make your usage of d2l-labs-checkbox-drawer accessible, use the following properties when applicable:

AttributeDescription
aria-labelProvides context for the component. Must be used if label is not used. Cannot be used with label.

Events:

  • d2l-checkbox-drawer-checked-change: dispatched when checkbox's state changes.
  • d2l-checkbox-drawer-expand: dispatched when the drawer starts to expand. As per the expand collapse component, the detail contains an expandComplete promise that can be waited on to determine when the content has finished expanding.
  • d2l-checkbox-drawer-collapse: dispatched when the drawer starts to collapse. As per the expand collapse component, the detail contains a collapseComplete promise that can be waited on to determine when the content has finished collapsing.

Developing, Testing and Contributing

After cloning the repo, run npm install to install dependencies.

Linting

# eslint and lit-analyzer
npm run lint

# eslint only
npm run lint:eslint

Testing

# lint & run headless unit tests
npm test

# unit tests only
npm run test:headless

# debug or run a subset of local unit tests
# then navigate to `http://localhost:9876/debug.html`
npm run test:headless:watch

Running the demos

To start an es-dev-server that hosts the demo page and tests:

npm start

Versioning and Releasing

This repo is configured to use semantic-release. Commits prefixed with fix: and feat: will trigger patch and minor releases when merged to main.

To learn how to create major releases and release from maintenance branches, refer to the semantic-release GitHub Action documentation.

2.2.0

6 months ago

2.1.9

6 months ago

2.1.6

9 months ago

2.1.8

7 months ago

2.1.7

7 months ago

2.1.5

1 year ago

2.1.4

1 year ago

2.1.2

1 year ago

2.1.3

1 year ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.2.2

2 years ago

1.2.0

2 years ago

1.2.1

2 years ago

1.1.0

3 years ago

1.0.0

3 years ago