@formixru/b2b-ui 1.1.1 → 1.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v1.2.0
2
+
3
+ - Для `isInViewport` добавлен параметр `partialVisibility` для определения частичной видимости элемента
4
+
1
5
  ## v1.1.1
2
6
 
3
7
  - Переменная `--tab-bar-height` добавлена в `base.scss`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formixru/b2b-ui",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,6 +1,16 @@
1
- export const isInViewport = ($el, offset = {}) => {
1
+ export const isInViewport = ($el, offset = {}, partialVisibility = false) => {
2
2
  const rect = $el.getBoundingClientRect();
3
3
  offset = Object.assign({ top: 0, left: 0, bottom: 0, right: 0 }, offset);
4
+
5
+ if (partialVisibility) {
6
+ return (
7
+ rect.bottom > offset.top &&
8
+ rect.right > offset.left &&
9
+ rect.top < window.innerHeight - offset.bottom &&
10
+ rect.left < window.innerWidth - offset.right
11
+ );
12
+ }
13
+
4
14
  return (
5
15
  rect.top >= offset.top &&
6
16
  rect.left >= offset.left &&