@sima-land/ui-nucleons 44.2.9 → 45.0.0-alpha.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/_internal/custom-scrollbar/index.d.ts +13 -7
- package/_internal/custom-scrollbar/index.js +29 -15
- package/_internal/dropdown-loading/index.d.ts +3 -3
- package/_internal/dropdown-loading/index.js +4 -2
- package/_internal/page-scroll-lock/adapters/body-scroll-lock.d.ts +39 -0
- package/_internal/page-scroll-lock/adapters/body-scroll-lock.js +62 -0
- package/_internal/page-scroll-lock/adapters/ui-nucleons.d.ts +25 -0
- package/_internal/page-scroll-lock/adapters/ui-nucleons.js +103 -0
- package/_internal/page-scroll-lock/context.d.ts +13 -0
- package/_internal/page-scroll-lock/context.js +54 -0
- package/_internal/page-scroll-lock/hook.d.ts +12 -0
- package/_internal/page-scroll-lock/hook.js +26 -0
- package/_internal/page-scroll-lock/index.d.ts +4 -0
- package/_internal/page-scroll-lock/index.js +9 -0
- package/_internal/page-scroll-lock/types.d.ts +22 -0
- package/_internal/{checkbox/index.js → page-scroll-lock/types.js} +0 -0
- package/_internal/readme.md +2 -0
- package/_internal/utils/dropdown.d.ts +1 -0
- package/_internal/utils/dropdown.js +1 -0
- package/alert/alert.module.scss +1 -24
- package/alert/index.d.ts +11 -17
- package/alert/index.js +33 -16
- package/arrow-button/arrow-button.module.scss +2 -0
- package/arrow-button/index.d.ts +2 -2
- package/autocomplete/autocomplete.d.ts +8 -0
- package/autocomplete/autocomplete.js +190 -0
- package/autocomplete/autocomplete.module.scss +2 -15
- package/autocomplete/index.d.ts +2 -27
- package/autocomplete/index.js +2 -126
- package/autocomplete/types.d.ts +19 -0
- package/autocomplete/types.js +2 -0
- package/autocomplete-deprecated/autocomplete.module.scss +20 -0
- package/autocomplete-deprecated/index.d.ts +28 -0
- package/autocomplete-deprecated/index.js +130 -0
- package/avatar/index.d.ts +2 -2
- package/avatar/user.d.ts +1 -1
- package/base-input/base-input.d.ts +11 -0
- package/base-input/base-input.js +96 -0
- package/base-input/base-input.module.scss +3 -3
- package/base-input/index.d.ts +2 -23
- package/base-input/index.js +2 -76
- package/base-input/types.d.ts +31 -0
- package/base-input/types.js +2 -0
- package/base-input/utils.d.ts +6 -0
- package/base-input/utils.js +14 -0
- package/base-input-deprecated/base-input.module.scss +66 -0
- package/base-input-deprecated/index.d.ts +24 -0
- package/base-input-deprecated/index.js +80 -0
- package/bordered-layout/index.d.ts +1 -0
- package/bordered-layout/index.js +1 -0
- package/bottom-bar/bottom-bar-util.scss +20 -0
- package/bottom-bar/bottom-bar.d.ts +12 -0
- package/bottom-bar/bottom-bar.js +47 -0
- package/bottom-bar/bottom-bar.module.scss +14 -0
- package/bottom-bar/index.d.ts +2 -21
- package/bottom-bar/index.js +5 -44
- package/bottom-bar/types.d.ts +10 -0
- package/bottom-bar/types.js +2 -0
- package/box/index.d.ts +1 -1
- package/breakpoints.scss +1 -1
- package/button/button.module.scss +70 -53
- package/button/index.d.ts +26 -41
- package/button/index.js +22 -46
- package/card/index.d.ts +2 -1
- package/card/index.js +23 -6
- package/card/slots.d.ts +17 -3
- package/card/slots.js +15 -13
- package/carousel/draggable.d.ts +7 -3
- package/carousel/draggable.js +10 -3
- package/carousel/helpers/draggable-event.d.ts +5 -2
- package/carousel/helpers/draggable-event.js +5 -0
- package/carousel/index.d.ts +1 -1
- package/carousel/index.js +24 -24
- package/checkbox/checkbox.module.scss +2 -0
- package/checkbox/index.d.ts +3 -3
- package/checkbox-field/index.d.ts +3 -0
- package/checkbox-field/index.js +3 -0
- package/clean-buttons/clean-buttons-util.scss +15 -0
- package/clean-buttons/clean-buttons.module.scss +5 -3
- package/clean-buttons/index.d.ts +16 -7
- package/clean-buttons/index.js +17 -14
- package/clean-buttons/types.d.ts +1 -1
- package/clean-buttons/utils.d.ts +5 -1
- package/clean-buttons/utils.js +4 -0
- package/{colors.d.ts → colors/index.d.ts} +1 -1
- package/{colors.js → colors/index.js} +0 -0
- package/dot-nav/index.d.ts +1 -1
- package/dropdown/index.d.ts +1 -0
- package/dropdown/utils.d.ts +19 -0
- package/dropdown/utils.js +45 -0
- package/dropdown-item/dropdown-item.module.scss +80 -15
- package/dropdown-item/index.d.ts +20 -9
- package/dropdown-item/index.js +12 -9
- package/dropdown-item/types.d.ts +3 -0
- package/dropdown-item/types.js +2 -0
- package/dropdown-item/utils.d.ts +45 -0
- package/dropdown-item/utils.js +89 -0
- package/expandable/utils.js +3 -3
- package/field-block/field-block.module.scss +155 -0
- package/field-block/index.d.ts +63 -0
- package/field-block/index.js +43 -0
- package/field-grid/index.d.ts +5 -4
- package/field-grid/index.js +1 -0
- package/helpers/bounds-of.d.ts +5 -1
- package/helpers/bounds-of.js +5 -0
- package/helpers/center-of.d.ts +4 -1
- package/helpers/center-of.js +8 -1
- package/helpers/create-container.d.ts +5 -2
- package/helpers/create-container.js +7 -2
- package/helpers/define-slots.d.ts +3 -3
- package/helpers/define-slots.js +5 -3
- package/helpers/events.d.ts +16 -8
- package/helpers/events.js +41 -15
- package/helpers/find-child-element.d.ts +12 -9
- package/helpers/find-child-element.js +9 -5
- package/helpers/find-offset-parent.d.ts +1 -2
- package/helpers/find-offset-parent.js +2 -2
- package/helpers/find-sibling-index.d.ts +11 -8
- package/helpers/find-sibling-index.js +8 -3
- package/helpers/fit-element-height.d.ts +5 -5
- package/helpers/fit-element-height.js +9 -7
- package/helpers/format-date.d.ts +11 -11
- package/helpers/format-date.js +15 -13
- package/helpers/format-number.d.ts +1 -1
- package/helpers/format-number.js +2 -2
- package/helpers/get-date-interval-data.d.ts +4 -1
- package/helpers/get-date-interval-data.js +7 -2
- package/helpers/get-declination.d.ts +5 -1
- package/helpers/get-declination.js +5 -0
- package/helpers/get-fraction-depth.d.ts +1 -1
- package/helpers/get-fraction-depth.js +2 -2
- package/helpers/get-no-index.d.ts +2 -2
- package/helpers/get-no-index.js +4 -3
- package/helpers/get-relative-pos.d.ts +4 -1
- package/helpers/get-relative-pos.js +7 -2
- package/helpers/get-scroll-parent.d.ts +1 -2
- package/helpers/get-scroll-parent.js +5 -5
- package/helpers/is-browser.d.ts +4 -1
- package/helpers/is-browser.js +8 -1
- package/helpers/is-fully-scrolled.d.ts +3 -3
- package/helpers/is-fully-scrolled.js +2 -2
- package/helpers/is-touch-device.d.ts +1 -1
- package/helpers/is-touch-device.js +4 -5
- package/helpers/layer.d.ts +1 -1
- package/helpers/layer.js +2 -2
- package/helpers/max-index-of.d.ts +4 -1
- package/helpers/max-index-of.js +7 -2
- package/helpers/media-query-list.d.ts +1 -1
- package/helpers/media-query-list.js +2 -2
- package/helpers/on.d.ts +4 -1
- package/helpers/on.js +7 -2
- package/helpers/point.d.ts +4 -1
- package/helpers/point.js +8 -1
- package/helpers/rename.d.ts +3 -1
- package/helpers/rename.js +1 -0
- package/helpers/scroll-to-child.d.ts +1 -1
- package/helpers/scroll-to-child.js +3 -2
- package/helpers/styles.d.ts +8 -2
- package/helpers/styles.js +18 -4
- package/helpers/with-prevent.d.ts +9 -6
- package/helpers/with-prevent.js +16 -9
- package/hint/hint-view.d.ts +26 -0
- package/hint/hint-view.js +43 -0
- package/hint/hint-view.module.scss +31 -0
- package/hint/hint.d.ts +14 -0
- package/hint/hint.js +41 -0
- package/hint/index.d.ts +5 -8
- package/hint/index.js +13 -48
- package/hint/utils.d.ts +61 -0
- package/hint/utils.js +161 -0
- package/{hint → hint-deprecated}/hint.module.scss +0 -0
- package/hint-deprecated/index.d.ts +11 -0
- package/hint-deprecated/index.js +53 -0
- package/hooks/breakpoint/index.d.ts +7 -4
- package/hooks/breakpoint/index.js +21 -13
- package/hooks/breakpoint/types.d.ts +3 -4
- package/hooks/breakpoint/utils.d.ts +2 -1
- package/hooks/breakpoint/utils.js +2 -1
- package/hooks/index.d.ts +8 -8
- package/hooks/index.js +27 -19
- package/hooks/intersection/test-utils.d.ts +1 -1
- package/hooks/intersection/test-utils.js +2 -1
- package/hooks/styles.d.ts +6 -0
- package/hooks/styles.js +26 -0
- package/info-text/index.d.ts +23 -0
- package/info-text/index.js +60 -0
- package/info-text/info-text.module.scss +28 -0
- package/input/index.d.ts +32 -0
- package/input/index.js +96 -0
- package/input/input.module.scss +20 -0
- package/input/utils.d.ts +36 -0
- package/input/utils.js +71 -0
- package/layout/index.d.ts +6 -11
- package/layout/index.js +6 -60
- package/layout/layout.d.ts +10 -0
- package/layout/layout.js +32 -0
- package/layout/layout.module.scss +33 -26
- package/layout/legacy.d.ts +15 -0
- package/layout/legacy.js +68 -0
- package/layout/legacy.module.scss +49 -0
- package/layout/types.d.ts +6 -0
- package/layout/types.js +2 -0
- package/link/index.d.ts +4 -1
- package/link/index.js +2 -2
- package/link/link.module.scss +10 -0
- package/loading-overlay/index.d.ts +1 -0
- package/loading-overlay/index.js +1 -0
- package/masked-field/index.d.ts +1 -0
- package/masked-field/index.js +1 -0
- package/masked-input/hook.d.ts +8 -0
- package/masked-input/hook.js +72 -0
- package/masked-input/index.d.ts +5 -0
- package/masked-input/index.js +7 -0
- package/masked-input/masked-input.d.ts +8 -0
- package/masked-input/masked-input.js +73 -0
- package/masked-input/types.d.ts +51 -0
- package/masked-input/types.js +2 -0
- package/masked-input/utils.d.ts +15 -0
- package/masked-input/utils.js +49 -0
- package/modal/index.d.ts +10 -12
- package/modal/index.js +27 -64
- package/modal/modal.module.scss +98 -55
- package/modal/slots.d.ts +13 -10
- package/modal/slots.js +30 -28
- package/modal/utils.d.ts +8 -10
- package/modal/utils.js +2 -26
- package/modal-overlay/index.d.ts +13 -0
- package/modal-overlay/index.js +60 -0
- package/modal-overlay/modal-overlay-util.scss +1 -0
- package/modal-overlay/modal-overlay.module.scss +14 -0
- package/modal-overlay/utils.d.ts +14 -0
- package/modal-overlay/utils.js +32 -0
- package/package.json +49 -41
- package/pagination/utils.d.ts +2 -2
- package/panel/index.d.ts +27 -13
- package/panel/index.js +43 -9
- package/panel/panel.module.scss +49 -8
- package/phone-input/index.d.ts +4 -28
- package/phone-input/index.js +2 -121
- package/phone-input/phone-input.d.ts +8 -0
- package/phone-input/phone-input.js +133 -0
- package/phone-input/phone-input.module.scss +8 -32
- package/phone-input/presets.d.ts +21 -22
- package/phone-input/presets.js +1 -2
- package/phone-input/types.d.ts +6 -0
- package/phone-input/types.js +2 -0
- package/phone-input/utils.d.ts +30 -1
- package/phone-input/utils.js +52 -3
- package/phone-input-deprecated/index.d.ts +29 -0
- package/phone-input-deprecated/index.js +124 -0
- package/phone-input-deprecated/phone-input.module.scss +41 -0
- package/plate/index.d.ts +3 -3
- package/plate/index.js +2 -2
- package/plate/plate.module.scss +3 -0
- package/popup/index.d.ts +5 -0
- package/popup/index.js +12 -0
- package/popup/popup-view.d.ts +14 -0
- package/popup/popup-view.js +35 -0
- package/popup/popup-view.module.scss +40 -0
- package/popup/popup.d.ts +17 -0
- package/popup/popup.js +73 -0
- package/popup/utils.d.ts +38 -0
- package/popup/utils.js +83 -0
- package/price/index.d.ts +1 -1
- package/price/index.js +3 -3
- package/price/utils.d.ts +5 -5
- package/price/utils.js +33 -23
- package/radio-button/index.d.ts +10 -0
- package/radio-button/index.js +33 -0
- package/radio-button/radio-button.module.scss +46 -0
- package/rating/index.d.ts +2 -1
- package/rating/types.d.ts +1 -1
- package/readme.md +34 -41
- package/screen/index.d.ts +4 -2
- package/screen/index.js +34 -3
- package/screen/screen.module.scss +0 -2
- package/screen/slots.d.ts +2 -8
- package/screen/slots.js +8 -9
- package/screen/utils.d.ts +2 -1
- package/select/index.d.ts +2 -33
- package/select/index.js +3 -109
- package/select/parts/block.d.ts +8 -0
- package/select/parts/block.js +70 -0
- package/select/parts/block.module.scss +3 -0
- package/select/parts/button.d.ts +8 -0
- package/select/parts/button.js +69 -0
- package/select/parts/menu.d.ts +8 -0
- package/select/parts/menu.js +105 -0
- package/select/parts/menu.module.scss +4 -0
- package/select/select.d.ts +14 -0
- package/select/select.js +145 -0
- package/select/types.d.ts +55 -0
- package/select/types.js +2 -0
- package/select/utils.d.ts +3 -0
- package/select/utils.js +13 -0
- package/select-deprecated/index.d.ts +34 -0
- package/select-deprecated/index.js +112 -0
- package/{select → select-deprecated}/select.module.scss +0 -0
- package/shadows.scss +18 -0
- package/side-page/index.d.ts +11 -26
- package/side-page/index.js +21 -26
- package/side-page/side-page.module.scss +35 -29
- package/side-page/slots.d.ts +12 -20
- package/side-page/slots.js +16 -28
- package/spinner/index.d.ts +18 -6
- package/spinner/index.js +25 -12
- package/spinner/spinner.module.scss +8 -0
- package/stepper/index.d.ts +18 -10
- package/stepper/index.js +17 -8
- package/stepper/stepper.module.scss +14 -15
- package/styling/fonts.d.ts +3 -3
- package/switcher-row/index.d.ts +42 -0
- package/switcher-row/index.js +59 -0
- package/switcher-row/switcher-row.module.scss +55 -0
- package/text/index.d.ts +1 -1
- package/text-button/index.d.ts +42 -0
- package/text-button/index.js +46 -0
- package/text-button/text-button.module.scss +99 -0
- package/text-field/index.d.ts +7 -6
- package/text-field/index.js +3 -2
- package/textarea/index.d.ts +21 -0
- package/textarea/index.js +85 -0
- package/textarea/textarea.module.scss +15 -0
- package/toggle/index.d.ts +3 -3
- package/toggle/toggle.module.scss +17 -8
- package/tooltip/index.d.ts +1 -0
- package/tooltip/index.js +1 -0
- package/top-bar/index.d.ts +3 -40
- package/top-bar/index.js +4 -60
- package/top-bar/top-bar-util.scss +29 -0
- package/top-bar/top-bar.d.ts +9 -0
- package/top-bar/top-bar.js +101 -0
- package/top-bar/top-bar.module.scss +129 -67
- package/top-bar/types.d.ts +31 -0
- package/top-bar/types.js +2 -0
- package/top-bar/utils.d.ts +14 -0
- package/top-bar/utils.js +56 -0
- package/touch-slider/index.d.ts +1 -0
- package/touch-slider/index.js +3 -2
- package/types.d.ts +18 -0
- package/types.js +2 -0
- package/unknown-content/index.d.ts +3 -3
- package/unknown-content/index.js +3 -3
- package/unknown-content/unknown-content.module.scss +16 -12
- package/upload-area/index.d.ts +2 -0
- package/upload-area/index.js +5 -0
- package/upload-area/types.d.ts +32 -0
- package/upload-area/types.js +2 -0
- package/upload-area/upload-area-util.scss +17 -0
- package/upload-area/upload-area.d.ts +8 -0
- package/upload-area/upload-area.js +105 -0
- package/upload-area/upload-area.module.scss +78 -0
- package/{upload → upload-area}/upload.svg +0 -0
- package/upload-area/utils.d.ts +17 -0
- package/upload-area/utils.js +48 -0
- package/utils.scss +74 -1
- package/with-hint/index.d.ts +3 -2
- package/with-hint/index.js +1 -0
- package/with-hint/positioning-hint.d.ts +1 -1
- package/with-hint/positioning-hint.js +2 -2
- package/with-tooltip/index.d.ts +2 -1
- package/with-tooltip/index.js +1 -0
- package/with-tooltip/utils.d.ts +2 -2
- package/_internal/body-scroll.d.ts +0 -23
- package/_internal/body-scroll.js +0 -41
- package/_internal/checkbox/index.d.ts +0 -5
- package/constants.d.ts +0 -6
- package/constants.js +0 -9
- package/nav-bar/index.d.ts +0 -46
- package/nav-bar/index.js +0 -76
- package/nav-bar/nav-bar.module.scss +0 -95
- package/upload/area.d.ts +0 -25
- package/upload/area.js +0 -65
- package/upload/area.module.scss +0 -44
- package/upload/utils.d.ts +0 -29
- package/upload/utils.js +0 -45
|
@@ -120,34 +120,38 @@
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
ol {
|
|
123
|
-
|
|
123
|
+
// ВАЖНО: экспериментально используем стили таблицы чтобы содержимое элемента списка не залезало под номер
|
|
124
|
+
// это не позволяет сделать отступ от номера 12px по гайдам - согласовано с дизайнерами
|
|
125
|
+
// при возникновении проблем пересмотреть подход
|
|
126
|
+
display: table;
|
|
127
|
+
border-spacing: 0 16px;
|
|
124
128
|
counter-reset: ordered-list;
|
|
125
129
|
list-style: none;
|
|
126
130
|
li {
|
|
127
|
-
display:
|
|
128
|
-
flex-direction: row;
|
|
129
|
-
list-style-position: inside;
|
|
131
|
+
display: table-row;
|
|
130
132
|
counter-increment: ordered-list;
|
|
131
133
|
}
|
|
132
134
|
li::before {
|
|
133
135
|
content: counter(ordered-list) '.';
|
|
134
|
-
display:
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
display: table-cell;
|
|
137
|
+
|
|
138
|
+
// ВАЖНО: 10 вместо 12 по гайдам - согласовано с дизайнерами
|
|
139
|
+
// уменьшили потому что при табличной стилизации отступ от номера формируется по самому длинному номеру
|
|
140
|
+
padding-right: 10px;
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
ul {
|
|
144
|
+
display: table;
|
|
145
|
+
border-spacing: 0 16px;
|
|
140
146
|
list-style: none;
|
|
141
147
|
li {
|
|
142
|
-
display:
|
|
143
|
-
flex-direction: row;
|
|
144
|
-
list-style-position: inside;
|
|
148
|
+
display: table-row;
|
|
145
149
|
counter-increment: ordered-list;
|
|
146
150
|
}
|
|
147
151
|
li::before {
|
|
148
|
-
display: block;
|
|
149
152
|
content: '—';
|
|
150
|
-
|
|
153
|
+
display: table-cell;
|
|
154
|
+
padding-right: 10px;
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UploadArea = void 0;
|
|
4
|
+
var upload_area_1 = require("./upload-area");
|
|
5
|
+
Object.defineProperty(exports, "UploadArea", { enumerable: true, get: function () { return upload_area_1.UploadArea; } });
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ChangeEvent, CSSProperties, DragEvent, HTMLAttributes, InputHTMLAttributes } from 'react';
|
|
2
|
+
export type UploadAreaSize = 's' | 'm';
|
|
3
|
+
export interface UploadAreaProps {
|
|
4
|
+
/** Размер. */
|
|
5
|
+
size?: UploadAreaSize | 'unset';
|
|
6
|
+
/** CSS-класс корневого элемента. */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Стили корневого элемента. */
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
/** Ограничение на количество файлов. */
|
|
11
|
+
countLimit?: number;
|
|
12
|
+
/** Состояние с ошибками валидации. */
|
|
13
|
+
failed?: boolean;
|
|
14
|
+
/** Отключенное состояния. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Роль файлов. */
|
|
17
|
+
fileRole?: string;
|
|
18
|
+
/** Форматы файлов, выводятся пользователю. */
|
|
19
|
+
formats?: string;
|
|
20
|
+
/** Ограничение на количество файлов. */
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
/** Сработает при выборе или перетаскивании файлов, получив список файлов и событие. */
|
|
23
|
+
onSelect?: (list: File[], event: DragEvent<HTMLElement> | ChangeEvent<HTMLInputElement>) => void;
|
|
24
|
+
/** Ограничение на размер. */
|
|
25
|
+
sizeLimit?: string;
|
|
26
|
+
/** Свойства корневого элемента. */
|
|
27
|
+
rootProps?: HTMLAttributes<HTMLElement>;
|
|
28
|
+
/** Свойства элемента input. */
|
|
29
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
30
|
+
/** Идентификатор для систем автоматизированного тестирования. */
|
|
31
|
+
'data-testid'?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@mixin size-s {
|
|
2
|
+
--padding-x: 16px;
|
|
3
|
+
--padding-y: 20px;
|
|
4
|
+
--justify-content: flex-start;
|
|
5
|
+
--icon-size: 0;
|
|
6
|
+
--icon-display: none;
|
|
7
|
+
--min-height: calc(48px + (2 * var(--padding-y)));
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@mixin size-m {
|
|
11
|
+
--padding-x: 60px;
|
|
12
|
+
--padding-y: 20px;
|
|
13
|
+
--justify-content: center;
|
|
14
|
+
--icon-size: 64px;
|
|
15
|
+
--icon-display: block;
|
|
16
|
+
--min-height: calc(var(--icon-size) + (2 * var(--padding-y)));
|
|
17
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UploadAreaProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Поля выбора файлов.
|
|
5
|
+
* @param props Свойства.
|
|
6
|
+
* @return Элемент.
|
|
7
|
+
*/
|
|
8
|
+
export declare function UploadArea({ className, style, size, multiple, disabled, failed, formats, fileRole, countLimit, onSelect, sizeLimit, rootProps, inputProps, 'data-testid': testId, }: UploadAreaProps): JSX.Element;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.UploadArea = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const link_1 = require("../link");
|
|
32
|
+
const utils_1 = require("./utils");
|
|
33
|
+
const lodash_1 = require("lodash");
|
|
34
|
+
const get_declination_1 = require("../helpers/get-declination");
|
|
35
|
+
const upload_svg_1 = __importDefault(require("./upload.svg"));
|
|
36
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
37
|
+
const upload_area_module_scss_1 = __importDefault(require("./upload-area.module.scss"));
|
|
38
|
+
const cx = bind_1.default.bind(upload_area_module_scss_1.default);
|
|
39
|
+
/**
|
|
40
|
+
* Поля выбора файлов.
|
|
41
|
+
* @param props Свойства.
|
|
42
|
+
* @return Элемент.
|
|
43
|
+
*/
|
|
44
|
+
function UploadArea({ className, style, size = 'm', multiple, disabled, failed, formats, fileRole = 'файл', countLimit = multiple ? undefined : 1, onSelect, sizeLimit, rootProps, inputProps, 'data-testid': testId = 'upload-area', }) {
|
|
45
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
46
|
+
const secondaryInfo = (0, lodash_1.upperFirst)([
|
|
47
|
+
typeof countLimit === 'number' && countLimit > 0
|
|
48
|
+
? `${countLimit} ${(0, get_declination_1.getDeclination)(countLimit, ['файл', 'файла', 'файлов'])}`
|
|
49
|
+
: null,
|
|
50
|
+
formats ? `формат ${formats}` : null,
|
|
51
|
+
sizeLimit ? `до ${sizeLimit}` : null,
|
|
52
|
+
]
|
|
53
|
+
.filter(Boolean)
|
|
54
|
+
.join(', '));
|
|
55
|
+
const filterFiles = (0, react_1.useCallback)((files) => {
|
|
56
|
+
const result = [...files];
|
|
57
|
+
multiple
|
|
58
|
+
? countLimit && Number.isFinite(countLimit) && result.splice(countLimit)
|
|
59
|
+
: result.splice(1);
|
|
60
|
+
return result;
|
|
61
|
+
}, [multiple, countLimit]);
|
|
62
|
+
const onInputChange = (0, react_1.useCallback)(event => {
|
|
63
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(filterFiles(event.target.files || []), event);
|
|
64
|
+
// очищаем поле чтобы можно было выбрать тот же файл повторно
|
|
65
|
+
event.target.value = '';
|
|
66
|
+
}, [filterFiles, onSelect]);
|
|
67
|
+
const { active, bind } = (0, utils_1.useFilesDrop)(event => {
|
|
68
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(filterFiles(event.dataTransfer.files), event);
|
|
69
|
+
});
|
|
70
|
+
const rootClassName = cx('root', size !== 'unset' && `size-${size}`, { active, failed, disabled }, className);
|
|
71
|
+
return (react_1.default.createElement("div", Object.assign({}, rootProps, bind, { "data-testid": testId, style: style, className: rootClassName, tabIndex: disabled ? -1 : 0, role: 'button', onFocus: event => {
|
|
72
|
+
var _a;
|
|
73
|
+
if (!disabled) {
|
|
74
|
+
(_a = rootProps === null || rootProps === void 0 ? void 0 : rootProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(rootProps, event);
|
|
75
|
+
}
|
|
76
|
+
}, onClick: event => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
if (!disabled) {
|
|
79
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
80
|
+
(_b = rootProps === null || rootProps === void 0 ? void 0 : rootProps.onClick) === null || _b === void 0 ? void 0 : _b.call(rootProps, event);
|
|
81
|
+
}
|
|
82
|
+
}, onKeyDown: event => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
// имитируем поведение кнопки
|
|
85
|
+
if (!disabled && ['Enter', 'Space'].includes(event.code)) {
|
|
86
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
87
|
+
(_b = rootProps === null || rootProps === void 0 ? void 0 : rootProps.onKeyDown) === null || _b === void 0 ? void 0 : _b.call(rootProps, event);
|
|
88
|
+
}
|
|
89
|
+
}, onBlur: event => {
|
|
90
|
+
var _a;
|
|
91
|
+
(_a = rootProps === null || rootProps === void 0 ? void 0 : rootProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(rootProps, event);
|
|
92
|
+
} }),
|
|
93
|
+
react_1.default.createElement(upload_svg_1.default, { className: cx('icon') }),
|
|
94
|
+
react_1.default.createElement("div", { className: cx('info') },
|
|
95
|
+
react_1.default.createElement("div", { className: cx('text', 'primary') },
|
|
96
|
+
react_1.default.createElement("input", Object.assign({}, inputProps, { ref: inputRef, type: 'file', multiple: multiple, className: cx('input'), onChange: onInputChange, onClick: e => {
|
|
97
|
+
// для того чтобы при клике на корневом элементе не вызывался второй клик
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
}, "data-testid": 'upload-area:input', disabled: disabled })),
|
|
100
|
+
react_1.default.createElement(link_1.Link, { pseudo: true, "data-testid": 'upload-area:anchor', disabled: disabled },
|
|
101
|
+
"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 ",
|
|
102
|
+
fileRole)),
|
|
103
|
+
secondaryInfo && react_1.default.createElement("div", { className: cx('text', 'secondary') }, secondaryInfo))));
|
|
104
|
+
}
|
|
105
|
+
exports.UploadArea = UploadArea;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
@use '../colors';
|
|
2
|
+
@use './upload-area-util';
|
|
3
|
+
|
|
4
|
+
.root {
|
|
5
|
+
--secondary-text-color: #{colors.$basic-gray38};
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: var(--justify-content);
|
|
9
|
+
padding: calc(var(--padding-y) - 1px) calc(var(--padding-x) - 1px);
|
|
10
|
+
min-height: var(--min-height);
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
border: 1px dashed colors.$basic-gray24;
|
|
13
|
+
max-width: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
outline: 0;
|
|
16
|
+
background: #fff;
|
|
17
|
+
&.size-s {
|
|
18
|
+
@include upload-area-util.size-s;
|
|
19
|
+
}
|
|
20
|
+
&.size-m {
|
|
21
|
+
@include upload-area-util.size-m;
|
|
22
|
+
}
|
|
23
|
+
&:not(.disabled):hover {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
border-color: colors.$basic-blue;
|
|
26
|
+
}
|
|
27
|
+
&:not(.disabled).active,
|
|
28
|
+
&:not(.disabled):focus-visible {
|
|
29
|
+
border-color: colors.$basic-blue;
|
|
30
|
+
border-style: solid;
|
|
31
|
+
}
|
|
32
|
+
&.disabled {
|
|
33
|
+
background: colors.$basic-gray4;
|
|
34
|
+
--secondary-text-color: #{colors.$basic-gray24};
|
|
35
|
+
}
|
|
36
|
+
&.failed {
|
|
37
|
+
--secondary-text-color: #{colors.$additional-deep-red};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.icon {
|
|
42
|
+
width: var(--icon-size);
|
|
43
|
+
height: var(--icon-size);
|
|
44
|
+
display: var(--icon-display);
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
margin-right: 24px;
|
|
47
|
+
fill: colors.$basic-gray24;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.info {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
align-items: flex-start;
|
|
56
|
+
text-align: left;
|
|
57
|
+
.text {
|
|
58
|
+
display: -webkit-box;
|
|
59
|
+
-webkit-box-orient: vertical;
|
|
60
|
+
-webkit-line-clamp: 2;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
&.primary {
|
|
64
|
+
font-size: 16px;
|
|
65
|
+
line-height: 24px;
|
|
66
|
+
}
|
|
67
|
+
&.secondary {
|
|
68
|
+
margin-top: 4px;
|
|
69
|
+
font-size: 14px;
|
|
70
|
+
line-height: 20px;
|
|
71
|
+
color: var(--secondary-text-color);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.input {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DragEventHandler } from 'react';
|
|
2
|
+
type UseFilesDropResult<T> = {
|
|
3
|
+
active: boolean;
|
|
4
|
+
bind: {
|
|
5
|
+
onDragEnter: DragEventHandler<T>;
|
|
6
|
+
onDragOver: DragEventHandler<T>;
|
|
7
|
+
onDragLeave: DragEventHandler<T>;
|
|
8
|
+
onDrop: DragEventHandler<T>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Хук обработки перетаскивания файлов на элемент.
|
|
13
|
+
* @param callback Опции.
|
|
14
|
+
* @return Данные.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useFilesDrop<T extends HTMLElement = HTMLElement>(callback: DragEventHandler<T>): UseFilesDropResult<T>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFilesDrop = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const identity_1 = require("../hooks/identity");
|
|
6
|
+
/**
|
|
7
|
+
* Хук обработки перетаскивания файлов на элемент.
|
|
8
|
+
* @param callback Опции.
|
|
9
|
+
* @return Данные.
|
|
10
|
+
*/
|
|
11
|
+
function useFilesDrop(callback) {
|
|
12
|
+
const [active, setActive] = (0, react_1.useState)(false);
|
|
13
|
+
const callbackRef = (0, identity_1.useIdentityRef)(callback);
|
|
14
|
+
const onDragEnter = (0, react_1.useCallback)(event => {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
setActive(true);
|
|
17
|
+
}, []);
|
|
18
|
+
const onDragOver = (0, react_1.useCallback)(event => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
setActive(true);
|
|
21
|
+
}, []);
|
|
22
|
+
const onDragLeave = (0, react_1.useCallback)(event => {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
const { currentTarget, relatedTarget } = event;
|
|
25
|
+
// игнорируем переход по дочерним элементам
|
|
26
|
+
if (!relatedTarget ||
|
|
27
|
+
(currentTarget instanceof Node &&
|
|
28
|
+
relatedTarget instanceof Node &&
|
|
29
|
+
!currentTarget.contains(relatedTarget))) {
|
|
30
|
+
setActive(false);
|
|
31
|
+
}
|
|
32
|
+
}, []);
|
|
33
|
+
const onDrop = (0, react_1.useCallback)(event => {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
setActive(false);
|
|
36
|
+
callbackRef.current(event);
|
|
37
|
+
}, []);
|
|
38
|
+
return {
|
|
39
|
+
active,
|
|
40
|
+
bind: {
|
|
41
|
+
onDragEnter,
|
|
42
|
+
onDragOver,
|
|
43
|
+
onDragLeave,
|
|
44
|
+
onDrop,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.useFilesDrop = useFilesDrop;
|
package/utils.scss
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
@use './colors';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Скрывает полосы прокрутки у элемента.
|
|
5
|
+
*/
|
|
2
6
|
@mixin hidden-scrollbars {
|
|
3
7
|
scrollbar-width: none; // Firefox
|
|
4
8
|
overflow: -moz-scrollbars-none; // old Firefox
|
|
@@ -7,3 +11,72 @@
|
|
|
7
11
|
display: none; // Chrome, Safari, Opera
|
|
8
12
|
}
|
|
9
13
|
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* стилизует полосы прокрутки по дизайн-гайдам с ограничениями:
|
|
17
|
+
* - в браузерах на основе webkit/blink (Chrome, Opera, Safari) полоса прокрутки не накладывается поверх контента
|
|
18
|
+
* - в браузерах которые поддерживают только стандартизированный способ стилизации (Firefox) определяет только цвет ползунка
|
|
19
|
+
*/
|
|
20
|
+
@mixin semi-stylized-scrollbars($bg-color: #fff) {
|
|
21
|
+
// firefox
|
|
22
|
+
scrollbar-width: thin;
|
|
23
|
+
scrollbar-color: colors.$basic-gray12 transparent;
|
|
24
|
+
|
|
25
|
+
// webkit
|
|
26
|
+
&::-webkit-scrollbar {
|
|
27
|
+
width: 12px;
|
|
28
|
+
}
|
|
29
|
+
&::-webkit-scrollbar-track {
|
|
30
|
+
background: $bg-color;
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
}
|
|
33
|
+
&::-webkit-scrollbar-thumb {
|
|
34
|
+
border: 4px solid $bg-color;
|
|
35
|
+
border-radius: 12px;
|
|
36
|
+
background: colors.$basic-gray12;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Полный сброс стилей button до состояния сравнимого с div.
|
|
42
|
+
* взято отсюда: https://gist.github.com/MoOx/9137295
|
|
43
|
+
*/
|
|
44
|
+
@mixin reset-button {
|
|
45
|
+
outline: none;
|
|
46
|
+
border: none;
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
width: auto;
|
|
50
|
+
overflow: visible;
|
|
51
|
+
|
|
52
|
+
background: transparent;
|
|
53
|
+
|
|
54
|
+
/* inherit font & color from ancestor */
|
|
55
|
+
color: inherit;
|
|
56
|
+
font: inherit;
|
|
57
|
+
|
|
58
|
+
/* Normalize `line-height`. Cannot be changed from `normal` in Firefox 4+. */
|
|
59
|
+
line-height: normal;
|
|
60
|
+
|
|
61
|
+
/* Corrects font smoothing for webkit */
|
|
62
|
+
-webkit-font-smoothing: inherit;
|
|
63
|
+
-moz-osx-font-smoothing: inherit;
|
|
64
|
+
|
|
65
|
+
/* Corrects inability to style clickable `input` types in iOS */
|
|
66
|
+
-webkit-appearance: none;
|
|
67
|
+
|
|
68
|
+
/* Remove excess padding and border in Firefox 4+ */
|
|
69
|
+
&::-moz-focus-inner {
|
|
70
|
+
border: 0;
|
|
71
|
+
padding: 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Формирует стандартную визуальную подсветку для состояния focus-visible.
|
|
77
|
+
*/
|
|
78
|
+
@mixin focus-visible() {
|
|
79
|
+
&:focus-visible {
|
|
80
|
+
outline: 2px solid colors.$basic-blue;
|
|
81
|
+
}
|
|
82
|
+
}
|
package/with-hint/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { HintProps } from '../hint';
|
|
3
|
-
|
|
2
|
+
import { HintProps } from '../hint-deprecated';
|
|
3
|
+
type ChildrenFn = (ref: React.RefObject<Element>, toggle: (opened: boolean) => void) => React.ReactNode;
|
|
4
4
|
export interface WithHintProps {
|
|
5
5
|
/** Содержимое хинта. */
|
|
6
6
|
hint: React.ReactNode;
|
|
@@ -15,6 +15,7 @@ export interface WithHintProps {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Компонент вывода "хинта" рядом с заданным элементом.
|
|
18
|
+
* @deprecated Следует использовать `hint`.
|
|
18
19
|
* @param props Свойства.
|
|
19
20
|
* @return Элемент.
|
|
20
21
|
*/
|
package/with-hint/index.js
CHANGED
|
@@ -30,6 +30,7 @@ const positioning_hint_1 = require("./positioning-hint");
|
|
|
30
30
|
const utils_1 = require("./utils");
|
|
31
31
|
/**
|
|
32
32
|
* Компонент вывода "хинта" рядом с заданным элементом.
|
|
33
|
+
* @deprecated Следует использовать `hint`.
|
|
33
34
|
* @param props Свойства.
|
|
34
35
|
* @return Элемент.
|
|
35
36
|
*/
|
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.PositioningHint = void 0;
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
|
-
const
|
|
31
|
+
const hint_deprecated_1 = require("../hint-deprecated");
|
|
32
32
|
const utils_1 = require("./utils");
|
|
33
33
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
34
34
|
const positioning_hint_module_scss_1 = __importDefault(require("./positioning-hint.module.scss"));
|
|
@@ -48,6 +48,6 @@ const PositioningHint = ({ children, direction, openerRef }) => {
|
|
|
48
48
|
utils_1.PlaceAt[direction](ref.current, openerRef.current);
|
|
49
49
|
}
|
|
50
50
|
}, [direction, children]);
|
|
51
|
-
return (react_1.default.createElement(
|
|
51
|
+
return (react_1.default.createElement(hint_deprecated_1.Hint, { ref: ref, direction: direction, className: cx('hint', 'hidden'), style: { zIndex: layer + 1 }, children: children }));
|
|
52
52
|
};
|
|
53
53
|
exports.PositioningHint = PositioningHint;
|
package/with-tooltip/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
type ChildrenFn = (ref: React.RefObject<HTMLElement>, toggle: (opened: boolean) => void, shown: boolean) => React.ReactNode;
|
|
3
3
|
export interface WithTooltipProps {
|
|
4
4
|
/** Сработает при клике вне подсказки или на крестик в ней. */
|
|
5
5
|
onDismiss?: () => void;
|
|
@@ -10,6 +10,7 @@ export interface WithTooltipProps {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Компонент, добавляющий к содержимому подсказку.
|
|
13
|
+
* @deprecated Можно использовать `popup/utils`.
|
|
13
14
|
* @param props Свойства.
|
|
14
15
|
* @return Элемент.
|
|
15
16
|
*/
|
package/with-tooltip/index.js
CHANGED
|
@@ -30,6 +30,7 @@ const portal_1 = require("../portal");
|
|
|
30
30
|
const positioning_tooltip_1 = require("./positioning-tooltip");
|
|
31
31
|
/**
|
|
32
32
|
* Компонент, добавляющий к содержимому подсказку.
|
|
33
|
+
* @deprecated Можно использовать `popup/utils`.
|
|
33
34
|
* @param props Свойства.
|
|
34
35
|
* @return Элемент.
|
|
35
36
|
*/
|
package/with-tooltip/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type DOMRectLike = Record<(typeof rectKeys)[number], number>;
|
|
2
|
+
type CanPlaceFn = (holder: HTMLElement, tooltipEl: HTMLElement, area: DOMRectLike) => boolean;
|
|
3
3
|
declare const rectKeys: readonly ["top", "left", "bottom", "right", "width", "height"];
|
|
4
4
|
export declare const CanPlace: Record<'onRight' | 'onLeft' | 'onBottom' | 'onTop', CanPlaceFn>;
|
|
5
5
|
export declare const PlaceOffset: {
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BodyScrollOptions } from 'body-scroll-lock';
|
|
2
|
-
export interface WithBodyScrollLock {
|
|
3
|
-
/** Нужно ли выключать прокрутку body. */
|
|
4
|
-
withScrollDisable?: boolean;
|
|
5
|
-
/** Опции отключения прокрутки. */
|
|
6
|
-
scrollDisableOptions?: BodyScrollOptions;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Хук управления блокировкой прокрутки body.
|
|
10
|
-
* @param ref Реф элемента для которого нужно отключить прокрутку body.
|
|
11
|
-
* @param needDisable Нужно ли отключать.
|
|
12
|
-
* @param options Опции.
|
|
13
|
-
*/
|
|
14
|
-
export declare const useBodyScrollLock: (ref: React.RefObject<HTMLElement>, needDisable: boolean | undefined, options?: BodyScrollOptions | undefined) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Проверяет необходимость блокировки дочерних элементов в прокручиваемом элементе.
|
|
17
|
-
* Необходима для того, чтобы в прокручиваемых контейнерах вложенные прокручиваемые элементы,
|
|
18
|
-
* имеющие специальный атрибут, прокручивались нормально.
|
|
19
|
-
* @see {@link https://github.com/willmcpo/body-scroll-lock#more-complex}
|
|
20
|
-
* @param startEl Начальный элемент.
|
|
21
|
-
* @return Нужно ли позволить перетаскивание элемента.
|
|
22
|
-
*/
|
|
23
|
-
export declare const allowTouchMove: Required<BodyScrollOptions>['allowTouchMove'];
|
package/_internal/body-scroll.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.allowTouchMove = exports.useBodyScrollLock = void 0;
|
|
4
|
-
const body_scroll_lock_1 = require("body-scroll-lock");
|
|
5
|
-
const constants_1 = require("../constants");
|
|
6
|
-
const hooks_1 = require("../hooks");
|
|
7
|
-
/**
|
|
8
|
-
* Хук управления блокировкой прокрутки body.
|
|
9
|
-
* @param ref Реф элемента для которого нужно отключить прокрутку body.
|
|
10
|
-
* @param needDisable Нужно ли отключать.
|
|
11
|
-
* @param options Опции.
|
|
12
|
-
*/
|
|
13
|
-
const useBodyScrollLock = (ref, needDisable, options) => {
|
|
14
|
-
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
15
|
-
const element = ref.current;
|
|
16
|
-
if (element && needDisable) {
|
|
17
|
-
(0, body_scroll_lock_1.disableBodyScroll)(element, options);
|
|
18
|
-
return () => (0, body_scroll_lock_1.enableBodyScroll)(element);
|
|
19
|
-
}
|
|
20
|
-
}, [needDisable, options]);
|
|
21
|
-
};
|
|
22
|
-
exports.useBodyScrollLock = useBodyScrollLock;
|
|
23
|
-
/**
|
|
24
|
-
* Проверяет необходимость блокировки дочерних элементов в прокручиваемом элементе.
|
|
25
|
-
* Необходима для того, чтобы в прокручиваемых контейнерах вложенные прокручиваемые элементы,
|
|
26
|
-
* имеющие специальный атрибут, прокручивались нормально.
|
|
27
|
-
* @see {@link https://github.com/willmcpo/body-scroll-lock#more-complex}
|
|
28
|
-
* @param startEl Начальный элемент.
|
|
29
|
-
* @return Нужно ли позволить перетаскивание элемента.
|
|
30
|
-
*/
|
|
31
|
-
const allowTouchMove = (startEl) => {
|
|
32
|
-
let el = startEl;
|
|
33
|
-
while (el && el !== document.body) {
|
|
34
|
-
if (el.getAttribute(constants_1.BSL_IGNORE_ATTR) !== null) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
el = el.parentElement;
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
};
|
|
41
|
-
exports.allowTouchMove = allowTouchMove;
|
package/constants.d.ts
DELETED
package/constants.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BSL_IGNORE_ATTR = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Имя атрибута, устанавливаемого на элемент, имеющий прокрутку.
|
|
6
|
-
* Атрибут устанавливается на элемент в случае, если
|
|
7
|
-
* прокручиваемый родитель элемента обрабатывается с помощью body-scroll-lock.
|
|
8
|
-
*/
|
|
9
|
-
exports.BSL_IGNORE_ATTR = 'data-bsl-ignore';
|