@formixru/b2b-ui 2.5.0 → 3.0.1

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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/package.json +42 -45
  3. package/src/components/action-link/index.scss +49 -0
  4. package/src/components/action-list/index.scss +6 -15
  5. package/src/components/counter/index.scss +16 -0
  6. package/src/components/dialog/index.js +8 -20
  7. package/src/components/dialog/index.scss +13 -0
  8. package/src/components/form/index.js +35 -35
  9. package/src/components/overlay/index.js +1 -1
  10. package/src/components/overlay/index.scss +4 -0
  11. package/src/components/request/index.js +8 -8
  12. package/src/components/sidebar/index.js +3 -3
  13. package/src/components/sidebar/index.scss +7 -0
  14. package/src/components/tabs/index.js +4 -4
  15. package/src/components/tooltip/index.js +4 -3
  16. package/src/{helpers → utils}/error-handler.js +3 -3
  17. package/src/{helpers → utils}/is-in-viewport.js +2 -2
  18. package/src/{helpers → utils}/mm.js +2 -2
  19. package/src/variables.scss +23 -12
  20. package/CHANGELOG.md +0 -108
  21. package/CONTRIBUTING.md +0 -59
  22. package/src/components/color-input/index.vue +0 -154
  23. package/src/components/date-input/index.vue +0 -240
  24. package/src/components/delete-all/index.scss +0 -44
  25. package/src/components/file-input/index.vue +0 -335
  26. package/src/components/font-input/index.vue +0 -174
  27. package/src/components/quantity-input/index.vue +0 -141
  28. package/src/components/range-input/index.vue +0 -185
  29. package/src/components/suggest-input/index.vue +0 -328
  30. package/src/components/warning-message/index.vue +0 -101
  31. package/vite.config.js +0 -75
  32. /package/src/{helpers → utils}/css-var.js +0 -0
  33. /package/src/{helpers → utils}/get-smart-captcha.js +0 -0
  34. /package/src/{helpers → utils}/scroll-to.js +0 -0
package/README.md CHANGED
@@ -19,10 +19,10 @@ import ExampleInput from '@formixru/b2b-ui/components/example-input/vue';
19
19
 
20
20
  При подключении Vue-компонента подключать SCSS не нужно - он подключается автоматически.
21
21
 
22
- ## Подключение хелперов
22
+ ## Подключение вспомогательных функций
23
23
 
24
24
  ```js
25
- import { cssVar } from '@formixru/b2b-ui/helpers/css-var';
25
+ import { cssVar } from '@formixru/b2b-ui/utils/css-var';
26
26
  ```
27
27
 
28
28
  ## Разработка
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formixru/b2b-ui",
3
- "version": "2.5.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,84 +8,72 @@
8
8
  },
9
9
  "license": "MIT",
10
10
  "browserslist": [
11
- "defaults",
12
- "not OperaMini all"
11
+ "defaults and fully supports es6-module"
13
12
  ],
14
- "packageManager": "yarn@4.9.3",
13
+ "packageManager": "yarn@4.12.0",
15
14
  "scripts": {
16
15
  "_postinstall": "husky",
17
16
  "prepack": "yarn pinst --disable",
18
17
  "postpack": "yarn pinst --enable",
19
18
  "lint:eslint": "yarn eslint --max-warnings 10 \"**/*.{js,vue}\"",
20
- "lint:stylelint": "yarn stylelint --max-warnings 10 \"**/*.scss\"",
19
+ "lint:stylelint": "yarn stylelint --max-warnings 10 \"src/**/*.scss\"",
21
20
  "lint:prettier": "yarn prettier --check .",
22
21
  "lint": "yarn lint:eslint && yarn lint:stylelint && yarn lint:prettier",
23
22
  "dev": "storybook dev -p 3000",
24
23
  "build": "storybook build -o www"
25
24
  },
