Skip to content

Commit

Permalink
feat: add click-outside-close attribute to dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrobino committed Feb 27, 2024
1 parent 280c485 commit 0ffb081
Show file tree
Hide file tree
Showing 21 changed files with 338 additions and 310 deletions.
2 changes: 1 addition & 1 deletion 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.1",
"version": "5.3.2",
"homepage": "https://drab.robino.dev",
"license": "MIT",
"author": {
Expand Down
1 change: 1 addition & 0 deletions src/docs/dialog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<div class="mb-4">
<drab-dialog
click-outside-close
animation-keyframe-from-transform="translateX(100%)"
animation-keyframe-to-transform="translateX(0)"
>
Expand Down
1 change: 1 addition & 0 deletions src/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ <h2 class="mb-4 mt-0">
<drab-dialog
animation-keyframe-from-transform="translateX(-100%)"
animation-keyframe-to-transform="translateX(0)"
click-outside-close
>
<button
data-trigger
Expand Down
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/56281dd/src/package/animate/index.ts#L39)
[src/package/animate/index.ts:39](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L17)
[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/animate/index.ts#L46)
[src/package/animate/index.ts:46](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L30)
[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L34)
[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/animate/index.ts#L128)
[src/package/animate/index.ts:128](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/animate/index.ts#L76)
[src/package/animate/index.ts:76](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L152)
[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L159)
[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L161)
[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L55)
[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L42)
[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L150)
[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L118)
[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L72)
[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L135)
[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L19)
[src/package/base/index.ts:19](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L17)
[src/package/base/index.ts:17](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L30)
[src/package/base/index.ts:30](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L34)
[src/package/base/index.ts:34](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L152)
[src/package/base/index.ts:152](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L159)
[src/package/base/index.ts:159](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L161)
[src/package/base/index.ts:161](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L55)
[src/package/base/index.ts:55](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L42)
[src/package/base/index.ts:42](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L150)
[src/package/base/index.ts:150](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L118)
[src/package/base/index.ts:118](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L72)
[src/package/base/index.ts:72](https://github.com/rossrobino/components/blob/280c485/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/56281dd/src/package/base/index.ts#L135)
[src/package/base/index.ts:135](https://github.com/rossrobino/components/blob/280c485/src/package/base/index.ts#L135)
Loading

0 comments on commit 0ffb081

Please sign in to comment.