@itcase/ui 1.0.96 → 1.0.99
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/dist/components/Button.js +1 -1
- package/dist/components/Checkbox.js +11 -6
- package/dist/components/Chips.js +6 -2
- package/dist/components/Choice.js +25 -12
- package/dist/components/DadataHintField.js +1 -1
- package/dist/components/DatePicker.js +7746 -8885
- package/dist/components/FormField.js +3 -3
- package/dist/components/Grid.js +2 -1
- package/dist/components/Group.js +9 -1
- package/dist/components/Input.js +6 -1
- package/dist/components/InputPassword.js +6 -1
- package/dist/components/Label.js +254 -35
- package/dist/components/RadioButton.js +12 -7
- package/dist/components/Segmented.js +22 -6
- package/dist/components/Select.js +8520 -46
- package/dist/components/Swiper.js +23 -13
- package/dist/components/Text.js +13 -1
- package/dist/components/Textarea.js +6 -1
- package/dist/components/Title.js +11 -3
- package/dist/components/Tooltip.js +115 -14
- package/dist/css/components/Avatar/Avatar.css +7 -0
- package/dist/css/components/Cell/Cell.css +1 -0
- package/dist/css/components/Chips/Chips.css +7 -7
- package/dist/css/components/DatePicker/DatePicker.css +33 -84
- package/dist/css/components/Grid/Grid.css +8 -0
- package/dist/css/components/Group/Group.css +8 -0
- package/dist/css/components/Label/Label.css +9 -1
- package/dist/css/components/Swiper/Swiper.css +3 -3
- package/dist/css/components/Tooltip/Tooltip.css +37 -3
- package/dist/css/styles/align/align_vertical.css +4 -4
- package/dist/css/styles/border-color/border-color.css +1 -2
- package/dist/css/styles/border-color/border-color_hover.css +22 -0
- package/dist/css/styles/fill/fill.css +2 -4
- package/dist/css/styles/fill/fill_active.css +2 -2
- package/dist/css/styles/fill/fill_disabled.css +2 -2
- package/dist/css/styles/fill/fill_hover.css +2 -2
- package/dist/css/styles/fill-gradient/fill-gradient.css +1 -1
- package/dist/css/styles/hover/hover-fill-color.css +1 -1
- package/dist/css/styles/hover/hover-item-color.css +1 -1
- package/dist/css/styles/hover/hover-text-color.css +1 -1
- package/dist/css/styles/mediaqueries.css +0 -14
- package/dist/css/styles/text-color/text-color.css +2 -3
- package/dist/css/styles/text-color/text-color_active.css +1 -1
- package/dist/css/styles/text-color/text-color_hover.css +23 -0
- package/dist/css/styles/text-gradient/text-gradient.css +0 -3
- package/dist/floating-ui.dom-D_Zct5p2.js +1401 -0
- package/dist/stories/Avatar.stories.js +179 -0
- package/dist/stories/Cell.stories.js +317 -0
- package/package.json +32 -30
- package/dist/SelectContainer-umrbJtB5.js +0 -8728
- package/dist/css/styles/border-color-hover/border-color-hover.css +0 -21
- package/dist/css/styles/text-color-hover/text-color-hover.css +0 -21
- package/dist/defineProperty-ujK-k7aM.js +0 -166
- /package/dist/{_commonjsHelpers-rI13D0F7.js → _commonjsHelpers-CFO10eej.js} +0 -0
- /package/dist/css/styles/{border-color-focus/border-color-focus.css → border-color/border-color_focus.css} +0 -0
|
@@ -506,6 +506,7 @@ function getDevice(overrides) {
|
|
|
506
506
|
let browser;
|
|
507
507
|
function calcBrowser() {
|
|
508
508
|
const window = getWindow();
|
|
509
|
+
const device = getDevice();
|
|
509
510
|
let needPerspectiveFix = false;
|
|
510
511
|
function isSafari() {
|
|
511
512
|
const ua = window.navigator.userAgent.toLowerCase();
|
|
@@ -518,10 +519,14 @@ function calcBrowser() {
|
|
|
518
519
|
needPerspectiveFix = major < 16 || major === 16 && minor < 2;
|
|
519
520
|
}
|
|
520
521
|
}
|
|
522
|
+
const isWebView = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent);
|
|
523
|
+
const isSafariBrowser = isSafari();
|
|
524
|
+
const need3dFix = isSafariBrowser || isWebView && device.ios;
|
|
521
525
|
return {
|
|
522
|
-
isSafari: needPerspectiveFix ||
|
|
526
|
+
isSafari: needPerspectiveFix || isSafariBrowser,
|
|
523
527
|
needPerspectiveFix,
|
|
524
|
-
|
|
528
|
+
need3dFix,
|
|
529
|
+
isWebView
|
|
525
530
|
};
|
|
526
531
|
}
|
|
527
532
|
function getBrowser() {
|
|
@@ -1827,7 +1832,7 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
|
|
|
1827
1832
|
wrapperEl,
|
|
1828
1833
|
enabled
|
|
1829
1834
|
} = swiper;
|
|
1830
|
-
if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) {
|
|
1835
|
+
if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial || swiper.destroyed) {
|
|
1831
1836
|
return false;
|
|
1832
1837
|
}
|
|
1833
1838
|
const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
|
|
@@ -1967,6 +1972,7 @@ function slideToLoop(index, speed, runCallbacks, internal) {
|
|
|
1967
1972
|
index = indexAsNumber;
|
|
1968
1973
|
}
|
|
1969
1974
|
const swiper = this;
|
|
1975
|
+
if (swiper.destroyed) return;
|
|
1970
1976
|
const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
|
|
1971
1977
|
let newIndex = index;
|
|
1972
1978
|
if (swiper.params.loop) {
|
|
@@ -2035,7 +2041,7 @@ function slideNext(speed, runCallbacks, internal) {
|
|
|
2035
2041
|
params,
|
|
2036
2042
|
animating
|
|
2037
2043
|
} = swiper;
|
|
2038
|
-
if (!enabled) return swiper;
|
|
2044
|
+
if (!enabled || swiper.destroyed) return swiper;
|
|
2039
2045
|
let perGroup = params.slidesPerGroup;
|
|
2040
2046
|
if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
|
|
2041
2047
|
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
|
|
@@ -2079,7 +2085,7 @@ function slidePrev(speed, runCallbacks, internal) {
|
|
|
2079
2085
|
enabled,
|
|
2080
2086
|
animating
|
|
2081
2087
|
} = swiper;
|
|
2082
|
-
if (!enabled) return swiper;
|
|
2088
|
+
if (!enabled || swiper.destroyed) return swiper;
|
|
2083
2089
|
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
2084
2090
|
if (params.loop) {
|
|
2085
2091
|
if (animating && !isVirtual && params.loopPreventsSliding) return false;
|
|
@@ -2139,6 +2145,7 @@ function slideReset(speed, runCallbacks, internal) {
|
|
|
2139
2145
|
runCallbacks = true;
|
|
2140
2146
|
}
|
|
2141
2147
|
const swiper = this;
|
|
2148
|
+
if (swiper.destroyed) return;
|
|
2142
2149
|
return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
|
|
2143
2150
|
}
|
|
2144
2151
|
|
|
@@ -2154,6 +2161,7 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
|
|
|
2154
2161
|
threshold = 0.5;
|
|
2155
2162
|
}
|
|
2156
2163
|
const swiper = this;
|
|
2164
|
+
if (swiper.destroyed) return;
|
|
2157
2165
|
let index = swiper.activeIndex;
|
|
2158
2166
|
const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
|
|
2159
2167
|
const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
|
|
@@ -2182,6 +2190,7 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
|
|
|
2182
2190
|
|
|
2183
2191
|
function slideToClickedSlide() {
|
|
2184
2192
|
const swiper = this;
|
|
2193
|
+
if (swiper.destroyed) return;
|
|
2185
2194
|
const {
|
|
2186
2195
|
params,
|
|
2187
2196
|
slidesEl
|
|
@@ -3538,6 +3547,7 @@ var defaults = {
|
|
|
3538
3547
|
init: true,
|
|
3539
3548
|
direction: 'horizontal',
|
|
3540
3549
|
oneWayMovement: false,
|
|
3550
|
+
swiperElementNodeName: 'SWIPER-CONTAINER',
|
|
3541
3551
|
touchEventsTarget: 'wrapper',
|
|
3542
3552
|
initialSlide: 0,
|
|
3543
3553
|
speed: 300,
|
|
@@ -3978,11 +3988,11 @@ let Swiper$2 = class Swiper {
|
|
|
3978
3988
|
let spv = 1;
|
|
3979
3989
|
if (typeof params.slidesPerView === 'number') return params.slidesPerView;
|
|
3980
3990
|
if (params.centeredSlides) {
|
|
3981
|
-
let slideSize = slides[activeIndex] ? slides[activeIndex].swiperSlideSize : 0;
|
|
3991
|
+
let slideSize = slides[activeIndex] ? Math.ceil(slides[activeIndex].swiperSlideSize) : 0;
|
|
3982
3992
|
let breakLoop;
|
|
3983
3993
|
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
|
3984
3994
|
if (slides[i] && !breakLoop) {
|
|
3985
|
-
slideSize += slides[i].swiperSlideSize;
|
|
3995
|
+
slideSize += Math.ceil(slides[i].swiperSlideSize);
|
|
3986
3996
|
spv += 1;
|
|
3987
3997
|
if (slideSize > swiperSize) breakLoop = true;
|
|
3988
3998
|
}
|
|
@@ -4119,7 +4129,7 @@ let Swiper$2 = class Swiper {
|
|
|
4119
4129
|
return false;
|
|
4120
4130
|
}
|
|
4121
4131
|
el.swiper = swiper;
|
|
4122
|
-
if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName ===
|
|
4132
|
+
if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
|
|
4123
4133
|
swiper.isElement = true;
|
|
4124
4134
|
}
|
|
4125
4135
|
const getWrapperSelector = () => {
|
|
@@ -4311,7 +4321,7 @@ Object.keys(prototypes).forEach(prototypeGroup => {
|
|
|
4311
4321
|
Swiper$2.use([Resize, Observer]);
|
|
4312
4322
|
|
|
4313
4323
|
/* underscore in name -> watch for changes */
|
|
4314
|
-
const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopAdditionalSlides', 'loopAddBlankSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideFullyVisibleClass', 'slideNextClass', 'slidePrevClass', 'slideBlankClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
|
|
4324
|
+
const paramsList = ['eventsPrefix', 'injectStyles', 'injectStylesUrls', 'modules', 'init', '_direction', 'oneWayMovement', 'swiperElementNodeName', 'touchEventsTarget', 'initialSlide', '_speed', 'cssMode', 'updateOnWindowResize', 'resizeObserver', 'nested', 'focusableElements', '_enabled', '_width', '_height', 'preventInteractionOnTransition', 'userAgent', 'url', '_edgeSwipeDetection', '_edgeSwipeThreshold', '_freeMode', '_autoHeight', 'setWrapperSize', 'virtualTranslate', '_effect', 'breakpoints', 'breakpointsBase', '_spaceBetween', '_slidesPerView', 'maxBackfaceHiddenSlides', '_grid', '_slidesPerGroup', '_slidesPerGroupSkip', '_slidesPerGroupAuto', '_centeredSlides', '_centeredSlidesBounds', '_slidesOffsetBefore', '_slidesOffsetAfter', 'normalizeSlideIndex', '_centerInsufficientSlides', '_watchOverflow', 'roundLengths', 'touchRatio', 'touchAngle', 'simulateTouch', '_shortSwipes', '_longSwipes', 'longSwipesRatio', 'longSwipesMs', '_followFinger', 'allowTouchMove', '_threshold', 'touchMoveStopPropagation', 'touchStartPreventDefault', 'touchStartForcePreventDefault', 'touchReleaseOnEdges', 'uniqueNavElements', '_resistance', '_resistanceRatio', '_watchSlidesProgress', '_grabCursor', 'preventClicks', 'preventClicksPropagation', '_slideToClickedSlide', '_loop', 'loopAdditionalSlides', 'loopAddBlankSlides', 'loopPreventsSliding', '_rewind', '_allowSlidePrev', '_allowSlideNext', '_swipeHandler', '_noSwiping', 'noSwipingClass', 'noSwipingSelector', 'passiveListeners', 'containerModifierClass', 'slideClass', 'slideActiveClass', 'slideVisibleClass', 'slideFullyVisibleClass', 'slideNextClass', 'slidePrevClass', 'slideBlankClass', 'wrapperClass', 'lazyPreloaderClass', 'lazyPreloadPrevNext', 'runCallbacksOnInit', 'observer', 'observeParents', 'observeSlideChildren',
|
|
4315
4325
|
// modules
|
|
4316
4326
|
'a11y', '_autoplay', '_controller', 'coverflowEffect', 'cubeEffect', 'fadeEffect', 'flipEffect', 'creativeEffect', 'cardsEffect', 'hashNavigation', 'history', 'keyboard', 'mousewheel', '_navigation', '_pagination', 'parallax', '_scrollbar', '_thumbs', 'virtual', 'zoom', 'control'];
|
|
4317
4327
|
|
|
@@ -4666,15 +4676,15 @@ const updateOnVirtualData = swiper => {
|
|
|
4666
4676
|
};
|
|
4667
4677
|
|
|
4668
4678
|
/**
|
|
4669
|
-
* Swiper React 11.0.
|
|
4679
|
+
* Swiper React 11.0.6
|
|
4670
4680
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
|
4671
4681
|
* https://swiperjs.com
|
|
4672
4682
|
*
|
|
4673
|
-
* Copyright 2014-
|
|
4683
|
+
* Copyright 2014-2024 Vladimir Kharlampidi
|
|
4674
4684
|
*
|
|
4675
4685
|
* Released under the MIT License
|
|
4676
4686
|
*
|
|
4677
|
-
* Released on:
|
|
4687
|
+
* Released on: February 5, 2024
|
|
4678
4688
|
*/
|
|
4679
4689
|
|
|
4680
4690
|
|
|
@@ -4896,7 +4906,7 @@ const Swiper$1 = /*#__PURE__*/React.forwardRef(function (_temp, externalElRef) {
|
|
|
4896
4906
|
scrollbarEl: scrollbarElRef.current,
|
|
4897
4907
|
swiper: swiperRef.current
|
|
4898
4908
|
}, swiperParams);
|
|
4899
|
-
if (onSwiper) onSwiper(swiperRef.current);
|
|
4909
|
+
if (onSwiper && !swiperRef.current.destroyed) onSwiper(swiperRef.current);
|
|
4900
4910
|
// eslint-disable-next-line
|
|
4901
4911
|
return () => {
|
|
4902
4912
|
if (swiperRef.current && !swiperRef.current.destroyed) {
|
package/dist/components/Text.js
CHANGED
|
@@ -27,9 +27,16 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
27
27
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
28
28
|
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
29
29
|
|
|
30
|
+
const textConfig = {
|
|
31
|
+
appearance: {},
|
|
32
|
+
setAppearance: newComponent => {
|
|
33
|
+
textConfig.appearance = newComponent;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
30
36
|
function Text(props) {
|
|
31
37
|
const {
|
|
32
38
|
after,
|
|
39
|
+
appearance,
|
|
33
40
|
before,
|
|
34
41
|
children,
|
|
35
42
|
className,
|
|
@@ -60,6 +67,10 @@ function Text(props) {
|
|
|
60
67
|
prefix: 'text-color_',
|
|
61
68
|
propsKey: 'textColor'
|
|
62
69
|
});
|
|
70
|
+
const textAlignClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
71
|
+
prefix: 'text-align_',
|
|
72
|
+
propsKey: 'textAlign'
|
|
73
|
+
});
|
|
63
74
|
const textColorActiveClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
64
75
|
prefix: 'text-color_active_',
|
|
65
76
|
propsKey: 'textColorActive'
|
|
@@ -89,7 +100,7 @@ function Text(props) {
|
|
|
89
100
|
propsKey: 'width'
|
|
90
101
|
});
|
|
91
102
|
return /*#__PURE__*/React__default.default.createElement(Tag, {
|
|
92
|
-
className: clsx__default.default(className, 'text', sizeClass, weightClass, textColorClass, textColorActiveClass, textColorHoverClass, textGradientClass, textStyleClass, textTruncateClass, textWrapClass, type && `text_type_${type}`, mode && `text_mode_${mode}`, widthClass, cursorClass, onClick && (cursor || 'cursor_type_pointer')),
|
|
103
|
+
className: clsx__default.default(className, 'text', sizeClass || textConfig.appearance[appearance] && `text_size_${textConfig.appearance[appearance].size}`.replace(/([A-Z])/g, '-$1').toLowerCase(), weightClass, textAlignClass, textColorClass || textConfig.appearance[appearance] && `text-color_${textConfig.appearance[appearance].textColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), textColorActiveClass, textColorHoverClass, textGradientClass, textStyleClass, textTruncateClass, textWrapClass, type && `text_type_${type}`, mode && `text_mode_${mode}`, widthClass, cursorClass, onClick && (cursor || 'cursor_type_pointer')),
|
|
93
104
|
"data-tour": dataTour,
|
|
94
105
|
htmlFor: htmlFor,
|
|
95
106
|
style: textStyles,
|
|
@@ -346,3 +357,4 @@ Text.__docgenInfo = {
|
|
|
346
357
|
};
|
|
347
358
|
|
|
348
359
|
exports.Text = Text;
|
|
360
|
+
exports.textConfig = textConfig;
|
|
@@ -23,10 +23,15 @@ const textareaConfig = {
|
|
|
23
23
|
state: {},
|
|
24
24
|
setState: newComponent => {
|
|
25
25
|
textareaConfig.state = newComponent;
|
|
26
|
+
},
|
|
27
|
+
appearance: {},
|
|
28
|
+
setAppearance: newComponent => {
|
|
29
|
+
textareaConfig.appearance = newComponent;
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
function Textarea(props) {
|
|
29
33
|
const {
|
|
34
|
+
appearance,
|
|
30
35
|
id,
|
|
31
36
|
className,
|
|
32
37
|
placeholder,
|
|
@@ -82,7 +87,7 @@ function Textarea(props) {
|
|
|
82
87
|
propsKey: 'width'
|
|
83
88
|
});
|
|
84
89
|
return /*#__PURE__*/React__default.default.createElement("textarea", {
|
|
85
|
-
className: clsx__default.default(className, 'textarea', (textSizeClass || textColorClass || weightClass) && 'text', caretClass, fillClass, borderColorClass || textareaConfig.state[state]?.borderColor && `border-color_${textareaConfig.state[state].borderColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), borderColorHoverClass, placeholderTextColorClass || textareaConfig.state[state]?.placeholderTextColor && `placeholder-text-color_${textareaConfig.state[state].placeholderTextColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), sizeClass, shapeClass, textSizeClass, textColorClass || textareaConfig.state[state]?.textColor && `text-color_${textareaConfig.state[state].textColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), weightClass, widthClass),
|
|
90
|
+
className: clsx__default.default(className, 'textarea', (textSizeClass || textColorClass || weightClass) && 'text', caretClass, fillClass, borderColorClass || textareaConfig.state[state]?.borderColor && `border-color_${textareaConfig.state[state].borderColor}`.replace(/([A-Z])/g, '-$1').toLowerCase() || textareaConfig.appearance[appearance]?.borderColor && `border-color_${textareaConfig.appearance[appearance].borderColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), borderColorHoverClass || textareaConfig.appearance[appearance]?.borderHover && `border-color_hover_${textareaConfig.appearance[appearance].borderHover}`.replace(/([A-Z])/g, '-$1').toLowerCase(), placeholderTextColorClass || textareaConfig.state[state]?.placeholderTextColor && `placeholder-text-color_${textareaConfig.state[state].placeholderTextColor}`.replace(/([A-Z])/g, '-$1').toLowerCase() || textareaConfig.appearance[appearance]?.placeholderTextColor && `placeholder-text-color_${textareaConfig.appearance[appearance].placeholderTextColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), sizeClass, shapeClass || textareaConfig.appearance[appearance]?.shape && `textarea_shape_${textareaConfig.appearance[appearance].shape}`.replace(/([A-Z])/g, '-$1').toLowerCase(), textSizeClass || textareaConfig.appearance[appearance]?.textSize && `text_size_${textareaConfig.appearance[appearance].textSize}`.replace(/([A-Z])/g, '-$1').toLowerCase(), textColorClass || textareaConfig.state[state]?.textColor && `text-color_${textareaConfig.state[state].textColor}`.replace(/([A-Z])/g, '-$1').toLowerCase() || textareaConfig.appearance[appearance]?.textColor && `text-color_${textareaConfig.appearance[appearance].textColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), weightClass, widthClass),
|
|
86
91
|
id: id,
|
|
87
92
|
disabled: disabled,
|
|
88
93
|
placeholder: placeholder,
|
package/dist/components/Title.js
CHANGED
|
@@ -29,6 +29,12 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
29
29
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
30
30
|
var clsx__default = /*#__PURE__*/_interopDefault(clsx);
|
|
31
31
|
|
|
32
|
+
const titleConfig = {
|
|
33
|
+
appearance: {},
|
|
34
|
+
setAppearance: newComponent => {
|
|
35
|
+
titleConfig.appearance = newComponent;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
32
38
|
function Title(props) {
|
|
33
39
|
const {
|
|
34
40
|
dataTour,
|
|
@@ -42,6 +48,7 @@ function Title(props) {
|
|
|
42
48
|
onClick
|
|
43
49
|
} = props;
|
|
44
50
|
const {
|
|
51
|
+
appearance,
|
|
45
52
|
mode,
|
|
46
53
|
size,
|
|
47
54
|
sizeMobile,
|
|
@@ -114,7 +121,7 @@ function Title(props) {
|
|
|
114
121
|
return size;
|
|
115
122
|
}, [isMobile, isTablet, isDesktop]);
|
|
116
123
|
return /*#__PURE__*/React__default.default.createElement(Tag, {
|
|
117
|
-
className: clsx__default.default(className, 'title', fillColorClass, size && `title_size_${size}`, mode && `title_mode_${mode}`, textColorClass, textColorActiveClass, textColorHoverClass, typeClass, textGradientClass, textStyleClass, weightClass, textWrap && `word-wrap_${textWrap}`),
|
|
124
|
+
className: clsx__default.default(className, 'title', fillColorClass, size && `title_size_${size}`, mode && `title_mode_${mode}`, textColorClass || titleConfig.appearance[appearance] && `text-color_${titleConfig.appearance[appearance].textColor}`.replace(/([A-Z])/g, '-$1').toLowerCase(), textColorActiveClass, textColorHoverClass, typeClass, textGradientClass, textStyleClass, weightClass, textWrap && `word-wrap_${textWrap}`),
|
|
118
125
|
"data-tour": dataTour,
|
|
119
126
|
onClick: onClick,
|
|
120
127
|
style: titleStyles
|
|
@@ -151,7 +158,7 @@ Title.propTypes = {
|
|
|
151
158
|
onClick: PropTypes__default.default.func
|
|
152
159
|
};
|
|
153
160
|
Title.defaultProps = {
|
|
154
|
-
size: '
|
|
161
|
+
size: 'h3'
|
|
155
162
|
};
|
|
156
163
|
Title.__docgenInfo = {
|
|
157
164
|
"description": "",
|
|
@@ -160,7 +167,7 @@ Title.__docgenInfo = {
|
|
|
160
167
|
"props": {
|
|
161
168
|
"size": {
|
|
162
169
|
"defaultValue": {
|
|
163
|
-
"value": "'
|
|
170
|
+
"value": "'h3'",
|
|
164
171
|
"computed": false
|
|
165
172
|
},
|
|
166
173
|
"description": "",
|
|
@@ -390,3 +397,4 @@ Title.__docgenInfo = {
|
|
|
390
397
|
};
|
|
391
398
|
|
|
392
399
|
exports.Title = Title;
|
|
400
|
+
exports.titleConfig = titleConfig;
|
|
@@ -41,11 +41,12 @@ const tooltipConfig = {
|
|
|
41
41
|
tooltipConfig.appearance = newComponent;
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
function Tooltip(props) {
|
|
44
|
+
const Tooltip = /*#__PURE__*/React__default.default.forwardRef(function Tooltip(props, ref) {
|
|
45
45
|
const {
|
|
46
46
|
before,
|
|
47
47
|
after,
|
|
48
48
|
appearance,
|
|
49
|
+
children,
|
|
49
50
|
className,
|
|
50
51
|
text,
|
|
51
52
|
title,
|
|
@@ -57,6 +58,37 @@ function Tooltip(props) {
|
|
|
57
58
|
textColor,
|
|
58
59
|
textSize
|
|
59
60
|
} = props;
|
|
61
|
+
const tooltipTimeoutHideRef = React.useRef(null);
|
|
62
|
+
const isTooltipCloseAnimationInProgressRef = React.useRef(false);
|
|
63
|
+
const [isTooltipVisible, setIsTooltipVisible] = React.useState(null);
|
|
64
|
+
const openTooltip = React.useCallback(() => {
|
|
65
|
+
if (!isTooltipCloseAnimationInProgressRef.current) {
|
|
66
|
+
clearTimeout(tooltipTimeoutHideRef.current);
|
|
67
|
+
setIsTooltipVisible(true);
|
|
68
|
+
}
|
|
69
|
+
}, []);
|
|
70
|
+
const closeTooltip = React.useCallback(() => {
|
|
71
|
+
// Make a small delay to be able to move cursor on the tooltip without
|
|
72
|
+
// triggering a close, because the label and the tooltip have space between
|
|
73
|
+
tooltipTimeoutHideRef.current = setTimeout(() => {
|
|
74
|
+
setIsTooltipVisible(prevState => {
|
|
75
|
+
const newState = false;
|
|
76
|
+
if (prevState === true) {
|
|
77
|
+
isTooltipCloseAnimationInProgressRef.current = true;
|
|
78
|
+
}
|
|
79
|
+
return newState;
|
|
80
|
+
});
|
|
81
|
+
}, 250);
|
|
82
|
+
}, []);
|
|
83
|
+
const onAnimationEnd = React.useCallback(() => {
|
|
84
|
+
isTooltipCloseAnimationInProgressRef.current = false;
|
|
85
|
+
}, []);
|
|
86
|
+
React.useImperativeHandle(ref, () => ({
|
|
87
|
+
openTooltip,
|
|
88
|
+
closeTooltip
|
|
89
|
+
}), [openTooltip, closeTooltip]);
|
|
90
|
+
|
|
91
|
+
/* STYLES */
|
|
60
92
|
const alignDirectionClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
61
93
|
prefix: 'align_',
|
|
62
94
|
propsKey: 'alignDirection'
|
|
@@ -89,31 +121,50 @@ function Tooltip(props) {
|
|
|
89
121
|
prefix: 'border_type_',
|
|
90
122
|
propsKey: 'borderType'
|
|
91
123
|
});
|
|
124
|
+
const elevationClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
125
|
+
prefix: 'elevation_',
|
|
126
|
+
propsKey: 'elevation'
|
|
127
|
+
});
|
|
128
|
+
const widthClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
129
|
+
prefix: 'width_',
|
|
130
|
+
propsKey: 'width'
|
|
131
|
+
});
|
|
132
|
+
const alignmentClass = useDeviceTargetClass.useDeviceTargetClass(props, {
|
|
133
|
+
prefix: 'alignment_',
|
|
134
|
+
propsKey: 'alignment'
|
|
135
|
+
});
|
|
92
136
|
const {
|
|
93
137
|
styles: tooltipStyles
|
|
94
138
|
} = useStyles.useStyles(props);
|
|
139
|
+
const tooltipAppearanceItem = tooltipConfig.appearance[appearance] || {};
|
|
95
140
|
return /*#__PURE__*/React__default.default.createElement("div", {
|
|
96
|
-
className: clsx__default.default(className, 'tooltip', fillClass ||
|
|
97
|
-
style: tooltipStyles
|
|
141
|
+
className: clsx__default.default(className, 'tooltip', isTooltipVisible === true && 'tooltip_state_open', isTooltipVisible === false && 'tooltip_state_close', fillClass || tooltipAppearanceItem.fillClass && `fill_${tooltipAppearanceItem.fillClass}`.replace(/([A-Z])/g, '-$1').toLowerCase(), shapeClass, alignDirectionClass, alignClass, alignmentClass, borderWidthClass, borderColorClass, borderTypeClass, elevationClass, sizeClass, arrowPosition && `tooltip_type_arrow tooltip_arrow_position_${arrowPosition}`, type && `tooltip_type_${type}`, set && `tooltip_set_${set}`, widthClass),
|
|
142
|
+
style: tooltipStyles,
|
|
143
|
+
onAnimationEnd: onAnimationEnd
|
|
98
144
|
}, before, /*#__PURE__*/React__default.default.createElement("div", {
|
|
99
145
|
className: "tooltip__inner"
|
|
100
146
|
}, title && /*#__PURE__*/React__default.default.createElement(index.Title, {
|
|
101
147
|
className: "tooltip__title",
|
|
102
148
|
size: titleSize,
|
|
103
|
-
textColor: titleTextColor ||
|
|
149
|
+
textColor: titleTextColor || tooltipAppearanceItem.titleTextColor
|
|
104
150
|
}, title), text && /*#__PURE__*/React__default.default.createElement(index$1.Text, {
|
|
105
151
|
className: "tooltip__text",
|
|
106
152
|
size: textSize,
|
|
107
|
-
textColor: textColor ||
|
|
108
|
-
}, text)), after);
|
|
109
|
-
}
|
|
153
|
+
textColor: textColor || tooltipAppearanceItem.textColor
|
|
154
|
+
}, text), children), after);
|
|
155
|
+
});
|
|
110
156
|
Tooltip.propTypes = {
|
|
157
|
+
after: PropTypes__default.default.string,
|
|
158
|
+
appearance: PropTypes__default.default.string,
|
|
159
|
+
arrowPosition: PropTypes__default.default.string,
|
|
160
|
+
before: PropTypes__default.default.string,
|
|
111
161
|
children: PropTypes__default.default.any,
|
|
112
162
|
className: PropTypes__default.default.string,
|
|
113
163
|
fill: PropTypes__default.default.oneOf(fill.default),
|
|
114
164
|
fillDesktop: PropTypes__default.default.oneOf(fill.default),
|
|
115
165
|
fillMobile: PropTypes__default.default.oneOf(fill.default),
|
|
116
166
|
fillTablet: PropTypes__default.default.oneOf(fill.default),
|
|
167
|
+
set: PropTypes__default.default.string,
|
|
117
168
|
shape: PropTypes__default.default.oneOf(shape.default),
|
|
118
169
|
shapeDesktop: PropTypes__default.default.oneOf(shape.default),
|
|
119
170
|
shapeMobile: PropTypes__default.default.oneOf(shape.default),
|
|
@@ -128,20 +179,42 @@ Tooltip.propTypes = {
|
|
|
128
179
|
textSizeDesktop: PropTypes__default.default.oneOf(size.default),
|
|
129
180
|
textSizeMobile: PropTypes__default.default.oneOf(size.default),
|
|
130
181
|
textSizeTablet: PropTypes__default.default.oneOf(size.default),
|
|
182
|
+
title: PropTypes__default.default.string,
|
|
183
|
+
titleSize: PropTypes__default.default.string,
|
|
184
|
+
titleTextColor: PropTypes__default.default.string,
|
|
131
185
|
type: PropTypes__default.default.string
|
|
132
186
|
};
|
|
133
|
-
Tooltip.defaultProps = {
|
|
134
|
-
label: 'Label'
|
|
135
|
-
};
|
|
187
|
+
Tooltip.defaultProps = {};
|
|
136
188
|
Tooltip.__docgenInfo = {
|
|
137
189
|
"description": "",
|
|
138
190
|
"methods": [],
|
|
139
191
|
"displayName": "Tooltip",
|
|
140
192
|
"props": {
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
"
|
|
193
|
+
"after": {
|
|
194
|
+
"description": "",
|
|
195
|
+
"type": {
|
|
196
|
+
"name": "string"
|
|
197
|
+
},
|
|
198
|
+
"required": false
|
|
199
|
+
},
|
|
200
|
+
"appearance": {
|
|
201
|
+
"description": "",
|
|
202
|
+
"type": {
|
|
203
|
+
"name": "string"
|
|
204
|
+
},
|
|
205
|
+
"required": false
|
|
206
|
+
},
|
|
207
|
+
"arrowPosition": {
|
|
208
|
+
"description": "",
|
|
209
|
+
"type": {
|
|
210
|
+
"name": "string"
|
|
211
|
+
},
|
|
212
|
+
"required": false
|
|
213
|
+
},
|
|
214
|
+
"before": {
|
|
215
|
+
"description": "",
|
|
216
|
+
"type": {
|
|
217
|
+
"name": "string"
|
|
145
218
|
},
|
|
146
219
|
"required": false
|
|
147
220
|
},
|
|
@@ -195,6 +268,13 @@ Tooltip.__docgenInfo = {
|
|
|
195
268
|
},
|
|
196
269
|
"required": false
|
|
197
270
|
},
|
|
271
|
+
"set": {
|
|
272
|
+
"description": "",
|
|
273
|
+
"type": {
|
|
274
|
+
"name": "string"
|
|
275
|
+
},
|
|
276
|
+
"required": false
|
|
277
|
+
},
|
|
198
278
|
"shape": {
|
|
199
279
|
"description": "",
|
|
200
280
|
"type": {
|
|
@@ -319,6 +399,27 @@ Tooltip.__docgenInfo = {
|
|
|
319
399
|
},
|
|
320
400
|
"required": false
|
|
321
401
|
},
|
|
402
|
+
"title": {
|
|
403
|
+
"description": "",
|
|
404
|
+
"type": {
|
|
405
|
+
"name": "string"
|
|
406
|
+
},
|
|
407
|
+
"required": false
|
|
408
|
+
},
|
|
409
|
+
"titleSize": {
|
|
410
|
+
"description": "",
|
|
411
|
+
"type": {
|
|
412
|
+
"name": "string"
|
|
413
|
+
},
|
|
414
|
+
"required": false
|
|
415
|
+
},
|
|
416
|
+
"titleTextColor": {
|
|
417
|
+
"description": "",
|
|
418
|
+
"type": {
|
|
419
|
+
"name": "string"
|
|
420
|
+
},
|
|
421
|
+
"required": false
|
|
422
|
+
},
|
|
322
423
|
"type": {
|
|
323
424
|
"description": "",
|
|
324
425
|
"type": {
|
|
@@ -13,31 +13,31 @@
|
|
|
13
13
|
.chips {
|
|
14
14
|
&&_size {
|
|
15
15
|
&_xxs {
|
|
16
|
-
padding: 2px 6px;
|
|
16
|
+
padding: var(--chips-size-xxs-padding, 2px 6px);
|
|
17
17
|
@mixin text-s;
|
|
18
18
|
}
|
|
19
19
|
&_xs {
|
|
20
|
-
padding: 2px 6px;
|
|
20
|
+
padding: var(--chips-size-xs-padding, 2px 6px);
|
|
21
21
|
@mixin text-s;
|
|
22
22
|
}
|
|
23
23
|
&_s {
|
|
24
|
-
padding: 2px 6px;
|
|
24
|
+
padding: var(--chips-size-s-padding, 2px 6px);
|
|
25
25
|
@mixin text-s;
|
|
26
26
|
}
|
|
27
27
|
&_m {
|
|
28
|
-
padding: 2px 6px;
|
|
28
|
+
padding: var(--chips-size-m-padding, 2px 6px);
|
|
29
29
|
@mixin text-m;
|
|
30
30
|
}
|
|
31
31
|
&_l {
|
|
32
|
-
padding: 2px 6px;
|
|
32
|
+
padding: var(--chips-size-l-padding, 2px 6px);
|
|
33
33
|
@mixin text-l;
|
|
34
34
|
}
|
|
35
35
|
&_xl {
|
|
36
|
-
padding: 2px 6px;
|
|
36
|
+
padding: var(--chips-size-xl-padding, 2px 6px);
|
|
37
37
|
@mixin text-l;
|
|
38
38
|
}
|
|
39
39
|
&_xxl {
|
|
40
|
-
padding: 6px 12px;
|
|
40
|
+
padding: var(--chips-size-xxl-padding, 6px 12px);
|
|
41
41
|
@mixin text-xxl;
|
|
42
42
|
}
|
|
43
43
|
}
|