26
25
  "devDependencies": {
27
- "@advdominion/get-scrollbar-width": "^2.0.0",
28
- "@advdominion/is": "^1.0.1",
29
- "@advdominion/pluralize": "^1.0.1",
30
- "@advdominion/tooltip": "^5.0.0",
31
- "@eslint/eslintrc": "^3.3.1",
32
- "@eslint/js": "^9.33.0",
26
+ "@advdominion/eslint-config": "^1.1.2",
27
+ "@advdominion/get-scrollbar-width": "^2.0.1",
28
+ "@advdominion/pluralize": "^1.0.2",
29
+ "@advdominion/tooltip": "^6.0.0",
33
30
  "@floating-ui/dom": "^1.7.4",
34
31
  "@popperjs/core": "^2.11.8",
35
32
  "@prettier/plugin-php": "^0.24.0",
36
- "@storybook/addon-designs": "^10.0.2",
37
- "@storybook/addon-docs": "^9.1.3",
38
- "@storybook/addon-links": "^9.1.3",
39
- "@storybook/vue3-vite": "^9.1.3",
40
- "@vitejs/plugin-vue": "^6.0.1",
41
- "@vueless/storybook-dark-mode": "^9.0.7",
42
- "color": "^5.0.0",
43
- "dayjs": "^1.11.13",
44
- "eslint": "^9.33.0",
45
- "eslint-config-prettier": "^10.1.8",
46
- "eslint-plugin-simple-import-sort": "^12.1.1",
47
- "eslint-plugin-storybook": "9.1.3",
48
- "eslint-plugin-unicorn": "^60.0.0",
49
- "eslint-plugin-vue": "^10.4.0",
50
- "globals": "^16.3.0",
33
+ "@storybook/addon-designs": "^11.1.1",
34
+ "@storybook/addon-docs": "^10.2.0",
35
+ "@storybook/addon-links": "^10.2.0",
36
+ "@storybook/vue3-vite": "^10.2.0",
37
+ "@vitejs/plugin-vue": "^6.0.3",
38
+ "@vueless/storybook-dark-mode": "^10.0.6",
39
+ "color": "^5.0.3",
40
+ "dayjs": "^1.11.19",
41
+ "es-toolkit": "^1.44.0",
42
+ "eslint": "^9.39.2",
51
43
  "husky": "^9.1.7",
52
44
  "imask": "^7.6.1",
53
- "lint-staged": "^16.1.5",
54
- "lodash-es": "^4.17.21",
55
- "mime": "^4.0.7",
56
- "msw": "^2.10.5",
57
- "msw-storybook-addon": "^2.0.5",
45
+ "lint-staged": "^16.2.7",
46
+ "mime": "^4.1.0",
47
+ "msw": "^2.12.7",
48
+ "msw-storybook-addon": "^2.0.6",
58
49
  "nouislider": "^15.8.1",
59
50
  "pinst": "^3.0.0",
60
- "prettier": "^3.6.2",
51
+ "postcss": "^8.5.6",
52
+ "postcss-preset-env": "^11.1.1",
53
+ "prettier": "^3.8.0",
61
54
  "reset-css": "^5.0.2",
62
- "sass-embedded": "^1.90.0",
63
- "storybook": "^9.1.3",
55
+ "sass-embedded": "^1.97.2",
56
+ "storybook": "^10.2.0",
64
57
  "stylelint": "^16.23.1",
65
58
  "stylelint-config-standard-scss": "^15.0.1",
66
59
  "stylelint-config-standard-vue": "^1.0.0",
67
60
  "stylelint-order": "^7.0.0",
68
- "swiper": "^11.2.10",
61
+ "swiper": "^12.0.3",
62
+ "update-browserslist-db": "^1.2.3",
69
63
  "v-calendar": "3.0.1",
70
- "vite": "^7.1.3",
71
- "vue": "^3.5.19",
64
+ "vite": "^7.3.1",
65
+ "vue": "^3.5.27",
72
66
  "vue-eslint-parser": "^10.2.0",
73
67
  "yargs": "^18.0.0"
74
68
  },
