Skip to content

Commit

Permalink
1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
elite174 committed Apr 24, 2024
1 parent d4489c8 commit 073769d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.9.0

- Popover API is used by default without possibility to disable it.
- Removed props `usePopoverAPI`, `popoverAPIMountFallback`, `mount`

# 1.8.0

- `anchorElementSelector` => `anchorElement`. Now you can pass HTML element or CSS selector.
Expand Down
31 changes: 3 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ A really simple and minimalistic popover component for your apps.
**IMPORTANT:**

- You may add `width: max-content` to the content element by yourself to avoid layout interference as it described [here](https://floating-ui.com/docs/computeposition#initial-layout).
- From version `1.7.0` popoverAPI enabled by [default](https://caniuse.com/mdn-api_htmlelement_popover) with mount fallback to `body`

## Features

- Minimalistic - no wrapper DOM nodes!
- Popover API support (with fallback)
- Popover API support
- Full control over position
- Works with SSR and Astro
- Multiple trigger events with vue-style modifiers
Expand All @@ -29,7 +28,7 @@ When you render the following code, only `button` (`<button data-popover-open="f

### Popover API support

You can use PopoverAPI! Just pass `usePopoverAPI` prop. Popover will automotically fallback to non-api behavior if popover API is not supported.
This component uses Popover API by default.

Don't forget to reset default browser styles for `[popover]`:

Expand All @@ -38,18 +37,14 @@ Don't forget to reset default browser styles for `[popover]`:
margin: 0;
background-color: transparent;
padding: 0;
border: 0;
border: none;
}
```

```tsx
<Popover
trigger={<button>Toggle popover!</button>}
content={<div>Nice content here</div>}
usePopoverAPI
// You may also provide an optional popover root
// It will be used when popover API is not supported
popoverAPIMountFallback={document.body}
/>
```

Expand Down Expand Up @@ -136,11 +131,6 @@ import { flip } from "@floating-ui/dom";
// Full control over position
autoUpdate
computePositionOptions={{ placement: "bottom-start", middleware: [flip()] }}
// Popover API support (where possible)
usePopoverAPI
// When popover API is not supported, fallback to mounting content to body
// SSR support
popoverAPIMountFallback="body"
// Highly customizable
sameWidth
dataAttributeName="data-open"
Expand Down Expand Up @@ -180,10 +170,6 @@ export type PopoverProps = {
* @example "pointerdown.capture.once.prevent|click"
*/
triggerEvents?: string | null;
/**
* HTMLElement or CSS selector (can be used in SSR) to mount popover content into
*/
mount?: HTMLElement | string;
/**
* Close popover on interaction outside
* @default true
Expand Down Expand Up @@ -217,23 +203,12 @@ export type PopoverProps = {
* @see https://floating-ui.com/docs/autoupdate#options
*/
autoUpdateOptions?: AutoUpdateOptions;
/**
* Use popover API where possible
* @default true
*/
usePopoverAPI?: boolean;
/**
* Close popover on escape key press.
* Uses 'keydown' event with 'Escape' key.
* @default true
*/
closeOnEscape?: boolean;
/**
* HTMLElement or CSS selector (can be used in SSR) to mount popover content into
* Fallback for browsers that don't support Popover API
* @default body
*/
popoverAPIMountFallback?: HTMLElement | string;
onOpenChange?: (open: boolean) => void;
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solid-simple-popover",
"version": "1.8.1",
"version": "1.9.0",
"description": "A simple popover component for SolidJS",
"author": "Vladislav Lipatov",
"type": "module",
Expand Down

0 comments on commit 073769d

Please sign in to comment.