@ozen-ui/kit 0.30.1 → 0.32.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/__inner__/cjs/components/FieldControl/FieldControl.js +6 -1
- package/__inner__/cjs/components/FieldControl/FieldControlContext.d.ts +2 -0
- package/__inner__/cjs/components/FieldControl/FieldControlContext.js +4 -2
- package/__inner__/cjs/components/FieldHint/FieldHint.js +1 -1
- package/__inner__/cjs/components/FieldIcon/FieldIcon.js +1 -1
- package/__inner__/cjs/components/FieldInput/FieldInput.js +1 -1
- package/__inner__/cjs/components/FieldLabel/FieldLabel.js +1 -1
- package/__inner__/cjs/components/InputNumber/InputNumber.js +3 -3
- package/__inner__/cjs/components/InputNumber/types.d.ts +5 -0
- package/__inner__/cjs/components/Select/components/SelectConsumer/SelectInputConsumer.js +2 -2
- package/__inner__/cjs/components/Textarea/components/TextareaConsumer.js +1 -1
- package/__inner__/cjs/components/Textarea/components/TextareaCounter.js +2 -2
- package/__inner__/cjs/components/ThemeProvider/_color/Theme_color_bBusinessDark.css +39 -39
- package/__inner__/cjs/components/ThemeProvider/_color/Theme_color_bBusinessDefault.css +29 -29
- package/__inner__/cjs/components/ThemeProvider/_color/Theme_color_ozenDark.css +66 -66
- package/__inner__/cjs/components/ThemeProvider/_color/Theme_color_ozenDefault.css +57 -57
- package/__inner__/cjs/hooks/useHover/index.d.ts +1 -0
- package/__inner__/cjs/hooks/useHover/index.js +4 -0
- package/__inner__/cjs/hooks/useHover/useHover.d.ts +14 -0
- package/__inner__/cjs/hooks/useHover/useHover.js +37 -0
- package/__inner__/cjs/locale/locale.js +12 -0
- package/__inner__/esm/components/FieldControl/FieldControl.js +7 -2
- package/__inner__/esm/components/FieldControl/FieldControlContext.d.ts +2 -0
- package/__inner__/esm/components/FieldControl/FieldControlContext.js +2 -1
- package/__inner__/esm/components/FieldHint/FieldHint.js +3 -3
- package/__inner__/esm/components/FieldIcon/FieldIcon.js +3 -3
- package/__inner__/esm/components/FieldInput/FieldInput.js +3 -3
- package/__inner__/esm/components/FieldLabel/FieldLabel.js +3 -3
- package/__inner__/esm/components/InputNumber/InputNumber.js +3 -3
- package/__inner__/esm/components/InputNumber/types.d.ts +5 -0
- package/__inner__/esm/components/Select/components/SelectConsumer/SelectInputConsumer.js +3 -3
- package/__inner__/esm/components/Textarea/components/TextareaConsumer.js +3 -3
- package/__inner__/esm/components/Textarea/components/TextareaCounter.js +3 -3
- package/__inner__/esm/components/ThemeProvider/_color/Theme_color_bBusinessDark.css +39 -39
- package/__inner__/esm/components/ThemeProvider/_color/Theme_color_bBusinessDefault.css +29 -29
- package/__inner__/esm/components/ThemeProvider/_color/Theme_color_ozenDark.css +66 -66
- package/__inner__/esm/components/ThemeProvider/_color/Theme_color_ozenDefault.css +57 -57
- package/__inner__/esm/hooks/useHover/index.d.ts +1 -0
- package/__inner__/esm/hooks/useHover/index.js +1 -0
- package/__inner__/esm/hooks/useHover/useHover.d.ts +14 -0
- package/__inner__/esm/hooks/useHover/useHover.js +33 -0
- package/__inner__/esm/locale/locale.js +12 -0
- package/package.json +1 -1
- package/useHover/package.json +5 -0
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
--color-content-primary: #17161a;
|
|
3
3
|
--color-content-secondary: #636574;
|
|
4
4
|
--color-content-tertiary: #7e8194;
|
|
5
|
-
--color-content-disabled: #
|
|
5
|
+
--color-content-disabled: #9a9eb5;
|
|
6
6
|
--color-content-ghost-disabled: rgb(255 255 255 / 40%);
|
|
7
7
|
--color-content-action: #0b0;
|
|
8
8
|
--color-content-action-hover: #039904;
|
|
9
9
|
--color-content-action-pressed: #067607;
|
|
10
10
|
--color-content-action-dark: #0a540b;
|
|
11
|
-
--color-content-action-secondary: #
|
|
12
|
-
--color-content-action-secondary-hover: #
|
|
13
|
-
--color-content-action-secondary-pressed: #
|
|
14
|
-
--color-content-action-secondary-dark: #
|
|
11
|
+
--color-content-action-secondary: #2c2c33;
|
|
12
|
+
--color-content-action-secondary-hover: #1e1d22;
|
|
13
|
+
--color-content-action-secondary-pressed: #17161a;
|
|
14
|
+
--color-content-action-secondary-dark: #17161a;
|
|
15
15
|
--color-content-action-on: #fff;
|
|
16
16
|
--color-content-error: #ff5959;
|
|
17
17
|
--color-content-error-hover: #cf4a4b;
|
|
18
18
|
--color-content-error-pressed: #9f3b3d;
|
|
19
19
|
--color-content-error-dark: #702d2e;
|
|
20
|
-
--color-content-warning: #
|
|
21
|
-
--color-content-warning-hover: #
|
|
22
|
-
--color-content-warning-pressed: #
|
|
23
|
-
--color-content-warning-dark: #
|
|
20
|
+
--color-content-warning: #ffac30;
|
|
21
|
+
--color-content-warning-hover: #cf8d2a;
|
|
22
|
+
--color-content-warning-pressed: #9f6d24;
|
|
23
|
+
--color-content-warning-dark: #704e1e;
|
|
24
24
|
--color-content-success: #0b0;
|
|
25
25
|
--color-content-success-hover: #039904;
|
|
26
26
|
--color-content-success-pressed: #067607;
|
|
27
27
|
--color-content-success-dark: #0a540b;
|
|
28
|
-
--color-content-info: #
|
|
29
|
-
--color-content-info-hover: #
|
|
30
|
-
--color-content-info-pressed: #
|
|
31
|
-
--color-content-info-dark: #
|
|
28
|
+
--color-content-info: #023dff;
|
|
29
|
+
--color-content-info-hover: #0534d0;
|
|
30
|
+
--color-content-info-pressed: #082ba0;
|
|
31
|
+
--color-content-info-dark: #0a2171;
|
|
32
32
|
--color-content-primary-inverse: #fff;
|
|
33
33
|
--color-content-accent-secondary: #989aa5;
|
|
34
34
|
--color-accent-main: #14151b;
|
|
@@ -51,59 +51,59 @@
|
|
|
51
51
|
--color-background-action: #0b0;
|
|
52
52
|
--color-background-action-hover: #039904;
|
|
53
53
|
--color-background-action-pressed: #067607;
|
|
54
|
-
--color-background-action-active-disabled: #
|
|
55
|
-
--color-background-action-light: #
|
|
56
|
-
--color-background-action-light-hover: #
|
|
57
|
-
--color-background-action-light-pressed: #
|
|
54
|
+
--color-background-action-active-disabled: #99e499;
|
|
55
|
+
--color-background-action-light: #d9f5d9;
|
|
56
|
+
--color-background-action-light-hover: #ccf1cc;
|
|
57
|
+
--color-background-action-light-pressed: #99e499;
|
|
58
58
|
--color-background-accent-action-light: #067607;
|
|
59
59
|
--color-background-accent-action-light-hover: #0a540b;
|
|
60
60
|
--color-background-accent-action-light-pressed: #0d310e;
|
|
61
|
-
--color-background-action-secondary: #
|
|
62
|
-
--color-background-action-secondary-hover: #
|
|
63
|
-
--color-background-action-secondary-pressed: #
|
|
64
|
-
--color-background-action-secondary-active-disabled: #
|
|
65
|
-
--color-background-action-secondary-light: #
|
|
66
|
-
--color-background-action-secondary-light-hover: #
|
|
67
|
-
--color-background-action-secondary-light-pressed: #
|
|
68
|
-
--color-background-accent-action-secondary-light: #
|
|
69
|
-
--color-background-accent-action-secondary-light-hover: #
|
|
70
|
-
--color-background-accent-action-secondary-light-pressed: #
|
|
61
|
+
--color-background-action-secondary: #2c2c33;
|
|
62
|
+
--color-background-action-secondary-hover: #1e1d22;
|
|
63
|
+
--color-background-action-secondary-pressed: #17161a;
|
|
64
|
+
--color-background-action-secondary-active-disabled: #c2c5d3;
|
|
65
|
+
--color-background-action-secondary-light: #ebecf0;
|
|
66
|
+
--color-background-action-secondary-light-hover: #d7d8e1;
|
|
67
|
+
--color-background-action-secondary-light-pressed: #c2c5d3;
|
|
68
|
+
--color-background-accent-action-secondary-light: #636574;
|
|
69
|
+
--color-background-accent-action-secondary-light-hover: #474853;
|
|
70
|
+
--color-background-accent-action-secondary-light-pressed: #2c2c33;
|
|
71
71
|
--color-background-error: #ff5959;
|
|
72
72
|
--color-background-error-hover: #cf4a4b;
|
|
73
73
|
--color-background-error-pressed: #9f3b3d;
|
|
74
|
-
--color-background-error-light: #
|
|
75
|
-
--color-background-error-light-hover: #
|
|
76
|
-
--color-background-error-light-pressed: #
|
|
74
|
+
--color-background-error-light: #ffe6e6;
|
|
75
|
+
--color-background-error-light-hover: #ffdede;
|
|
76
|
+
--color-background-error-light-pressed: #ffbdbd;
|
|
77
77
|
--color-background-accent-error-light: #9f3b3d;
|
|
78
78
|
--color-background-accent-error-light-hover: #702d2e;
|
|
79
79
|
--color-background-accent-error-light-pressed: #401e20;
|
|
80
|
-
--color-background-warning: #
|
|
81
|
-
--color-background-warning-hover: #
|
|
82
|
-
--color-background-warning-pressed: #
|
|
83
|
-
--color-background-warning-light: #
|
|
84
|
-
--color-background-warning-light-hover: #
|
|
85
|
-
--color-background-warning-light-pressed: #
|
|
86
|
-
--color-background-accent-warning-light: #
|
|
87
|
-
--color-background-accent-warning-light-hover: #
|
|
88
|
-
--color-background-accent-warning-light-pressed: #
|
|
80
|
+
--color-background-warning: #ffac30;
|
|
81
|
+
--color-background-warning-hover: #cf8d2a;
|
|
82
|
+
--color-background-warning-pressed: #9f6d24;
|
|
83
|
+
--color-background-warning-light: #fff3e0;
|
|
84
|
+
--color-background-warning-light-hover: #ffeed6;
|
|
85
|
+
--color-background-warning-light-pressed: #ffdeac;
|
|
86
|
+
--color-background-accent-warning-light: #9f6d24;
|
|
87
|
+
--color-background-accent-warning-light-hover: #704e1e;
|
|
88
|
+
--color-background-accent-warning-light-pressed: #402e18;
|
|
89
89
|
--color-background-success: #0b0;
|
|
90
90
|
--color-background-success-hover: #039904;
|
|
91
91
|
--color-background-success-pressed: #067607;
|
|
92
|
-
--color-background-success-light: #
|
|
93
|
-
--color-background-success-light-hover: #
|
|
94
|
-
--color-background-success-light-pressed: #
|
|
92
|
+
--color-background-success-light: #d9f5d9;
|
|
93
|
+
--color-background-success-light-hover: #ccf1cc;
|
|
94
|
+
--color-background-success-light-pressed: #99e499;
|
|
95
95
|
--color-background-accent-success-light: #067607;
|
|
96
96
|
--color-background-accent-success-light-hover: #0a540b;
|
|
97
97
|
--color-background-accent-success-light-pressed: #0d310e;
|
|
98
|
-
--color-background-info: #
|
|
99
|
-
--color-background-info-hover: #
|
|
100
|
-
--color-background-info-pressed: #
|
|
101
|
-
--color-background-info-light: #
|
|
102
|
-
--color-background-info-light-hover: #
|
|
103
|
-
--color-background-info-light-pressed: #
|
|
104
|
-
--color-background-accent-info-light: #
|
|
105
|
-
--color-background-accent-info-light-hover: #
|
|
106
|
-
--color-background-accent-info-light-pressed: #
|
|
98
|
+
--color-background-info: #023dff;
|
|
99
|
+
--color-background-info-hover: #0534d0;
|
|
100
|
+
--color-background-info-pressed: #082ba0;
|
|
101
|
+
--color-background-info-light: #d9e2ff;
|
|
102
|
+
--color-background-info-light-hover: #ccd8ff;
|
|
103
|
+
--color-background-info-light-pressed: #9ab1ff;
|
|
104
|
+
--color-background-accent-info-light: #082ba0;
|
|
105
|
+
--color-background-accent-info-light-hover: #0a2171;
|
|
106
|
+
--color-background-accent-info-light-pressed: #0d1841;
|
|
107
107
|
--color-background-main-inverse: #1e1d22;
|
|
108
108
|
--color-background-overlay: rgb(0 0 0 / 50%);
|
|
109
109
|
--color-background-ghost: rgb(255 255 255 / 10%);
|
|
@@ -122,17 +122,17 @@
|
|
|
122
122
|
--color-border-action: #0b0;
|
|
123
123
|
--color-border-action-hover: #039904;
|
|
124
124
|
--color-border-action-pressed: #067607;
|
|
125
|
-
--color-border-action-secondary: #
|
|
126
|
-
--color-border-action-secondary-hover: #
|
|
127
|
-
--color-border-action-secondary-pressed: #
|
|
125
|
+
--color-border-action-secondary: #2c2c33;
|
|
126
|
+
--color-border-action-secondary-hover: #1e1d22;
|
|
127
|
+
--color-border-action-secondary-pressed: #17161a;
|
|
128
128
|
--color-border-error: #ff5959;
|
|
129
|
-
--color-border-warning: #
|
|
129
|
+
--color-border-warning: #ffac30;
|
|
130
130
|
--color-border-success: #0b0;
|
|
131
|
-
--color-border-info: #
|
|
131
|
+
--color-border-info: #023dff;
|
|
132
132
|
--color-border-main-on: #fff;
|
|
133
133
|
--color-border-accent-main: #989aa5;
|
|
134
134
|
--color-border-accent-disabled: #5f6374;
|
|
135
|
-
--color-border-accent-focused: #
|
|
135
|
+
--color-border-accent-focused: #0e290f;
|
|
136
136
|
--color-accent-main-hover: #1b1c24;
|
|
137
137
|
--color-accent-main-pressed: #252732;
|
|
138
138
|
--color-accent-primary-hover: #252732;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useHover';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
export type UseHoverOptions = {
|
|
3
|
+
/** Функция обратного вызова на событие перехода курсора на целевой элемент */
|
|
4
|
+
onEnter?: (e: PointerEvent) => void;
|
|
5
|
+
/** Функция обратного вызова на событие покидания курсора с целевого элемента */
|
|
6
|
+
onLeave?: (e: PointerEvent) => void;
|
|
7
|
+
/** Признак активности обработчика события, используется для повышения производительности. */
|
|
8
|
+
active?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function useHover<T extends HTMLElement = HTMLElement>(
|
|
11
|
+
/** Ссылка на элемент к которому будет привязано событие */
|
|
12
|
+
elRef: RefObject<T>,
|
|
13
|
+
/** Дополнительные опции */
|
|
14
|
+
options?: UseHoverOptions): boolean;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useHover = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var useBoolean_1 = require("../useBoolean");
|
|
6
|
+
var useEventListener_1 = require("../useEventListener");
|
|
7
|
+
function useHover(
|
|
8
|
+
/** Ссылка на элемент к которому будет привязано событие */
|
|
9
|
+
elRef,
|
|
10
|
+
/** Дополнительные опции */
|
|
11
|
+
options) {
|
|
12
|
+
if (options === void 0) { options = { active: true }; }
|
|
13
|
+
var onLeave = options.onLeave, onEnter = options.onEnter, active = options.active;
|
|
14
|
+
var _a = tslib_1.__read((0, useBoolean_1.useBoolean)(false), 2), value = _a[0], _b = _a[1], on = _b.on, off = _b.off;
|
|
15
|
+
var handleEnter = function (e) {
|
|
16
|
+
on();
|
|
17
|
+
onEnter === null || onEnter === void 0 ? void 0 : onEnter(e);
|
|
18
|
+
};
|
|
19
|
+
var handleLeave = function (e) {
|
|
20
|
+
off();
|
|
21
|
+
onLeave === null || onLeave === void 0 ? void 0 : onLeave(e);
|
|
22
|
+
};
|
|
23
|
+
(0, useEventListener_1.useEventListener)({
|
|
24
|
+
handler: handleEnter,
|
|
25
|
+
element: elRef,
|
|
26
|
+
eventName: 'pointerenter',
|
|
27
|
+
active: active,
|
|
28
|
+
});
|
|
29
|
+
(0, useEventListener_1.useEventListener)({
|
|
30
|
+
handler: handleLeave,
|
|
31
|
+
element: elRef,
|
|
32
|
+
eventName: 'pointerleave',
|
|
33
|
+
active: active,
|
|
34
|
+
});
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
exports.useHover = useHover;
|
|
@@ -10,6 +10,10 @@ exports.ruRU = {
|
|
|
10
10
|
placeholder: 'Файл не выбран',
|
|
11
11
|
clearText: 'Очистить поле',
|
|
12
12
|
},
|
|
13
|
+
InputNumber: {
|
|
14
|
+
incrementButtonText: 'Увеличить',
|
|
15
|
+
decrementButtonText: 'Уменьшить',
|
|
16
|
+
},
|
|
13
17
|
},
|
|
14
18
|
};
|
|
15
19
|
exports.kkKZ = {
|
|
@@ -21,6 +25,10 @@ exports.kkKZ = {
|
|
|
21
25
|
placeholder: 'Файл таңдалмаған',
|
|
22
26
|
clearText: 'Өрісті тазалаңыз',
|
|
23
27
|
},
|
|
28
|
+
InputNumber: {
|
|
29
|
+
incrementButtonText: 'Үлкейту',
|
|
30
|
+
decrementButtonText: 'Азайту',
|
|
31
|
+
},
|
|
24
32
|
},
|
|
25
33
|
};
|
|
26
34
|
exports.enUS = {
|
|
@@ -32,5 +40,9 @@ exports.enUS = {
|
|
|
32
40
|
placeholder: 'No file selected',
|
|
33
41
|
clearText: 'Clear field',
|
|
34
42
|
},
|
|
43
|
+
InputNumber: {
|
|
44
|
+
incrementButtonText: 'Increment',
|
|
45
|
+
decrementButtonText: 'Decrement',
|
|
46
|
+
},
|
|
35
47
|
},
|
|
36
48
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import './FieldControl.css';
|
|
3
|
-
import React, { useState } from 'react';
|
|
3
|
+
import React, { useRef, useState } from 'react';
|
|
4
|
+
import { useHover } from '../../hooks/useHover';
|
|
5
|
+
import { useMultiRef } from '../../hooks/useMultiRef';
|
|
4
6
|
import { useThemeProps } from '../../hooks/useThemeProps';
|
|
5
7
|
import { cn } from '../../utils/classname';
|
|
6
8
|
import { polymorphicComponentWithRef, } from '../../utils/polymorphicComponentWithRef';
|
|
@@ -12,6 +14,8 @@ export var FieldControl = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
12
14
|
props: inProps,
|
|
13
15
|
name: 'FieldControl',
|
|
14
16
|
});
|
|
17
|
+
var innerRef = useRef(null);
|
|
18
|
+
var hovered = useHover(innerRef);
|
|
15
19
|
var _a = props.as, Tag = _a === void 0 ? FIELD_CONTROL_DEFAULT_TAG : _a, sizeProp = props.size, disabledProp = props.disabled, requiredProp = props.required, errorProp = props.error, fullWidthProp = props.fullWidth, filledProp = props.filled, focusedProp = props.focused, children = props.children, className = props.className, otherProp = __rest(props, ["as", "size", "disabled", "required", "error", "fullWidth", "filled", "focused", "children", "className"]);
|
|
16
20
|
var focused = focusedProp;
|
|
17
21
|
var filled = filledProp;
|
|
@@ -61,7 +65,7 @@ export var FieldControl = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
61
65
|
filled: filled,
|
|
62
66
|
focused: focused,
|
|
63
67
|
hasLabel: !!label,
|
|
64
|
-
}, [className]) }, otherProp, { ref: ref }),
|
|
68
|
+
}, [className]) }, otherProp, { ref: useMultiRef([ref, innerRef]) }),
|
|
65
69
|
React.createElement(FieldControlContext.Provider, { value: [
|
|
66
70
|
{
|
|
67
71
|
error: error,
|
|
@@ -72,6 +76,7 @@ export var FieldControl = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
72
76
|
size: size,
|
|
73
77
|
filled: filled,
|
|
74
78
|
focused: focused,
|
|
79
|
+
hovered: hovered,
|
|
75
80
|
value: value,
|
|
76
81
|
},
|
|
77
82
|
setState,
|
|
@@ -9,7 +9,9 @@ export type FieldControlContextValue = {
|
|
|
9
9
|
fullWidth?: boolean;
|
|
10
10
|
filled?: boolean;
|
|
11
11
|
focused?: boolean;
|
|
12
|
+
hovered?: boolean;
|
|
12
13
|
label?: string;
|
|
13
14
|
value?: string | number;
|
|
14
15
|
};
|
|
15
16
|
export declare const FieldControlContext: React.Context<[FieldControlContextValue, Dispatch<SetStateAction<FieldControlContextValue>>]>;
|
|
17
|
+
export declare const useFieldControl: () => [FieldControlContextValue, Dispatch<SetStateAction<FieldControlContextValue>>];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import './FieldHint.css';
|
|
3
|
-
import React, { forwardRef,
|
|
3
|
+
import React, { forwardRef, Children } from 'react';
|
|
4
4
|
import { cn } from '../../utils/classname';
|
|
5
|
-
import {
|
|
5
|
+
import { useFieldControl } from '../FieldControl';
|
|
6
6
|
export var FIELD_HINT_DEFAULT_TAG = 'div';
|
|
7
7
|
export var cnFieldHint = cn('FieldHint');
|
|
8
8
|
export var FieldHint = forwardRef(function (_a, ref) {
|
|
9
9
|
var children = _a.children, errorProp = _a.error, disabledProp = _a.disabled, sizeProp = _a.size, className = _a.className, other = __rest(_a, ["children", "error", "disabled", "size", "className"]);
|
|
10
|
-
var context =
|
|
10
|
+
var context = useFieldControl();
|
|
11
11
|
var _b = __read(context, 1), fieldControl = _b[0];
|
|
12
12
|
var Tag = FIELD_HINT_DEFAULT_TAG;
|
|
13
13
|
var size = sizeProp;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import './FieldIcon.css';
|
|
3
|
-
import React, { forwardRef
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
4
|
import { cn } from '../../utils/classname';
|
|
5
5
|
import { getIconSizeToFormElement } from '../../utils/getIconSizeToFormElement';
|
|
6
6
|
import { renderContent } from '../../utils/renderContent';
|
|
7
|
-
import {
|
|
7
|
+
import { useFieldControl } from '../FieldControl';
|
|
8
8
|
export var FIELD_ICON_DEFAULT_TAG = 'div';
|
|
9
9
|
export var cnFieldIcon = cn('FieldIcon');
|
|
10
10
|
export var FieldIcon = forwardRef(function (_a, ref) {
|
|
11
11
|
var icon = _a.icon, className = _a.className, sizeProp = _a.size, other = __rest(_a, ["icon", "className", "size"]);
|
|
12
|
-
var context =
|
|
12
|
+
var context = useFieldControl();
|
|
13
13
|
var _b = __read(context, 1), fieldControl = _b[0];
|
|
14
14
|
var Tag = FIELD_ICON_DEFAULT_TAG;
|
|
15
15
|
var size = sizeProp;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
|
-
import React, { useCallback,
|
|
2
|
+
import React, { useCallback, useState } from 'react';
|
|
3
3
|
import { useControlled } from '../../hooks/useControlled';
|
|
4
4
|
import { useIsomorphicEffect } from '../../hooks/useIsomorphicEffect';
|
|
5
5
|
import { cn } from '../../utils/classname';
|
|
6
6
|
import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
7
|
-
import {
|
|
7
|
+
import { useFieldControl } from '../FieldControl';
|
|
8
8
|
export var FIELD_INPUT_DEFAULT_TAG = 'input';
|
|
9
9
|
export var cnFieldInput = cn('FieldInput');
|
|
10
10
|
export var FieldInput = polymorphicComponentWithRef(function (_a, ref) {
|
|
11
11
|
var _b = _a.as, Tag = _b === void 0 ? FIELD_INPUT_DEFAULT_TAG : _b, className = _a.className, requiredProp = _a.required, disabledProp = _a.disabled, valueProp = _a.value, onChange = _a.onChange, defaultValue = _a.defaultValue, children = _a.children, onFocus = _a.onFocus, onBlur = _a.onBlur, other = __rest(_a, ["as", "className", "required", "disabled", "value", "onChange", "defaultValue", "children", "onFocus", "onBlur"]);
|
|
12
12
|
var _c = __read(useState(), 2), focused = _c[0], setFocused = _c[1];
|
|
13
|
-
var context =
|
|
13
|
+
var context = useFieldControl();
|
|
14
14
|
var _d = __read(context, 2), fieldControl = _d[0], setFieldControl = _d[1];
|
|
15
15
|
var _e = __read(useControlled({
|
|
16
16
|
value: valueProp,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { __assign, __read } from "tslib";
|
|
2
2
|
import './FieldLabel.css';
|
|
3
|
-
import React, { forwardRef
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
4
|
import { useIsomorphicEffect } from '../../hooks/useIsomorphicEffect';
|
|
5
5
|
import { cn } from '../../utils/classname';
|
|
6
|
-
import {
|
|
6
|
+
import { useFieldControl } from '../FieldControl';
|
|
7
7
|
export var FIELD_LABEL_DEFAULT_TAG = 'span';
|
|
8
8
|
export var cnFieldLabel = cn('FieldLabel');
|
|
9
9
|
export var FieldLabel = forwardRef(function (_a, ref) {
|
|
10
10
|
var focusedProp = _a.focused, children = _a.children, filledProp = _a.filled, shrink = _a.shrink, requiredProp = _a.required, disabledProp = _a.disabled, className = _a.className, sizeProp = _a.size;
|
|
11
|
-
var context =
|
|
11
|
+
var context = useFieldControl();
|
|
12
12
|
var _b = __read(context, 2), fieldControl = _b[0], setFieldControl = _b[1];
|
|
13
13
|
var Tag = FIELD_LABEL_DEFAULT_TAG;
|
|
14
14
|
var size = sizeProp;
|
|
@@ -24,7 +24,7 @@ export var InputNumber = forwardRef(function (inProps, ref) {
|
|
|
24
24
|
props: inProps,
|
|
25
25
|
name: 'InputNumber',
|
|
26
26
|
});
|
|
27
|
-
var _a = props.size, size = _a === void 0 ? INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? INPUT_NUMBER_DEFAULT_MAX : _k, label = props.label, placeholder = props.placeholder, id = props.id, name = props.name, renderLeft = props.renderLeft, renderRight = props.renderRight, hint = props.hint, className = props.className, inputProps = props.inputProps, valueProp = props.value, onChange = props.onChange, labelRef = props.labelRef, labelProps = props.labelProps, bodyProps = props.bodyProps, other = __rest(props, ["size", "step", "autoFocus", "error", "required", "disabled", "fullWidth", "defaultValue", "min", "max", "label", "placeholder", "id", "name", "renderLeft", "renderRight", "hint", "className", "inputProps", "value", "onChange", "labelRef", "labelProps", "bodyProps"]);
|
|
27
|
+
var _a = props.size, size = _a === void 0 ? INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? INPUT_NUMBER_DEFAULT_MAX : _k, label = props.label, placeholder = props.placeholder, id = props.id, name = props.name, renderLeft = props.renderLeft, renderRight = props.renderRight, hint = props.hint, className = props.className, inputProps = props.inputProps, valueProp = props.value, onChange = props.onChange, labelRef = props.labelRef, labelProps = props.labelProps, bodyProps = props.bodyProps, incrementButtonText = props.incrementButtonText, decrementButtonText = props.decrementButtonText, other = __rest(props, ["size", "step", "autoFocus", "error", "required", "disabled", "fullWidth", "defaultValue", "min", "max", "label", "placeholder", "id", "name", "renderLeft", "renderRight", "hint", "className", "inputProps", "value", "onChange", "labelRef", "labelProps", "bodyProps", "incrementButtonText", "decrementButtonText"]);
|
|
28
28
|
var _l = __read(useBoolean(false), 2), focused = _l[0], _m = _l[1], onFocus = _m.on, offFocus = _m.off;
|
|
29
29
|
var _o = __read(useState(null), 2), timeoutId = _o[0], setTimeoutId = _o[1];
|
|
30
30
|
var _p = __read(useState(null), 2), countDirection = _p[0], setCountDirection = _p[1];
|
|
@@ -134,8 +134,8 @@ export var InputNumber = forwardRef(function (inProps, ref) {
|
|
|
134
134
|
React.createElement(FieldInput, __assign({ id: id, min: min, max: max, step: step, name: name, type: "number", value: valueState, autoFocus: autoFocus, placeholder: placeholder }, inputProps, { onBlur: handleBlur, onFocus: handleFocus, onChange: handleChange, onKeyDown: handleKeyDown, ref: useMultiRef([inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, fieldInnerRef]), className: cnInputNumber('Field', [inputProps === null || inputProps === void 0 ? void 0 : inputProps.className]) }))),
|
|
135
135
|
React.createElement(FieldIcon, { icon: renderRight }),
|
|
136
136
|
React.createElement("span", { className: cnInputNumber('Controls') },
|
|
137
|
-
React.createElement(IconButton, { size: size, type: "button", tabIndex: -1, variant: "ghost", icon: SortUpIcon, disabled: disabled, "aria-label":
|
|
138
|
-
React.createElement(IconButton, { size: size, tabIndex: -1, type: "button", variant: "ghost", icon: SortDownIcon, disabled: disabled, "aria-label":
|
|
137
|
+
React.createElement(IconButton, { size: size, type: "button", tabIndex: -1, variant: "ghost", icon: SortUpIcon, disabled: disabled, "aria-label": incrementButtonText, className: cnInputNumber('Increment'), onMouseDown: handleMouseDown('increment') }),
|
|
138
|
+
React.createElement(IconButton, { size: size, tabIndex: -1, type: "button", variant: "ghost", icon: SortDownIcon, disabled: disabled, "aria-label": decrementButtonText, className: cnInputNumber('Decrement'), onMouseDown: handleMouseDown('decrement') })),
|
|
139
139
|
React.createElement(Fieldset, { className: cnInputNumber('Fieldset') })),
|
|
140
140
|
React.createElement(FieldHint, null, hint)));
|
|
141
141
|
});
|
|
@@ -67,6 +67,11 @@ export type InputNumberProps = {
|
|
|
67
67
|
max?: number;
|
|
68
68
|
/** Ссылка на корневой DOM-элемент компонента */
|
|
69
69
|
ref?: Ref<HTMLDivElement>;
|
|
70
|
+
/** data-атрибут для тестирования */
|
|
70
71
|
'data-testid'?: string;
|
|
72
|
+
/** Текст для кнопки увеличения числового значения */
|
|
73
|
+
incrementButtonText?: string;
|
|
74
|
+
/** Текст для кнопки уменьшения числового значения */
|
|
75
|
+
decrementButtonText?: string;
|
|
71
76
|
} & InputNumberPropsDeprecated & Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'onChange'>;
|
|
72
77
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __assign, __read } from "tslib";
|
|
2
|
-
import React
|
|
3
|
-
import {
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useFieldControl } from '../../../FieldControl';
|
|
4
4
|
import { cnSelect } from '../../index';
|
|
5
5
|
export var SelectInputConsumer = function (_a) {
|
|
6
6
|
var id = _a.id, name = _a.name, _b = _a.value, valueProp = _b === void 0 ? '' : _b, placeholderProp = _a.placeholder, defaultValue = _a.defaultValue, inputProps = _a.inputProps, inputRef = _a.inputRef, fieldRef = _a.fieldRef, fieldProps = _a.fieldProps, renderedValue = _a.renderedValue;
|
|
7
|
-
var context =
|
|
7
|
+
var context = useFieldControl();
|
|
8
8
|
var _c = __read(context, 1), fieldControl = _c[0];
|
|
9
9
|
var disabled = fieldControl.disabled, required = fieldControl.required, filled = fieldControl.filled, focused = fieldControl.focused, label = fieldControl.label;
|
|
10
10
|
var hasLabel = !!label;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __read } from "tslib";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
3
|
import { useMultiRef } from '../../../hooks/useMultiRef';
|
|
4
|
-
import {
|
|
4
|
+
import { useFieldControl } from '../../FieldControl';
|
|
5
5
|
import { FieldHint } from '../../FieldHint';
|
|
6
6
|
import { FieldInput } from '../../FieldInput';
|
|
7
7
|
import { FieldLabel } from '../../FieldLabel';
|
|
@@ -11,7 +11,7 @@ import { TextareaCounter } from './index';
|
|
|
11
11
|
export var TextareaConsumer = function (_a) {
|
|
12
12
|
var labelProps = _a.labelProps, labelRef = _a.labelRef, maxLength = _a.maxLength, label = _a.label, id = _a.id, name = _a.name, cols = _a.cols, rows = _a.rows, disabled = _a.disabled, valueProp = _a.value, required = _a.required, defaultValue = _a.defaultValue, placeholder = _a.placeholder, autoFocus = _a.autoFocus, textareaProps = _a.textareaProps, onChange = _a.onChange, textareaRef = _a.textareaRef, expand = _a.expand, hint = _a.hint;
|
|
13
13
|
var fieldRef = useRef(null);
|
|
14
|
-
var context =
|
|
14
|
+
var context = useFieldControl();
|
|
15
15
|
var _b = __read(context, 1), value = _b[0].value;
|
|
16
16
|
// autoSize
|
|
17
17
|
useEffect(function () {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __read } from "tslib";
|
|
2
|
-
import React
|
|
3
|
-
import {
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useFieldControl } from '../../FieldControl';
|
|
4
4
|
import { cnTextarea } from '../index';
|
|
5
5
|
export var TextareaCounter = function (_a) {
|
|
6
6
|
var _b, _c, _d;
|
|
7
7
|
var maxLength = _a.maxLength, disabledProp = _a.disabled;
|
|
8
|
-
var context =
|
|
8
|
+
var context = useFieldControl();
|
|
9
9
|
var _e = __read(context, 1), fieldControl = _e[0];
|
|
10
10
|
var disabled = disabledProp;
|
|
11
11
|
// maxLength
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
--color-content-error-hover: #cf4a4b;
|
|
19
19
|
--color-content-error-pressed: #9f3b3d;
|
|
20
20
|
--color-content-error-dark: #ffbdbd;
|
|
21
|
-
--color-content-warning: #
|
|
22
|
-
--color-content-warning-hover: #
|
|
23
|
-
--color-content-warning-pressed: #
|
|
24
|
-
--color-content-warning-dark: #
|
|
21
|
+
--color-content-warning: #ffac30;
|
|
22
|
+
--color-content-warning-hover: #cf8d2a;
|
|
23
|
+
--color-content-warning-pressed: #9f6d24;
|
|
24
|
+
--color-content-warning-dark: #ffdeac;
|
|
25
25
|
--color-content-success: #0b0;
|
|
26
26
|
--color-content-success-hover: #039904;
|
|
27
27
|
--color-content-success-pressed: #067607;
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
--color-background-action: #0534d0;
|
|
53
53
|
--color-background-action-hover: #023dff;
|
|
54
54
|
--color-background-action-pressed: #3564ff;
|
|
55
|
-
--color-background-action-active-disabled: #
|
|
56
|
-
--color-background-action-light: #
|
|
57
|
-
--color-background-action-light-hover: #
|
|
58
|
-
--color-background-action-light-pressed: #
|
|
59
|
-
--color-background-accent-action-light: #
|
|
60
|
-
--color-background-accent-action-light-hover: #
|
|
61
|
-
--color-background-accent-action-light-pressed: #
|
|
55
|
+
--color-background-action-active-disabled: #0a2171;
|
|
56
|
+
--color-background-action-light: #0e1636;
|
|
57
|
+
--color-background-action-light-hover: #0d1841;
|
|
58
|
+
--color-background-action-light-pressed: #0a2171;
|
|
59
|
+
--color-background-accent-action-light: #0a2171;
|
|
60
|
+
--color-background-accent-action-light-hover: #082ba0;
|
|
61
|
+
--color-background-accent-action-light-pressed: #0534d0;
|
|
62
62
|
--color-background-action-secondary: #7e8194;
|
|
63
63
|
--color-background-action-secondary-hover: #9a9eb5;
|
|
64
64
|
--color-background-action-secondary-pressed: #aeb1c4;
|
|
@@ -72,39 +72,39 @@
|
|
|
72
72
|
--color-background-error: #cf4a4b;
|
|
73
73
|
--color-background-error-hover: #ff5959;
|
|
74
74
|
--color-background-error-pressed: #ff7a7a;
|
|
75
|
-
--color-background-error-light: #
|
|
76
|
-
--color-background-error-light-hover: #
|
|
77
|
-
--color-background-error-light-pressed: #
|
|
78
|
-
--color-background-accent-error-light: #
|
|
79
|
-
--color-background-accent-error-light-hover: #
|
|
80
|
-
--color-background-accent-error-light-pressed: #
|
|
81
|
-
--color-background-warning: #
|
|
82
|
-
--color-background-warning-hover: #
|
|
83
|
-
--color-background-warning-pressed: #
|
|
84
|
-
--color-background-warning-light: #
|
|
85
|
-
--color-background-warning-light-hover: #
|
|
86
|
-
--color-background-warning-light-pressed: #
|
|
87
|
-
--color-background-accent-warning-light: #
|
|
88
|
-
--color-background-accent-warning-light-hover: #
|
|
89
|
-
--color-background-accent-warning-light-pressed: #
|
|
75
|
+
--color-background-error-light: #341a1d;
|
|
76
|
+
--color-background-error-light-hover: #401e20;
|
|
77
|
+
--color-background-error-light-pressed: #702d2e;
|
|
78
|
+
--color-background-accent-error-light: #702d2e;
|
|
79
|
+
--color-background-accent-error-light-hover: #9f3b3d;
|
|
80
|
+
--color-background-accent-error-light-pressed: #cf4a4b;
|
|
81
|
+
--color-background-warning: #cf8d2a;
|
|
82
|
+
--color-background-warning-hover: #ffac30;
|
|
83
|
+
--color-background-warning-pressed: #ffbd59;
|
|
84
|
+
--color-background-warning-light: #342717;
|
|
85
|
+
--color-background-warning-light-hover: #402e18;
|
|
86
|
+
--color-background-warning-light-pressed: #704e1e;
|
|
87
|
+
--color-background-accent-warning-light: #704e1e;
|
|
88
|
+
--color-background-accent-warning-light-hover: #9f6d24;
|
|
89
|
+
--color-background-accent-warning-light-pressed: #cf8d2a;
|
|
90
90
|
--color-background-success: #039904;
|
|
91
91
|
--color-background-success-hover: #0b0;
|
|
92
92
|
--color-background-success-pressed: #33c933;
|
|
93
|
-
--color-background-success-light: #
|
|
94
|
-
--color-background-success-light-hover: #
|
|
95
|
-
--color-background-success-light-pressed: #
|
|
96
|
-
--color-background-accent-success-light: #
|
|
97
|
-
--color-background-accent-success-light-hover: #
|
|
98
|
-
--color-background-accent-success-light-pressed: #
|
|
93
|
+
--color-background-success-light: #0e290f;
|
|
94
|
+
--color-background-success-light-hover: #0d310e;
|
|
95
|
+
--color-background-success-light-pressed: #0a540b;
|
|
96
|
+
--color-background-accent-success-light: #0a540b;
|
|
97
|
+
--color-background-accent-success-light-hover: #067607;
|
|
98
|
+
--color-background-accent-success-light-pressed: #039904;
|
|
99
99
|
--color-background-info: #6a05d0;
|
|
100
100
|
--color-background-info-hover: #8002ff;
|
|
101
101
|
--color-background-info-pressed: #9a35ff;
|
|
102
|
-
--color-background-info-light: #
|
|
103
|
-
--color-background-info-light-hover: #
|
|
104
|
-
--color-background-info-light-pressed: #
|
|
105
|
-
--color-background-accent-info-light: #
|
|
106
|
-
--color-background-accent-info-light-hover: #
|
|
107
|
-
--color-background-accent-info-light-pressed: #
|
|
102
|
+
--color-background-info-light: #210d36;
|
|
103
|
+
--color-background-info-light-hover: #270d41;
|
|
104
|
+
--color-background-info-light-pressed: #3d0a71;
|
|
105
|
+
--color-background-accent-info-light: #3d0a71;
|
|
106
|
+
--color-background-accent-info-light-hover: #5307a0;
|
|
107
|
+
--color-background-accent-info-light-pressed: #6a05d0;
|
|
108
108
|
--color-background-overlay: rgb(0 0 0 / 60%);
|
|
109
109
|
--color-background-ghost: rgb(255 255 255 / 10%);
|
|
110
110
|
--color-background-ghost-hover: rgb(255 255 255 / 20%);
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
--color-border-action-secondary-hover: #c2c5d3;
|
|
127
127
|
--color-border-action-secondary-pressed: #aeb1c4;
|
|
128
128
|
--color-border-error: #cf4a4b;
|
|
129
|
-
--color-border-warning: #
|
|
129
|
+
--color-border-warning: #cf8d2a;
|
|
130
130
|
--color-border-success: #039904;
|
|
131
131
|
--color-border-info: #6a05d0;
|
|
132
132
|
--color-border-main-on: #fff;
|