-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5521bec
commit 2e860c7
Showing
30 changed files
with
454 additions
and
1,052 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
"@collapsed/web-component": patch | ||
"@collapsed/lit": patch | ||
--- | ||
|
||
New implementation of collapsed as a Lit web component. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 🙈 Collapsed | ||
|
||
[![CI][ci-badge]][ci] | ||
![npm bundle size (version)][minzipped-badge] | ||
[![npm version][npm-badge]][npm-version] | ||
[![Netlify Status](https://api.netlify.com/api/v1/badges/5a5b0e80-d15e-4983-976d-37fe6bdada7a/deploy-status)](https://app.netlify.com/sites/react-collapsed/deploys) | ||
|
||
Headless UI for building flexible and accessible animating expand/collapse sections or disclosures. Animates the height of elements to `auto`. | ||
|
||
```bash | ||
npm install react-collapsed | ||
``` | ||
|
||
[View installation and usage docs here!](/packages/react-collapsed) | ||
|
||
## Experimental Framework Adapters | ||
|
||
[react-collapsed][react-collapsed] is stable and ready to use. I've also been exploring a rewrite with a framework-agnostic core that's also available with a few different framework adapters (indicated with the `@collapsed/` namespace). Here's a breakdown to clarify what's available and their stability: | ||
|
||
| Package | Stable | | ||
| ---------------------------------- | ------ | | ||
| [react-collapsed][react-collapsed] | ✅ | | ||
| [@collapsed/core](packages/core) | 🚧 | | ||
| [@collapsed/react](packages/react) | 🚧 | | ||
| [@collapsed/solid](packages/solid) | 🚧 | | ||
| [@collapsed/lit](packages/lit) | 🚧 | | ||
|
||
[react-collapsed]: /packages/react-collapsed | ||
[minzipped-badge]: https://img.shields.io/bundlephobia/minzip/react-collapsed/latest | ||
[npm-badge]: http://img.shields.io/npm/v/react-collapsed.svg?style=flat | ||
[npm-version]: https://npmjs.org/package/react-collapsed "View this project on npm" | ||
[ci-badge]: https://github.com/roginfarrer/collapsed/workflows/CI/badge.svg | ||
[ci]: https://github.com/roginfarrer/collapsed/actions/workflows/main.yml?query=branch:main | ||
[netlify]: https://app.netlify.com/sites/react-collapsed/deploys | ||
[netlify-badge]: https://api.netlify.com/api/v1/badges/4d285ffc-aa4f-4d32-8549-eb58e00dd2d1/deploy-status |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
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,3 @@ | ||
module.exports = { | ||
extends: ["../../internal/eslint-config-collapsed/index.cjs"], | ||
}; |
File renamed without changes.
File renamed without changes.
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,44 @@ | ||
# @collapsed/lit | ||
|
||
A Lit element for creating accessible expand/collapse elements. Animates the height using CSS transitions from `0` to `auto`. | ||
|
||
## Features | ||
|
||
- Handles the height of animations of your elements, `auto` included! | ||
- Minimally-styled to be functional--you control the styles. | ||
- No animation framework required! Simply powered by CSS animations. | ||
|
||
## Installation | ||
|
||
```bash | ||
npm install @collapsed/lit | ||
``` | ||
|
||
## Usage | ||
|
||
```tsx | ||
import { CollapsedDisclosure } from "@collapsed/lit"; | ||
import { html } from "lit"; | ||
|
||
export function App() { | ||
function handleClick(evt) { | ||
const collapse = document.querySelector("#disclosure"); | ||
const btn = event.target; | ||
collapse.toggleAttribute("open"); | ||
btn.setAttribute("aria-expanded", collapse.hasAttribute("open").toString()); | ||
} | ||
|
||
return html`<div> | ||
<button | ||
aria-controls="disclosure" | ||
aria-expanded="false" | ||
@click="${handleClick}" | ||
> | ||
Toggle | ||
</button> | ||
<collapsed-disclosure id="disclosure"> | ||
<!-- Content goes here --> | ||
</collapsed-disclosure> | ||
</div>`; | ||
} | ||
``` |
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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.