@sima-land/ui-nucleons 44.2.10 → 45.0.0-alpha.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.
- 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/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 +34 -3
- 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 +1 -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} +2 -2
- package/{colors.js → colors/index.js} +2 -1
- package/colors.scss +2 -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 +47 -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 +32 -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-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-util.scss +37 -0
- package/link/link.module.scss +19 -12
- 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 +56 -65
- 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 +7 -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/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 +59 -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 +96 -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-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
- /package/_internal/{checkbox/index.js → page-scroll-lock/types.js} +0 -0
- /package/{hint → hint-deprecated}/hint.module.scss +0 -0
- /package/{select → select-deprecated}/select.module.scss +0 -0
- /package/{upload → upload-area}/upload.svg +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextFieldProps } from '../text-field';
|
|
3
|
+
type Size = 's' | 'm' | 'l' | 'xl';
|
|
4
|
+
export interface SelectProps extends Omit<TextFieldProps, 'style' | 'endAdornment'> {
|
|
5
|
+
/** Нужно ли выводить состояние загрузки списка. */
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
/** Сработает при открытии/закрытии меню. */
|
|
8
|
+
onMenuToggle?: (opened: boolean) => void;
|
|
9
|
+
/** Сработает при выборе. */
|
|
10
|
+
onSelect?: (option: any) => void;
|
|
11
|
+
/** Список опций. */
|
|
12
|
+
options: any[];
|
|
13
|
+
/** Размер для DropdownItem. */
|
|
14
|
+
optionSize?: Size;
|
|
15
|
+
/** Вернет содержимое опции. */
|
|
16
|
+
renderOption?: (option: any) => React.ReactNode;
|
|
17
|
+
/** Стили. */
|
|
18
|
+
style?: React.CSSProperties;
|
|
19
|
+
endAdornment?: TextFieldProps['endAdornment'] | ((opened: boolean) => React.ReactNode);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Выводит иконку стрелки для поля Select по умолчанию.
|
|
23
|
+
* @param opened Открыт ли список опций.
|
|
24
|
+
* @return Элемент.
|
|
25
|
+
*/
|
|
26
|
+
export declare const renderDefaultArrow: (opened: boolean) => JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Поле выбора из списка.
|
|
29
|
+
* @deprecated Следует использовать новую реализацию из "@sima-land/ui-nucleons/select".
|
|
30
|
+
* @param props Свойства.
|
|
31
|
+
* @return Элемент.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Select: ({ options, optionSize, onSelect, style, className, label, onClick, value, loading, onMenuToggle, renderOption, "data-testid": dataTestId, size, endAdornment, ...restProps }: SelectProps) => JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.Select = exports.renderDefaultArrow = void 0;
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const dropdown_1 = require("../dropdown");
|
|
43
|
+
const dropdown_item_1 = require("../dropdown-item");
|
|
44
|
+
const text_field_1 = require("../text-field");
|
|
45
|
+
const dropdown_2 = require("../_internal/utils/dropdown");
|
|
46
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
47
|
+
const down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/down"));
|
|
48
|
+
const up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/up"));
|
|
49
|
+
const select_module_scss_1 = __importDefault(require("./select.module.scss"));
|
|
50
|
+
const colors_1 = require("../colors");
|
|
51
|
+
const dropdown_loading_1 = require("../_internal/dropdown-loading");
|
|
52
|
+
const hooks_1 = require("../hooks");
|
|
53
|
+
const cx = bind_1.default.bind(select_module_scss_1.default);
|
|
54
|
+
/**
|
|
55
|
+
* Выводит иконку стрелки для поля Select по умолчанию.
|
|
56
|
+
* @param opened Открыт ли список опций.
|
|
57
|
+
* @return Элемент.
|
|
58
|
+
*/
|
|
59
|
+
const renderDefaultArrow = (opened) => {
|
|
60
|
+
const ArrowSVG = opened ? up_1.default : down_1.default;
|
|
61
|
+
return react_1.default.createElement(ArrowSVG, { fill: colors_1.COLORS.get('basic-gray38') });
|
|
62
|
+
};
|
|
63
|
+
exports.renderDefaultArrow = renderDefaultArrow;
|
|
64
|
+
/**
|
|
65
|
+
* Поле выбора из списка.
|
|
66
|
+
* @deprecated Следует использовать новую реализацию из "@sima-land/ui-nucleons/select".
|
|
67
|
+
* @param props Свойства.
|
|
68
|
+
* @return Элемент.
|
|
69
|
+
*/
|
|
70
|
+
const Select = (_a) => {
|
|
71
|
+
var { options, optionSize, onSelect, style, className, label, onClick, value, loading, onMenuToggle, renderOption = String, 'data-testid': dataTestId, size, endAdornment = exports.renderDefaultArrow } = _a, restProps = __rest(_a, ["options", "optionSize", "onSelect", "style", "className", "label", "onClick", "value", "loading", "onMenuToggle", "renderOption", 'data-testid', "size", "endAdornment"]);
|
|
72
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
73
|
+
const fieldRef = (0, react_1.useRef)(null);
|
|
74
|
+
const menuRef = (0, react_1.useRef)(null);
|
|
75
|
+
const [opened, toggleMenu] = (0, react_1.useState)(false);
|
|
76
|
+
(0, react_1.useEffect)(() => {
|
|
77
|
+
opened && menuRef.current && menuRef.current.focus();
|
|
78
|
+
onMenuToggle && onMenuToggle(opened);
|
|
79
|
+
}, [opened]);
|
|
80
|
+
(0, hooks_1.useOutsideClick)(rootRef, toggleMenu.bind(null, false));
|
|
81
|
+
return (react_1.default.createElement("div", { ref: rootRef, style: style, className: cx('root', className), "data-testid": dataTestId },
|
|
82
|
+
react_1.default.createElement(text_field_1.TextField, Object.assign({}, restProps, { size: size, blockProps: {
|
|
83
|
+
ref: fieldRef,
|
|
84
|
+
tabIndex: 0,
|
|
85
|
+
onMouseDown: () => {
|
|
86
|
+
toggleMenu(a => !a);
|
|
87
|
+
},
|
|
88
|
+
onKeyDown: e => {
|
|
89
|
+
e.key === 'Enter' && toggleMenu(true);
|
|
90
|
+
},
|
|
91
|
+
}, onClick: e => {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
onClick && onClick(e);
|
|
94
|
+
}, className: select_module_scss_1.default.field, "data-testid": 'select:field', label: label, focused: opened, baseInputProps: {
|
|
95
|
+
// чтобы не ловить фокус на поле
|
|
96
|
+
style: { pointerEvents: 'none' },
|
|
97
|
+
tabIndex: -1,
|
|
98
|
+
}, value: value, multiline: false, variant: 'desktop', readOnly: true, endAdornment: typeof endAdornment === 'function' ? endAdornment(opened) : endAdornment })),
|
|
99
|
+
opened && (loading || options.length > 0) && (react_1.default.createElement(dropdown_1.Dropdown, Object.assign({}, (0, dropdown_2.placeDropdown)(size), { ref: menuRef, "data-testid": 'select:menu', role: 'menu', tabIndex: -1, className: cx('menu'), onKeyDown: event => {
|
|
100
|
+
if (event.key === 'Enter') {
|
|
101
|
+
toggleMenu(false);
|
|
102
|
+
fieldRef.current && fieldRef.current.focus();
|
|
103
|
+
}
|
|
104
|
+
}, onBlur: () => {
|
|
105
|
+
toggleMenu(false);
|
|
106
|
+
fieldRef.current && fieldRef.current.focus();
|
|
107
|
+
} }), loading ? (react_1.default.createElement(dropdown_loading_1.DropdownLoading, { "data-testid": 'select:loading-area' })) : (options.map((option, index) => (react_1.default.createElement(dropdown_item_1.DropdownItem, { size: optionSize, key: index, role: 'menuitem', onClick: () => {
|
|
108
|
+
toggleMenu(false);
|
|
109
|
+
onSelect && onSelect(option);
|
|
110
|
+
} }, renderOption(option)))))))));
|
|
111
|
+
};
|
|
112
|
+
exports.Select = Select;
|
package/shadows.scss
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Формирует тень по дизайн-гайдам.
|
|
3
|
+
*/
|
|
4
|
+
@mixin box-shadow($key) {
|
|
5
|
+
@if $key == 'z1' {
|
|
6
|
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.08);
|
|
7
|
+
} @else if $key == 'z2' {
|
|
8
|
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.04), 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
9
|
+
} @else if $key == 'z2-straight' {
|
|
10
|
+
box-shadow: 0 0 15px rgba(0, 0, 0, 0.12);
|
|
11
|
+
} @else if $key == 'z3' {
|
|
12
|
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08), 0 0 4px rgba(0, 0, 0, 0.04);
|
|
13
|
+
} @else if $key == 'z4' {
|
|
14
|
+
box-shadow: 0 0 4px rgba(0, 0, 0, 0.04), 0 12px 30px rgba(0, 0, 0, 0.1);
|
|
15
|
+
} @else {
|
|
16
|
+
@warn 'No such shadow `#{$key}`.';
|
|
17
|
+
}
|
|
18
|
+
}
|
package/side-page/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { WithPageScrollLock } from '../_internal/page-scroll-lock';
|
|
3
|
+
import { SidePageBody, SidePageFooter, SidePageHeader } from './slots';
|
|
3
4
|
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
4
|
-
export interface SidePageProps extends
|
|
5
|
+
export interface SidePageProps extends WithPageScrollLock {
|
|
5
6
|
/** Нужно ли показать компонент. */
|
|
6
7
|
shown?: boolean;
|
|
7
8
|
/** Нужно ли использовать анимации при открытии/закрытии. */
|
|
@@ -9,7 +10,7 @@ export interface SidePageProps extends WithBodyScrollLock {
|
|
|
9
10
|
/** Ширина. */
|
|
10
11
|
size?: 's' | 'm';
|
|
11
12
|
/** Содержимое. */
|
|
12
|
-
children?:
|
|
13
|
+
children?: ReactNode;
|
|
13
14
|
/** Сработает при закрытии. */
|
|
14
15
|
onClose?: () => void;
|
|
15
16
|
/** Обработчик "onEntering" для CSSTransition. */
|
|
@@ -30,25 +31,9 @@ export interface SidePageProps extends WithBodyScrollLock {
|
|
|
30
31
|
* @param props Свойства.
|
|
31
32
|
* @return Элемент.
|
|
32
33
|
*/
|
|
33
|
-
export declare
|
|
34
|
-
|
|
35
|
-
Header:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}): JSX.Element;
|
|
40
|
-
displayName: string;
|
|
41
|
-
};
|
|
42
|
-
Body: {
|
|
43
|
-
({ children }: {
|
|
44
|
-
children?: React.ReactNode;
|
|
45
|
-
}): JSX.Element;
|
|
46
|
-
displayName: string;
|
|
47
|
-
};
|
|
48
|
-
Footer: {
|
|
49
|
-
({ padded, ...props }: import("../bottom-bar").BottomBarProps & {
|
|
50
|
-
padded?: boolean | undefined;
|
|
51
|
-
}): JSX.Element;
|
|
52
|
-
displayName: string;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
34
|
+
export declare function SidePage({ shown, withTransitions, onEnter, onEntering, onEntered, onExit, onExiting, onExited, ...restProps }: SidePageProps): JSX.Element;
|
|
35
|
+
export declare namespace SidePage {
|
|
36
|
+
var Header: typeof SidePageHeader;
|
|
37
|
+
var Body: typeof SidePageBody;
|
|
38
|
+
var Footer: typeof SidePageFooter;
|
|
39
|
+
}
|
package/side-page/index.js
CHANGED
|
@@ -40,11 +40,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
40
|
exports.SidePage = void 0;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
42
|
const define_slots_1 = require("../helpers/define-slots");
|
|
43
|
-
const
|
|
44
|
-
const layer_1 = require("../helpers/layer");
|
|
45
|
-
const body_scroll_1 = require("../_internal/body-scroll");
|
|
43
|
+
const page_scroll_lock_1 = require("../_internal/page-scroll-lock");
|
|
46
44
|
const slots_1 = require("./slots");
|
|
47
45
|
const CSSTransition_1 = __importDefault(require("react-transition-group/CSSTransition"));
|
|
46
|
+
const modal_overlay_1 = require("../modal-overlay");
|
|
47
|
+
const utils_1 = require("../modal-overlay/utils");
|
|
48
48
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
49
49
|
const side_page_module_scss_1 = __importDefault(require("./side-page.module.scss"));
|
|
50
50
|
const cx = bind_1.default.bind(side_page_module_scss_1.default);
|
|
@@ -59,38 +59,33 @@ const transitionClasses = {
|
|
|
59
59
|
* @param props Свойства.
|
|
60
60
|
* @return Элемент.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
function SidePage(_a) {
|
|
63
63
|
var { shown, withTransitions, onEnter, onEntering, onEntered, onExit, onExiting, onExited } = _a, restProps = __rest(_a, ["shown", "withTransitions", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited"]);
|
|
64
64
|
const transitionDuration = withTransitions ? 300 : 0;
|
|
65
65
|
return (react_1.default.createElement(CSSTransition_1.default, { in: shown, timeout: transitionDuration, classNames: transitionClasses, unmountOnExit: true, onEntering: onEntering, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited }, transitionStatus => (react_1.default.createElement(SidePageInner, Object.assign({}, restProps, { transitionStatus, transitionDuration })))));
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
67
|
exports.SidePage = SidePage;
|
|
68
68
|
/**
|
|
69
69
|
* Фиктивный компонент, необходимый для того чтобы задействовать хук блокировки прокрутки внутри CSSTransition.
|
|
70
70
|
* @param props Свойства.
|
|
71
71
|
* @return Элемент.
|
|
72
72
|
*/
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
const overlayBind = (0, utils_1.useCloseHandler)(onClose);
|
|
73
|
+
function SidePageInner({ size = 'm', children, onClose, withScrollDisable = false, scrollDisableOptions, transitionStatus, transitionDuration, }) {
|
|
74
|
+
const overlayClickBind = (0, utils_1.useExactClick)(onClose);
|
|
76
75
|
const ref = (0, react_1.useRef)(null);
|
|
77
|
-
|
|
78
|
-
zIndex: layer,
|
|
79
|
-
'--transition-duration': `${transitionDuration}ms`,
|
|
80
|
-
};
|
|
76
|
+
(0, page_scroll_lock_1.usePageScrollLock)(ref, Object.assign({ lockEnabled: withScrollDisable }, scrollDisableOptions));
|
|
81
77
|
const { header, body, footer } = (0, define_slots_1.defineSlots)(children, {
|
|
82
|
-
header:
|
|
83
|
-
body:
|
|
84
|
-
footer:
|
|
78
|
+
header: SidePage.Header,
|
|
79
|
+
body: SidePage.Body,
|
|
80
|
+
footer: SidePage.Footer,
|
|
85
81
|
});
|
|
86
|
-
|
|
87
|
-
return (react_1.default.createElement(
|
|
88
|
-
react_1.default.createElement(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
exports.SidePage.Footer = slots_1.SidePageFooter;
|
|
82
|
+
const overlayProps = Object.assign({ style: { '--transition-duration': `${transitionDuration}ms` } }, (transitionStatus !== 'entering' && overlayClickBind));
|
|
83
|
+
return (react_1.default.createElement(modal_overlay_1.ModalOverlay, Object.assign({}, overlayProps),
|
|
84
|
+
react_1.default.createElement("div", { className: cx('side-page', `size-${size}`) },
|
|
85
|
+
header,
|
|
86
|
+
react_1.default.createElement("div", { ref: ref, className: cx('body') }, body),
|
|
87
|
+
footer)));
|
|
88
|
+
}
|
|
89
|
+
SidePage.Header = slots_1.SidePageHeader;
|
|
90
|
+
SidePage.Body = slots_1.SidePageBody;
|
|
91
|
+
SidePage.Footer = slots_1.SidePageFooter;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
@use '../colors';
|
|
2
|
+
@use '../breakpoints';
|
|
3
|
+
@use '../top-bar/top-bar-util';
|
|
4
|
+
@use '../bottom-bar/bottom-bar-util';
|
|
5
|
+
@use '../modal-overlay/modal-overlay-util';
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
.overlay {
|
|
6
|
-
position: fixed;
|
|
7
|
-
top: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
right: 0;
|
|
10
|
-
bottom: 0;
|
|
11
|
-
background: $overlay-color;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.main {
|
|
7
|
+
.side-page {
|
|
15
8
|
position: absolute;
|
|
16
9
|
top: 0;
|
|
17
10
|
right: 0;
|
|
@@ -20,18 +13,34 @@ $overlay-color: rgba(0, 0, 0, 0.24);
|
|
|
20
13
|
display: flex;
|
|
21
14
|
flex-direction: column;
|
|
22
15
|
background: #fff;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.size-m
|
|
30
|
-
|
|
16
|
+
@include breakpoints.down('xs') {
|
|
17
|
+
width: 100%;
|
|
18
|
+
.header {
|
|
19
|
+
@include top-bar-util.size-m;
|
|
20
|
+
}
|
|
21
|
+
.footer {
|
|
22
|
+
@include bottom-bar-util.size-m;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
@include breakpoints.up('xs') {
|
|
26
|
+
&.size-s {
|
|
27
|
+
max-width: 488px;
|
|
28
|
+
}
|
|
29
|
+
&.size-m {
|
|
30
|
+
max-width: 968px;
|
|
31
|
+
}
|
|
32
|
+
.header {
|
|
33
|
+
@include top-bar-util.size-xl;
|
|
34
|
+
}
|
|
35
|
+
.footer {
|
|
36
|
+
@include bottom-bar-util.size-l;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
.header {
|
|
34
42
|
flex-shrink: 0;
|
|
43
|
+
width: 100%;
|
|
35
44
|
}
|
|
36
45
|
|
|
37
46
|
.body {
|
|
@@ -42,32 +51,29 @@ $overlay-color: rgba(0, 0, 0, 0.24);
|
|
|
42
51
|
.footer {
|
|
43
52
|
flex-shrink: 0;
|
|
44
53
|
width: 100%;
|
|
45
|
-
&.padded {
|
|
46
|
-
padding: 0 40px;
|
|
47
|
-
}
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
// transitions
|
|
51
57
|
.enter {
|
|
52
58
|
background-color: transparent;
|
|
53
|
-
.
|
|
59
|
+
.side-page {
|
|
54
60
|
transform: translateX(100%);
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
.enter-active {
|
|
59
65
|
transition: background-color var(--transition-duration) ease-in-out;
|
|
60
|
-
background-color:
|
|
66
|
+
background-color: modal-overlay-util.$overlay-color;
|
|
61
67
|
overflow: hidden;
|
|
62
|
-
.
|
|
68
|
+
.side-page {
|
|
63
69
|
transition: transform var(--transition-duration) ease-in-out;
|
|
64
70
|
transform: translateX(0);
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
.exit {
|
|
69
|
-
background-color:
|
|
70
|
-
.
|
|
75
|
+
background-color: modal-overlay-util.$overlay-color;
|
|
76
|
+
.side-page {
|
|
71
77
|
transform: translateX(0);
|
|
72
78
|
}
|
|
73
79
|
}
|
|
@@ -76,7 +82,7 @@ $overlay-color: rgba(0, 0, 0, 0.24);
|
|
|
76
82
|
transition: background-color var(--transition-duration) ease-in-out;
|
|
77
83
|
background-color: transparent;
|
|
78
84
|
overflow: hidden;
|
|
79
|
-
.
|
|
85
|
+
.side-page {
|
|
80
86
|
transition: transform var(--transition-duration) ease-in-out;
|
|
81
87
|
transform: translateX(100%);
|
|
82
88
|
}
|
package/side-page/slots.d.ts
CHANGED
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { TopBarProps } from '../top-bar';
|
|
3
3
|
import { BottomBarProps } from '../bottom-bar';
|
|
4
4
|
/**
|
|
5
|
+
* Шапка SidePage.
|
|
5
6
|
* @param props Свойства.
|
|
6
7
|
* @return Элемент.
|
|
7
8
|
*/
|
|
8
|
-
export declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}): JSX.Element;
|
|
13
|
-
displayName: string;
|
|
14
|
-
};
|
|
9
|
+
export declare function SidePageHeader({ onBack, onClose, buttons, ...topBarProps }: TopBarProps & {
|
|
10
|
+
onBack?: () => void;
|
|
11
|
+
onClose?: () => void;
|
|
12
|
+
}): JSX.Element;
|
|
15
13
|
/**
|
|
14
|
+
* Основной контент SidePage.
|
|
16
15
|
* @param props Свойства.
|
|
17
16
|
* @return Элемент.
|
|
18
17
|
*/
|
|
19
|
-
export declare
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}): JSX.Element;
|
|
23
|
-
displayName: string;
|
|
24
|
-
};
|
|
18
|
+
export declare function SidePageBody({ children }: {
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}): JSX.Element;
|
|
25
21
|
/**
|
|
22
|
+
* Подвал SidePage.
|
|
26
23
|
* @param props Свойства.
|
|
27
24
|
* @return Элемент.
|
|
28
25
|
*/
|
|
29
|
-
export declare
|
|
30
|
-
({ padded, ...props }: BottomBarProps & {
|
|
31
|
-
padded?: boolean | undefined;
|
|
32
|
-
}): JSX.Element;
|
|
33
|
-
displayName: string;
|
|
34
|
-
};
|
|
26
|
+
export declare function SidePageFooter({ ...props }: BottomBarProps): JSX.Element;
|
package/side-page/slots.js
CHANGED
|
@@ -18,47 +18,35 @@ exports.SidePageFooter = exports.SidePageBody = exports.SidePageHeader = void 0;
|
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const top_bar_1 = require("../top-bar");
|
|
20
20
|
const bottom_bar_1 = require("../bottom-bar");
|
|
21
|
-
const
|
|
22
|
-
const arrow_left_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/arrow-left"));
|
|
23
|
-
const side_page_module_scss_1 = __importDefault(require("./side-page.module.scss"));
|
|
21
|
+
const utils_1 = require("../top-bar/utils");
|
|
24
22
|
const classnames_1 = __importDefault(require("classnames"));
|
|
23
|
+
const side_page_module_scss_1 = __importDefault(require("./side-page.module.scss"));
|
|
25
24
|
/**
|
|
25
|
+
* Шапка SidePage.
|
|
26
26
|
* @param props Свойства.
|
|
27
27
|
* @return Элемент.
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
var { onBack, onClose } = _a, topBarProps = __rest(_a, ["onBack", "onClose"]);
|
|
31
|
-
return (react_1.default.createElement(top_bar_1.TopBar, Object.assign({}, topBarProps, { size: '
|
|
32
|
-
|
|
33
|
-
'data-testid': 'side-page:back',
|
|
34
|
-
onClick: onBack,
|
|
35
|
-
icon: react_1.default.createElement(arrow_left_1.default, null),
|
|
36
|
-
},
|
|
37
|
-
})), (onClose && {
|
|
38
|
-
end: {
|
|
39
|
-
'data-testid': 'side-page:close',
|
|
40
|
-
onClick: onClose,
|
|
41
|
-
icon: react_1.default.createElement(cross_1.default, null),
|
|
42
|
-
},
|
|
43
|
-
})) })));
|
|
44
|
-
};
|
|
29
|
+
function SidePageHeader(_a) {
|
|
30
|
+
var { onBack, onClose, buttons } = _a, topBarProps = __rest(_a, ["onBack", "onClose", "buttons"]);
|
|
31
|
+
return (react_1.default.createElement(top_bar_1.TopBar, Object.assign({}, topBarProps, { size: 'unset', className: side_page_module_scss_1.default.header, buttons: (0, utils_1.navigationButtons)({ buttons, onBack, onClose }) })));
|
|
32
|
+
}
|
|
45
33
|
exports.SidePageHeader = SidePageHeader;
|
|
46
|
-
exports.SidePageHeader.displayName = 'SidePage.Header';
|
|
47
34
|
/**
|
|
35
|
+
* Основной контент SidePage.
|
|
48
36
|
* @param props Свойства.
|
|
49
37
|
* @return Элемент.
|
|
50
38
|
*/
|
|
51
|
-
|
|
39
|
+
function SidePageBody({ children }) {
|
|
40
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
41
|
+
}
|
|
52
42
|
exports.SidePageBody = SidePageBody;
|
|
53
|
-
exports.SidePageBody.displayName = 'SidePage.Body';
|
|
54
43
|
/**
|
|
44
|
+
* Подвал SidePage.
|
|
55
45
|
* @param props Свойства.
|
|
56
46
|
* @return Элемент.
|
|
57
47
|
*/
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
props
|
|
61
|
-
|
|
62
|
-
};
|
|
48
|
+
function SidePageFooter(_a) {
|
|
49
|
+
var props = __rest(_a, []);
|
|
50
|
+
return react_1.default.createElement(bottom_bar_1.BottomBar, Object.assign({}, props, { size: 'unset', className: (0, classnames_1.default)(side_page_module_scss_1.default.footer) }));
|
|
51
|
+
}
|
|
63
52
|
exports.SidePageFooter = SidePageFooter;
|
|
64
|
-
exports.SidePageFooter.displayName = 'SidePage.Footer';
|
package/spinner/index.d.ts
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Token } from '../colors';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Следует использовать 's' | 'm' | 'l'.
|
|
5
|
+
*/
|
|
6
|
+
type SpinnerLegacySize = 'small' | 'medium' | 'large';
|
|
7
|
+
export type SpinnerSize = 's' | 'm' | 'l';
|
|
5
8
|
export interface SpinnerProps {
|
|
6
9
|
/** Размер. */
|
|
7
|
-
size?:
|
|
10
|
+
size?: SpinnerSize | SpinnerLegacySize;
|
|
8
11
|
/** Цвет. */
|
|
9
|
-
color?:
|
|
12
|
+
color?: Token;
|
|
10
13
|
/** Класс. */
|
|
11
14
|
className?: string;
|
|
12
15
|
/** Стили. */
|
|
13
16
|
style?: React.CSSProperties;
|
|
17
|
+
/** Идентификатор для систем автоматизированного тестирования. */
|
|
18
|
+
'data-testid'?: string | null;
|
|
14
19
|
}
|
|
15
|
-
export declare const DIAMETERS: Record<
|
|
20
|
+
export declare const DIAMETERS: Record<SpinnerSize | SpinnerLegacySize, number>;
|
|
16
21
|
/**
|
|
17
22
|
* Компонент спиннера.
|
|
18
23
|
* @param props Свойства.
|
|
19
24
|
* @return Элемент.
|
|
20
25
|
*/
|
|
21
|
-
export declare
|
|
26
|
+
export declare function Spinner({ size, color, className, style, 'data-testid': testId, }: SpinnerProps): JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Спиннер.
|
|
29
|
+
* Выделен в отдельный компонент для возможности использования без обертки в виде div.
|
|
30
|
+
* @param props Свойства.
|
|
31
|
+
* @return Элемент.
|
|
32
|
+
*/
|
|
33
|
+
export declare function SpinnerSVG({ size, color, className, style, 'data-testid': testId, }: SpinnerProps): JSX.Element;
|
|
22
34
|
export {};
|
package/spinner/index.js
CHANGED
|
@@ -3,32 +3,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Spinner = exports.DIAMETERS = void 0;
|
|
6
|
+
exports.SpinnerSVG = exports.Spinner = exports.DIAMETERS = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const lodash_1 = require("lodash");
|
|
9
|
-
const bind_1 = __importDefault(require("classnames/bind"));
|
|
10
9
|
const colors_1 = require("../colors");
|
|
10
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
11
11
|
const spinner_module_scss_1 = __importDefault(require("./spinner.module.scss"));
|
|
12
12
|
const cx = bind_1.default.bind(spinner_module_scss_1.default);
|
|
13
13
|
exports.DIAMETERS = {
|
|
14
|
+
s: 20,
|
|
15
|
+
m: 48,
|
|
16
|
+
l: 80,
|
|
17
|
+
// legacy, @todo удалить со временем:
|
|
14
18
|
small: 20,
|
|
15
19
|
medium: 48,
|
|
16
20
|
large: 80,
|
|
17
21
|
};
|
|
18
22
|
const DEFAULT_COLOR = 'basic-blue';
|
|
19
|
-
const AVAILABLE_COLORS = ['basic-blue', 'basic-white'];
|
|
20
23
|
/**
|
|
21
24
|
* Компонент спиннера.
|
|
22
25
|
* @param props Свойства.
|
|
23
26
|
* @return Элемент.
|
|
24
27
|
*/
|
|
25
|
-
|
|
26
|
-
const readySize = (0, lodash_1.has)(exports.DIAMETERS, size) ? size : '
|
|
27
|
-
const readyColor =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
react_1.default.createElement("svg", { className: cx('spinner', `size-${readySize}`), viewBox: `0 0 ${diameter} ${diameter}`, width: diameter, height: diameter, stroke: colors_1.COLORS.get(readyColor) },
|
|
32
|
-
react_1.default.createElement("circle", { className: cx('circle'), cx: radius, cy: radius, r: radius - 1 }))));
|
|
33
|
-
};
|
|
28
|
+
function Spinner({ size = 'm', color = DEFAULT_COLOR, className, style, 'data-testid': testId = 'spinner', }) {
|
|
29
|
+
const readySize = (0, lodash_1.has)(exports.DIAMETERS, size) ? size : 'm';
|
|
30
|
+
const readyColor = colors_1.COLORS.has(color) ? color : DEFAULT_COLOR;
|
|
31
|
+
return (react_1.default.createElement("div", { className: className, style: style, "data-testid": testId },
|
|
32
|
+
react_1.default.createElement(SpinnerSVG, { size: readySize, color: readyColor, "data-testid": null })));
|
|
33
|
+
}
|
|
34
34
|
exports.Spinner = Spinner;
|
|
35
|
+
/**
|
|
36
|
+
* Спиннер.
|
|
37
|
+
* Выделен в отдельный компонент для возможности использования без обертки в виде div.
|
|
38
|
+
* @param props Свойства.
|
|
39
|
+
* @return Элемент.
|
|
40
|
+
*/
|
|
41
|
+
function SpinnerSVG({ size = 'm', color = DEFAULT_COLOR, className, style, 'data-testid': testId = 'spinner', }) {
|
|
42
|
+
const diameter = exports.DIAMETERS[size];
|
|
43
|
+
const radius = diameter / 2;
|
|
44
|
+
return (react_1.default.createElement("svg", { style: style, className: cx('spinner', `size-${size}`, className), viewBox: `0 0 ${diameter} ${diameter}`, width: diameter, height: diameter, stroke: colors_1.COLORS.get(color), "data-testid": testId },
|
|
45
|
+
react_1.default.createElement("circle", { className: cx('circle'), cx: radius, cy: radius, r: radius - 1 })));
|
|
46
|
+
}
|
|
47
|
+
exports.SpinnerSVG = SpinnerSVG;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
$pi: 3.141592653589793;
|
|
2
2
|
$sizes: (
|
|
3
|
+
s: 20,
|
|
4
|
+
m: 48,
|
|
5
|
+
l: 80,
|
|
6
|
+
// legacy, @todo удалить со временем:
|
|
3
7
|
small: 20,
|
|
4
8
|
medium: 48,
|
|
5
9
|
large: 80,
|
|
6
10
|
);
|
|
7
11
|
$durations: (
|
|
12
|
+
s: 600ms,
|
|
13
|
+
m: 750ms,
|
|
14
|
+
l: 950ms,
|
|
15
|
+
// legacy, @todo удалить со временем:
|
|
8
16
|
small: 600ms,
|
|
9
17
|
medium: 750ms,
|
|
10
18
|
large: 950ms,
|