@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
package/stepper/index.d.ts
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { CSSProperties, InputHTMLAttributes, MouseEventHandler } from 'react';
|
|
2
|
+
/** Размер Stepper (влияет на высоту и минимальную ширину). */
|
|
3
|
+
export type StepperSize = 's' | 'm';
|
|
4
|
+
/** Стили Stepper. */
|
|
5
|
+
export interface StepperStyle extends CSSProperties {
|
|
6
|
+
/** Ширина. */
|
|
4
7
|
'--stepper-width'?: string;
|
|
5
8
|
}
|
|
6
|
-
export interface StepperProps extends Omit<
|
|
9
|
+
export interface StepperProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'style'> {
|
|
7
10
|
/** Нужно ли выводить кнопку добавления. */
|
|
8
11
|
canAdd?: boolean;
|
|
9
12
|
/** Нужно ли выводить кнопку вычитания. */
|
|
10
13
|
canSubtract?: boolean;
|
|
14
|
+
/** Делает кнопку "+" отключенной. */
|
|
15
|
+
plusDisabled?: boolean;
|
|
16
|
+
/** Делает кнопку "-" отключенной. */
|
|
17
|
+
minusDisabled?: boolean;
|
|
18
|
+
/** Нужно ли предотвращать blur на поле при нажатии "+/-". */
|
|
19
|
+
buttonClickBehavior?: 'prevent-input-blur';
|
|
11
20
|
/** Сработает при добавлении. */
|
|
12
|
-
onAdd?:
|
|
21
|
+
onAdd?: MouseEventHandler;
|
|
13
22
|
/** Сработает при вычитании. */
|
|
14
|
-
onSubtract?:
|
|
23
|
+
onSubtract?: MouseEventHandler;
|
|
15
24
|
/** Размер. */
|
|
16
|
-
size?:
|
|
25
|
+
size?: StepperSize;
|
|
17
26
|
/** Идентификатор для систем автоматизированного тестирования. */
|
|
18
27
|
'data-testid'?: string;
|
|
19
28
|
/** Стили корневого элемента. */
|
|
20
|
-
style?:
|
|
29
|
+
style?: StepperStyle;
|
|
21
30
|
/** Нужно ли показывать состояние ошибки. */
|
|
22
31
|
failed?: boolean;
|
|
23
32
|
}
|
|
24
33
|
/**
|
|
25
|
-
*
|
|
34
|
+
* Stepper - поле ввода количества.
|
|
26
35
|
* @param props Свойства.
|
|
27
36
|
* @return Элемент.
|
|
28
37
|
*/
|
|
29
38
|
export declare const Stepper: React.ForwardRefExoticComponent<StepperProps & React.RefAttributes<HTMLInputElement>>;
|
|
30
|
-
export {};
|
package/stepper/index.js
CHANGED
|
@@ -45,16 +45,25 @@ const stepper_module_scss_1 = __importDefault(require("./stepper.module.scss"));
|
|
|
45
45
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
46
46
|
const cx = bind_1.default.bind(stepper_module_scss_1.default);
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Stepper - поле ввода количества.
|
|
49
49
|
* @param props Свойства.
|
|
50
50
|
* @return Элемент.
|
|
51
51
|
*/
|
|
52
|
-
exports.Stepper = (0, react_1.forwardRef)((_a,
|
|
53
|
-
var
|
|
52
|
+
exports.Stepper = (0, react_1.forwardRef)(function Stepper(_a, forwardedRef) {
|
|
53
|
+
var _b, _c;
|
|
54
|
+
var { buttonClickBehavior, canAdd = true, canSubtract = true, className, disabled, plusDisabled = disabled, minusDisabled = disabled, readOnly, onAdd, onBlur, onChange, onFocus, onSubtract, size = 'm', style, value, failed, 'data-testid': testId = 'stepper' } = _a, inputProps = __rest(_a, ["buttonClickBehavior", "canAdd", "canSubtract", "className", "disabled", "plusDisabled", "minusDisabled", "readOnly", "onAdd", "onBlur", "onChange", "onFocus", "onSubtract", "size", "style", "value", "failed", 'data-testid']);
|
|
55
|
+
const ref = (0, react_1.useRef)(null);
|
|
54
56
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
(0, react_1.useImperativeHandle)(forwardedRef, () => ref.current);
|
|
58
|
+
const noBlurOnMousedown = (0, react_1.useCallback)(event => {
|
|
59
|
+
if (focused && event.target !== ref.current && buttonClickBehavior === 'prevent-input-blur') {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
}
|
|
62
|
+
}, [focused, buttonClickBehavior]);
|
|
63
|
+
const rootClassName = cx('root', `size-${size}`, { disabled, focused, failed }, className);
|
|
64
|
+
return (react_1.default.createElement("div", { "data-testid": testId, style: style, className: rootClassName, onMouseDown: noBlurOnMousedown },
|
|
65
|
+
react_1.default.createElement("button", { tabIndex: -1, hidden: !canSubtract, disabled: (_b = minusDisabled !== null && minusDisabled !== void 0 ? minusDisabled : disabled) !== null && _b !== void 0 ? _b : readOnly, className: cx('button'), "data-testid": 'stepper:minus', "aria-label": '\u0423\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C', onMouseDown: noBlurOnMousedown, onClick: canSubtract && !minusDisabled && !disabled && !readOnly ? onSubtract : undefined },
|
|
66
|
+
react_1.default.createElement(minus_1.default, { className: stepper_module_scss_1.default.svg })),
|
|
58
67
|
react_1.default.createElement("input", Object.assign({}, inputProps, { ref: ref, readOnly: readOnly, "data-testid": 'stepper:input', className: cx('input'), value: value, disabled: disabled, onChange: onChange, onFocus: e => {
|
|
59
68
|
setFocused(true);
|
|
60
69
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
@@ -62,6 +71,6 @@ exports.Stepper = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
62
71
|
setFocused(false);
|
|
63
72
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
64
73
|
} })),
|
|
65
|
-
react_1.default.createElement("button", {
|
|
66
|
-
react_1.default.createElement(plus_1.default,
|
|
74
|
+
react_1.default.createElement("button", { tabIndex: -1, hidden: !canAdd, disabled: (_c = plusDisabled !== null && plusDisabled !== void 0 ? plusDisabled : disabled) !== null && _c !== void 0 ? _c : readOnly, className: cx('button'), "data-testid": 'stepper:plus', "aria-label": '\u0423\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C', onMouseDown: noBlurOnMousedown, onClick: canAdd && !plusDisabled && !disabled && !readOnly ? onAdd : undefined },
|
|
75
|
+
react_1.default.createElement(plus_1.default, { className: stepper_module_scss_1.default.svg }))));
|
|
67
76
|
});
|
|
@@ -7,24 +7,15 @@
|
|
|
7
7
|
border-radius: 4px;
|
|
8
8
|
color: colors.$basic-gray87;
|
|
9
9
|
background: colors.$basic-gray8;
|
|
10
|
-
&.focused
|
|
10
|
+
&.focused {
|
|
11
11
|
border-color: colors.$basic-blue;
|
|
12
12
|
}
|
|
13
13
|
&.disabled {
|
|
14
14
|
color: colors.$basic-gray24;
|
|
15
15
|
border-color: colors.$basic-gray4;
|
|
16
16
|
background: colors.$basic-gray4;
|
|
17
|
-
.button {
|
|
18
|
-
fill: colors.$basic-gray24;
|
|
19
|
-
}
|
|
20
17
|
}
|
|
21
|
-
&.
|
|
22
|
-
.button {
|
|
23
|
-
fill: colors.$basic-gray24;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
&.failed:not(.disabled):not(.focused) {
|
|
27
|
-
border-color: transparent;
|
|
18
|
+
&.failed {
|
|
28
19
|
color: colors.$additional-deep-red;
|
|
29
20
|
}
|
|
30
21
|
&.size-s {
|
|
@@ -65,7 +56,7 @@
|
|
|
65
56
|
background: transparent;
|
|
66
57
|
width: var(--stepper-button-width);
|
|
67
58
|
height: 100%;
|
|
68
|
-
|
|
59
|
+
color: colors.$basic-gray87;
|
|
69
60
|
flex-shrink: 0;
|
|
70
61
|
&:first-child {
|
|
71
62
|
justify-content: flex-end;
|
|
@@ -73,11 +64,19 @@
|
|
|
73
64
|
&:last-child {
|
|
74
65
|
justify-content: flex-start;
|
|
75
66
|
}
|
|
76
|
-
&:not(.hidden) {
|
|
67
|
+
&:not(.hidden):not(:disabled) {
|
|
77
68
|
cursor: pointer;
|
|
78
69
|
}
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
&:disabled {
|
|
71
|
+
color: colors.$basic-gray24;
|
|
81
72
|
pointer-events: none;
|
|
82
73
|
}
|
|
74
|
+
&[hidden] {
|
|
75
|
+
pointer-events: none;
|
|
76
|
+
opacity: 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.svg {
|
|
81
|
+
fill: currentColor;
|
|
83
82
|
}
|
package/styling/fonts.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type Size = 12 | 14 | 16 | 20 | 24 | 32 | 48 | 64;
|
|
2
|
+
export type LineHeight = 16 | 20 | 24 | 28 | 32 | 40 | 60 | 80;
|
|
3
|
+
export type Weight = 400 | 600 | 700;
|
|
4
4
|
export declare const SIZES: Set<Size>;
|
|
5
5
|
export declare const LINE_HEIGHTS: Set<LineHeight>;
|
|
6
6
|
export declare const WEIGHTS: Set<Weight>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
export interface SwitcherRowProps {
|
|
3
|
+
/** Содержимое. */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** Направление текста. */
|
|
6
|
+
textAlign?: 'left' | 'right';
|
|
7
|
+
/** Стили корневого элемента. */
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
/** CSS-класс корневого элемента. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Позиция поля. */
|
|
12
|
+
fieldPosition?: 'start' | 'end';
|
|
13
|
+
/** Идентификатор для систем автоматизированного тестирования. */
|
|
14
|
+
'data-testid'?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Блок вывода полей-переключателей (Checkbox, Toggle, RadioButton).
|
|
18
|
+
* @param props Свойства.
|
|
19
|
+
* @return Элемент.
|
|
20
|
+
*/
|
|
21
|
+
export declare function SwitcherRow({ children, className, style, textAlign, fieldPosition, 'data-testid': testId, }: SwitcherRowProps): JSX.Element;
|
|
22
|
+
export declare namespace SwitcherRow {
|
|
23
|
+
var Label: typeof SwitcherRowLabel;
|
|
24
|
+
var Comment: typeof SwitcherRowComment;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Слот ярлыка.
|
|
28
|
+
* @param props Свойства.
|
|
29
|
+
* @return Элемент.
|
|
30
|
+
*/
|
|
31
|
+
declare function SwitcherRowLabel({ children }: {
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}): JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* Слот комментария.
|
|
36
|
+
* @param props Свойства.
|
|
37
|
+
* @return Элемент.
|
|
38
|
+
*/
|
|
39
|
+
declare function SwitcherRowComment({ children }: {
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
}): JSX.Element;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SwitcherRow = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const checkbox_1 = require("../checkbox");
|
|
9
|
+
const define_slots_1 = require("../helpers/define-slots");
|
|
10
|
+
const radio_button_1 = require("../radio-button");
|
|
11
|
+
const toggle_1 = require("../toggle");
|
|
12
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
13
|
+
const switcher_row_module_scss_1 = __importDefault(require("./switcher-row.module.scss"));
|
|
14
|
+
const cx = bind_1.default.bind(switcher_row_module_scss_1.default);
|
|
15
|
+
/**
|
|
16
|
+
* Блок вывода полей-переключателей (Checkbox, Toggle, RadioButton).
|
|
17
|
+
* @param props Свойства.
|
|
18
|
+
* @return Элемент.
|
|
19
|
+
*/
|
|
20
|
+
function SwitcherRow({ children, className, style, textAlign, fieldPosition = 'start', 'data-testid': testId = 'switcher-row', }) {
|
|
21
|
+
var _a;
|
|
22
|
+
const { toggle, checkbox, radio, label, comment } = (0, define_slots_1.defineSlots)(children, {
|
|
23
|
+
toggle: toggle_1.Toggle,
|
|
24
|
+
checkbox: checkbox_1.Checkbox,
|
|
25
|
+
radio: radio_button_1.RadioButton,
|
|
26
|
+
label: SwitcherRowLabel,
|
|
27
|
+
comment: SwitcherRowComment,
|
|
28
|
+
});
|
|
29
|
+
const input = (_a = toggle !== null && toggle !== void 0 ? toggle : checkbox) !== null && _a !== void 0 ? _a : radio;
|
|
30
|
+
const failed = input === null || input === void 0 ? void 0 : input.props.failed;
|
|
31
|
+
const disabled = input === null || input === void 0 ? void 0 : input.props.disabled;
|
|
32
|
+
const fieldId = input === null || input === void 0 ? void 0 : input.props.id;
|
|
33
|
+
const fieldColumn = input && (react_1.default.createElement("div", { className: cx('col', 'field-col', { 'toggle-col': toggle }) }, input));
|
|
34
|
+
return (react_1.default.createElement("div", { className: cx('root', `text-align-${textAlign}`, { failed, disabled }, className), style: style, "data-testid": testId },
|
|
35
|
+
fieldPosition === 'start' && fieldColumn,
|
|
36
|
+
react_1.default.createElement("label", { className: cx('col', 'main-col'), htmlFor: fieldId },
|
|
37
|
+
label && (react_1.default.createElement("span", { className: cx('label', { 'for-toggle': toggle }), "data-testid": 'switcher-row:label' }, label)),
|
|
38
|
+
comment && (react_1.default.createElement("span", { className: cx('comment'), "data-testid": 'switcher-row:comment' }, comment))),
|
|
39
|
+
fieldPosition === 'end' && fieldColumn));
|
|
40
|
+
}
|
|
41
|
+
exports.SwitcherRow = SwitcherRow;
|
|
42
|
+
/**
|
|
43
|
+
* Слот ярлыка.
|
|
44
|
+
* @param props Свойства.
|
|
45
|
+
* @return Элемент.
|
|
46
|
+
*/
|
|
47
|
+
function SwitcherRowLabel({ children }) {
|
|
48
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Слот комментария.
|
|
52
|
+
* @param props Свойства.
|
|
53
|
+
* @return Элемент.
|
|
54
|
+
*/
|
|
55
|
+
function SwitcherRowComment({ children }) {
|
|
56
|
+
return react_1.default.createElement(react_1.default.Fragment, null, children);
|
|
57
|
+
}
|
|
58
|
+
SwitcherRow.Label = SwitcherRowLabel;
|
|
59
|
+
SwitcherRow.Comment = SwitcherRowComment;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@use '../colors';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
--label-color: #{colors.$basic-gray87};
|
|
5
|
+
--comment-color: #{colors.$basic-gray38};
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
&.text-align-left {
|
|
9
|
+
text-align: left;
|
|
10
|
+
}
|
|
11
|
+
&.text-align-right {
|
|
12
|
+
text-align: right;
|
|
13
|
+
}
|
|
14
|
+
&.disabled {
|
|
15
|
+
--label-color: #{colors.$basic-gray24};
|
|
16
|
+
--comment-color: #{colors.$basic-gray24};
|
|
17
|
+
}
|
|
18
|
+
&.failed {
|
|
19
|
+
--label-color: #{colors.$additional-deep-red};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.col + .col {
|
|
24
|
+
margin-left: 8px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.toggle-col + .col {
|
|
28
|
+
margin-left: 12px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.field-col {
|
|
32
|
+
flex-grow: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.main-col {
|
|
36
|
+
flex-grow: 1;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.label {
|
|
41
|
+
display: block;
|
|
42
|
+
font-size: inherit;
|
|
43
|
+
line-height: inherit;
|
|
44
|
+
font-weight: inherit;
|
|
45
|
+
color: var(--label-color);
|
|
46
|
+
&.for-toggle {
|
|
47
|
+
font-weight: 600;
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
line-height: 24px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.comment {
|
|
54
|
+
display: block;
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
line-height: 20px;
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
color: var(--comment-color);
|
|
59
|
+
}
|
package/text/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Size, LineHeight, Weight } from '../styling/fonts';
|
|
3
3
|
import { Token } from '../colors';
|
|
4
|
-
|
|
4
|
+
type Align = 'left' | 'center' | 'right' | 'justify';
|
|
5
5
|
export interface TextProps {
|
|
6
6
|
/** Направление. */
|
|
7
7
|
align?: Align;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, ComponentType, Ref, SVGAttributes } from 'react';
|
|
2
|
+
import { LinkColor } from '../link';
|
|
3
|
+
export type TextButtonSize = 's' | 'm';
|
|
4
|
+
export type TextButtonColor = LinkColor;
|
|
5
|
+
interface CommonProps {
|
|
6
|
+
/** Размер. */
|
|
7
|
+
size?: TextButtonSize;
|
|
8
|
+
/** Цвет. */
|
|
9
|
+
color?: TextButtonColor;
|
|
10
|
+
/** Иконка перед текстом. */
|
|
11
|
+
startIcon?: ComponentType<SVGAttributes<SVGSVGElement>>;
|
|
12
|
+
/** Иконка после текста. */
|
|
13
|
+
endIcon?: ComponentType<SVGAttributes<SVGSVGElement>>;
|
|
14
|
+
/** Ref для элемента button. Будет заполнен только при appearance: 'button'. */
|
|
15
|
+
buttonRef?: Ref<HTMLButtonElement>;
|
|
16
|
+
/** Ref для элемента a. Будет заполнен только при appearance: 'link'. */
|
|
17
|
+
anchorRef?: Ref<HTMLAnchorElement>;
|
|
18
|
+
/** Нужно ли выводить подчеркивание. */
|
|
19
|
+
underline?: boolean;
|
|
20
|
+
/** Отключенное состояние. */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Отступ от иконок. */
|
|
23
|
+
iconGutter?: 4 | 8;
|
|
24
|
+
/** Идентификатор для систем автоматизированного тестирования. */
|
|
25
|
+
'data-testid'?: string;
|
|
26
|
+
}
|
|
27
|
+
export type TextButtonAsButtonProps = CommonProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof CommonProps> & {
|
|
28
|
+
/** Какой элемент выводить в качестве текстовой кнопки. */
|
|
29
|
+
as?: 'button';
|
|
30
|
+
};
|
|
31
|
+
export type TextButtonAsAnchorProps = CommonProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof CommonProps> & {
|
|
32
|
+
/** Какой элемент выводить в качестве текстовой кнопки. */
|
|
33
|
+
as: 'anchor';
|
|
34
|
+
};
|
|
35
|
+
export type TextButtonProps = TextButtonAsButtonProps | TextButtonAsAnchorProps;
|
|
36
|
+
/**
|
|
37
|
+
* Текстовая кнопка.
|
|
38
|
+
* @param props Свойства.
|
|
39
|
+
* @return Элемент.
|
|
40
|
+
*/
|
|
41
|
+
export declare function TextButton({ size, color, children, className, startIcon: StartIcon, endIcon: EndIcon, buttonRef, anchorRef, underline, disabled, iconGutter, 'data-testid': testId, ...restProps }: TextButtonProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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.TextButton = void 0;
|
|
18
|
+
const react_1 = __importDefault(require("react"));
|
|
19
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
20
|
+
const text_button_module_scss_1 = __importDefault(require("./text-button.module.scss"));
|
|
21
|
+
const cx = bind_1.default.bind(text_button_module_scss_1.default);
|
|
22
|
+
/**
|
|
23
|
+
* Текстовая кнопка.
|
|
24
|
+
* @param props Свойства.
|
|
25
|
+
* @return Элемент.
|
|
26
|
+
*/
|
|
27
|
+
function TextButton(_a) {
|
|
28
|
+
var { size = 'm', color = 'basic-blue', children, className, startIcon: StartIcon, endIcon: EndIcon, buttonRef, anchorRef, underline, disabled, iconGutter = 8, 'data-testid': testId = 'text-button' } = _a, restProps = __rest(_a, ["size", "color", "children", "className", "startIcon", "endIcon", "buttonRef", "anchorRef", "underline", "disabled", "iconGutter", 'data-testid']);
|
|
29
|
+
const rooClassName = cx('root', `color-${color}`, `size-${size}`, `icon-gutter-${iconGutter}`, underline && 'underline', disabled && 'disabled', className);
|
|
30
|
+
const content = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
31
|
+
StartIcon && react_1.default.createElement(StartIcon, { className: cx('icon-start') }),
|
|
32
|
+
children,
|
|
33
|
+
EndIcon && react_1.default.createElement(EndIcon, { className: cx('icon-end') })));
|
|
34
|
+
let result;
|
|
35
|
+
switch (restProps.as) {
|
|
36
|
+
case 'anchor':
|
|
37
|
+
result = (react_1.default.createElement("a", Object.assign({}, restProps, { ref: anchorRef, className: rooClassName, "data-testid": testId }), content));
|
|
38
|
+
break;
|
|
39
|
+
case 'button':
|
|
40
|
+
default:
|
|
41
|
+
result = (react_1.default.createElement("button", Object.assign({}, restProps, { ref: buttonRef, className: rooClassName, disabled: disabled, "data-testid": testId }), content));
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
exports.TextButton = TextButton;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@use '../colors';
|
|
2
|
+
@use '../utils';
|
|
3
|
+
@use '../link/link-util';
|
|
4
|
+
|
|
5
|
+
.root {
|
|
6
|
+
@include utils.reset-button;
|
|
7
|
+
@include utils.focus-visible;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
font-weight: 600;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
background: transparent;
|
|
13
|
+
padding: 0;
|
|
14
|
+
margin: 0;
|
|
15
|
+
border: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.root,
|
|
19
|
+
.root:link,
|
|
20
|
+
.root:visited,
|
|
21
|
+
.root:hover,
|
|
22
|
+
.root:active {
|
|
23
|
+
cursor: default;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
border-bottom-color: transparent;
|
|
26
|
+
&.underline {
|
|
27
|
+
box-shadow: inset 0 -1px 0 0 currentColor;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.root:hover {
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.size-s {
|
|
36
|
+
font-size: 14px;
|
|
37
|
+
line-height: 20px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.size-m {
|
|
41
|
+
font-size: 16px;
|
|
42
|
+
line-height: 24px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.icon-gutter-4 {
|
|
46
|
+
--text-button-icon-gutter: 4px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.icon-gutter-8 {
|
|
50
|
+
--text-button-icon-gutter: 8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ниже двойные классы для высокой специфичности в монолите
|
|
54
|
+
.root.disabled {
|
|
55
|
+
color: colors.$basic-gray24;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.root:not(.disabled).color-basic-blue {
|
|
60
|
+
@include link-util.color('basic-blue');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.root:not(.disabled).color-basic-gray87 {
|
|
64
|
+
@include link-util.color('basic-gray87');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.root:not(.disabled).color-basic-gray38 {
|
|
68
|
+
@include link-util.color('basic-gray38');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.root:not(.disabled).color-basic-white {
|
|
72
|
+
@include link-util.color('basic-white');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.root:not(.disabled).color-additional-red {
|
|
76
|
+
@include link-util.color('additional-red');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.root:not(.disabled).color-additional-teal {
|
|
80
|
+
@include link-util.color('additional-teal');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// иконки
|
|
84
|
+
.icon-start,
|
|
85
|
+
.icon-end {
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
fill: currentColor;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.icon-start {
|
|
91
|
+
margin-right: var(--text-button-icon-gutter);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.icon-end {
|
|
95
|
+
margin-left: var(--text-button-icon-gutter);
|
|
96
|
+
}
|
package/text-field/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BaseInputProps } from '../base-input';
|
|
2
|
+
import { BaseInputProps } from '../base-input-deprecated';
|
|
3
3
|
import { SmallRounds } from '../styling/shapes';
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
4
|
+
type Variant = 'desktop' | 'mobile';
|
|
5
|
+
export type DesktopSize = 'xs' | 's' | 'l';
|
|
6
|
+
type Classes = {
|
|
7
7
|
root?: string;
|
|
8
8
|
baseInput?: string;
|
|
9
9
|
blockFocused?: string;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type IgnoredInputProps = 'size' | 'onClick' | 'onInput' | 'onChange' | 'onKeyDown' | 'onKeyUp' | 'onSelect';
|
|
12
12
|
export interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, IgnoredInputProps> {
|
|
13
13
|
/** Ярлык. */
|
|
14
14
|
label?: string;
|
|
@@ -57,10 +57,11 @@ export declare const HEIGHTS: {
|
|
|
57
57
|
readonly l: 56;
|
|
58
58
|
};
|
|
59
59
|
export declare const DEFAULTS: {
|
|
60
|
-
readonly size: "
|
|
60
|
+
readonly size: "xs" | "s" | "l";
|
|
61
61
|
};
|
|
62
62
|
/**
|
|
63
63
|
* Компонент текстового поля.
|
|
64
|
+
* @deprecated На адаптивных страницах следует использовать Input или Textarea.
|
|
64
65
|
* @param props Свойства.
|
|
65
66
|
* @return Элемент.
|
|
66
67
|
*/
|
package/text-field/index.js
CHANGED
|
@@ -30,7 +30,7 @@ exports.TextField = exports.DEFAULTS = exports.HEIGHTS = void 0;
|
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const lodash_1 = require("lodash");
|
|
32
32
|
const box_1 = require("../box");
|
|
33
|
-
const
|
|
33
|
+
const base_input_deprecated_1 = require("../base-input-deprecated");
|
|
34
34
|
const shapes_1 = require("../styling/shapes");
|
|
35
35
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
36
36
|
const text_field_module_scss_1 = __importDefault(require("./text-field.module.scss"));
|
|
@@ -52,6 +52,7 @@ const isVisible = (value) => !(0, lodash_1.isNil)(value) && `${value}` !== '';
|
|
|
52
52
|
const modifiersToClasses = ({ disabled, failed, focused, variant, }) => cx(disabled && 'disabled', failed && 'failed', focused && 'focused', variant && `variant-${variant}`);
|
|
53
53
|
/**
|
|
54
54
|
* Компонент текстового поля.
|
|
55
|
+
* @deprecated На адаптивных страницах следует использовать Input или Textarea.
|
|
55
56
|
* @param props Свойства.
|
|
56
57
|
* @return Элемент.
|
|
57
58
|
*/
|
|
@@ -87,7 +88,7 @@ exports.TextField = (0, react_1.forwardRef)(function TextField({ autoFocus, capt
|
|
|
87
88
|
react_1.default.createElement("div", { className: cx('main-column') },
|
|
88
89
|
withLabel && (react_1.default.createElement("label", { className: cx('label', commonModifyClasses, hasValue && 'filled', labelAsPlaceholder && 'as-placeholder'), htmlFor: id, children: label, "data-testid": 'text-field:label' })),
|
|
89
90
|
react_1.default.createElement("div", { className: cx('input-wrapper') },
|
|
90
|
-
react_1.default.createElement(
|
|
91
|
+
react_1.default.createElement(base_input_deprecated_1.BaseInput, Object.assign({}, baseInputProps, { type: type, id: id, name: name, autoComplete: autoComplete, "data-testid": 'text-field:field', multiline: multiline, ref: baseInputRef, placeholder: withLabel && labelAsPlaceholder ? undefined : placeholder, restPlaceholder: withLabel && labelAsPlaceholder ? undefined : restPlaceholder, autoFocus: autoFocus, className: cx('base-input', commonModifyClasses, classes.baseInput, size && `size-${size}`), defaultValue: defaultValue, value: value, readOnly: readOnly, disabled: disabled, onFocus: (event) => {
|
|
91
92
|
onFocus && onFocus(event);
|
|
92
93
|
toggleHasValue(Boolean(event.target.value));
|
|
93
94
|
toggleFocused(true);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TextareaHTMLAttributes, Ref } from 'react';
|
|
2
|
+
import { BaseInputAsTextareaProps } from '../base-input';
|
|
3
|
+
import { FieldBlockProps } from '../field-block';
|
|
4
|
+
type HTMLTextareaProps = Pick<TextareaHTMLAttributes<HTMLTextAreaElement>, 'autoComplete' | 'autoFocus' | 'defaultValue' | 'disabled' | 'id' | 'name' | 'onBlur' | 'onChange' | 'onFocus' | 'onInput' | 'placeholder' | 'readOnly' | 'required' | 'rows' | 'value'>;
|
|
5
|
+
export interface TextareaProps extends HTMLTextareaProps, FieldBlockProps {
|
|
6
|
+
/** Ref элемента textarea. */
|
|
7
|
+
textareaRef?: Ref<HTMLTextAreaElement>;
|
|
8
|
+
/** Свойства BaseInputProps. */
|
|
9
|
+
baseInputProps?: BaseInputAsTextareaProps;
|
|
10
|
+
/** Стили корневого элемента. */
|
|
11
|
+
style?: Required<FieldBlockProps>['rootProps']['style'];
|
|
12
|
+
/** CSS-класс корневого элемента. */
|
|
13
|
+
className?: Required<FieldBlockProps>['rootProps']['className'];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Текстовая область.
|
|
17
|
+
* @param props Свойства.
|
|
18
|
+
* @return Элемент.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Textarea({ textareaRef, baseInputProps, style, className, autoComplete, autoFocus, defaultValue, disabled, id, name, onBlur, onChange, onFocus, onInput, placeholder, readOnly, required, rows, value, label, failed, caption, blockProps, 'data-testid': testId, ...restProps }: TextareaProps): JSX.Element;
|
|
21
|
+
export {};
|