75
- "msw": {
76
- "workerDirectory": [
77
- ".storybook/static"
78
- ]
79
- },
80
69
  "peerDependencies": {
81
70
  "@advdominion/get-scrollbar-width": "^2.0.0",
82
- "@advdominion/is": "^1.0.0",
83
71
  "@advdominion/pluralize": "^1.0.0",
84
- "@advdominion/tooltip": "^5.0.0",
72
+ "@advdominion/tooltip": "^6.0.0",
85
73
  "color": "^5.0.0",
86
74
  "dayjs": "^1.0.0",
75
+ "es-toolkit": "^1.0.0",
87
76
  "imask": "^7.0.0",
88
- "lodash-es": "^4.0.0",
89
77
  "mime": "^4.0.0",
90
78
  "nouislider": "^15.0.0",
91
79
  "reset-css": "^5.0.0",
@@ -99,5 +87,14 @@
99
87
  "./helpers/*": "./src/helpers/*.js",
100
88
  "./base": "./src/base.scss",
101
89
  "./variables": "./src/variables.scss"
90
+ },
91
+ "files": [
92
+ "src/**/*.scss",
93
+ "src/**/*.js"
94
+ ],
95
+ "msw": {
96
+ "workerDirectory": [
97
+ ".storybook/static"
98
+ ]
102
99
  }
103
100
  }
@@ -0,0 +1,49 @@
1
+ @use '../../variables' as *;
2
+ @use '../link';
3
+
4
+ $b: '.action-link';
5
+
6
+ #{$b} {
7
+ align-items: center;
8
+ display: inline-flex;
9
+ gap: 8px;
10
+
11
+ @include font($action-link-font);
12
+
13
+ .action-list & {
14
+ @include font($action-link-action-list-font);
15
+ }
16
+
17
+ &_danger {
18
+ color: $action-link-danger-color;
19
+ cursor: pointer;
20
+ text-decoration: none;
21
+
22
+ @include link.transform;
23
+ @include font($action-link-danger-font);
24
+
25
+ &:hover,
26
+ &:focus-visible {
27
+ color: $action-link-danger-active-color;
28
+ }
29
+ }
30
+
31
+ &__icon {
32
+ flex-shrink: 0;
33
+ height: 24px;
34
+ position: relative;
35
+ top: -1px;
36
+ width: 24px;
37
+
38
+ #{$b}_danger & {
39
+ fill: $action-link-danger-icon-color;
40
+
41
+ @include link.transform(fill);
42
+ }
43
+
44
+ #{$b}_danger:hover &,
45
+ #{$b}_danger:focus-visible & {
46
+ fill: $action-link-danger-icon-active-color;
47
+ }
48
+ }
49
+ }
@@ -3,36 +3,27 @@
3
3
  $b: '.action-list';
4
4
 
5
5
  #{$b} {
6
+ color: $action-list-color;
7
+
6
8
  &__item {
7
9
  }
8
10
 
9
11
  &__link {
10
- align-items: center;
11
- color: $action-list-link-color;
12
- display: flex;
13
- padding: 4px * 2 4px * 4;
12
+ padding: 8px 16px;
14
13
  width: 100%;
15
14
 
16
15
  #{$b}__item:first-child:not(:last-child) & {
17
- padding-top: 4px * 4;
16
+ padding-top: 16px;
18
17
  }
19
18
 
20
19
  #{$b}__item:last-child:not(:first-child) & {
21
- padding-bottom: 4px * 4;
20
+ padding-bottom: 16px;
22
21
  }
23
22
 
24
23
  &_separator {
25
24
  border-top: $action-list-link-separator-width solid $action-list-link-separator-color;
26
25
  margin-top: 4px;
27
- padding-top: 4px * 3;
26
+ padding-top: 12px;
28
27
  }
29
28
  }
30
-
31
- &__icon {
32
- fill: currentcolor;
33
- flex-shrink: 0;
34
- height: 4px * 6;
35
- margin-right: 4px * 2;
36
- width: 4px * 6;
37
- }
38
29
  }
