@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
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@use '../clean-buttons/clean-buttons-util';
|
|
2
|
+
|
|
3
|
+
$size-s-height: 64px;
|
|
4
|
+
$size-m-height: 72px;
|
|
5
|
+
$size-l-height: 80px;
|
|
6
|
+
|
|
7
|
+
@mixin size-s {
|
|
8
|
+
--bottom-bar-height: #{$size-s-height};
|
|
9
|
+
@include clean-buttons-util.size-s;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@mixin size-m {
|
|
13
|
+
--bottom-bar-height: #{$size-m-height};
|
|
14
|
+
@include clean-buttons-util.size-m;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@mixin size-l {
|
|
18
|
+
--bottom-bar-height: #{$size-l-height};
|
|
19
|
+
@include clean-buttons-util.size-l;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BottomBarProps, BottomBarSize } from './types';
|
|
3
|
+
export declare const BOTTOM_BAR_HEIGHT: Record<BottomBarSize, number>;
|
|
4
|
+
export declare const BOTTOM_BAR_DEFAULTS: {
|
|
5
|
+
readonly size: "m";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Боттом бар.
|
|
9
|
+
* @param props Свойства.
|
|
10
|
+
* @return Элемент.
|
|
11
|
+
*/
|
|
12
|
+
export declare function BottomBar({ size, divided, children, className, 'data-testid': testId, ...rest }: BottomBarProps): JSX.Element;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.BottomBar = exports.BOTTOM_BAR_DEFAULTS = exports.BOTTOM_BAR_HEIGHT = void 0;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const shapes_1 = require("../styling/shapes");
|
|
20
|
+
const utils_1 = require("../clean-buttons/utils");
|
|
21
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
22
|
+
const bottom_bar_module_scss_1 = __importDefault(require("./bottom-bar.module.scss"));
|
|
23
|
+
const cx = bind_1.default.bind(bottom_bar_module_scss_1.default);
|
|
24
|
+
// некоторым компонентам нужно знать конкретную высоту, делаем единый источник
|
|
25
|
+
exports.BOTTOM_BAR_HEIGHT = {
|
|
26
|
+
s: 64,
|
|
27
|
+
m: 72,
|
|
28
|
+
l: 80,
|
|
29
|
+
};
|
|
30
|
+
// некоторым компонентам нужно знать значения по умолчанию, делаем единый источник
|
|
31
|
+
exports.BOTTOM_BAR_DEFAULTS = {
|
|
32
|
+
size: 'm',
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Боттом бар.
|
|
36
|
+
* @param props Свойства.
|
|
37
|
+
* @return Элемент.
|
|
38
|
+
*/
|
|
39
|
+
function BottomBar(_a) {
|
|
40
|
+
var { size = exports.BOTTOM_BAR_DEFAULTS.size, divided, children, className, 'data-testid': testId = 'bottom-bar' } = _a, rest = __rest(_a, ["size", "divided", "children", "className", 'data-testid']);
|
|
41
|
+
const rooClassName = cx('root', size !== 'unset' && `size-${size}`, { divided }, shapes_1.MediumRounds.bottom, className);
|
|
42
|
+
return (
|
|
43
|
+
// чтобы CleanButton автоматически брали размер, соответствующий размеру BottomBar
|
|
44
|
+
react_1.default.createElement(utils_1.CleanGroupSizeContext.Provider, { value: size },
|
|
45
|
+
react_1.default.createElement("div", Object.assign({}, rest, { className: rooClassName, "data-testid": testId }), children)));
|
|
46
|
+
}
|
|
47
|
+
exports.BottomBar = BottomBar;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@use './bottom-bar-util';
|
|
1
2
|
@import '../styling/borders.module';
|
|
2
3
|
|
|
3
4
|
.root {
|
|
@@ -6,6 +7,7 @@
|
|
|
6
7
|
position: relative;
|
|
7
8
|
background: #fff;
|
|
8
9
|
overflow: hidden;
|
|
10
|
+
height: var(--bottom-bar-height);
|
|
9
11
|
|
|
10
12
|
// чтобы разделитель был над контентом делаем через pseudo-элемент
|
|
11
13
|
&.divided::after {
|
|
@@ -19,3 +21,15 @@
|
|
|
19
21
|
@extend .inner-border-top;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
24
|
+
|
|
25
|
+
.size-s {
|
|
26
|
+
@include bottom-bar-util.size-s;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.size-m {
|
|
30
|
+
@include bottom-bar-util.size-m;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.size-l {
|
|
34
|
+
@include bottom-bar-util.size-l;
|
|
35
|
+
}
|
package/bottom-bar/index.d.ts
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface BottomBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'size'> {
|
|
4
|
-
/** Размер (высота). */
|
|
5
|
-
size?: BottomBarSize;
|
|
6
|
-
/** Нужна ли разделительная черта сверху. */
|
|
7
|
-
divided?: boolean;
|
|
8
|
-
/** Идентификатор для систем автоматизированного тестирования. */
|
|
9
|
-
'data-testid'?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const BOTTOM_BAR_HEIGHT: Record<BottomBarSize, number>;
|
|
12
|
-
export declare const BOTTOM_BAR_DEFAULTS: {
|
|
13
|
-
readonly size: "m";
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Боттом бар.
|
|
17
|
-
* @param props Свойства.
|
|
18
|
-
* @return Элемент.
|
|
19
|
-
*/
|
|
20
|
-
export declare const BottomBar: ({ size, divided, children, className, style, "data-testid": testId, ...rest }: BottomBarProps) => JSX.Element;
|
|
21
|
-
export {};
|
|
1
|
+
export { BottomBar, BOTTOM_BAR_DEFAULTS, BOTTOM_BAR_HEIGHT } from './bottom-bar';
|
|
2
|
+
export { BottomBarSize, BottomBarProps } from './types';
|
package/bottom-bar/index.js
CHANGED
|
@@ -1,46 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const utils_1 = require("../clean-buttons/utils");
|
|
23
|
-
const cx = bind_1.default.bind(bottom_bar_module_scss_1.default);
|
|
24
|
-
// некоторым компонентам нужно знать конкретную высоту, делаем единый источник
|
|
25
|
-
exports.BOTTOM_BAR_HEIGHT = {
|
|
26
|
-
s: 64,
|
|
27
|
-
m: 72,
|
|
28
|
-
l: 80,
|
|
29
|
-
};
|
|
30
|
-
// некоторым компонентам нужно знать значения по умолчанию, делаем единый источник
|
|
31
|
-
exports.BOTTOM_BAR_DEFAULTS = {
|
|
32
|
-
size: 'm',
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Боттом бар.
|
|
36
|
-
* @param props Свойства.
|
|
37
|
-
* @return Элемент.
|
|
38
|
-
*/
|
|
39
|
-
const BottomBar = (_a) => {
|
|
40
|
-
var { size = exports.BOTTOM_BAR_DEFAULTS.size, divided, children, className, style, 'data-testid': testId = 'bottom-bar' } = _a, rest = __rest(_a, ["size", "divided", "children", "className", "style", 'data-testid']);
|
|
41
|
-
return (
|
|
42
|
-
// чтобы Clean.Button автоматически брали размер, соответствующий размер BottomBar
|
|
43
|
-
react_1.default.createElement(utils_1.CleanGroupSizeContext.Provider, { value: size },
|
|
44
|
-
react_1.default.createElement("div", Object.assign({ className: cx('root', { divided }, shapes_1.MediumRounds.bottom, className), style: Object.assign(Object.assign({}, style), { height: `${exports.BOTTOM_BAR_HEIGHT[size]}px` }) }, rest, { "data-testid": testId }), children)));
|
|
45
|
-
};
|
|
46
|
-
exports.BottomBar = BottomBar;
|
|
3
|
+
exports.BOTTOM_BAR_HEIGHT = exports.BOTTOM_BAR_DEFAULTS = exports.BottomBar = void 0;
|
|
4
|
+
var bottom_bar_1 = require("./bottom-bar");
|
|
5
|
+
Object.defineProperty(exports, "BottomBar", { enumerable: true, get: function () { return bottom_bar_1.BottomBar; } });
|
|
6
|
+
Object.defineProperty(exports, "BOTTOM_BAR_DEFAULTS", { enumerable: true, get: function () { return bottom_bar_1.BOTTOM_BAR_DEFAULTS; } });
|
|
7
|
+
Object.defineProperty(exports, "BOTTOM_BAR_HEIGHT", { enumerable: true, get: function () { return bottom_bar_1.BOTTOM_BAR_HEIGHT; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type BottomBarSize = 's' | 'm' | 'l';
|
|
3
|
+
export interface BottomBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'size'> {
|
|
4
|
+
/** Размер (высота). */
|
|
5
|
+
size?: BottomBarSize | 'unset';
|
|
6
|
+
/** Нужна ли разделительная черта сверху. */
|
|
7
|
+
divided?: boolean;
|
|
8
|
+
/** Идентификатор для систем автоматизированного тестирования. */
|
|
9
|
+
'data-testid'?: string;
|
|
10
|
+
}
|
package/box/index.d.ts
CHANGED
package/breakpoints.scss
CHANGED
|
@@ -1,98 +1,115 @@
|
|
|
1
1
|
@use '../colors';
|
|
2
2
|
|
|
3
|
-
.
|
|
3
|
+
.root {
|
|
4
|
+
position: relative;
|
|
4
5
|
white-space: nowrap;
|
|
5
6
|
display: inline-flex;
|
|
6
7
|
align-items: center;
|
|
7
8
|
justify-content: center;
|
|
8
9
|
flex-wrap: nowrap;
|
|
9
10
|
border-radius: 4px;
|
|
10
|
-
font: inherit;
|
|
11
|
-
font-size: 16px;
|
|
11
|
+
font-family: inherit;
|
|
12
12
|
font-weight: 600;
|
|
13
13
|
box-sizing: border-box;
|
|
14
|
+
padding: 0;
|
|
15
|
+
padding-left: var(--button-left-gutter, var(--button-gutter));
|
|
16
|
+
padding-right: var(--button-right-gutter, var(--button-gutter));
|
|
14
17
|
border: 0;
|
|
15
18
|
outline: 0;
|
|
16
19
|
text-decoration: none;
|
|
17
20
|
overflow: hidden;
|
|
21
|
+
font-size: var(--button-font-size);
|
|
22
|
+
background: var(--button-background);
|
|
23
|
+
color: var(--button-color);
|
|
24
|
+
min-width: var(--button-min-size);
|
|
25
|
+
height: var(--button-min-size);
|
|
26
|
+
--button-icon-gutter: 12px;
|
|
18
27
|
&::-moz-focus-inner {
|
|
19
28
|
border: 0;
|
|
20
29
|
}
|
|
21
|
-
|
|
30
|
+
// @todo disabled для ссылок?
|
|
31
|
+
&:disabled,
|
|
32
|
+
&.disabled {
|
|
33
|
+
pointer-events: none;
|
|
22
34
|
color: colors.$basic-gray24;
|
|
23
35
|
background-color: colors.$basic-gray8;
|
|
24
36
|
}
|
|
37
|
+
&.loading {
|
|
38
|
+
color: transparent;
|
|
39
|
+
> :not(.spinner) {
|
|
40
|
+
opacity: 0;
|
|
41
|
+
pointer-events: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
25
44
|
}
|
|
26
45
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
padding: 0 8px;
|
|
34
|
-
min-width: 40px;
|
|
35
|
-
height: 40px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.text-button-s {
|
|
39
|
-
padding-left: 20px;
|
|
40
|
-
padding-right: 20px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.button-s-with-start-icon {
|
|
44
|
-
padding-left: 12px;
|
|
45
|
-
padding-right: 20px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.button-s-with-end-icon {
|
|
49
|
-
padding-left: 20px;
|
|
50
|
-
padding-right: 12px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// medium
|
|
54
|
-
.button-m {
|
|
55
|
-
padding: 0 12px;
|
|
56
|
-
min-width: 48px;
|
|
57
|
-
height: 48px;
|
|
46
|
+
// sizes
|
|
47
|
+
.size-xs {
|
|
48
|
+
--button-min-size: 32px;
|
|
49
|
+
--button-font-size: 14px;
|
|
50
|
+
--button-line-height: 20px;
|
|
51
|
+
--button-gutter: 12px;
|
|
58
52
|
}
|
|
59
53
|
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
.size-s {
|
|
55
|
+
--button-min-size: 40px;
|
|
56
|
+
--button-font-size: 16px;
|
|
57
|
+
--button-line-height: 24px;
|
|
58
|
+
--button-gutter: 20px;
|
|
63
59
|
}
|
|
64
60
|
|
|
65
|
-
.
|
|
66
|
-
|
|
61
|
+
.size-m {
|
|
62
|
+
--button-min-size: 48px;
|
|
63
|
+
--button-font-size: 16px;
|
|
64
|
+
--button-line-height: 24px;
|
|
65
|
+
--button-gutter: 24px;
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
// content
|
|
69
|
+
.icon-only {
|
|
70
|
+
--button-left-gutter: 0;
|
|
71
|
+
--button-right-gutter: 0;
|
|
72
|
+
--button-icon-gutter: 0;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
.icon-start {
|
|
74
|
-
|
|
76
|
+
--button-left-gutter: 0;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
.icon-end {
|
|
78
|
-
|
|
80
|
+
--button-right-gutter: 0;
|
|
79
81
|
}
|
|
80
82
|
|
|
81
|
-
//
|
|
82
|
-
.
|
|
83
|
-
background
|
|
84
|
-
color: #fff;
|
|
83
|
+
// view variants
|
|
84
|
+
.view-primary {
|
|
85
|
+
--button-background: #{colors.$basic-blue};
|
|
86
|
+
--button-color: #fff;
|
|
85
87
|
&:hover:not(:disabled) {
|
|
86
88
|
cursor: pointer;
|
|
87
|
-
background
|
|
89
|
+
--button-background: #1b74c1;
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
.
|
|
92
|
-
background
|
|
93
|
-
color: colors.$basic-gray87;
|
|
93
|
+
.view-secondary {
|
|
94
|
+
--button-background: #{colors.$basic-gray8};
|
|
95
|
+
--button-color: #{colors.$basic-gray87};
|
|
94
96
|
&:hover:not(:disabled) {
|
|
95
97
|
cursor: pointer;
|
|
96
|
-
background
|
|
98
|
+
--button-background: #{colors.$basic-gray12};
|
|
97
99
|
}
|
|
98
100
|
}
|
|
101
|
+
|
|
102
|
+
// icons
|
|
103
|
+
.icon {
|
|
104
|
+
margin: 0 var(--button-icon-gutter);
|
|
105
|
+
flex-shrink: 0;
|
|
106
|
+
fill: currentColor;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// spinner
|
|
110
|
+
.spinner {
|
|
111
|
+
position: absolute;
|
|
112
|
+
top: 50%;
|
|
113
|
+
left: 50%;
|
|
114
|
+
transform: translate(-50%, -50%);
|
|
115
|
+
}
|
package/button/index.d.ts
CHANGED
|
@@ -1,55 +1,40 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
interface
|
|
1
|
+
import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, ComponentType, HTMLAttributes, SVGAttributes } from 'react';
|
|
2
|
+
export type ButtonSize = 'xs' | 's' | 'm';
|
|
3
|
+
export type ButtonViewType = 'primary' | 'secondary';
|
|
4
|
+
export type ButtonAppearance = 'button' | 'link' | 'container';
|
|
5
|
+
export type ButtonIconPosition = 'start' | 'end';
|
|
6
|
+
interface CommonProps<T extends ButtonAppearance = ButtonAppearance> {
|
|
7
7
|
/** Определяет внешний вид кнопки. */
|
|
8
|
-
viewType?:
|
|
8
|
+
viewType?: ButtonViewType;
|
|
9
9
|
/** Определяет тип корневого элемента. */
|
|
10
10
|
appearance?: T;
|
|
11
11
|
/** Иконка. */
|
|
12
|
-
icon?:
|
|
13
|
-
/** Позиция
|
|
14
|
-
iconPosition?:
|
|
12
|
+
icon?: ComponentType<SVGAttributes<SVGSVGElement>>;
|
|
13
|
+
/** Позиция иконки относительно текста. */
|
|
14
|
+
iconPosition?: ButtonIconPosition;
|
|
15
15
|
/** Размер. */
|
|
16
|
-
size?:
|
|
16
|
+
size?: ButtonSize;
|
|
17
|
+
/** Нужно ли отображать состояние загрузки. */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/** Отключенное состояние. */
|
|
20
|
+
disabled?: boolean;
|
|
17
21
|
/** Идентификатор для систем автоматизированного тестирования. */
|
|
18
22
|
'data-testid'?: string;
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
type AsButtonProps = CommonProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof CommonProps> & {
|
|
25
|
+
appearance?: 'button';
|
|
26
|
+
};
|
|
27
|
+
type AsAnchorProps = CommonProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof CommonProps> & {
|
|
28
|
+
appearance: 'link';
|
|
29
|
+
};
|
|
30
|
+
type AsContainerProps = CommonProps & Omit<HTMLAttributes<HTMLDivElement>, keyof CommonProps> & {
|
|
31
|
+
appearance: 'container';
|
|
32
|
+
};
|
|
33
|
+
export type ButtonProps = AsButtonProps | AsAnchorProps | AsContainerProps;
|
|
22
34
|
/**
|
|
23
35
|
* Компонент кнопки, стилизованной по дизайн-гайдам.
|
|
24
36
|
* @param props Свойства.
|
|
25
37
|
* @return Элемент.
|
|
26
38
|
*/
|
|
27
|
-
export declare const Button: React.ForwardRefExoticComponent<
|
|
28
|
-
/**
|
|
29
|
-
* Возвращает строку с классами для стилизации кнопки.
|
|
30
|
-
* @param props Опции.
|
|
31
|
-
* @param props.actionType Определяет внешний вид кнопки.
|
|
32
|
-
* @param props.size Определяет размер.
|
|
33
|
-
* @param props.iconPosition Положение иконки.
|
|
34
|
-
* @param props.withIcon Показывать ли иконку.
|
|
35
|
-
* @param props.withContent Есть ли контент.
|
|
36
|
-
* @param props.className Дополнительный класс.
|
|
37
|
-
* @return Строка с классами.
|
|
38
|
-
*/
|
|
39
|
-
export declare const computeClassName: ({ size, viewType, iconPosition, withIcon, withContent, className, }: {
|
|
40
|
-
size: Size;
|
|
41
|
-
viewType: ViewType;
|
|
42
|
-
iconPosition: IconPosition;
|
|
43
|
-
withIcon: boolean;
|
|
44
|
-
withContent: boolean;
|
|
45
|
-
className?: string | undefined;
|
|
46
|
-
}) => string;
|
|
47
|
-
/**
|
|
48
|
-
* Возвращает кортеж с именем элемента и свойствами компонента по ключу.
|
|
49
|
-
* @param appearance Ключ.
|
|
50
|
-
* @return Кортеж с именем элемента и свойствами.
|
|
51
|
-
*/
|
|
52
|
-
export declare const resolveAppearance: (Target: "link" | "button" | "container") => ["a" | "button" | "div", {
|
|
53
|
-
role: 'button';
|
|
54
|
-
} | null];
|
|
39
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<any>>;
|
|
55
40
|
export {};
|
package/button/index.js
CHANGED
|
@@ -37,9 +37,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.
|
|
40
|
+
exports.Button = void 0;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
|
-
const
|
|
42
|
+
const spinner_1 = require("../spinner");
|
|
43
43
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
44
44
|
const button_module_scss_1 = __importDefault(require("./button.module.scss"));
|
|
45
45
|
const cx = bind_1.default.bind(button_module_scss_1.default);
|
|
@@ -49,48 +49,24 @@ const cx = bind_1.default.bind(button_module_scss_1.default);
|
|
|
49
49
|
* @return Элемент.
|
|
50
50
|
*/
|
|
51
51
|
exports.Button = (0, react_1.forwardRef)(function Button(_a, ref) {
|
|
52
|
-
var {
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
var { viewType = 'primary', icon: Icon, iconPosition = 'start', size = 'm', loading, disabled, className, children, 'data-testid': testId = 'button' } = _a, restProps = __rest(_a, ["viewType", "icon", "iconPosition", "size", "loading", "disabled", "className", "children", 'data-testid']);
|
|
53
|
+
const hasIcon = Boolean(Icon);
|
|
54
|
+
const hasText = Boolean(children);
|
|
55
|
+
const rootClassName = cx('root', `size-${size}`, `view-${viewType}`, loading && 'loading', disabled && 'disabled', hasIcon && !hasText && 'icon-only', hasText && hasIcon && iconPosition === 'start' && 'icon-start', hasText && hasIcon && iconPosition === 'end' && 'icon-end', className);
|
|
56
|
+
const content = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
57
|
+
Icon && iconPosition === 'start' && react_1.default.createElement(Icon, { className: cx('icon') }),
|
|
58
|
+
children,
|
|
59
|
+
Icon && iconPosition === 'end' && react_1.default.createElement(Icon, { className: cx('icon') }),
|
|
60
|
+
loading && (react_1.default.createElement(spinner_1.SpinnerSVG, { size: 's', color: disabled || viewType === 'secondary' ? 'basic-gray38' : 'basic-white', className: cx('spinner') }))));
|
|
61
|
+
let result = null;
|
|
62
|
+
if (restProps.appearance === 'container') {
|
|
63
|
+
result = (react_1.default.createElement("div", Object.assign({}, restProps, { ref: ref, className: rootClassName, role: 'button', "data-testid": testId }), content));
|
|
64
|
+
}
|
|
65
|
+
else if (restProps.appearance === 'link') {
|
|
66
|
+
result = (react_1.default.createElement("a", Object.assign({}, restProps, { ref: ref, className: rootClassName, "data-testid": testId }), content));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
result = (react_1.default.createElement("button", Object.assign({}, restProps, { ref: ref, className: rootClassName, disabled: disabled, "data-testid": testId }), content));
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
66
72
|
});
|
|
67
|
-
/**
|
|
68
|
-
* Возвращает строку с классами для стилизации кнопки.
|
|
69
|
-
* @param props Опции.
|
|
70
|
-
* @param props.actionType Определяет внешний вид кнопки.
|
|
71
|
-
* @param props.size Определяет размер.
|
|
72
|
-
* @param props.iconPosition Положение иконки.
|
|
73
|
-
* @param props.withIcon Показывать ли иконку.
|
|
74
|
-
* @param props.withContent Есть ли контент.
|
|
75
|
-
* @param props.className Дополнительный класс.
|
|
76
|
-
* @return Строка с классами.
|
|
77
|
-
*/
|
|
78
|
-
const computeClassName = ({ size, viewType, iconPosition, withIcon, withContent, className, }) => cx([
|
|
79
|
-
className,
|
|
80
|
-
'button-base',
|
|
81
|
-
viewType === 'secondary' ? 'button-secondary' : 'button-primary',
|
|
82
|
-
`button-${size}`,
|
|
83
|
-
withContent && !withIcon && `text-button-${size}`,
|
|
84
|
-
withContent && withIcon && `button-${size}-with-${iconPosition}-icon`,
|
|
85
|
-
]);
|
|
86
|
-
exports.computeClassName = computeClassName;
|
|
87
|
-
/**
|
|
88
|
-
* Возвращает кортеж с именем элемента и свойствами компонента по ключу.
|
|
89
|
-
* @param appearance Ключ.
|
|
90
|
-
* @return Кортеж с именем элемента и свойствами.
|
|
91
|
-
*/
|
|
92
|
-
exports.resolveAppearance = (0, fp_1.cond)([
|
|
93
|
-
[(0, fp_1.eq)('link'), (0, fp_1.always)(['a', null])],
|
|
94
|
-
[(0, fp_1.eq)('container'), (0, fp_1.always)(['div', { role: 'button' }])],
|
|
95
|
-
[fp_1.stubTrue, (0, fp_1.always)(['button', null])],
|
|
96
|
-
]);
|
package/card/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { PlateProps } from '../plate';
|
|
3
3
|
import { CardContent, CardFooter, CardHeader } from './slots';
|
|
4
|
-
export
|
|
4
|
+
export type CardProps = PlateProps;
|
|
5
5
|
export interface CardComponent {
|
|
6
6
|
(props: CardProps): JSX.Element;
|
|
7
7
|
Header: typeof CardHeader;
|
|
@@ -14,3 +14,4 @@ export interface CardComponent {
|
|
|
14
14
|
* @return Элемент.
|
|
15
15
|
*/
|
|
16
16
|
export declare const Card: CardComponent;
|
|
17
|
+
export { CardContent };
|
package/card/index.js
CHANGED
|
@@ -14,14 +14,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Card = void 0;
|
|
17
|
+
exports.CardContent = exports.Card = void 0;
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const plate_1 = require("../plate");
|
|
20
20
|
const slots_1 = require("./slots");
|
|
21
|
+
Object.defineProperty(exports, "CardContent", { enumerable: true, get: function () { return slots_1.CardContent; } });
|
|
21
22
|
const utils_1 = require("./utils");
|
|
23
|
+
const define_slots_1 = require("../helpers/define-slots");
|
|
24
|
+
const top_bar_1 = require("../top-bar");
|
|
25
|
+
const bottom_bar_1 = require("../bottom-bar");
|
|
26
|
+
const shapes_1 = require("../styling/shapes");
|
|
22
27
|
const classnames_1 = __importDefault(require("classnames"));
|
|
23
28
|
const card_module_scss_1 = __importDefault(require("./card.module.scss"));
|
|
24
|
-
const define_slots_1 = require("../helpers/define-slots");
|
|
25
29
|
/**
|
|
26
30
|
* Компонент карточки - это расширенный Plate с возможностью определять слоты: шапку, тело и футер.
|
|
27
31
|
* @param props Свойства.
|
|
@@ -29,18 +33,31 @@ const define_slots_1 = require("../helpers/define-slots");
|
|
|
29
33
|
*/
|
|
30
34
|
const Card = (_a) => {
|
|
31
35
|
var { children, className, rounds } = _a, restProps = __rest(_a, ["children", "className", "rounds"]);
|
|
32
|
-
const { header, content, footer } = (0, define_slots_1.defineSlots)(children, {
|
|
33
|
-
|
|
36
|
+
const { header, content, footer, topBar, bottomBar } = (0, define_slots_1.defineSlots)(children, {
|
|
37
|
+
topBar: top_bar_1.TopBar,
|
|
34
38
|
content: slots_1.CardContent,
|
|
39
|
+
bottomBar: bottom_bar_1.BottomBar,
|
|
40
|
+
header: slots_1.CardHeader,
|
|
35
41
|
footer: slots_1.CardFooter,
|
|
36
42
|
});
|
|
37
43
|
return (react_1.default.createElement(utils_1.CardContext.Provider, { value: { rounds } },
|
|
38
44
|
react_1.default.createElement(plate_1.Plate, Object.assign({}, restProps, { rounds: rounds, className: (0, classnames_1.default)(card_module_scss_1.default.root, className) }),
|
|
39
|
-
header,
|
|
45
|
+
!topBar && header,
|
|
46
|
+
topBar && (react_1.default.createElement(top_bar_1.TopBar, Object.assign({}, topBar.props, { className: (0, classnames_1.default)(topBar.props.className, rounds === 's' && shapes_1.SmallRounds.top, rounds === 'm' && shapes_1.MediumRounds.top) }))),
|
|
40
47
|
content,
|
|
41
|
-
|
|
48
|
+
bottomBar && react_1.default.createElement(bottom_bar_1.BottomBar, Object.assign({}, bottomBar.props)),
|
|
49
|
+
!bottomBar && footer)));
|
|
42
50
|
};
|
|
43
51
|
exports.Card = Card;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Нужно использовать TopBar.
|
|
54
|
+
*/
|
|
44
55
|
exports.Card.Header = slots_1.CardHeader;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Нужно использовать `import { CardContent }`.
|
|
58
|
+
*/
|
|
45
59
|
exports.Card.Content = slots_1.CardContent;
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Нужно использовать BottomBar.
|
|
62
|
+
*/
|
|
46
63
|
exports.Card.Footer = slots_1.CardFooter;
|