diff --git a/docs/src/pages/components/Popover.svx b/docs/src/pages/components/Popover.svx index aaa86aa2b5..acd5ac4ce9 100644 --- a/docs/src/pages/components/Popover.svx +++ b/docs/src/pages/components/Popover.svx @@ -3,7 +3,8 @@ components: ["Popover", "PopoverContent"] --- @@ -11,34 +12,29 @@ components: ["Popover", "PopoverContent"] By default, the position of the popover component is absolute. -
- - Parent - Content - -
- -## Relative position - -Set `relative` to `true` to use a relative position. - -
- Parent - -
Content
-
-
+ +
+
+ +
Available storage
+

This server has 150 GB of block storage remaining.

+
+
## Close on outside click Set `closeOnOutsideClick` to set `open` to `false` when clicking outside of the popover. -
- Parent - {console.log('on:click:outside')}}> -
Content
-
-
+ {console.log('on:click:outside')}}> +
+
+ +
Available storage
+

This server has 150 GB of block storage remaining.

+
+
## Popover alignment @@ -46,80 +42,98 @@ Customize the popover alignment using the `align` prop. Valid values include: `" The default `align` value is `"top"`. -
- Parent - -
top-left
-
+ +
+
-
- Parent + +

Top-left alignment

+
+ + +
-
top-right
+
-
- Parent +
-
bottom
+
-
- Parent +
-
bottom-left
-
-
-
- Parent - -
bottom-right
+
-
- Parent +
-
left
+
-
- Parent +
-
left-bottom
+
-
- Parent - -
left-right
+
+ +
-
- Parent +
-
right
+
-
- Parent +
-
right-bottom
+
-
- Parent +
-
right-top
+
## With caret -
- Parent - -
Content
-
+
+ +
## Custom caret alignment @@ -128,29 +142,50 @@ By default, the caret is aligned "top". Possible `align` values include `"top"`, `"top-left"`, `"top-right"`, `"bottom"`, `"bottom-left"`, `"bottom-right"`, `"left"`, `"left-bottom"`, `"left-top"`, `"right"`, `"right-bottom"` or `"right-top"`. -
- Parent - -
Content
-
+
+ +
## Light variant -
- Parent - -
Content
-
+
+ +
## High contrast variant -
- Parent - -
Content
-
+
+ +
+ +## Drop shadow + +
+ +
## External element diff --git a/docs/src/pages/framed/Popover/WithButton.svelte b/docs/src/pages/framed/Popover/WithButton.svelte index c16d54d222..4ce200e816 100644 --- a/docs/src/pages/framed/Popover/WithButton.svelte +++ b/docs/src/pages/framed/Popover/WithButton.svelte @@ -1,20 +1,31 @@
- - -
Content
-
+ + + +
+
Available storage
+

This server has 150 GB of block storage remaining.

+
+
+
+
diff --git a/src/Popover/Popover.svelte b/src/Popover/Popover.svelte index 3373b94dea..0a7b8968da 100644 --- a/src/Popover/Popover.svelte +++ b/src/Popover/Popover.svelte @@ -3,6 +3,9 @@ * @event {{ target: HTMLElement; }} click:outside */ + /** Set an id for the content `span` component */ + export let id = "ccs-" + Math.random().toString(36); + /** Set to `true` to display the popover */ export let open = false; @@ -21,11 +24,17 @@ /** Set to `true` to enable the light variant */ export let light = false; + /** Specify whether a drop shadow should be rendered on the popover */ + export let dropShadow = false; + /** Set to `true` to enable the high contrast variant */ export let highContrast = false; - /** Set to `true` to use a relative position */ - export let relative = false; + /** + * Specify the container `div` props + * @type {import('svelte/elements').HTMLDivAttributes} + */ + export let containerProps = {}; import { createEventDispatcher } from "svelte"; @@ -44,10 +53,12 @@ }}" /> -
-
+ diff --git a/src/Popover/PopoverContent.svelte b/src/Popover/PopoverContent.svelte index 4d30a3510c..b9cd51cd88 100644 --- a/src/Popover/PopoverContent.svelte +++ b/src/Popover/PopoverContent.svelte @@ -1,9 +1,13 @@ - - + + diff --git a/tests/Popover.test.svelte b/tests/Popover.test.svelte index 34d5832da6..550c91e7d0 100644 --- a/tests/Popover.test.svelte +++ b/tests/Popover.test.svelte @@ -5,16 +5,15 @@ - Content + Content