@megafon/ui-core 4.11.4 → 4.13.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/CHANGELOG.md +22 -0
- package/dist/es/components/Carousel/Carousel.css +52 -13
- package/dist/es/components/Carousel/Carousel.d.ts +6 -1
- package/dist/es/components/Carousel/Carousel.js +21 -6
- package/dist/es/components/Carousel/useGradient.d.ts +18 -0
- package/dist/es/components/Carousel/useGradient.js +52 -0
- package/dist/es/components/NavArrow/NavArrow.css +11 -2
- package/dist/es/components/Search/Search.d.ts +3 -0
- package/dist/es/components/Search/Search.js +10 -7
- package/dist/es/components/Select/Select.d.ts +16 -0
- package/dist/es/components/Select/Select.js +12 -7
- package/dist/es/components/Switcher/Switcher.d.ts +2 -1
- package/dist/es/components/Switcher/Switcher.js +4 -3
- package/dist/es/components/Tabs/Tab.d.ts +2 -0
- package/dist/es/components/Tabs/Tab.js +1 -0
- package/dist/es/components/Tabs/Tabs.js +15 -2
- package/dist/es/components/TextField/TextField.d.ts +1 -0
- package/dist/es/components/TextField/TextField.js +4 -3
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/lib/components/Carousel/Carousel.css +52 -13
- package/dist/lib/components/Carousel/Carousel.d.ts +6 -1
- package/dist/lib/components/Carousel/Carousel.js +53 -27
- package/dist/lib/components/Carousel/useGradient.d.ts +18 -0
- package/dist/lib/components/Carousel/useGradient.js +69 -0
- package/dist/lib/components/NavArrow/NavArrow.css +11 -2
- package/dist/lib/components/Search/Search.d.ts +3 -0
- package/dist/lib/components/Search/Search.js +10 -7
- package/dist/lib/components/Select/Select.d.ts +16 -0
- package/dist/lib/components/Select/Select.js +12 -7
- package/dist/lib/components/Switcher/Switcher.d.ts +2 -1
- package/dist/lib/components/Switcher/Switcher.js +4 -3
- package/dist/lib/components/Tabs/Tab.d.ts +2 -0
- package/dist/lib/components/Tabs/Tab.js +1 -0
- package/dist/lib/components/Tabs/Tabs.js +15 -2
- package/dist/lib/components/TextField/TextField.d.ts +1 -0
- package/dist/lib/components/TextField/TextField.js +4 -3
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +8 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.13.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.12.0...@megafon/ui-core@4.13.0) (2023-02-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **carousel:** add property for gradient ([9900586](https://github.com/MegafonWebLab/megafon-ui/commit/99005866bc54d60f3447742f129f036391fb3a68))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [4.12.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.11.4...@megafon/ui-core@4.12.0) (2023-02-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **tabs:** add rel prop ([7a4a2de](https://github.com/MegafonWebLab/megafon-ui/commit/7a4a2ded26083cc466de10c362700a6c98a38dfd))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [4.11.4](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.11.3...@megafon/ui-core@4.11.4) (2023-02-06)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @megafon/ui-core
|
|
@@ -44,6 +44,49 @@
|
|
|
44
44
|
padding-left: 16px;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
.mfui-carousel__swiper_gradient:before,
|
|
48
|
+
.mfui-carousel__swiper_gradient:after {
|
|
49
|
+
content: '';
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 0;
|
|
52
|
+
z-index: 5;
|
|
53
|
+
width: var(--gap);
|
|
54
|
+
height: 85%;
|
|
55
|
+
}
|
|
56
|
+
@media screen and (max-width: 1023px) {
|
|
57
|
+
.mfui-carousel__swiper_gradient:before,
|
|
58
|
+
.mfui-carousel__swiper_gradient:after {
|
|
59
|
+
display: none;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
.mfui-carousel__swiper_gradient:before {
|
|
63
|
+
left: 0;
|
|
64
|
+
background: -webkit-gradient(linear, right top, left top, from(transparent), to(var(--gradientColor)));
|
|
65
|
+
background: linear-gradient(270deg, transparent 0%, var(--gradientColor) 100%);
|
|
66
|
+
}
|
|
67
|
+
.mfui-carousel__swiper_gradient:after {
|
|
68
|
+
right: 0;
|
|
69
|
+
background: -webkit-gradient(linear, right top, left top, from(var(--gradientColor)), to(transparent));
|
|
70
|
+
background: linear-gradient(270deg, var(--gradientColor) 0%, transparent 100%);
|
|
71
|
+
}
|
|
72
|
+
.mfui-carousel__swiper_gradient-color_default {
|
|
73
|
+
--gradientColor: var(--base);
|
|
74
|
+
}
|
|
75
|
+
.mfui-carousel__swiper_gradient-color_green {
|
|
76
|
+
--gradientColor: var(--brandGreen);
|
|
77
|
+
}
|
|
78
|
+
.mfui-carousel__swiper_gradient-color_black {
|
|
79
|
+
--gradientColor: var(--stcBlack);
|
|
80
|
+
}
|
|
81
|
+
.mfui-carousel__swiper_gradient-color_spbSky0 {
|
|
82
|
+
--gradientColor: var(--spbSky0);
|
|
83
|
+
}
|
|
84
|
+
.mfui-carousel__swiper_gradient-color_spbSky1 {
|
|
85
|
+
--gradientColor: var(--spbSky1);
|
|
86
|
+
}
|
|
87
|
+
.mfui-carousel__swiper_gradient-color_spbSky2 {
|
|
88
|
+
--gradientColor: var(--spbSky2);
|
|
89
|
+
}
|
|
47
90
|
.mfui-carousel .swiper-wrapper {
|
|
48
91
|
z-index: 1;
|
|
49
92
|
display: -webkit-box;
|
|
@@ -105,6 +148,7 @@
|
|
|
105
148
|
display: -webkit-box;
|
|
106
149
|
display: -ms-flexbox;
|
|
107
150
|
display: flex;
|
|
151
|
+
gap: 12px;
|
|
108
152
|
-webkit-box-align: center;
|
|
109
153
|
-ms-flex-align: center;
|
|
110
154
|
align-items: center;
|
|
@@ -136,9 +180,10 @@
|
|
|
136
180
|
box-sizing: border-box;
|
|
137
181
|
width: 8px;
|
|
138
182
|
height: 8px;
|
|
139
|
-
padding: 1px;
|
|
140
183
|
border-radius: 50%;
|
|
141
184
|
cursor: pointer;
|
|
185
|
+
-webkit-transition: width 0.5s, background-color 0.3s;
|
|
186
|
+
transition: width 0.5s, background-color 0.3s;
|
|
142
187
|
}
|
|
143
188
|
.mfui-carousel .swiper-pagination-bullet:before {
|
|
144
189
|
content: '';
|
|
@@ -146,9 +191,8 @@
|
|
|
146
191
|
width: 100%;
|
|
147
192
|
height: 100%;
|
|
148
193
|
border-radius: 50%;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
margin-right: 8px;
|
|
194
|
+
-webkit-transition: border-radius 0.5s;
|
|
195
|
+
transition: border-radius 0.5s;
|
|
152
196
|
}
|
|
153
197
|
.mfui-carousel_nav-theme_green .swiper-pagination-bullet:before {
|
|
154
198
|
background-color: var(--stcWhite50);
|
|
@@ -157,20 +201,15 @@
|
|
|
157
201
|
background-color: var(--spbSky2);
|
|
158
202
|
}
|
|
159
203
|
.mfui-carousel .swiper-pagination-bullet-active {
|
|
160
|
-
|
|
204
|
+
width: 20px;
|
|
161
205
|
cursor: default;
|
|
162
206
|
}
|
|
163
|
-
.mfui-
|
|
164
|
-
|
|
165
|
-
cursor: default;
|
|
207
|
+
.mfui-carousel .swiper-pagination-bullet-active:before {
|
|
208
|
+
border-radius: 4px;
|
|
166
209
|
}
|
|
167
210
|
.mfui-carousel_nav-theme_green .swiper-pagination-bullet-active:before {
|
|
168
211
|
background-color: var(--base);
|
|
169
212
|
}
|
|
170
|
-
.mfui-carousel_nav-theme_light .swiper-pagination-bullet-active {
|
|
171
|
-
padding: 0;
|
|
172
|
-
cursor: default;
|
|
173
|
-
}
|
|
174
213
|
.mfui-carousel_nav-theme_light .swiper-pagination-bullet-active:before {
|
|
175
|
-
background-color: var(--
|
|
214
|
+
background-color: var(--brandGreen);
|
|
176
215
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import SwiperCore from 'swiper';
|
|
3
3
|
import { PaginationOptions } from 'swiper/types/components/pagination';
|
|
4
|
+
import { GradientTheme } from './useGradient';
|
|
4
5
|
import './Carousel.less';
|
|
5
6
|
export declare const NavTheme: {
|
|
6
7
|
readonly LIGHT: "light";
|
|
@@ -82,6 +83,10 @@ export interface ICarouselProps {
|
|
|
82
83
|
onPrevClick?: (index: number) => void;
|
|
83
84
|
/** Обработчик смены слайда (должен быть обернут в useCallback) */
|
|
84
85
|
onChange?: (currentIndex: number, previousIndex: number, slidesPerView?: number | 'auto') => void;
|
|
86
|
+
/** Наличие градиента по краям контейнера */
|
|
87
|
+
gradient?: boolean;
|
|
88
|
+
/** Цвет градиента */
|
|
89
|
+
gradientColor?: GradientTheme;
|
|
85
90
|
}
|
|
86
91
|
declare const Carousel: React.FC<ICarouselProps>;
|
|
87
92
|
export default Carousel;
|
|
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
9
9
|
|
|
10
10
|
var _defaultSlidesSetting;
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import React from 'react';
|
|
13
13
|
import { breakpoints, cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
14
14
|
import throttle from 'lodash.throttle';
|
|
15
15
|
import * as PropTypes from 'prop-types';
|
|
@@ -19,6 +19,7 @@ import NavArrow, { Theme as ArrowTheme } from "../NavArrow/NavArrow";
|
|
|
19
19
|
import throttleTime from "../../constants/throttleTime";
|
|
20
20
|
import usePrevious from "../../hooks/usePrevious";
|
|
21
21
|
import checkBreakpointsPropTypes from "./checkBreakpointsPropTypes";
|
|
22
|
+
import useGradient, { GradientTheme } from "./useGradient";
|
|
22
23
|
import "./Carousel.css";
|
|
23
24
|
SwiperCore.use([Autoplay, Pagination, EffectFade]);
|
|
24
25
|
export var NavTheme = {
|
|
@@ -96,7 +97,11 @@ var Carousel = function Carousel(_ref) {
|
|
|
96
97
|
onPrevClick = _ref.onPrevClick,
|
|
97
98
|
onChange = _ref.onChange,
|
|
98
99
|
_ref$slideToClickedSl = _ref.slideToClickedSlide,
|
|
99
|
-
slideToClickedSlide = _ref$slideToClickedSl === void 0 ? false : _ref$slideToClickedSl
|
|
100
|
+
slideToClickedSlide = _ref$slideToClickedSl === void 0 ? false : _ref$slideToClickedSl,
|
|
101
|
+
_ref$gradient = _ref.gradient,
|
|
102
|
+
gradient = _ref$gradient === void 0 ? false : _ref$gradient,
|
|
103
|
+
_ref$gradientColor = _ref.gradientColor,
|
|
104
|
+
gradientColor = _ref$gradientColor === void 0 ? GradientTheme.DEFAULT : _ref$gradientColor;
|
|
100
105
|
|
|
101
106
|
var _React$useState = React.useState(),
|
|
102
107
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -121,6 +126,11 @@ var Carousel = function Carousel(_ref) {
|
|
|
121
126
|
var childrenLen = Array.isArray(children) ? children.length : 0;
|
|
122
127
|
var prevChildrenLen = usePrevious(childrenLen) || 0;
|
|
123
128
|
var isChildrenLenDiff = childrenLen !== prevChildrenLen;
|
|
129
|
+
var gradientStyles = useGradient(gradient, {
|
|
130
|
+
instance: swiperInstance,
|
|
131
|
+
slidesSettings: slidesSettings,
|
|
132
|
+
isLocked: isLocked
|
|
133
|
+
});
|
|
124
134
|
var increaseAutoplayDelay = React.useCallback(function (_ref2) {
|
|
125
135
|
var params = _ref2.params,
|
|
126
136
|
autoplay = _ref2.autoplay;
|
|
@@ -245,7 +255,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
245
255
|
return function () {
|
|
246
256
|
window.removeEventListener('resize', windowResizeHandlerThrottled);
|
|
247
257
|
};
|
|
248
|
-
}, [swiperInstance]);
|
|
258
|
+
}, [slidesSettings, swiperInstance]);
|
|
249
259
|
React.useEffect(function () {
|
|
250
260
|
if (swiperInstance && isChildrenLenDiff) {
|
|
251
261
|
handleNavDisplay(swiperInstance);
|
|
@@ -256,12 +266,15 @@ var Carousel = function Carousel(_ref) {
|
|
|
256
266
|
className: cn({
|
|
257
267
|
'nav-theme': navTheme
|
|
258
268
|
}, [className, rootClass]),
|
|
259
|
-
onClick: handleRootClick
|
|
269
|
+
onClick: handleRootClick,
|
|
270
|
+
style: gradientStyles
|
|
260
271
|
}), /*#__PURE__*/React.createElement(Swiper, _extends({}, containerModifier ? {
|
|
261
272
|
containerModifierClass: containerModifier
|
|
262
273
|
} : {}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.slider), {
|
|
263
274
|
className: cn('swiper', {
|
|
264
|
-
'default-inner-indents': !innerIndentsClass
|
|
275
|
+
'default-inner-indents': !innerIndentsClass,
|
|
276
|
+
gradient: gradient,
|
|
277
|
+
'gradient-color': gradient && gradientColor
|
|
265
278
|
}, [innerIndentsClass, containerClass]),
|
|
266
279
|
breakpoints: slidesSettings,
|
|
267
280
|
watchSlidesVisibility: true,
|
|
@@ -371,6 +384,8 @@ Carousel.propTypes = {
|
|
|
371
384
|
getSwiper: PropTypes.func,
|
|
372
385
|
onNextClick: PropTypes.func,
|
|
373
386
|
onPrevClick: PropTypes.func,
|
|
374
|
-
onChange: PropTypes.func
|
|
387
|
+
onChange: PropTypes.func,
|
|
388
|
+
gradient: PropTypes.oneOfType([PropTypes.bool]),
|
|
389
|
+
gradientColor: PropTypes.oneOf(Object.values(GradientTheme))
|
|
375
390
|
};
|
|
376
391
|
export default Carousel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import SwiperCore from 'swiper';
|
|
3
|
+
import { SlidesSettingsType } from './Carousel';
|
|
4
|
+
declare type SwiperConfig = {
|
|
5
|
+
instance: SwiperCore | undefined;
|
|
6
|
+
slidesSettings: SlidesSettingsType;
|
|
7
|
+
isLocked: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare enum GradientTheme {
|
|
10
|
+
DEFAULT = "default",
|
|
11
|
+
GREEN = "green",
|
|
12
|
+
BLACK = "black",
|
|
13
|
+
SPB_SKY_0 = "spbSky0",
|
|
14
|
+
SPB_SKY_1 = "spbSky1",
|
|
15
|
+
SPB_SKY_2 = "spbSky2"
|
|
16
|
+
}
|
|
17
|
+
declare const _default: (gradient: boolean, swiper: SwiperConfig) => CSSProperties;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { breakpoints } from '@megafon/ui-helpers';
|
|
4
|
+
import throttle from 'lodash.throttle';
|
|
5
|
+
import throttleTime from "../../constants/throttleTime";
|
|
6
|
+
export var GradientTheme;
|
|
7
|
+
|
|
8
|
+
(function (GradientTheme) {
|
|
9
|
+
GradientTheme["DEFAULT"] = "default";
|
|
10
|
+
GradientTheme["GREEN"] = "green";
|
|
11
|
+
GradientTheme["BLACK"] = "black";
|
|
12
|
+
GradientTheme["SPB_SKY_0"] = "spbSky0";
|
|
13
|
+
GradientTheme["SPB_SKY_1"] = "spbSky1";
|
|
14
|
+
GradientTheme["SPB_SKY_2"] = "spbSky2";
|
|
15
|
+
})(GradientTheme || (GradientTheme = {}));
|
|
16
|
+
|
|
17
|
+
export default (function (gradient, swiper) {
|
|
18
|
+
var _useState = useState(0),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
slidesGap = _useState2[0],
|
|
21
|
+
setSlidesGap = _useState2[1];
|
|
22
|
+
|
|
23
|
+
var swiperInstance = swiper.instance,
|
|
24
|
+
slidesSettings = swiper.slidesSettings,
|
|
25
|
+
isLocked = swiper.isLocked;
|
|
26
|
+
var isGradientEnable = gradient && !isLocked;
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
var isTouch = window.innerWidth < breakpoints.DESKTOP_SMALL_START;
|
|
29
|
+
var isPossibleToSetGap = isGradientEnable && swiperInstance && !isTouch;
|
|
30
|
+
|
|
31
|
+
if (!isPossibleToSetGap) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var setCurrenSlidesGap = function setCurrenSlidesGap() {
|
|
36
|
+
var currentBreakpoint = swiperInstance.getBreakpoint(slidesSettings);
|
|
37
|
+
var currentSpaceBetweenValue = slidesSettings[currentBreakpoint].spaceBetween;
|
|
38
|
+
setSlidesGap(currentSpaceBetweenValue);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
setCurrenSlidesGap();
|
|
42
|
+
var throttledHandler = throttle(setCurrenSlidesGap, throttleTime.resize);
|
|
43
|
+
window.addEventListener('resize', throttledHandler);
|
|
44
|
+
return function () {
|
|
45
|
+
window.removeEventListener('resize', throttledHandler);
|
|
46
|
+
};
|
|
47
|
+
}, [gradient, slidesSettings, swiperInstance, isLocked, isGradientEnable]);
|
|
48
|
+
var gradientStyles = {
|
|
49
|
+
'--gap': "".concat(slidesGap, "px")
|
|
50
|
+
};
|
|
51
|
+
return isGradientEnable ? gradientStyles : {};
|
|
52
|
+
});
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
border-radius: 50%;
|
|
10
10
|
outline: none;
|
|
11
11
|
cursor: pointer;
|
|
12
|
+
-webkit-transition: background-color 0.3s, opacity 0.3s;
|
|
13
|
+
transition: background-color 0.3s, opacity 0.3s;
|
|
12
14
|
-webkit-appearance: none;
|
|
13
15
|
-moz-appearance: none;
|
|
14
16
|
appearance: none;
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
.mfui-nav-arrow:disabled {
|
|
18
20
|
cursor: default;
|
|
19
21
|
opacity: 0.3;
|
|
22
|
+
pointer-events: none;
|
|
20
23
|
}
|
|
21
24
|
.mfui-nav-arrow__icon {
|
|
22
25
|
display: block;
|
|
@@ -27,12 +30,18 @@
|
|
|
27
30
|
.mfui-nav-arrow_theme_purple {
|
|
28
31
|
background-color: var(--brandPurple);
|
|
29
32
|
}
|
|
30
|
-
.mfui-nav-arrow_theme_purple:hover
|
|
33
|
+
.mfui-nav-arrow_theme_purple:hover {
|
|
31
34
|
background-color: var(--buttonHoverPurple);
|
|
32
35
|
}
|
|
36
|
+
.mfui-nav-arrow_theme_purple:active {
|
|
37
|
+
background-color: var(--buttonDown);
|
|
38
|
+
}
|
|
33
39
|
.mfui-nav-arrow_theme_dark {
|
|
34
40
|
background-color: var(--stcBlack20);
|
|
35
41
|
}
|
|
36
|
-
.mfui-nav-arrow_theme_dark:hover
|
|
42
|
+
.mfui-nav-arrow_theme_dark:hover {
|
|
37
43
|
background-color: var(--stcBlack50);
|
|
38
44
|
}
|
|
45
|
+
.mfui-nav-arrow_theme_dark:active {
|
|
46
|
+
background-color: var(--buttonDown);
|
|
47
|
+
}
|
|
@@ -22,9 +22,12 @@ export interface ISearchProps {
|
|
|
22
22
|
/** Дополнительные data атрибуты к внутренним элементам */
|
|
23
23
|
dataAttrs?: {
|
|
24
24
|
root?: Record<string, string>;
|
|
25
|
+
control?: Record<string, string>;
|
|
25
26
|
searchField?: Record<string, string>;
|
|
26
27
|
submit?: Record<string, string>;
|
|
27
28
|
item?: Record<string, string>;
|
|
29
|
+
itemTitle?: Record<string, string>;
|
|
30
|
+
notice?: Record<string, string>;
|
|
28
31
|
};
|
|
29
32
|
/** Значение */
|
|
30
33
|
value?: string;
|
|
@@ -185,12 +185,12 @@ var Search = function Search(_ref) {
|
|
|
185
185
|
open: isFocused,
|
|
186
186
|
disabled: disabled
|
|
187
187
|
}, [className])
|
|
188
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.control), {
|
|
189
189
|
className: cn('control', {
|
|
190
190
|
error: verification === Verification.ERROR,
|
|
191
191
|
success: verification === Verification.VALID
|
|
192
192
|
}, [classes === null || classes === void 0 ? void 0 : classes.control])
|
|
193
|
-
}, /*#__PURE__*/React.createElement("label", {
|
|
193
|
+
}), /*#__PURE__*/React.createElement("label", {
|
|
194
194
|
className: cn('search-wrapper', {
|
|
195
195
|
labeled: !!label,
|
|
196
196
|
'no-label': !label
|
|
@@ -238,23 +238,26 @@ var Search = function Search(_ref) {
|
|
|
238
238
|
onMouseDown: handleSelectSubmit(i),
|
|
239
239
|
onMouseEnter: handleHoverItem(i),
|
|
240
240
|
key: i
|
|
241
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
241
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.itemTitle, i + 1), {
|
|
242
242
|
className: cn('item-title', [classes === null || classes === void 0 ? void 0 : classes.listItemTitle])
|
|
243
|
-
}, searchView || highlightString(itemValue)));
|
|
244
|
-
})))), noticeText && /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
}), searchView || highlightString(itemValue)));
|
|
244
|
+
})))), noticeText && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.notice), {
|
|
245
245
|
className: cn('notice', {
|
|
246
246
|
error: verification === Verification.ERROR,
|
|
247
247
|
success: verification === Verification.VALID
|
|
248
248
|
})
|
|
249
|
-
}, noticeText));
|
|
249
|
+
}), noticeText));
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
Search.propTypes = {
|
|
253
253
|
dataAttrs: PropTypes.shape({
|
|
254
254
|
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
255
|
+
control: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
255
256
|
searchField: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
256
257
|
submit: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
257
|
-
item: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
258
|
+
item: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
259
|
+
itemTitle: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
260
|
+
notice: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
258
261
|
}),
|
|
259
262
|
value: PropTypes.string,
|
|
260
263
|
label: PropTypes.string,
|
|
@@ -75,9 +75,13 @@ export interface ISelectProps<T extends SelectItemValueType> {
|
|
|
75
75
|
dataAttrs?: {
|
|
76
76
|
root?: Record<string, string>;
|
|
77
77
|
label?: Record<string, string>;
|
|
78
|
+
control?: Record<string, string>;
|
|
78
79
|
title?: Record<string, string>;
|
|
80
|
+
titleInner?: Record<string, string>;
|
|
79
81
|
input?: Record<string, string>;
|
|
80
82
|
noticeText?: Record<string, string>;
|
|
83
|
+
list?: Record<string, string>;
|
|
84
|
+
listInner?: Record<string, string>;
|
|
81
85
|
listItem?: Record<string, string>;
|
|
82
86
|
listItemTitle?: Record<string, string>;
|
|
83
87
|
notFound?: Record<string, string>;
|
|
@@ -120,15 +124,27 @@ declare const Select: {
|
|
|
120
124
|
label: PropTypes.Requireable<{
|
|
121
125
|
[x: string]: string;
|
|
122
126
|
}>;
|
|
127
|
+
control: PropTypes.Requireable<{
|
|
128
|
+
[x: string]: string;
|
|
129
|
+
}>;
|
|
123
130
|
title: PropTypes.Requireable<{
|
|
124
131
|
[x: string]: string;
|
|
125
132
|
}>;
|
|
133
|
+
titleInner: PropTypes.Requireable<{
|
|
134
|
+
[x: string]: string;
|
|
135
|
+
}>;
|
|
126
136
|
input: PropTypes.Requireable<{
|
|
127
137
|
[x: string]: string;
|
|
128
138
|
}>;
|
|
129
139
|
noticeText: PropTypes.Requireable<{
|
|
130
140
|
[x: string]: string;
|
|
131
141
|
}>;
|
|
142
|
+
list: PropTypes.Requireable<{
|
|
143
|
+
[x: string]: string;
|
|
144
|
+
}>;
|
|
145
|
+
listInner: PropTypes.Requireable<{
|
|
146
|
+
[x: string]: string;
|
|
147
|
+
}>;
|
|
132
148
|
listItem: PropTypes.Requireable<{
|
|
133
149
|
[x: string]: string;
|
|
134
150
|
}>;
|
|
@@ -200,6 +200,7 @@ var Select = function Select(_ref) {
|
|
|
200
200
|
comparableInputValue: title,
|
|
201
201
|
items: items
|
|
202
202
|
});
|
|
203
|
+
e.persist();
|
|
203
204
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(e, item);
|
|
204
205
|
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
205
206
|
};
|
|
@@ -355,11 +356,11 @@ var Select = function Select(_ref) {
|
|
|
355
356
|
role: "button",
|
|
356
357
|
tabIndex: 0,
|
|
357
358
|
onClick: handleSelectClick
|
|
358
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
359
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.titleInner), {
|
|
359
360
|
className: cn('title-inner', {
|
|
360
361
|
'hide-value': !item
|
|
361
362
|
}, [classes === null || classes === void 0 ? void 0 : classes.titleInner])
|
|
362
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
363
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
363
364
|
className: cn('title-value')
|
|
364
365
|
}, inputTitle), label && renderLabel()));
|
|
365
366
|
};
|
|
@@ -379,14 +380,14 @@ var Select = function Select(_ref) {
|
|
|
379
380
|
|
|
380
381
|
var renderChildren = function renderChildren() {
|
|
381
382
|
var currentItems = type === SelectTypes.COMBOBOX ? itemsList : items;
|
|
382
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
383
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.list), {
|
|
383
384
|
className: cn('list', [classes.list])
|
|
384
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
385
|
+
}), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.listInner), {
|
|
385
386
|
className: cn('list-inner', {
|
|
386
387
|
"short": shortList
|
|
387
388
|
}, [classes.listInner]),
|
|
388
389
|
ref: itemWrapperNode
|
|
389
|
-
}, currentItems.map(function (_ref3, i) {
|
|
390
|
+
}), currentItems.map(function (_ref3, i) {
|
|
390
391
|
var title = _ref3.title,
|
|
391
392
|
value = _ref3.value,
|
|
392
393
|
view = _ref3.view,
|
|
@@ -423,12 +424,12 @@ var Select = function Select(_ref) {
|
|
|
423
424
|
ref: selectNode
|
|
424
425
|
}), /*#__PURE__*/React.createElement("div", {
|
|
425
426
|
className: cn('inner')
|
|
426
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
427
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.control), {
|
|
427
428
|
className: cn('control', {
|
|
428
429
|
labeled: !!label
|
|
429
430
|
}, classes.control),
|
|
430
431
|
onKeyDown: handleKeyDown
|
|
431
|
-
}, type === SelectTypes.COMBOBOX && renderCombobox(), type === SelectTypes.CLASSIC && renderTitle()), renderChildren()), noticeText && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.noticeText), {
|
|
432
|
+
}), type === SelectTypes.COMBOBOX && renderCombobox(), type === SelectTypes.CLASSIC && renderTitle()), renderChildren()), noticeText && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.noticeText), {
|
|
432
433
|
className: cn('text', {
|
|
433
434
|
error: verification === Verification.ERROR,
|
|
434
435
|
success: verification === Verification.VALID
|
|
@@ -461,9 +462,13 @@ Select.propTypes = {
|
|
|
461
462
|
dataAttrs: PropTypes.shape({
|
|
462
463
|
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
463
464
|
label: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
465
|
+
control: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
464
466
|
title: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
467
|
+
titleInner: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
465
468
|
input: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
466
469
|
noticeText: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
470
|
+
list: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
471
|
+
listInner: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
467
472
|
listItem: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
468
473
|
listItemTitle: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
469
474
|
notFound: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
@@ -6,6 +6,7 @@ export interface ISwitcherProps {
|
|
|
6
6
|
dataAttrs?: {
|
|
7
7
|
root?: Record<string, string>;
|
|
8
8
|
input?: Record<string, string>;
|
|
9
|
+
loader?: Record<string, string>;
|
|
9
10
|
};
|
|
10
11
|
/** Дополнительный класс корневого элемента */
|
|
11
12
|
className?: string;
|
|
@@ -13,7 +14,7 @@ export interface ISwitcherProps {
|
|
|
13
14
|
checked?: boolean;
|
|
14
15
|
/** Отключение переключателя */
|
|
15
16
|
disabled?: boolean;
|
|
16
|
-
/**
|
|
17
|
+
/** Состояние загрузки */
|
|
17
18
|
showLoader?: boolean;
|
|
18
19
|
/** Размер текста лейбла */
|
|
19
20
|
textSize?: 'small' | 'medium';
|
|
@@ -50,9 +50,9 @@ var Switcher = function Switcher(_ref) {
|
|
|
50
50
|
onClick: handleChange,
|
|
51
51
|
onKeyDown: handleChange,
|
|
52
52
|
tabIndex: isInteractiveDisabled ? undefined : 0
|
|
53
|
-
}), showLoader && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
}), showLoader && !disabled && /*#__PURE__*/React.createElement("div", _extends({
|
|
54
54
|
className: cn('loader')
|
|
55
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader))), /*#__PURE__*/React.createElement("div", {
|
|
56
56
|
className: cn('pointer')
|
|
57
57
|
})), isRightContent && /*#__PURE__*/React.createElement("div", {
|
|
58
58
|
className: cn('content', {
|
|
@@ -64,7 +64,8 @@ var Switcher = function Switcher(_ref) {
|
|
|
64
64
|
Switcher.propTypes = {
|
|
65
65
|
dataAttrs: PropTypes.shape({
|
|
66
66
|
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
67
|
-
input: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
67
|
+
input: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
68
|
+
loader: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
68
69
|
}),
|
|
69
70
|
className: PropTypes.string,
|
|
70
71
|
textSize: PropTypes.oneOf(['small', 'medium']),
|
|
@@ -271,10 +271,16 @@ var Tabs = function Tabs(_ref) {
|
|
|
271
271
|
var rootRefNode = rootRef.current;
|
|
272
272
|
rootRefNode && ((_a = intersectionObserverRef.current) === null || _a === void 0 ? void 0 : _a.unobserve(outerObserveContainer || rootRefNode));
|
|
273
273
|
}, [outerObserveContainer]);
|
|
274
|
-
var renderTab = React.useCallback(function (
|
|
274
|
+
var renderTab = React.useCallback(function (_ref3, index) {
|
|
275
|
+
var title = _ref3.title,
|
|
276
|
+
icon = _ref3.icon,
|
|
277
|
+
href = _ref3.href,
|
|
278
|
+
rel = _ref3.rel,
|
|
279
|
+
attr = _ref3.attr;
|
|
275
280
|
var ElementType = href ? 'a' : 'div';
|
|
276
281
|
return /*#__PURE__*/React.createElement(ElementType, _extends({
|
|
277
282
|
href: href,
|
|
283
|
+
rel: rel,
|
|
278
284
|
className: cn('tab-inner', {
|
|
279
285
|
current: currentIndex === index,
|
|
280
286
|
'with-icon': !!icon
|
|
@@ -292,9 +298,16 @@ var Tabs = function Tabs(_ref) {
|
|
|
292
298
|
title = _child$props.title,
|
|
293
299
|
icon = _child$props.icon,
|
|
294
300
|
href = _child$props.href,
|
|
301
|
+
rel = _child$props.rel,
|
|
295
302
|
renderTabWrapper = _child$props.renderTabWrapper,
|
|
296
303
|
data = _child$props.dataAttrs;
|
|
297
|
-
var tab = renderTab(
|
|
304
|
+
var tab = renderTab({
|
|
305
|
+
title: title,
|
|
306
|
+
icon: icon,
|
|
307
|
+
href: href,
|
|
308
|
+
rel: rel,
|
|
309
|
+
attr: data === null || data === void 0 ? void 0 : data.inner
|
|
310
|
+
}, i);
|
|
298
311
|
var activeTabClassName = currentIndex === i ? classes === null || classes === void 0 ? void 0 : classes.activeTab : undefined;
|
|
299
312
|
return /*#__PURE__*/React.createElement(SwiperSlide, {
|
|
300
313
|
className: cn('slide')
|
|
@@ -77,6 +77,7 @@ export declare type TextFieldProps = {
|
|
|
77
77
|
notice?: Record<string, string>;
|
|
78
78
|
input?: Record<string, string>;
|
|
79
79
|
iconBox?: Record<string, string>;
|
|
80
|
+
resizer?: Record<string, string>;
|
|
80
81
|
};
|
|
81
82
|
/** Атрибут элемента input */
|
|
82
83
|
inputMode?: 'numeric' | 'tel' | 'decimal' | 'email' | 'url' | 'search' | 'none';
|
|
@@ -465,10 +465,10 @@ var TextField = function TextField(_ref) {
|
|
|
465
465
|
className: cn('field-wrapper', {
|
|
466
466
|
textarea: textarea && textareaType
|
|
467
467
|
})
|
|
468
|
-
}, renderField(), textareaType === TextareaTypes.FLEXIBLE && !hideResizeButton && /*#__PURE__*/React.createElement("div", {
|
|
468
|
+
}, renderField(), textareaType === TextareaTypes.FLEXIBLE && !hideResizeButton && /*#__PURE__*/React.createElement("div", _extends({
|
|
469
469
|
className: cn('resizer'),
|
|
470
470
|
ref: resizerRef
|
|
471
|
-
}, /*#__PURE__*/React.createElement(ResizeIcon, null))), /*#__PURE__*/React.createElement("div", {
|
|
471
|
+
}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.resizer)), /*#__PURE__*/React.createElement(ResizeIcon, null))), /*#__PURE__*/React.createElement("div", {
|
|
472
472
|
className: cn('field-bottom-wrapper', {
|
|
473
473
|
filled: !!currentNoticeText || !!symbolCounter
|
|
474
474
|
})
|
|
@@ -527,7 +527,8 @@ TextField.propTypes = {
|
|
|
527
527
|
label: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
528
528
|
notice: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
529
529
|
input: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
530
|
-
iconBox: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
530
|
+
iconBox: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
531
|
+
resizer: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
531
532
|
})
|
|
532
533
|
};
|
|
533
534
|
export default TextField;
|
package/dist/es/index.d.ts
CHANGED
|
@@ -43,4 +43,5 @@ export { default as Tile } from './components/Tile/Tile';
|
|
|
43
43
|
export { default as Timer } from './components/Badges/components/TimerBadge/Timer/Timer';
|
|
44
44
|
export { default as TimerBadge } from './components/Badges/components/TimerBadge/TimerBadge';
|
|
45
45
|
export { default as Tooltip } from './components/Tooltip/Tooltip';
|
|
46
|
+
export { default as useGradient } from './components/Carousel/useGradient';
|
|
46
47
|
export { default as usePagination } from './components/Pagination/usePagination';
|
package/dist/es/index.js
CHANGED
|
@@ -43,4 +43,5 @@ export { default as Tile } from "./components/Tile/Tile";
|
|
|
43
43
|
export { default as Timer } from "./components/Badges/components/TimerBadge/Timer/Timer";
|
|
44
44
|
export { default as TimerBadge } from "./components/Badges/components/TimerBadge/TimerBadge";
|
|
45
45
|
export { default as Tooltip } from "./components/Tooltip/Tooltip";
|
|
46
|
+
export { default as useGradient } from "./components/Carousel/useGradient";
|
|
46
47
|
export { default as usePagination } from "./components/Pagination/usePagination";
|