@neovici/cosmoz-dropdown 3.1.0 → 3.2.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.
@@ -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 };
@@ -1,3 +1,5 @@
1
+ // eslint-disable-next-line
2
+ /// <reference path="../types/position.d.ts" />
1
3
  import { useEffect } from 'haunted';
2
4
  import getPosition from 'position.js';
3
5
  import { onScrolled } from './on-scrolled';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-dropdown",
3
- "version": "3.1.0",
3
+ "version": "3.2.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
+ }