@@ -0,0 +1,16 @@
1
+ @use '../../variables' as *;
2
+
3
+ $b: '.counter';
4
+
5
+ #{$b} {
6
+ align-items: center;
7
+ background-color: $counter-bg;
8
+ border-radius: $counter-radius;
9
+ color: $counter-color;
10
+ display: flex;
11
+ height: $counter-size;
12
+ justify-content: center;
13
+ width: $counter-size;
14
+
15
+ @include font($counter-font);
16
+ }
@@ -1,7 +1,7 @@
1
- import _throttle from 'lodash-es/throttle.js';
1
+ import { throttle } from 'es-toolkit';
2
2
 
3
- import { cssVar } from '../../helpers/css-var.js';
4
- import { mm } from '../../helpers/mm.js';
3
+ import { cssVar } from '../../utils/css-var.js';
4
+ import { mm } from '../../utils/mm.js';
5
5
  import { hide as hideLoader } from '../loader/index.js';
6
6
  import { disableScroll, enableScroll } from '../overlay/index.js';
7
7
  import { initRequestContent, request } from '../request/index.js';
@@ -18,21 +18,13 @@ export const init = ($b) => {
18
18
  // Отключаем скролл у body, если при загрузке на странице есть видимое диалоговое окно
19
19
  if (!$b.hidden) {
20
20
  disableScroll();
21
- if (isDialogOverflow($b)) {
22
- $b.classList.add('dialog_overflow');
23
- } else {
24
- $b.classList.remove('dialog_overflow');
25
- }
21
+ $b.classList.toggle('dialog_overflow', isDialogOverflow($b));
26
22
  }
27
23
  if ($b._OVERFLOW_OBSERVER_) {
28
24
  $b._OVERFLOW_OBSERVER_.disconnect();
29
25
  }
30
26
  $b._OVERFLOW_OBSERVER_ = new MutationObserver(() => {
31
- if (isDialogOverflow($b)) {
32
- $b.classList.add('dialog_overflow');
33
- } else {
34
- $b.classList.remove('dialog_overflow');
35
- }
27
+ $b.classList.toggle('dialog_overflow', isDialogOverflow($b));
36
28
  });
37
29
  $b._OVERFLOW_OBSERVER_.observe($b, {
38
30
  childList: true,
@@ -104,9 +96,9 @@ export const get = async (id, url) => {
104
96
  const $b = document.querySelector(elementId);
105
97
  if ($b) {
106
98
  $b.querySelector('.dialog__container').innerHTML = content;
99
+ hideLoader();
107
100
  await show($b);
108
101
  initRequestContent($b);
109
- hideLoader();
110
102
  } else {
111
103
  console.error(`Диалоговое окно с id ${elementId} не найдено`);
112
104
  }
@@ -123,16 +115,12 @@ const resizeWindowListener = () => {
123
115
  prevWindowHeight = window.innerHeight;
124
116
  for (const $el of document.querySelectorAll('.dialog')) {
125
117
  if (!$el.hidden) {
126
- if (isDialogOverflow($el)) {
127
- $el.classList.add('dialog_overflow');
128
- } else {
129
- $el.classList.remove('dialog_overflow');
130
- }
118
+ $el.classList.toggle('dialog_overflow', isDialogOverflow($el));
131
119
  }
132
120
  }
133
121
  }
134
122
  };
135
- window.addEventListener('resize', _throttle(resizeWindowListener, 100));
123
+ window.addEventListener('resize', throttle(resizeWindowListener, 100));
136
124
 
137
125
  let $pointerDownTarget;
138
126
  document.body.addEventListener('pointerdown', (event) => {
@@ -22,6 +22,10 @@ $b: '.dialog';
22
22
  padding: 4px * 10 0;
23
23
  }
24
24
 
25
+ body:has(.loader_active) & {
26
+ background-color: transparent;
27
+ }
28
+
25
29
  &_overflow {
26
30
  @media (--tablet-landscape-up) {
27
31
  justify-content: flex-start;
@@ -50,6 +54,15 @@ $b: '.dialog';
50
54
  min-height: auto;
51
55
  padding: 4px * 10;
52
56
  position: relative;
57
+ transition-duration: var(--duration-leave-s);
58
+ transition-property: opacity;
59
+ transition-timing-function: var(--easing-acceleration);
60
+ }
61
+
62
+ body:has(.loader_active) & {
63
+ @media (--tablet-landscape-up) {
64
+ opacity: 0.5;
65
+ }
53
66
  }
54
67
 
55
68
  #{$b}_overflow & {
@@ -1,42 +1,9 @@
1
1
  /* globals SmartCaptcha, SMART_CAPTCHA_KEY */
2
2
 
3
- import { getSmartCaptcha } from '../../helpers/get-smart-captcha.js';
4
- import { scrollTo } from '../../helpers/scroll-to.js';
3
+ import { getSmartCaptcha } from '../../utils/get-smart-captcha.js';
4
+ import { scrollTo } from '../../utils/scroll-to.js';
5
5
  import { initRequestContent, request } from '../request/index.js';
6
6
 
7
- export const send = async ($b, url, method, data) => {
8
- const { success, content } = await request({
9
- $b,
10
- url: url || $b.getAttribute('action'),
11
- method: method || $b.getAttribute('method'),
12
- data: data || new FormData($b),
13
- });
14
- if (success) {
15
- $b.dispatchEvent(new CustomEvent('form-success', { bubbles: true }));
16
- }
17
- if (content) {
18
- const $dialog = $b.closest('.dialog');
19
- if ($dialog) {
20
- $dialog.querySelector('.dialog__container').innerHTML = content;
21
- initRequestContent($dialog);
22
- setTimeout(() => {
23
- scrollToError($dialog);
24
- });
25
- } else {
26
- const $parent = $b.parentElement;
27
- $b.outerHTML = content;
28
- const $form = $parent.querySelector('.form');
29
- if ($form) {
30
- init($form);
31
- initRequestContent($form);
32
- setTimeout(() => {
33
- scrollToError($form);
34
- });
35
- }
36
- }
37
- }
38
- };
39
-
40
7
  const scrollToError = ($b = document.body) => {
41
8
  const $error = [...$b.querySelectorAll('.form__input-error, .form__submit-error')].find(($el) => {
42
9
  const rect = $el.getBoundingClientRect();
@@ -96,6 +63,39 @@ export const init = ($b) => {
96
63
  }
97
64
  };
98
65
 
66
+ export const send = async ($b, url, method, data) => {
67
+ const { success, content } = await request({
68
+ $b,
69
+ url: url || $b.getAttribute('action'),
70
+ method: method || $b.getAttribute('method'),
71
+ data: data || new FormData($b),
72
+ });
73
+ if (success) {
74
+ $b.dispatchEvent(new CustomEvent('form-success', { bubbles: true }));
75
+ }
76
+ if (content) {
77
+ const $dialog = $b.closest('.dialog');
78
+ if ($dialog) {
79
+ $dialog.querySelector('.dialog__container').innerHTML = content;
80
+ initRequestContent($dialog);
81
+ setTimeout(() => {
82
+ scrollToError($dialog);
83
+ });
84
+ } else {
85
+ const $parent = $b.parentElement;
86
+ $b.outerHTML = content;
87
+ const $form = $parent.querySelector('.form');
88
+ if ($form) {
89
+ init($form);
90
+ initRequestContent($form);
91
+ setTimeout(() => {
92
+ scrollToError($form);
93
+ });
94
+ }
95
+ }
96
+ }
97
+ };
98
+
99
99
  document.body.addEventListener('submit', (event) => {
100
100
  const { target } = event;
101
101
  const $b = target.closest('.form');
@@ -1,6 +1,6 @@
1
1
  import { getScrollbarWidth } from '@advdominion/get-scrollbar-width';
2
2
 
3
- import { mm } from '../../helpers/mm.js';
3
+ import { mm } from '../../utils/mm.js';
4
4
 
5
5
  export const show = () => {
6
6
  if (!document.querySelector('.overlay')) {
@@ -26,4 +26,8 @@ $b: '.overlay';
26
26
  transition-duration: var(--duration-enter-s);
27
27
  transition-timing-function: var(--easing-deceleration);
28
28
  }
29
+
30
+ body:has(.loader_active) & {
31
+ background-color: transparent;
32
+ }
29
33
  }
@@ -1,8 +1,8 @@
1
1
  /* globals BX */
2
2
 
3
- import { is } from '@advdominion/is';
3
+ import { isString } from 'es-toolkit';
4
4
 
5
- import { errorHandler } from '../../helpers/error-handler.js';
5
+ import { errorHandler } from '../../utils/error-handler.js';
6
6
  import { hide as hideDialog, show as showDialog } from '../dialog/index.js';
7
7
  import { clearLoaderTimeout, hide as hideLoader, show as showLoader } from '../loader/index.js';
8
8
  import { hide as hideSidebar, show as showSidebar } from '../sidebar/index.js';
@@ -31,7 +31,7 @@ export const request = async ({
31
31
  showLoaderDelay,
32
32
  hideLoaderOnSuccess = true,
33
33
  }) => {
34
- url = new URL(url, location.origin);
34
+ const reqUrl = new URL(url, location.origin);
35
35
  const options = {
36
36
  method,
37
37
  headers: {
@@ -43,16 +43,16 @@ export const request = async ({
43
43
  let entries;
44
44
  if (data instanceof FormData) {
45
45
  entries = data.entries();
46
- } else if (is(data, 'String')) {
46
+ } else if (isString(data)) {
47
47
  entries = Object.entries(JSON.parse(data));
48
48
  } else {
49
49
  entries = Object.entries(data);
50
50
  }
51
51
  for (const [name, value] of entries) {
52
- url.searchParams.append(name, value);
52
+ reqUrl.searchParams.append(name, value);
53
53
  }
54
54
  } else {
55
- if (data instanceof FormData || is(data, 'String')) {
55
+ if (data instanceof FormData || isString(data)) {
56
56
  options.body = data;
57
57
  } else {
58
58
  options.body = JSON.stringify(data);
@@ -63,7 +63,7 @@ export const request = async ({
63
63
  showLoader(showLoaderDelay);
64
64
  }
65
65
  try {
66
- const response = await fetch(url, options);
66
+ const response = await fetch(reqUrl, options);
67
67
  if (!response.ok) {
68
68
  throw response;
69
69
  }
@@ -77,7 +77,7 @@ export const request = async ({
77
77
  data = { content: raw };
78
78
  }
79
79
 
80
- if (is(data.redirect, 'String')) {
80
+ if (isString(data.redirect)) {
81
81
  if (data.redirect) {
82
82
  location.assign(data.redirect);
83
83
  if (data.redirect.startsWith('tg:')) {
@@ -1,5 +1,5 @@
1
- import { cssVar } from '../../helpers/css-var.js';
2
- import { mm } from '../../helpers/mm.js';
1
+ import { cssVar } from '../../utils/css-var.js';
2
+ import { mm } from '../../utils/mm.js';
3
3
  import { hide as hideLoader } from '../loader/index.js';
4
4
  import { disableScroll, enableScroll, hide as hideOverlay, show as showOverlay } from '../overlay/index.js';
5
5
  import { initRequestContent, request } from '../request/index.js';
@@ -69,9 +69,9 @@ export const get = async (id, url, showLoaderDelay) => {
69
69
  const $b = document.querySelector(elementId);
70
70
  if ($b) {
71
71
  $b.innerHTML = content;
72
+ hideLoader();
72
73
  await show($b);
73
74
  initRequestContent($b);
74
- hideLoader();
75
75
  } else {
76
76
  console.error(`Сайдбар с id ${elementId} не найден`);
77
77
  }
@@ -8,6 +8,9 @@ $b: '.sidebar';
8
8
  position: fixed;
9
9
  right: 0;
10
10
  top: 0;
11
+ transition-duration: var(--duration-leave-s);
12
+ transition-property: opacity;
13
+ transition-timing-function: var(--easing-acceleration);
11
14
  width: calc(100% - 56px);
12
15
  z-index: 910;
13
16
 
@@ -16,6 +19,10 @@ $b: '.sidebar';
16
19
  width: 320px;
17
20
  }
18
21
 
22
+ body:has(.loader_active) & {
23
+ opacity: 0.5;
24
+ }
25
+
19
26
  &_left {
20
27
  left: 0;
21
28
  right: auto;
@@ -1,9 +1,9 @@
1
1
  /* globals BX */
2
2
 
3
- import { cssVar } from '../../helpers/css-var.js';
4
- import { errorHandler } from '../../helpers/error-handler.js';
5
- import { isInViewport } from '../../helpers/is-in-viewport.js';
6
- import { scrollTo } from '../../helpers/scroll-to.js';
3
+ import { cssVar } from '../../utils/css-var.js';
4
+ import { errorHandler } from '../../utils/error-handler.js';
5
+ import { isInViewport } from '../../utils/is-in-viewport.js';
6
+ import { scrollTo } from '../../utils/scroll-to.js';
7
7
  import { hide as hideLoader, show as showLoader } from '../loader/index.js';
8
8
 
9
9
  const setLeftWidth = async ($line, $el) => {
@@ -1,7 +1,7 @@
1
1
  /* globals BX */
2
2
 
3
- import { cssVar } from '../../helpers/css-var.js';
4
- import { errorHandler } from '../../helpers/error-handler.js';
3
+ import { cssVar } from '../../utils/css-var.js';
4
+ import { errorHandler } from '../../utils/error-handler.js';
5
5
 
6
6
  export const init = async ($b) => {
7
7
  const { createTooltip } = await import('@advdominion/tooltip');
@@ -15,7 +15,8 @@ export const init = async ($b) => {
15
15
  return new Promise((resolve) => {
16
16
  if ($b._tooltip) {
17
17
  $b._tooltip.setContent(content);
18
- return resolve();
18
+ resolve();
19
+ return;
19
20
  }
20
21
 
21
22
  const tooltipFetch = $b.dataset.tooltipFetch;
@@ -1,4 +1,4 @@
1
- import { is } from '@advdominion/is';
1
+ import { isError } from 'es-toolkit';
2
2
 
3
3
  import { show as showDialog } from '../components/dialog/index.js';
4
4
 
@@ -26,9 +26,9 @@ export const errorHandler = async (error) => {
26
26
  }
27
27
  const $dialog = document.querySelector('#error-handler');
28
28
  let content = '<p>Не удаётся выполнить действие. Перезагрузите страницу или попробуйте позже</p>';
29
- if (is(error, 'Error')) {
29
+ if (isError(error)) {
30
30
  content += `<pre>${error.toString()}</pre>`;
31
- } else if (is(error, 'Response')) {
31
+ } else if (error instanceof Response) {
32
32
  content = `<pre>${JSON.stringify(
33
33
  {
34
34
  url: error.url,
@@ -1,6 +1,6 @@
1
- export const isInViewport = ($el, offset = {}, partialVisibility = false) => {
1
+ export const isInViewport = ($el, initOffset = {}, partialVisibility = false) => {
2
2
  const rect = $el.getBoundingClientRect();
3
- offset = Object.assign({ top: 0, left: 0, bottom: 0, right: 0 }, offset);
3
+ const offset = Object.assign({ top: 0, left: 0, bottom: 0, right: 0 }, initOffset);
4
4
 
5
5
  if (partialVisibility) {
6
6
  return (
@@ -26,8 +26,8 @@ export const deviceBreakpoint = (device, returnDeviceIndex = false) => {
26
26
  return breakpoint;
27
27
  };
28
28
 
29
- export const mm = (query) => {
30
- query = query.split('-');
29
+ export const mm = (queryString) => {
30
+ const query = queryString.split('-');
31
31
  const device = query.length > 2 ? `${query[0]}-${query[1]}` : query[0];
32
32
  const condition = query.length > 2 ? query[2] : query[1];
33
33
  const { breakpoint, deviceIndex } = deviceBreakpoint(device, true);