Skip to content

Commit

Permalink
feat: Dialog - add remove-body-scroll attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrobino committed Apr 12, 2024
1 parent d5d1f10 commit f3c8d7e
Show file tree
Hide file tree
Showing 22 changed files with 362 additions and 322 deletions.
Binary file modified bun.lockb
Binary file not shown.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "drab",
"description": "A headless custom element library",
"version": "5.3.6",
"version": "5.4.0",
"homepage": "https://drab.robino.dev",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -184,19 +184,19 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.12",
"@types/node": "^20.11.30",
"@types/node": "^20.12.7",
"@vercel/analytics": "^1.2.2",
"autoprefixer": "^10.4.19",
"domco": "^0.5.3",
"domco": "^0.5.4",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.5.13",
"robino": "^0.1.0",
"tailwindcss": "^3.4.3",
"tsup": "^8.0.2",
"typedoc": "^0.25.12",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^3.17.1",
"typescript": "^5.4.3",
"uico": "^0.2.2",
"vite": "^5.2.6"
"typescript": "^5.4.5",
"uico": "^0.2.4",
"vite": "^5.2.8"
}
}
1 change: 1 addition & 0 deletions src/docs/dialog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="mb-4">
<drab-dialog
click-outside-close
remove-body-scroll
animation-keyframe-from-transform="translateX(100%)"
animation-keyframe-to-transform="translateX(0)"
>
Expand Down
6 changes: 3 additions & 3 deletions src/lib/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

### Write JavaScript, or don't

