@primer/behaviors 0.0.0-2021113183512 → 0.0.0-2021113211757
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/README.md
CHANGED
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<img alt="" src="https://img.shields.io/npm/v/@primer/behaviors.svg">
|
|
8
|
-
</a>
|
|
9
|
-
<a aria-label="contributors graph" href="https://github.com/primer/behaviors/graphs/contributors">
|
|
10
|
-
<img src="https://img.shields.io/github/contributors/primer/behaviors.svg">
|
|
11
|
-
</a>
|
|
12
|
-
<a aria-label="last commit" href="https://github.com/primer/behaviors/commits/main">
|
|
13
|
-
<img alt="" src=
|
|
14
|
-
"https://img.shields.io/github/last-commit/primer/behaviors.svg">
|
|
15
|
-
</a>
|
|
16
|
-
<a aria-label="license" href="https://github.com/primer/behaviors/blob/main/LICENSE">
|
|
17
|
-
<img src="https://img.shields.io/github/license/primer/behaviors.svg" alt="">
|
|
18
|
-
</a>
|
|
19
|
-
</p>
|
|
1
|
+
# Primer Behaviors
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@primer/behaviors)
|
|
4
|
+
[](https://github.com/primer/behaviors/actions/workflows/ci.yml)
|
|
5
|
+
|
|
6
|
+
Shared behaviors for JavaScript components
|
|
20
7
|
|
|
21
8
|
## Documentation
|
|
22
9
|
|
|
23
|
-
* [Anchored Position](
|
|
24
|
-
* [Focus Trap](
|
|
25
|
-
* [Focus Zone](
|
|
26
|
-
* Scroll Into
|
|
10
|
+
* [Anchored Position](/docs/anchored-position.md)
|
|
11
|
+
* [Focus Trap](/docs/focus-trap.md)
|
|
12
|
+
* [Focus Zone](/docs/focus-zone.md)
|
|
13
|
+
* [Scroll Into View](/docs/scroll-into-view.md)
|
|
27
14
|
|
|
28
15
|
## Installation
|
|
29
16
|
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ScrollIntoViewOptions {
|
|
2
|
+
direction?: 'horizontal' | 'vertical';
|
|
3
|
+
startMargin?: number;
|
|
4
|
+
endMargin?: number;
|
|
5
|
+
behavior?: ScrollBehavior;
|
|
6
|
+
}
|
|
7
|
+
export declare const scrollIntoView: (child: HTMLElement, viewingArea: HTMLElement, { direction, startMargin, endMargin, behavior }?: ScrollIntoViewOptions) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const scrollIntoView = (child, viewingArea, { direction = 'vertical', startMargin = 8, endMargin = 0, behavior = 'smooth' } = {}) => {
|
|
2
2
|
const startSide = direction === 'vertical' ? 'top' : 'left';
|
|
3
3
|
const endSide = direction === 'vertical' ? 'bottom' : 'right';
|
|
4
4
|
const scrollSide = direction === 'vertical' ? 'scrollTop' : 'scrollLeft';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/behaviors",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-2021113211757",
|
|
4
4
|
"description": "Shared behaviors for JavaScript components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
"@types/react": "^17.0.37",
|
|
58
58
|
"esbuild": "^0.14.1",
|
|
59
59
|
"esbuild-jest": "^0.5.0",
|
|
60
|
-
"eslint": "^8.
|
|
60
|
+
"eslint": "^8.3.0",
|
|
61
61
|
"eslint-plugin-github": "^4.3.5",
|
|
62
62
|
"jest": "^27.4.3",
|
|
63
|
-
"prettier": "^2.
|
|
63
|
+
"prettier": "^2.5.0",
|
|
64
64
|
"react": "^17.0.2",
|
|
65
65
|
"react-dom": "^17.0.2",
|
|
66
66
|
"size-limit": "^7.0.3",
|
|
67
|
-
"typescript": "^4.
|
|
67
|
+
"typescript": "^4.5.2"
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const scrollIntoViewingArea: (child: HTMLElement, viewingArea: HTMLElement, direction?: 'horizontal' | 'vertical', startMargin?: number, endMargin?: number, behavior?: ScrollBehavior) => void;
|