@neovici/cosmoz-dropdown 3.1.0 → 3.3.0
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/dist/use-focus.d.ts +1 -1
- package/dist/use-position.d.ts +2 -1
- package/dist/use-position.js +2 -0
- package/package.json +3 -2
- package/types/position.d.ts +49 -0
package/dist/use-focus.d.ts
CHANGED
package/dist/use-position.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../types/position.d.ts" />
|
|
1
2
|
import type { Placement } from 'position.js';
|
|
2
3
|
export declare const defaultPlacement: readonly ["bottom-left", "bottom-right", "bottom", "top-left", "top-right", "top"];
|
|
3
4
|
export { Placement };
|
|
@@ -10,6 +11,6 @@ export interface PositionOpts {
|
|
|
10
11
|
}
|
|
11
12
|
export declare const position: ({ host, anchor, placement, confinement, limit, }: PositionOpts) => void;
|
|
12
13
|
interface UsePositionOpts extends Omit<PositionOpts, 'anchor'> {
|
|
13
|
-
anchor?: (() => HTMLElement) | HTMLElement | null;
|
|
14
|
+
anchor?: (() => HTMLElement | null) | HTMLElement | null;
|
|
14
15
|
}
|
|
15
16
|
export declare const usePosition: ({ anchor: anchorage, host, ...thru }: UsePositionOpts) => void;
|
package/dist/use-position.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-dropdown",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "A simple dropdown web component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit-html",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
|
-
"dist/"
|
|
49
|
+
"dist/",
|
|
50
|
+
"types"
|
|
50
51
|
],
|
|
51
52
|
"commitlint": {
|
|
52
53
|
"extends": [
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
declare module 'position.js' {
|
|
2
|
+
export type PlacementDirection =
|
|
3
|
+
| 'bottom'
|
|
4
|
+
| 'top'
|
|
5
|
+
| 'right'
|
|
6
|
+
| 'left'
|
|
7
|
+
| 'center'
|
|
8
|
+
| 'left-center'
|
|
9
|
+
| 'top-center'
|
|
10
|
+
| 'bottom-center'
|
|
11
|
+
| 'bottom-left'
|
|
12
|
+
| 'bottom-right'
|
|
13
|
+
| 'bottom'
|
|
14
|
+
| 'top-left'
|
|
15
|
+
| 'top-right'
|
|
16
|
+
| 'top';
|
|
17
|
+
|
|
18
|
+
export interface PlacementPrecise {
|
|
19
|
+
popup: PlacementDirection;
|
|
20
|
+
anchor: PlacementDirection;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type Placement =
|
|
24
|
+
| PlacementPrecise
|
|
25
|
+
| PlacementDirection
|
|
26
|
+
| readonly PlacementDirection[]
|
|
27
|
+
| readonly PlacementPrecise[];
|
|
28
|
+
|
|
29
|
+
export interface Bounds {
|
|
30
|
+
top: number;
|
|
31
|
+
left: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default function position(
|
|
35
|
+
hostBounds: Bounds,
|
|
36
|
+
anchorBounds: Bounds,
|
|
37
|
+
placement: Placement,
|
|
38
|
+
options?: {
|
|
39
|
+
fixed?: boolean;
|
|
40
|
+
adjustXY?: 'both';
|
|
41
|
+
offsetParent?: HTMLElement;
|
|
42
|
+
}
|
|
43
|
+
): {
|
|
44
|
+
popupOffset: {
|
|
45
|
+
top: number;
|
|
46
|
+
left: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}
|