- Elements can be installed as a package (recommended), or utilized without writing any JavaScript by adding a `script` tag to your document.
- Elements can be [installed](http://drab.robino.dev/getting-started/#install) as a package (recommended), or utilized without writing any JavaScript by adding a `script` tag to your document.
- Each element can be configured through HTML attributes, making it possible to use an alternative language for your backend.

### Built in animations
Expand All @@ -34,7 +34,7 @@ Since this is an headless library, simple elements like a badge that can be easi

### Local Development

This library is built with [Vite](https://vitejs.dev), [domco](https://domco.robino.dev), and TypeScript. The package contents are located in `src/package`.
This library is built with [TypeScript](https://www.typescriptlang.org/) and [tsup](https://tsup.egoist.dev/). The docs are built with [Vite](https://vitejs.dev), [domco](https://domco.robino.dev), and [TailwindCSS](https://tailwindcss.com). The package contents are located in `src/package`.

1. Clone the [repository](https://github.com/rossrobino/drab)
2. `bun i`
Expand All @@ -46,4 +46,4 @@ This library is built with [Vite](https://vitejs.dev), [domco](https://domco.rob
2. Add or edit the example in `src/docs`.
3. Export the element from `src/package/index.ts`.
4. Run `bun doc` to document your element with [TypeDoc](https://typedoc.org/).
5. Add the element as an entry point to `tsup.config.ts`, then run `bun package` to build with [tsup](https://tsup.egoist.dev/).
5. Add the element as an entry point to `tsup.config.ts`, then run `bun package` to build with tsup.
32 changes: 16 additions & 16 deletions src/lib/docs/classes/animate.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Animations `options` can be set:

#### Defined in

[src/package/animate/index.ts:39](https://github.com/rossrobino/components/blob/c9c92dd/src/package/animate/index.ts#L39)
[src/package/animate/index.ts:39](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/animate/index.ts#L39)

---

Expand All @@ -75,7 +75,7 @@ To clean up event listeners added to `document` when the element is removed.

#### Defined in

[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L17)
[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L17)

---

Expand All @@ -93,7 +93,7 @@ An object containing the values of each `animation-option` attribute

#### Defined in

[src/package/animate/index.ts:46](https://github.com/rossrobino/components/blob/c9c92dd/src/package/animate/index.ts#L46)
[src/package/animate/index.ts:46](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/animate/index.ts#L46)

### event

Expand All @@ -119,7 +119,7 @@ Base.event

#### Defined in

[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L30)
[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L30)

`set` **event**(`value`): `void`

Expand All @@ -139,7 +139,7 @@ Base.event

#### Defined in

[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L34)
[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L34)

### keyframes

Expand All @@ -151,7 +151,7 @@ Base.event

#### Defined in

[src/package/animate/index.ts:128](https://github.com/rossrobino/components/blob/c9c92dd/src/package/animate/index.ts#L128)
[src/package/animate/index.ts:128](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/animate/index.ts#L128)

---

Expand Down Expand Up @@ -185,7 +185,7 @@ Animates a particular element using the web animations API.

#### Defined in

[src/package/animate/index.ts:76](https://github.com/rossrobino/components/blob/c9c92dd/src/package/animate/index.ts#L76)
[src/package/animate/index.ts:76](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/animate/index.ts#L76)

### connectedCallback

Expand All @@ -201,7 +201,7 @@ Animates a particular element using the web animations API.

#### Defined in

[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L152)
[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L152)

### destroy

Expand All @@ -219,7 +219,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L159)
[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L159)

### disconnectedCallback

Expand All @@ -235,7 +235,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L161)
[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L161)

### getContent

Expand Down Expand Up @@ -271,7 +271,7 @@ this.querySelector("[data-content]");

#### Defined in

[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L55)
[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L55)

### getTrigger

Expand Down Expand Up @@ -301,7 +301,7 @@ this.querySelectorAll("[data-trigger]");

#### Defined in

[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L42)
[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L42)

### mount

Expand All @@ -321,7 +321,7 @@ The reason for this is to make these elements work better with frameworks like S

#### Defined in

[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L150)
[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L150)

### safeListener

Expand Down Expand Up @@ -356,7 +356,7 @@ element is removed from the DOM, these event listeners are cleaned up.

#### Defined in

[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L118)
[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L118)

### swapContent

Expand All @@ -382,7 +382,7 @@ swaps `this.content()` with the content of the element found.

#### Defined in

[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L72)
[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L72)

### triggerListener

Expand Down Expand Up @@ -413,4 +413,4 @@ swaps `this.content()` with the content of the element found.

#### Defined in

[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L135)
[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L135)
26 changes: 13 additions & 13 deletions src/lib/docs/classes/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ HTMLElement.constructor

#### Defined in

[src/package/base/index.ts:19](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L19)
[src/package/base/index.ts:19](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L19)

---

Expand All @@ -67,7 +67,7 @@ To clean up event listeners added to `document` when the element is removed.

#### Defined in

[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L17)
[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L17)

---

Expand All @@ -93,7 +93,7 @@ keyof `HTMLElementEventMap`

#### Defined in

[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L30)
[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L30)

`set` **event**(`value`): `void`

Expand All @@ -109,7 +109,7 @@ keyof `HTMLElementEventMap`

#### Defined in

[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L34)
[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L34)

---

Expand All @@ -125,7 +125,7 @@ keyof `HTMLElementEventMap`

#### Defined in

[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L152)
[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L152)

### destroy

Expand All @@ -139,7 +139,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L159)
[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L159)

### disconnectedCallback

Expand All @@ -151,7 +151,7 @@ Passed into `disconnectedCallback`, since `Base` needs to run `disconnectedCallb

#### Defined in

[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L161)
[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L161)

### getContent

Expand Down Expand Up @@ -183,7 +183,7 @@ this.querySelector("[data-content]");

#### Defined in

[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L55)
[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L55)

### getTrigger

Expand All @@ -209,7 +209,7 @@ this.querySelectorAll("[data-trigger]");

#### Defined in

[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L42)
[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L42)

### mount

Expand All @@ -225,7 +225,7 @@ The reason for this is to make these elements work better with frameworks like S

#### Defined in

[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L150)
[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L150)

### safeListener

Expand Down Expand Up @@ -256,7 +256,7 @@ element is removed from the DOM, these event listeners are cleaned up.

#### Defined in

[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L118)
[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L118)

### swapContent

Expand All @@ -278,7 +278,7 @@ swaps `this.content()` with the content of the element found.

#### Defined in

[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L72)
[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L72)

### triggerListener

Expand All @@ -305,4 +305,4 @@ swaps `this.content()` with the content of the element found.

#### Defined in

[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/c9c92dd/src/package/base/index.ts#L135)
[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/d5d1f10397ac02ff73b15264f6245f23a8f58eac/src/package/base/index.ts#L135)
Loading

0 comments on commit f3c8d7e

Please sign in to comment.