@megafon/ui-core 2.3.0 → 2.4.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 +16 -0
- package/dist/es/colors/Colors.d.ts +2 -2
- package/dist/es/components/Accordion/Accordion.js +1 -1
- package/dist/es/components/Banner/Banner.css +28 -0
- package/dist/es/components/Banner/Banner.d.ts +2 -0
- package/dist/es/components/Banner/Banner.js +15 -10
- package/dist/es/components/Button/Button.js +2 -2
- package/dist/es/components/Calendar/Calendar.js +3 -2
- package/dist/es/components/Calendar/components/Day/Day.js +1 -1
- package/dist/es/components/Carousel/Carousel.js +17 -14
- package/dist/es/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/es/components/Checkbox/Checkbox.js +1 -1
- package/dist/es/components/Counter/Counter.js +3 -3
- package/dist/es/components/Header/Header.d.ts +1 -1
- package/dist/es/components/Link/Link.d.ts +7 -3
- package/dist/es/components/Link/Link.js +21 -8
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.js +1 -1
- package/dist/es/components/Pagination/helpers.d.ts +1 -1
- package/dist/es/components/RadioButton/RadioButton.js +1 -1
- package/dist/es/components/Search/Search.js +3 -3
- package/dist/es/components/Select/Select.d.ts +3 -3
- package/dist/es/components/Select/Select.js +5 -5
- package/dist/es/components/Switcher/Switcher.js +1 -1
- package/dist/es/components/Tabs/Tabs.js +10 -9
- package/dist/es/components/TextField/TextField.js +9 -9
- package/dist/es/components/Tile/Tile.js +1 -1
- package/dist/es/components/Tooltip/Tooltip.js +17 -17
- package/dist/lib/colors/Colors.d.ts +2 -2
- package/dist/lib/components/Accordion/Accordion.js +1 -1
- package/dist/lib/components/Banner/Banner.css +28 -0
- package/dist/lib/components/Banner/Banner.d.ts +2 -0
- package/dist/lib/components/Banner/Banner.js +15 -10
- package/dist/lib/components/Button/Button.js +2 -2
- package/dist/lib/components/Calendar/Calendar.js +3 -3
- package/dist/lib/components/Calendar/components/Day/Day.js +1 -1
- package/dist/lib/components/Carousel/Carousel.js +15 -12
- package/dist/lib/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/lib/components/Checkbox/Checkbox.js +1 -1
- package/dist/lib/components/Counter/Counter.js +3 -3
- package/dist/lib/components/Header/Header.d.ts +1 -1
- package/dist/lib/components/Link/Link.d.ts +7 -3
- package/dist/lib/components/Link/Link.js +34 -23
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.js +1 -1
- package/dist/lib/components/Pagination/helpers.d.ts +1 -1
- package/dist/lib/components/RadioButton/RadioButton.js +1 -1
- package/dist/lib/components/Search/Search.js +3 -3
- package/dist/lib/components/Select/Select.d.ts +3 -3
- package/dist/lib/components/Select/Select.js +5 -5
- package/dist/lib/components/Switcher/Switcher.js +1 -1
- package/dist/lib/components/Tabs/Tabs.js +10 -9
- package/dist/lib/components/TextField/TextField.js +9 -9
- package/dist/lib/components/Tile/Tile.js +1 -1
- package/dist/lib/components/Tooltip/Tooltip.js +17 -17
- package/package.json +2 -2
|
@@ -193,11 +193,11 @@ var Tabs = function Tabs(_ref) {
|
|
|
193
193
|
left: left,
|
|
194
194
|
right: documentWidth - right
|
|
195
195
|
});
|
|
196
|
-
}, [
|
|
196
|
+
}, [sticky]);
|
|
197
197
|
var handleTabInnerClick = React.useCallback(function (index) {
|
|
198
198
|
return function () {
|
|
199
199
|
setUnderlineTransition('all');
|
|
200
|
-
onTabClick
|
|
200
|
+
onTabClick === null || onTabClick === void 0 ? void 0 : onTabClick(index);
|
|
201
201
|
|
|
202
202
|
if (outerIndex === undefined) {
|
|
203
203
|
setInnerIndex(index);
|
|
@@ -246,7 +246,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
246
246
|
ref: setTabRef
|
|
247
247
|
}, (0, _uiHelpers.filterDataAttrs)(dataAttrs)), renderTabWrapper ? renderTabWrapper(tab) : tab));
|
|
248
248
|
});
|
|
249
|
-
}, [renderTab, children]);
|
|
249
|
+
}, [renderTab, children, activeTabClass, currentIndex, setTabRef, tabClass]);
|
|
250
250
|
var renderPanels = React.useCallback(function () {
|
|
251
251
|
return React.Children.map(children, function (child, i) {
|
|
252
252
|
var panel = child.props.children;
|
|
@@ -262,7 +262,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
262
262
|
})
|
|
263
263
|
}, panel);
|
|
264
264
|
});
|
|
265
|
-
}, [children, currentIndex]);
|
|
265
|
+
}, [children, currentIndex, renderOnlyCurrentPanel]);
|
|
266
266
|
var handleReachBeginning = React.useCallback(function (swiper) {
|
|
267
267
|
setBeginning(swiper.isBeginning);
|
|
268
268
|
}, []);
|
|
@@ -274,6 +274,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
274
274
|
setEnd(swiper.isEnd);
|
|
275
275
|
}, []);
|
|
276
276
|
React.useEffect(function () {
|
|
277
|
+
var rootRefNode = rootRef.current;
|
|
277
278
|
var observer = new IntersectionObserver(function (entries) {
|
|
278
279
|
entries.forEach(function (_ref2) {
|
|
279
280
|
var isIntersecting = _ref2.isIntersecting,
|
|
@@ -282,7 +283,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
282
283
|
left = _ref2$boundingClientR.left,
|
|
283
284
|
right = _ref2$boundingClientR.right;
|
|
284
285
|
|
|
285
|
-
if (!sticky || !
|
|
286
|
+
if (!sticky || !rootRefNode || !tabListRef.current) {
|
|
286
287
|
return;
|
|
287
288
|
}
|
|
288
289
|
|
|
@@ -315,11 +316,11 @@ var Tabs = function Tabs(_ref) {
|
|
|
315
316
|
}, {
|
|
316
317
|
threshold: [0, 1]
|
|
317
318
|
});
|
|
318
|
-
|
|
319
|
+
rootRefNode && observer.observe(rootRefNode);
|
|
319
320
|
return function () {
|
|
320
|
-
|
|
321
|
+
rootRefNode && observer.unobserve(rootRefNode);
|
|
321
322
|
};
|
|
322
|
-
}, [calculateSticky]);
|
|
323
|
+
}, [calculateSticky, sticky]);
|
|
323
324
|
React.useEffect(function () {
|
|
324
325
|
var handleResize = (0, _lodash["default"])(function () {
|
|
325
326
|
calculateSticky();
|
|
@@ -340,7 +341,7 @@ var Tabs = function Tabs(_ref) {
|
|
|
340
341
|
return function () {
|
|
341
342
|
window.removeEventListener('resize', handleResize);
|
|
342
343
|
};
|
|
343
|
-
}, [calculateUnderline, calculateSticky]);
|
|
344
|
+
}, [calculateUnderline, calculateSticky, currentIndex]);
|
|
344
345
|
React.useEffect(function () {
|
|
345
346
|
if (!swiperInstance) {
|
|
346
347
|
return;
|
|
@@ -175,7 +175,7 @@ var TextField = function TextField(_ref) {
|
|
|
175
175
|
(0, React.useEffect)(function () {
|
|
176
176
|
!isControlled && setInputValue(value);
|
|
177
177
|
checkSymbolMaxLimit(value);
|
|
178
|
-
}, [value, checkSymbolMaxLimit]);
|
|
178
|
+
}, [value, checkSymbolMaxLimit, isControlled]);
|
|
179
179
|
(0, React.useEffect)(function () {
|
|
180
180
|
setTouch((0, _uiHelpers.detectTouch)());
|
|
181
181
|
}, []);
|
|
@@ -183,7 +183,7 @@ var TextField = function TextField(_ref) {
|
|
|
183
183
|
return setPasswordHidden(function (prevPassState) {
|
|
184
184
|
return !prevPassState;
|
|
185
185
|
});
|
|
186
|
-
}, [
|
|
186
|
+
}, []);
|
|
187
187
|
|
|
188
188
|
var setTextareaHeight = function setTextareaHeight() {
|
|
189
189
|
if (!(fieldNode === null || fieldNode === void 0 ? void 0 : fieldNode.current)) {
|
|
@@ -206,7 +206,7 @@ var TextField = function TextField(_ref) {
|
|
|
206
206
|
|
|
207
207
|
!isControlled && setInputValue(e.target.value);
|
|
208
208
|
checkSymbolMaxLimit(e.target.value);
|
|
209
|
-
onChange
|
|
209
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
210
210
|
};
|
|
211
211
|
|
|
212
212
|
var handleTextareaClick = function handleTextareaClick() {
|
|
@@ -223,18 +223,18 @@ var TextField = function TextField(_ref) {
|
|
|
223
223
|
var isClearFuncAvailable = !customIcon && !onCustomIconClick && verification === ERROR;
|
|
224
224
|
var field = fieldNode.current;
|
|
225
225
|
isPasswordType && togglePasswordHiding();
|
|
226
|
-
onCustomIconClick
|
|
226
|
+
onCustomIconClick === null || onCustomIconClick === void 0 ? void 0 : onCustomIconClick(e);
|
|
227
227
|
|
|
228
228
|
if (!isControlled && isClearFuncAvailable) {
|
|
229
229
|
setInputValue('');
|
|
230
|
-
field
|
|
230
|
+
field === null || field === void 0 ? void 0 : field.focus();
|
|
231
231
|
}
|
|
232
|
-
}, [isPasswordType, togglePasswordHiding, onCustomIconClick, verification,
|
|
232
|
+
}, [isPasswordType, togglePasswordHiding, onCustomIconClick, verification, customIcon, isControlled]);
|
|
233
233
|
var handleFocus = (0, React.useCallback)(function (e) {
|
|
234
|
-
onFocus
|
|
234
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
235
235
|
}, [onFocus]);
|
|
236
236
|
var handleBlur = (0, React.useCallback)(function (e) {
|
|
237
|
-
onBlur
|
|
237
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
238
238
|
}, [onBlur]);
|
|
239
239
|
var handleBeforeMaskChange = (0, React.useCallback)(function (newState, oldState, inputedValue) {
|
|
240
240
|
return onBeforeMaskChange && onBeforeMaskChange(inputedValue, newState, oldState);
|
|
@@ -278,7 +278,7 @@ var TextField = function TextField(_ref) {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
fieldNode.current = node;
|
|
281
|
-
inputRef
|
|
281
|
+
inputRef === null || inputRef === void 0 ? void 0 : inputRef(node);
|
|
282
282
|
};
|
|
283
283
|
|
|
284
284
|
var getIcon = function getIcon() {
|
|
@@ -109,7 +109,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
109
109
|
|
|
110
110
|
(0, _react.useEffect)(function () {
|
|
111
111
|
return setIsOpen(isOpened);
|
|
112
|
-
}, [isOpened
|
|
112
|
+
}, [isOpened]);
|
|
113
113
|
var options = (0, _react.useMemo)(function () {
|
|
114
114
|
return {
|
|
115
115
|
placement: placement,
|
|
@@ -137,7 +137,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
137
137
|
}
|
|
138
138
|
}]
|
|
139
139
|
};
|
|
140
|
-
}, [placement, arrowElement, currentBoundary, isOpen]);
|
|
140
|
+
}, [placement, arrowElement, currentBoundary, isOpen, fallbackPlacements]);
|
|
141
141
|
|
|
142
142
|
var _usePopper = (0, _reactPopper.usePopper)(currentTarget, popperElement, options),
|
|
143
143
|
styles = _usePopper.styles,
|
|
@@ -145,7 +145,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
145
145
|
update = _usePopper.update;
|
|
146
146
|
|
|
147
147
|
(0, _react.useEffect)(function () {
|
|
148
|
-
update
|
|
148
|
+
update === null || update === void 0 ? void 0 : update();
|
|
149
149
|
}, [children, update]);
|
|
150
150
|
|
|
151
151
|
var _useState7 = (0, _react.useState)(false),
|
|
@@ -155,7 +155,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
155
155
|
|
|
156
156
|
(0, _react.useEffect)(function () {
|
|
157
157
|
return setIsTouchDevice((0, _uiHelpers.detectTouch)());
|
|
158
|
-
}, [
|
|
158
|
+
}, []);
|
|
159
159
|
var clickEvent = (0, _react.useMemo)(function () {
|
|
160
160
|
return isTouchDevice ? TOUCH_KEY : MOUSE_KEY;
|
|
161
161
|
}, [isTouchDevice]);
|
|
@@ -165,9 +165,9 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
165
165
|
var handleMouseEnter = (0, _react.useCallback)(function (e) {
|
|
166
166
|
if (!isOpen) {
|
|
167
167
|
setIsOpen(true);
|
|
168
|
-
onOpen
|
|
168
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen(e);
|
|
169
169
|
}
|
|
170
|
-
}, [isOpen, onOpen
|
|
170
|
+
}, [isOpen, onOpen]);
|
|
171
171
|
var handleClick = (0, _react.useCallback)(function (e) {
|
|
172
172
|
if (!checkEventIsClickOrEnterPress(e)) {
|
|
173
173
|
return;
|
|
@@ -178,24 +178,24 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
if (!isOpen) {
|
|
181
|
-
onOpen
|
|
181
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen(e);
|
|
182
182
|
} else {
|
|
183
|
-
onClose
|
|
183
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
184
184
|
}
|
|
185
|
-
}, [isOpen, onOpen, onClose
|
|
185
|
+
}, [isOpen, onOpen, onClose]);
|
|
186
186
|
var handleOutsideEvent = (0, _react.useCallback)(function (e) {
|
|
187
187
|
var isTargetInPopper = e.target instanceof Element && popperElement && popperElement.contains(e.target);
|
|
188
188
|
var isTargetInTrigger = e.target instanceof Element && currentTrigger && currentTrigger.contains(e.target);
|
|
189
189
|
|
|
190
190
|
if (!isTargetInPopper && !isTargetInTrigger) {
|
|
191
191
|
setIsOpen(false);
|
|
192
|
-
onClose
|
|
192
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
193
193
|
}
|
|
194
|
-
}, [onClose, currentTrigger, popperElement
|
|
194
|
+
}, [onClose, currentTrigger, popperElement]);
|
|
195
195
|
var handleBlurEvent = (0, _react.useCallback)(function (e) {
|
|
196
196
|
setIsOpen(false);
|
|
197
|
-
onClose
|
|
198
|
-
}, [onClose
|
|
197
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
198
|
+
}, [onClose]);
|
|
199
199
|
(0, _react.useEffect)(function () {
|
|
200
200
|
if (triggerEventName === TriggerEvent.HOVER) {
|
|
201
201
|
if (currentTrigger) {
|
|
@@ -205,10 +205,10 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
205
205
|
|
|
206
206
|
if (isOpen) {
|
|
207
207
|
document.addEventListener('mouseover', handleOutsideEvent);
|
|
208
|
-
currentTrigger
|
|
208
|
+
currentTrigger === null || currentTrigger === void 0 ? void 0 : currentTrigger.addEventListener('blur', handleBlurEvent);
|
|
209
209
|
} else {
|
|
210
210
|
document.removeEventListener('mouseover', handleOutsideEvent);
|
|
211
|
-
currentTrigger
|
|
211
|
+
currentTrigger === null || currentTrigger === void 0 ? void 0 : currentTrigger.removeEventListener('blur', handleBlurEvent);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
return function () {
|
|
@@ -222,7 +222,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
return undefined;
|
|
225
|
-
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleMouseEnter]);
|
|
225
|
+
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleMouseEnter, handleBlurEvent]);
|
|
226
226
|
(0, _react.useEffect)(function () {
|
|
227
227
|
if (triggerEventName === TriggerEvent.CLICK) {
|
|
228
228
|
if (currentTrigger) {
|
|
@@ -247,7 +247,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
return undefined;
|
|
250
|
-
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick]);
|
|
250
|
+
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick, clickEvent]);
|
|
251
251
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
252
252
|
className: cn({
|
|
253
253
|
paddings: paddings,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"react-popper": "^2.2.3",
|
|
97
97
|
"swiper": "^6.5.6"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "1c92184284a8224e5832b4c2218231edfcbb4d5f"
|
|
100
100
|
}
|