@startupjs-ui/popover 0.1.13 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.mdx +18 -16
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.19](https://github.com/startupjs/startupjs-ui/compare/v0.1.18...v0.1.19) (2026-03-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **docs:** don't load all icons to keep bundle small ([#17](https://github.com/startupjs/startupjs-ui/issues/17)) ([d7eb70b](https://github.com/startupjs/startupjs-ui/commit/d7eb70bc11f5b15923f2e43b7ef1f86ea066494e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @startupjs-ui/popover
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @startupjs-ui/popover
|
package/README.mdx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
import { Sandbox } from '@startupjs-ui/docs'
|
|
3
|
-
import { faUserCircle } from '@fortawesome/free-solid-svg-icons'
|
|
3
|
+
import { faUserCircle } from '@fortawesome/free-solid-svg-icons/faUserCircle'
|
|
4
4
|
import Popover, { _PropsJsonSchema as PopoverPropsJsonSchema } from './index'
|
|
5
5
|
import Icon from '@startupjs-ui/icon'
|
|
6
6
|
import Button from '@startupjs-ui/button'
|
|
@@ -9,7 +9,11 @@ import Span from '@startupjs-ui/span'
|
|
|
9
9
|
|
|
10
10
|
# Popover
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
A floating panel that appears near an anchor element when triggered. Use it to display additional content, menus, or tooltips tied to a specific element on the page.
|
|
13
|
+
|
|
14
|
+
The `visible` prop controls whether the popover is shown, and `onChange` is called when visibility should change. You can also use `$visible` for two-way data binding. Pass `children` as the anchor (the always-visible element) and `renderContent` to render the popover content. A `ref` can be used to programmatically call `open()` and `close()`.
|
|
15
|
+
|
|
16
|
+
The component also supports lifecycle callbacks inherited from AbstractPopover: `onRequestOpen`, `onRequestClose`, `onOpenComplete`, and `onCloseComplete`. Use `renderWrapper` to wrap the popover node with custom markup.
|
|
13
17
|
|
|
14
18
|
```jsx
|
|
15
19
|
import { Popover } from 'startupjs-ui'
|
|
@@ -17,12 +21,11 @@ import { Popover } from 'startupjs-ui'
|
|
|
17
21
|
|
|
18
22
|
## Initialization
|
|
19
23
|
|
|
20
|
-
Before
|
|
24
|
+
Before using Popover, you need to configure [Portal](/docs/components/Portal).
|
|
21
25
|
|
|
22
26
|
## Simple example
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
- `renderContent` (function: ReactNode): function returns hidden part
|
|
28
|
+
Pass `children` as the anchor element and `renderContent` as a function that returns the popover content.
|
|
26
29
|
|
|
27
30
|
```jsx example
|
|
28
31
|
const [visible, setVisible] = useState(false)
|
|
@@ -48,9 +51,7 @@ return (
|
|
|
48
51
|
|
|
49
52
|
## Position
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
- `attachment` (string - 'start', 'center', 'end'): optional parameter for offset
|
|
53
|
-
- `placements` (array): what positions can be used for auto-fix
|
|
54
|
+
Use the `position` prop to control where the popover appears relative to the anchor: `'top'`, `'bottom'` (default), `'left'`, or `'right'`. The `attachment` prop adjusts alignment along the secondary axis: `'start'` (default), `'center'`, or `'end'`. The `placements` prop accepts an array of fallback positions used for automatic repositioning when the popover would overflow the screen.
|
|
54
55
|
|
|
55
56
|
```jsx example
|
|
56
57
|
const [visible, setVisible] = useState(false)
|
|
@@ -76,13 +77,15 @@ return (
|
|
|
76
77
|
)
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
##
|
|
80
|
+
## Styling
|
|
81
|
+
|
|
82
|
+
Use the following props to customize the appearance:
|
|
83
|
+
|
|
84
|
+
- `style` -- styles for the anchor wrapper
|
|
85
|
+
- `attachmentStyle` -- styles for the popover container
|
|
86
|
+
- `overlayStyle` -- styles for the dismiss overlay
|
|
80
87
|
|
|
81
|
-
|
|
82
|
-
- `attachmentStyle`: styles for the popover container
|
|
83
|
-
- `overlayStyle`: dismiss overlay styles
|
|
84
|
-
- `arrow` (boolean): show an arrow
|
|
85
|
-
- `matchAnchorWidth` (boolean): the width of the popover is equal to the width of the anchor
|
|
88
|
+
Set `arrow` to `true` to display an arrow pointing from the popover to the anchor. Set `matchAnchorWidth` to `true` to make the popover match the anchor's width.
|
|
86
89
|
|
|
87
90
|
```jsx example
|
|
88
91
|
const [visible, setVisible] = useState(false)
|
|
@@ -110,8 +113,7 @@ return (
|
|
|
110
113
|
|
|
111
114
|
## Extra options
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
- `durationClose` (number): animation time on close
|
|
116
|
+
Use `durationOpen` (defaults to `100`ms) and `durationClose` (defaults to `50`ms) to control the animation timing for opening and closing the popover.
|
|
115
117
|
|
|
116
118
|
## Sandbox
|
|
117
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/popover",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@startupjs-ui/abstract-popover": "^0.1.
|
|
12
|
-
"@startupjs-ui/core": "^0.1.
|
|
13
|
-
"@startupjs-ui/div": "^0.1.
|
|
11
|
+
"@startupjs-ui/abstract-popover": "^0.1.19",
|
|
12
|
+
"@startupjs-ui/core": "^0.1.19",
|
|
13
|
+
"@startupjs-ui/div": "^0.1.19"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "*",
|
|
17
17
|
"react-native": "*",
|
|
18
18
|
"startupjs": "*"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "bfcca786dc363f42a09b6eef4feb7ca8139302fc"
|
|
21
21
|
}
|