@itcase/ui 1.8.10 → 1.8.12
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/{Button_cjs_BKQLT7oE.js → Button_cjs_Bb9svkwu.js} +1 -0
- package/dist/{Button_es_H15aBFcg.js → Button_es_Cd4sw9Q5.js} +1 -0
- package/dist/cjs/components/Button.js +1 -1
- package/dist/cjs/components/CookiesWarning.js +1 -1
- package/dist/cjs/components/DatePicker.js +3 -4
- package/dist/cjs/components/Response.js +1 -1
- package/dist/cjs/components/Segmented.js +10 -0
- package/dist/cjs/components/Tab.js +1 -1
- package/dist/cjs/context/UIContext.js +5 -7
- package/dist/cjs/hooks/useStyles/useStyles.js +0 -3
- package/dist/components/Button.js +1 -1
- package/dist/components/CookiesWarning.js +1 -1
- package/dist/components/DatePicker.js +3 -4
- package/dist/components/Response.js +1 -1
- package/dist/components/Segmented.js +10 -0
- package/dist/components/Tab.js +1 -1
- package/dist/context/UIContext.js +5 -7
- package/dist/css/components/DatePicker/DatePicker.css +4 -0
- package/dist/css/components/Notification/Notification.css +4 -4
- package/dist/css/components/Notification/css/__item/notification__item_status.css +4 -4
- package/dist/css/components/Swiper/Swiper.css +2 -2
- package/dist/css/styles/height/height.css +3 -1
- package/dist/hooks/useStyles/useStyles.js +0 -3
- package/dist/stories/useDevicePropsGenerator.mdx +230 -0
- package/dist/stories/useMediaQueries.mdx +55 -0
- package/dist/stories/useStyles.mdx +102 -0
- package/dist/types/components/DatePicker/DatePicker.appearance.d.ts +8 -8
- package/dist/types/components/DatePicker/appearance/datePickerSize.d.ts +6 -6
- package/dist/types/components/DatePicker/appearance/datePickerSurface.d.ts +2 -2
- package/dist/types/components/Pagination/appearance/paginationSurface.d.ts +1 -1
- package/dist/types/components/Search/appearance/searchSize.d.ts +4 -4
- package/dist/types/components/Segmented/appearance/segmentedSurface.d.ts +10 -0
- package/dist/types/context/UIContext.d.ts +3 -0
- package/package.json +9 -9
|
@@ -266,6 +266,7 @@ var Button = React.forwardRef(function Button(props, ref) {
|
|
|
266
266
|
var shapeStrengthClass = propsGenerator.getClassName('shapeStrength', {
|
|
267
267
|
replace: [/\./, '-'],
|
|
268
268
|
});
|
|
269
|
+
// const a = propsGenerator.
|
|
269
270
|
// @ts-expect-error
|
|
270
271
|
var _d = useStyles.useStyles(props), labelStyles = _d.label, buttonStyles = _d.styles;
|
|
271
272
|
var buttonTypeClass = after ||
|
|
@@ -264,6 +264,7 @@ var Button = React.forwardRef(function Button(props, ref) {
|
|
|
264
264
|
var shapeStrengthClass = propsGenerator.getClassName('shapeStrength', {
|
|
265
265
|
replace: [/\./, '-'],
|
|
266
266
|
});
|
|
267
|
+
// const a = propsGenerator.
|
|
267
268
|
// @ts-expect-error
|
|
268
269
|
var _d = useStyles(props), labelStyles = _d.label, buttonStyles = _d.styles;
|
|
269
270
|
var buttonTypeClass = after ||
|
|
@@ -5,7 +5,7 @@ var React = require('react');
|
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var Cookies = require('js-cookie');
|
|
7
7
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
8
|
-
var Button = require('../../
|
|
8
|
+
var Button = require('../../Button_cjs_Bb9svkwu.js');
|
|
9
9
|
var Group = require('../../Group_cjs_DFmNT5Mq.js');
|
|
10
10
|
var Text = require('../../Text_cjs_D4xG0cKD.js');
|
|
11
11
|
require('../../tslib.es6_cjs_CCZ3TN_7.js');
|
|
@@ -8,7 +8,7 @@ var locale = require('date-fns/locale');
|
|
|
8
8
|
var DatePicker = require('react-datepicker');
|
|
9
9
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
10
10
|
var useStyles = require('../hooks/useStyles/useStyles.js');
|
|
11
|
-
var Button = require('../../
|
|
11
|
+
var Button = require('../../Button_cjs_Bb9svkwu.js');
|
|
12
12
|
var Icon = require('../../Icon_cjs_BaWMPaAR.js');
|
|
13
13
|
var Input = require('../../Input_cjs_BAVggtkk.js');
|
|
14
14
|
var Label = require('../../Label_cjs_CbcENlSZ.js');
|
|
@@ -115,9 +115,9 @@ var datePickerConfig = {
|
|
|
115
115
|
};
|
|
116
116
|
function DatePickerInput(props) {
|
|
117
117
|
var _a;
|
|
118
|
-
var className = props.className,
|
|
118
|
+
var className = props.className, _b = props.datePickerProps, datePickerProps = _b === void 0 ? {} : _b, endValue = props.endValue, _c = props.inputProps, inputProps = _c === void 0 ? {} : _c, value = props.value, onChange = props.onChange;
|
|
119
119
|
var datepickerRef = React.useRef(null);
|
|
120
|
-
var
|
|
120
|
+
var customTimeInput = datePickerProps.customTimeInput, disablePastDays = datePickerProps.disablePastDays, monthsShown = datePickerProps.monthsShown, selectsRange = datePickerProps.selectsRange;
|
|
121
121
|
var appearanceConfig = (_a = datePickerProps.appearance) === null || _a === void 0 ? void 0 : _a.split(' ').reduce(function (resultConfig, appearanceKey) {
|
|
122
122
|
var _a;
|
|
123
123
|
return (tslib_es6.__assign(tslib_es6.__assign({}, resultConfig), (_a = datePickerConfig.appearance) === null || _a === void 0 ? void 0 : _a[appearanceKey]));
|
|
@@ -181,7 +181,6 @@ function DatePickerInput(props) {
|
|
|
181
181
|
setEndDate(end);
|
|
182
182
|
}, [end]);
|
|
183
183
|
var datePickerStyles = useStyles.useStyles(props).styles;
|
|
184
|
-
console.log(inputProps);
|
|
185
184
|
return (jsxRuntime.jsx("div", { className: clsx(className, 'datepicker', monthsShown && 'datepicker_multiple-months', customTimeInput && 'datepicker_button', widthClass && "datepicker_width_".concat(widthClass)), style: datePickerStyles, children: jsxRuntime.jsx(DatePicker, tslib_es6.__assign({ minDate: disablePastDays ? new Date() : undefined, customInput: jsxRuntime.jsx(DatePickerCustomInput, { datepickerRef: datepickerRef, inputProps: inputProps, isClearable: isClearable }), endDate: selectsRange ? endDate : undefined, locale: locale.ru, popperClassName: popper && "react-datepicker-popper-".concat(popper), ref: datepickerRef, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, onChange: selectsRange ? handleChange : onChange }, datePickerProps, {
|
|
186
185
|
// Important for use custom clear button
|
|
187
186
|
isClearable: false })) }));
|
|
@@ -7,7 +7,7 @@ var clsx = require('clsx');
|
|
|
7
7
|
var SVG = require('react-inlinesvg');
|
|
8
8
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
9
9
|
var useStyles = require('../hooks/useStyles/useStyles.js');
|
|
10
|
-
var Button = require('../../
|
|
10
|
+
var Button = require('../../Button_cjs_Bb9svkwu.js');
|
|
11
11
|
var Group = require('../../Group_cjs_DFmNT5Mq.js');
|
|
12
12
|
var Text = require('../../Text_cjs_D4xG0cKD.js');
|
|
13
13
|
require('lodash/camelCase');
|
|
@@ -46,6 +46,16 @@ var segmentedAppearanceSurface = {
|
|
|
46
46
|
indicatorFill: 'accentPrimary',
|
|
47
47
|
shape: 'rounded',
|
|
48
48
|
},
|
|
49
|
+
surfaceSecondary: {
|
|
50
|
+
fill: 'surfaceSecondary',
|
|
51
|
+
fillActive: 'accentPrimary',
|
|
52
|
+
fillActiveHover: 'accentPrimary',
|
|
53
|
+
fillHover: 'surfaceSecondary',
|
|
54
|
+
labelTextActiveColor: 'accentTextPrimary',
|
|
55
|
+
labelTextColor: 'surfaceTextPrimary',
|
|
56
|
+
indicatorFill: 'accentPrimary',
|
|
57
|
+
shape: 'rounded',
|
|
58
|
+
},
|
|
49
59
|
};
|
|
50
60
|
|
|
51
61
|
var segmentedAppearance = tslib_es6.__assign(tslib_es6.__assign({}, segmentedAppearanceSurface), segmentedAppearanceSize);
|
|
@@ -124,7 +124,7 @@ function Tab(props) {
|
|
|
124
124
|
var tab = useStyles.useStyles(props).styles;
|
|
125
125
|
return (jsxRuntime.jsx("div", { className: clsx('tab', isActive && 'tab_state_active', isDisabled && 'tab_state_disabled', isHover && 'tab_state_hover', !isDisabled
|
|
126
126
|
? fillClass && "fill_".concat(fillClass)
|
|
127
|
-
: fillDisabledClass && "fill_disabled_".concat(fillDisabledClass), !isDisabled ? fillHoverClass && "fill_hover_".concat(fillHoverClass) : null, className, sizeClass && "tab_size_".concat(sizeClass), fillActiveClass && "fill_active_".concat(fillActiveClass), fillActiveHoverClass && "fill_active_hover_".concat(fillActiveHoverClass), shapeClass && "tab_shape_".concat(shapeClass), typeClass && "tab_type_".concat(typeClass), widthClass && "width_".concat(widthClass), reset && 'tab-reset', set && "tab_set_".concat(set), justifyContentClass && "tab_justify-content_".concat(justifyContentClass), onClick && 'cursor_type_pointer'), "data-tour": dataTour, style: tab, onClick: onClick, onMouseEnter: onMouseEnter, children: jsxRuntime.jsx(Link.Link, { className: clsx('tab__link', alignDirectionClass && "align_".concat(alignDirectionClass), alignClass && "align_".concat(alignClass)), fill: linkFill, href: link || href, rel: rel, target: target, children: jsxRuntime.jsxs(React.Fragment, { children: [before, children || (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("div", { className: "tab__wrapper", children: [label && (jsxRuntime.jsx(Text.Text, { className: "tab__label", size: labelTextSize, textAlign: labelTextAlign, textColor: isDisabled ? labelColorDisabled : labelColor, textColorActive: isActive && labelColorActive, textColorGradient: labelTextGradient, textColorHover: labelTextColorHover, textStyle: labelTextStyle, textWeight: labelTextWeight, textWrap: labelTextWrap, children: label })), badgeValue && (jsxRuntime.jsx(Badge.Badge, { appearance: badgeAppearance, size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue }))] }), jsxRuntime.jsx(Divider.Divider, { width: "fill", direction: dividerDirection, size: dividerSize, fill: isDisabled ? dividerFillDisabled : dividerFill, fillActive: isActive && dividerFillActive, fillActiveHover: dividerFillActiveHover, fillHover: isHover && dividerFillHover })] })), after] }) }) }));
|
|
127
|
+
: fillDisabledClass && "fill_disabled_".concat(fillDisabledClass), !isDisabled ? fillHoverClass && "fill_hover_".concat(fillHoverClass) : null, className, sizeClass && "tab_size_".concat(sizeClass), fillActiveClass && "fill_active_".concat(fillActiveClass), fillActiveHoverClass && "fill_active_hover_".concat(fillActiveHoverClass), shapeClass && "tab_shape_".concat(shapeClass), typeClass && "tab_type_".concat(typeClass), widthClass && "width_".concat(widthClass), reset && 'tab-reset', set && "tab_set_".concat(set), justifyContentClass && "tab_justify-content_".concat(justifyContentClass), onClick && 'cursor_type_pointer'), "data-tour": dataTour, style: tab, onClick: onClick, onMouseEnter: onMouseEnter, children: jsxRuntime.jsx(Link.Link, { className: clsx('tab__link', alignDirectionClass && "align_".concat(alignDirectionClass), alignClass && "align_".concat(alignClass)), fill: linkFill, href: link || href, rel: rel, target: target, children: jsxRuntime.jsxs(React.Fragment, { children: [before, children || (jsxRuntime.jsxs(React.Fragment, { children: [jsxRuntime.jsxs("div", { className: "tab__wrapper", children: [label && (jsxRuntime.jsx(Text.Text, { className: "tab__label", size: labelTextSize, textAlign: labelTextAlign, textColor: isDisabled ? labelColorDisabled : labelColor, textColorActive: isActive && labelColorActive, textColorGradient: labelTextGradient, textColorHover: labelTextColorHover, textStyle: labelTextStyle, textWeight: labelTextWeight, textWrap: labelTextWrap, children: label })), badgeValue && (jsxRuntime.jsx(Badge.Badge, { appearance: badgeAppearance, size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue }))] }), jsxRuntime.jsx(Divider.Divider, { width: "fill", direction: dividerDirection, size: dividerSize, zIndex: '1', fill: isDisabled ? dividerFillDisabled : dividerFill, fillActive: isActive && dividerFillActive, fillActiveHover: dividerFillActiveHover, fillHover: isHover && dividerFillHover })] })), after] }) }) }));
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
function TabGroup(props) {
|
|
@@ -13,6 +13,7 @@ var UserDeviceContext = React.createContext({
|
|
|
13
13
|
isMobile: false,
|
|
14
14
|
isTablet: false,
|
|
15
15
|
isDesktop: false,
|
|
16
|
+
deviceCurrentMainType: '',
|
|
16
17
|
});
|
|
17
18
|
var UIProvider = React.memo(function UIProvider(props) {
|
|
18
19
|
var _a = props.userDeviceState, userDeviceState = _a === void 0 ? {} : _a, children = props.children;
|
|
@@ -24,14 +25,11 @@ var UIProvider = React.memo(function UIProvider(props) {
|
|
|
24
25
|
* We will need to look at how to change this behavior.
|
|
25
26
|
*/
|
|
26
27
|
var allDevicesTypes = useMediaQueries.useMediaQueries(userDeviceState);
|
|
27
|
-
var isMobile = allDevicesTypes.isMobile, isTablet = allDevicesTypes.isTablet, isDesktop = allDevicesTypes.isDesktop, fullNamedDeviceTypes = tslib_es6.__rest(allDevicesTypes
|
|
28
|
-
|
|
29
|
-
, ["isMobile", "isTablet", "isDesktop"]);
|
|
30
|
-
// prettier-ignore
|
|
31
|
-
var deviceCurrentMainType = ((isMobile && 'mobile') ||
|
|
28
|
+
var isMobile = allDevicesTypes.isMobile, isTablet = allDevicesTypes.isTablet, isDesktop = allDevicesTypes.isDesktop, fullNamedDeviceTypes = tslib_es6.__rest(allDevicesTypes, ["isMobile", "isTablet", "isDesktop"]);
|
|
29
|
+
var deviceCurrentMainType = (isMobile && 'mobile') ||
|
|
32
30
|
(isTablet && 'tablet') ||
|
|
33
|
-
(isDesktop && 'desktop')
|
|
34
|
-
|
|
31
|
+
(isDesktop && 'desktop') ||
|
|
32
|
+
'';
|
|
35
33
|
var _b = React.useMemo(function () {
|
|
36
34
|
var deviceTypesList = Object.keys(allDevicesTypes).map(function (key) {
|
|
37
35
|
return camelCase(key.replace('is', ''));
|
|
@@ -44,9 +44,6 @@ function useStyles(props) {
|
|
|
44
44
|
const resultStylesGroups = {};
|
|
45
45
|
for (const [propKey, propValue] of Object.entries(propsStyleAttributes)) {
|
|
46
46
|
let value = null;
|
|
47
|
-
console.log('propKey');
|
|
48
|
-
console.log(propKey);
|
|
49
|
-
console.log('propKey=======');
|
|
50
47
|
const styleAttributeKey = getTargetStyleAttributeKey(propKey, propValue);
|
|
51
48
|
const isStyleForCurrentDevice = propKey.toLowerCase().endsWith(deviceCurrentType.toLowerCase());
|
|
52
49
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as Button, a as buttonAppearance, b as buttonConfig } from '../
|
|
1
|
+
export { B as Button, a as buttonAppearance, b as buttonConfig } from '../Button_es_Cd4sw9Q5.js';
|
|
2
2
|
import '../tslib.es6_es_Bwu1Cn-t.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
@@ -3,7 +3,7 @@ import { useRef, useMemo, useCallback, useEffect } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import Cookies from 'js-cookie';
|
|
5
5
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
6
|
-
import { B as Button } from '../
|
|
6
|
+
import { B as Button } from '../Button_es_Cd4sw9Q5.js';
|
|
7
7
|
import { G as Group } from '../Group_es_CRGwi5XI.js';
|
|
8
8
|
import { T as Text } from '../Text_es_FJGduy7Z.js';
|
|
9
9
|
import '../tslib.es6_es_Bwu1Cn-t.js';
|
|
@@ -6,7 +6,7 @@ import { ru } from 'date-fns/locale';
|
|
|
6
6
|
import DatePicker from 'react-datepicker';
|
|
7
7
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
8
8
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
9
|
-
import { B as Button } from '../
|
|
9
|
+
import { B as Button } from '../Button_es_Cd4sw9Q5.js';
|
|
10
10
|
import { I as Icon } from '../Icon_es_B0sySEUu.js';
|
|
11
11
|
import { I as Input } from '../Input_es_CNduH28G.js';
|
|
12
12
|
import { L as Label } from '../Label_es_BCpDqP3q.js';
|
|
@@ -113,9 +113,9 @@ var datePickerConfig = {
|
|
|
113
113
|
};
|
|
114
114
|
function DatePickerInput(props) {
|
|
115
115
|
var _a;
|
|
116
|
-
var className = props.className,
|
|
116
|
+
var className = props.className, _b = props.datePickerProps, datePickerProps = _b === void 0 ? {} : _b, endValue = props.endValue, _c = props.inputProps, inputProps = _c === void 0 ? {} : _c, value = props.value, onChange = props.onChange;
|
|
117
117
|
var datepickerRef = useRef(null);
|
|
118
|
-
var
|
|
118
|
+
var customTimeInput = datePickerProps.customTimeInput, disablePastDays = datePickerProps.disablePastDays, monthsShown = datePickerProps.monthsShown, selectsRange = datePickerProps.selectsRange;
|
|
119
119
|
var appearanceConfig = (_a = datePickerProps.appearance) === null || _a === void 0 ? void 0 : _a.split(' ').reduce(function (resultConfig, appearanceKey) {
|
|
120
120
|
var _a;
|
|
121
121
|
return (__assign(__assign({}, resultConfig), (_a = datePickerConfig.appearance) === null || _a === void 0 ? void 0 : _a[appearanceKey]));
|
|
@@ -179,7 +179,6 @@ function DatePickerInput(props) {
|
|
|
179
179
|
setEndDate(end);
|
|
180
180
|
}, [end]);
|
|
181
181
|
var datePickerStyles = useStyles(props).styles;
|
|
182
|
-
console.log(inputProps);
|
|
183
182
|
return (jsx("div", { className: clsx(className, 'datepicker', monthsShown && 'datepicker_multiple-months', customTimeInput && 'datepicker_button', widthClass && "datepicker_width_".concat(widthClass)), style: datePickerStyles, children: jsx(DatePicker, __assign({ minDate: disablePastDays ? new Date() : undefined, customInput: jsx(DatePickerCustomInput, { datepickerRef: datepickerRef, inputProps: inputProps, isClearable: isClearable }), endDate: selectsRange ? endDate : undefined, locale: ru, popperClassName: popper && "react-datepicker-popper-".concat(popper), ref: datepickerRef, renderCustomHeader: renderCustomHeader, renderDayContents: renderDayContents, selected: startDate, startDate: startDate, onChange: selectsRange ? handleChange : onChange }, datePickerProps, {
|
|
184
183
|
// Important for use custom clear button
|
|
185
184
|
isClearable: false })) }));
|
|
@@ -5,7 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import SVG from 'react-inlinesvg';
|
|
6
6
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
7
7
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
8
|
-
import { B as Button } from '../
|
|
8
|
+
import { B as Button } from '../Button_es_Cd4sw9Q5.js';
|
|
9
9
|
import { G as Group } from '../Group_es_CRGwi5XI.js';
|
|
10
10
|
import { T as Text } from '../Text_es_FJGduy7Z.js';
|
|
11
11
|
import 'lodash/camelCase';
|
|
@@ -44,6 +44,16 @@ var segmentedAppearanceSurface = {
|
|
|
44
44
|
indicatorFill: 'accentPrimary',
|
|
45
45
|
shape: 'rounded',
|
|
46
46
|
},
|
|
47
|
+
surfaceSecondary: {
|
|
48
|
+
fill: 'surfaceSecondary',
|
|
49
|
+
fillActive: 'accentPrimary',
|
|
50
|
+
fillActiveHover: 'accentPrimary',
|
|
51
|
+
fillHover: 'surfaceSecondary',
|
|
52
|
+
labelTextActiveColor: 'accentTextPrimary',
|
|
53
|
+
labelTextColor: 'surfaceTextPrimary',
|
|
54
|
+
indicatorFill: 'accentPrimary',
|
|
55
|
+
shape: 'rounded',
|
|
56
|
+
},
|
|
47
57
|
};
|
|
48
58
|
|
|
49
59
|
var segmentedAppearance = __assign(__assign({}, segmentedAppearanceSurface), segmentedAppearanceSize);
|
package/dist/components/Tab.js
CHANGED
|
@@ -122,7 +122,7 @@ function Tab(props) {
|
|
|
122
122
|
var tab = useStyles(props).styles;
|
|
123
123
|
return (jsx("div", { className: clsx('tab', isActive && 'tab_state_active', isDisabled && 'tab_state_disabled', isHover && 'tab_state_hover', !isDisabled
|
|
124
124
|
? fillClass && "fill_".concat(fillClass)
|
|
125
|
-
: fillDisabledClass && "fill_disabled_".concat(fillDisabledClass), !isDisabled ? fillHoverClass && "fill_hover_".concat(fillHoverClass) : null, className, sizeClass && "tab_size_".concat(sizeClass), fillActiveClass && "fill_active_".concat(fillActiveClass), fillActiveHoverClass && "fill_active_hover_".concat(fillActiveHoverClass), shapeClass && "tab_shape_".concat(shapeClass), typeClass && "tab_type_".concat(typeClass), widthClass && "width_".concat(widthClass), reset && 'tab-reset', set && "tab_set_".concat(set), justifyContentClass && "tab_justify-content_".concat(justifyContentClass), onClick && 'cursor_type_pointer'), "data-tour": dataTour, style: tab, onClick: onClick, onMouseEnter: onMouseEnter, children: jsx(Link, { className: clsx('tab__link', alignDirectionClass && "align_".concat(alignDirectionClass), alignClass && "align_".concat(alignClass)), fill: linkFill, href: link || href, rel: rel, target: target, children: jsxs(React.Fragment, { children: [before, children || (jsxs(React.Fragment, { children: [jsxs("div", { className: "tab__wrapper", children: [label && (jsx(Text, { className: "tab__label", size: labelTextSize, textAlign: labelTextAlign, textColor: isDisabled ? labelColorDisabled : labelColor, textColorActive: isActive && labelColorActive, textColorGradient: labelTextGradient, textColorHover: labelTextColorHover, textStyle: labelTextStyle, textWeight: labelTextWeight, textWrap: labelTextWrap, children: label })), badgeValue && (jsx(Badge, { appearance: badgeAppearance, size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue }))] }), jsx(Divider, { width: "fill", direction: dividerDirection, size: dividerSize, fill: isDisabled ? dividerFillDisabled : dividerFill, fillActive: isActive && dividerFillActive, fillActiveHover: dividerFillActiveHover, fillHover: isHover && dividerFillHover })] })), after] }) }) }));
|
|
125
|
+
: fillDisabledClass && "fill_disabled_".concat(fillDisabledClass), !isDisabled ? fillHoverClass && "fill_hover_".concat(fillHoverClass) : null, className, sizeClass && "tab_size_".concat(sizeClass), fillActiveClass && "fill_active_".concat(fillActiveClass), fillActiveHoverClass && "fill_active_hover_".concat(fillActiveHoverClass), shapeClass && "tab_shape_".concat(shapeClass), typeClass && "tab_type_".concat(typeClass), widthClass && "width_".concat(widthClass), reset && 'tab-reset', set && "tab_set_".concat(set), justifyContentClass && "tab_justify-content_".concat(justifyContentClass), onClick && 'cursor_type_pointer'), "data-tour": dataTour, style: tab, onClick: onClick, onMouseEnter: onMouseEnter, children: jsx(Link, { className: clsx('tab__link', alignDirectionClass && "align_".concat(alignDirectionClass), alignClass && "align_".concat(alignClass)), fill: linkFill, href: link || href, rel: rel, target: target, children: jsxs(React.Fragment, { children: [before, children || (jsxs(React.Fragment, { children: [jsxs("div", { className: "tab__wrapper", children: [label && (jsx(Text, { className: "tab__label", size: labelTextSize, textAlign: labelTextAlign, textColor: isDisabled ? labelColorDisabled : labelColor, textColorActive: isActive && labelColorActive, textColorGradient: labelTextGradient, textColorHover: labelTextColorHover, textStyle: labelTextStyle, textWeight: labelTextWeight, textWrap: labelTextWrap, children: label })), badgeValue && (jsx(Badge, { appearance: badgeAppearance, size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue }))] }), jsx(Divider, { width: "fill", direction: dividerDirection, size: dividerSize, zIndex: '1', fill: isDisabled ? dividerFillDisabled : dividerFill, fillActive: isActive && dividerFillActive, fillActiveHover: dividerFillActiveHover, fillHover: isHover && dividerFillHover })] })), after] }) }) }));
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
function TabGroup(props) {
|
|
@@ -11,6 +11,7 @@ var UserDeviceContext = createContext({
|
|
|
11
11
|
isMobile: false,
|
|
12
12
|
isTablet: false,
|
|
13
13
|
isDesktop: false,
|
|
14
|
+
deviceCurrentMainType: '',
|
|
14
15
|
});
|
|
15
16
|
var UIProvider = memo(function UIProvider(props) {
|
|
16
17
|
var _a = props.userDeviceState, userDeviceState = _a === void 0 ? {} : _a, children = props.children;
|
|
@@ -22,14 +23,11 @@ var UIProvider = memo(function UIProvider(props) {
|
|
|
22
23
|
* We will need to look at how to change this behavior.
|
|
23
24
|
*/
|
|
24
25
|
var allDevicesTypes = useMediaQueries(userDeviceState);
|
|
25
|
-
var isMobile = allDevicesTypes.isMobile, isTablet = allDevicesTypes.isTablet, isDesktop = allDevicesTypes.isDesktop, fullNamedDeviceTypes = __rest(allDevicesTypes
|
|
26
|
-
|
|
27
|
-
, ["isMobile", "isTablet", "isDesktop"]);
|
|
28
|
-
// prettier-ignore
|
|
29
|
-
var deviceCurrentMainType = ((isMobile && 'mobile') ||
|
|
26
|
+
var isMobile = allDevicesTypes.isMobile, isTablet = allDevicesTypes.isTablet, isDesktop = allDevicesTypes.isDesktop, fullNamedDeviceTypes = __rest(allDevicesTypes, ["isMobile", "isTablet", "isDesktop"]);
|
|
27
|
+
var deviceCurrentMainType = (isMobile && 'mobile') ||
|
|
30
28
|
(isTablet && 'tablet') ||
|
|
31
|
-
(isDesktop && 'desktop')
|
|
32
|
-
|
|
29
|
+
(isDesktop && 'desktop') ||
|
|
30
|
+
'';
|
|
33
31
|
var _b = useMemo(function () {
|
|
34
32
|
var deviceTypesList = Object.keys(allDevicesTypes).map(function (key) {
|
|
35
33
|
return camelCase(key.replace('is', ''));
|
|
@@ -1238,6 +1238,9 @@ h2.react-datepicker__current-month {
|
|
|
1238
1238
|
}
|
|
1239
1239
|
}
|
|
1240
1240
|
}
|
|
1241
|
+
.react-datepicker__week-number--selected {
|
|
1242
|
+
background: var(--date-picker-week-number-fill-active);
|
|
1243
|
+
}
|
|
1241
1244
|
.datepicker {
|
|
1242
1245
|
width: 100%;
|
|
1243
1246
|
border-radius: var(--date-picker-day-border-radius);
|
|
@@ -1305,6 +1308,7 @@ h2.react-datepicker__current-month {
|
|
|
1305
1308
|
--date-picker-week-text-weight: normal;
|
|
1306
1309
|
|
|
1307
1310
|
--date-picker-week-number-fill-hover: #eee;
|
|
1311
|
+
--date-picker-week-number-fill-active: #eee;
|
|
1308
1312
|
--date-picker-week-number-text-color: var(--color-surface-text-quaternary);
|
|
1309
1313
|
|
|
1310
1314
|
--date-picker-name-size: 16px;
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
.notification__item {
|
|
95
95
|
&_status {
|
|
96
96
|
&_success {
|
|
97
|
-
background: var(--color-success-primary);
|
|
97
|
+
background: var(--color-success-fill-primary);
|
|
98
98
|
^^&-wrapper {
|
|
99
99
|
^^^&-title {
|
|
100
100
|
color: var(--color-success-text-secondary);
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
&_error {
|
|
108
|
-
background: var(--color-error-primary);
|
|
108
|
+
background: var(--color-error-fill-primary);
|
|
109
109
|
^^&-wrapper {
|
|
110
110
|
^^^&-title {
|
|
111
111
|
color: var(--color-error-text-secondary);
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
&_warning {
|
|
119
|
-
background: var(--color-primary-primary);
|
|
119
|
+
background: var(--color-primary-fill-primary);
|
|
120
120
|
^^&-wrapper {
|
|
121
121
|
^^^&-title {
|
|
122
122
|
color: var(--color-primary-text-primary);
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
&_info {
|
|
130
|
-
background: var(--color-info-primary);
|
|
130
|
+
background: var(--color-info-fill-primary);
|
|
131
131
|
^^&-wrapper {
|
|
132
132
|
^^^&-title {
|
|
133
133
|
color: var(--color-info-text-primary);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.notification__item {
|
|
2
2
|
&_status {
|
|
3
3
|
&_success {
|
|
4
|
-
background: var(--color-success-primary);
|
|
4
|
+
background: var(--color-success-fill-primary);
|
|
5
5
|
^^&-wrapper {
|
|
6
6
|
^^^&-title {
|
|
7
7
|
color: var(--color-success-text-secondary);
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
&_error {
|
|
15
|
-
background: var(--color-error-primary);
|
|
15
|
+
background: var(--color-error-fill-primary);
|
|
16
16
|
^^&-wrapper {
|
|
17
17
|
^^^&-title {
|
|
18
18
|
color: var(--color-error-text-secondary);
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
&_warning {
|
|
26
|
-
background: var(--color-primary-primary);
|
|
26
|
+
background: var(--color-primary-fill-primary);
|
|
27
27
|
^^&-wrapper {
|
|
28
28
|
^^^&-title {
|
|
29
29
|
color: var(--color-primary-text-primary);
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
&_info {
|
|
37
|
-
background: var(--color-info-primary);
|
|
37
|
+
background: var(--color-info-fill-primary);
|
|
38
38
|
^^&-wrapper {
|
|
39
39
|
^^^&-title {
|
|
40
40
|
color: var(--color-info-text-primary);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Swiper 11.2.
|
|
2
|
+
* Swiper 11.2.8
|
|
3
3
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
|
4
4
|
* https://swiperjs.com
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Released under the MIT License
|
|
9
9
|
*
|
|
10
|
-
* Released on: May
|
|
10
|
+
* Released on: May 23, 2025
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/* FONT_START */
|
|
@@ -42,9 +42,6 @@ function useStyles(props) {
|
|
|
42
42
|
const resultStylesGroups = {};
|
|
43
43
|
for (const [propKey, propValue] of Object.entries(propsStyleAttributes)) {
|
|
44
44
|
let value = null;
|
|
45
|
-
console.log('propKey');
|
|
46
|
-
console.log(propKey);
|
|
47
|
-
console.log('propKey=======');
|
|
48
45
|
const styleAttributeKey = getTargetStyleAttributeKey(propKey, propValue);
|
|
49
46
|
const isStyleForCurrentDevice = propKey.toLowerCase().endsWith(deviceCurrentType.toLowerCase());
|
|
50
47
|
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title="Hooks / useDevicePropsGenerator" />
|
|
4
|
+
|
|
5
|
+
# `useDevicePropsGenerator`
|
|
6
|
+
Хук позволяет автоматически получать значения пропсов или appearance, соответствующие viewport пользователя, а также преобразовывать их в CSS‑классы.
|
|
7
|
+
|
|
8
|
+
## Использование
|
|
9
|
+
|
|
10
|
+
1. При создании компонента, можно опционально задать componentConfig, который содержит все appearance для данного компонента и позволяет задать новые appearance извне
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
const componentConfig: ComponentConfig = {
|
|
14
|
+
appearance: componentAppearance,
|
|
15
|
+
setAppearance: (appearanceConfig) => {
|
|
16
|
+
componentConfig.appearance = appearanceConfig
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Для того чтобы передавать несколько appearance в одной строке, например:
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
<Component appearance='errorPrimary sizeM' />
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
где `errorPrimary` это
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
{
|
|
31
|
+
fill: 'errorTertiary',
|
|
32
|
+
borderColor: 'errorBorderQuaternary',
|
|
33
|
+
borderHover: 'errorBorderQuaternary',
|
|
34
|
+
textColor: 'surfaceTextPrimary',
|
|
35
|
+
iconBeforeFill: 'errorItemQuaternary',
|
|
36
|
+
iconClearFill: 'errorItemPrimary',
|
|
37
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
а `sizeM` это
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
{
|
|
45
|
+
size: 'm',
|
|
46
|
+
textSize: 'm',
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
нужен appearanceConfig
|
|
51
|
+
```js
|
|
52
|
+
const appearanceConfig = appearance?.split(' ').reduce(
|
|
53
|
+
(resultConfig, appearanceKey) => ({
|
|
54
|
+
...resultConfig,
|
|
55
|
+
...componentConfig.appearance?.[appearanceKey],
|
|
56
|
+
}),
|
|
57
|
+
{},
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
которому передается созданный ранее componentConfig и его результатом будет единный объект со свойствами из разных appearance
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
{
|
|
64
|
+
fill: 'errorTertiary',
|
|
65
|
+
borderColor: 'errorBorderQuaternary',
|
|
66
|
+
borderHover: 'errorBorderQuaternary',
|
|
67
|
+
textColor: 'surfaceTextPrimary',
|
|
68
|
+
iconBeforeFill: 'errorItemQuaternary',
|
|
69
|
+
iconClearFill: 'errorItemPrimary',
|
|
70
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
71
|
+
size: "m",
|
|
72
|
+
textSize: "m"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. Используем useDevicePropsGenerator, который принимает 2 параметра
|
|
77
|
+
|
|
78
|
+
<table>
|
|
79
|
+
<thead>
|
|
80
|
+
<tr>
|
|
81
|
+
<th>Название</th>
|
|
82
|
+
<th>Обязательный</th>
|
|
83
|
+
<th>Тип</th>
|
|
84
|
+
<th>Значение</th>
|
|
85
|
+
<th>Описание</th>
|
|
86
|
+
</tr>
|
|
87
|
+
</thead>
|
|
88
|
+
<tbody>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>componentProps</td>
|
|
91
|
+
<td>Да</td>
|
|
92
|
+
<td>`[key: string]: number | string`</td>
|
|
93
|
+
<td>errorTertiary</td>
|
|
94
|
+
<td>Пропсы компонента</td>
|
|
95
|
+
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td>appearanceConfig</td>
|
|
98
|
+
<td>Нет</td>
|
|
99
|
+
<td>`[key: string]: number | string`</td>
|
|
100
|
+
<td>
|
|
101
|
+
appearanceConfig[propsKey]
|
|
102
|
+
</td>
|
|
103
|
+
<td>Объект из appearance</td>
|
|
104
|
+
</tr>
|
|
105
|
+
</tbody>
|
|
106
|
+
</table>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
Из propsGenerator получаем переменные со строками, которые соответствуют appearance переданными в хук. Если указать просто fill, то получим `errorTertiary`,
|
|
110
|
+
если укажем `fillClass` то получим `error-tertiary`, поэтому везде в приведенном ниже примере указан суффикс `Class`.
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig)
|
|
114
|
+
|
|
115
|
+
const {
|
|
116
|
+
fillClass,
|
|
117
|
+
borderColorClass,
|
|
118
|
+
borderHoverClass,
|
|
119
|
+
borderWidthClass,
|
|
120
|
+
textColorClass,
|
|
121
|
+
textSizeClass,
|
|
122
|
+
textWeightClass,
|
|
123
|
+
caretClass,
|
|
124
|
+
placeholderTextColorClass,
|
|
125
|
+
shapeClass,
|
|
126
|
+
sizeClass,
|
|
127
|
+
widthClass,
|
|
128
|
+
} = propsGenerator
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
4. Применяем стили к компоненту. Важно учитывать, если в названии класса указывается сначала название компонента, это означает что он ссылается на стили,
|
|
132
|
+
которые определены внутри директории этого компонента
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
`border-width_${borderWidthClass}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
если в названии класса нет название комопнента, это означает что ссылаемся на глобальный класс, который определен `src/styles`
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
`fill_${fillClass}`
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
``jsx
|
|
145
|
+
<textarea
|
|
146
|
+
id={id}
|
|
147
|
+
className={clsx(
|
|
148
|
+
'textarea__input',
|
|
149
|
+
(textSizeClass || textColorClass || textWeightClass) && 'text',
|
|
150
|
+
caretClass && `caret-color_${caretClass}`,
|
|
151
|
+
fillClass && `fill_${fillClass}`,
|
|
152
|
+
borderColorClass && `border-color_${borderColorClass}`,
|
|
153
|
+
borderWidthClass && `border-width_${borderWidthClass}`,
|
|
154
|
+
borderHoverClass && `border-color_hover_${borderHoverClass}`,
|
|
155
|
+
placeholderTextColorClass && `placeholder-text-color_${placeholderTextColorClass}`,
|
|
156
|
+
textSizeClass && `text_size_${textSizeClass}`,
|
|
157
|
+
textColorClass && `text-color_${textColorClass}`,
|
|
158
|
+
textWeightClass && `text-weight_${textWeightClass}`,
|
|
159
|
+
widthClass && `width_${widthClass}`,
|
|
160
|
+
)}
|
|
161
|
+
/>
|
|
162
|
+
```
|
|
163
|
+
к примеру `fill`, будет отображаться в браузере как `fill_`
|
|
164
|
+
|
|
165
|
+
Возьмем к примеру fillClass
|
|
166
|
+
|
|
167
|
+
Возьмем appearance из приведенного ранее примера
|
|
168
|
+
```js
|
|
169
|
+
{
|
|
170
|
+
fill: 'errorTertiary',
|
|
171
|
+
borderColor: 'errorBorderQuaternary',
|
|
172
|
+
borderHover: 'errorBorderQuaternary',
|
|
173
|
+
textColor: 'surfaceTextPrimary',
|
|
174
|
+
iconBeforeFill: 'errorItemQuaternary',
|
|
175
|
+
iconClearFill: 'errorItemPrimary',
|
|
176
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
177
|
+
size: "m",
|
|
178
|
+
textSize: "m"
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
и возьмем из него свойство `fill_error-tertiary`
|
|
183
|
+
|
|
184
|
+
5. Cоздаются классы, которые соответствуют структуре определенной в css-файлах, например глобальный класс `fill`
|
|
185
|
+
|
|
186
|
+
```css
|
|
187
|
+
.fill {
|
|
188
|
+
&_none {
|
|
189
|
+
background-color: transparent;
|
|
190
|
+
}
|
|
191
|
+
@each $type in accent, primary, secondary, tertiary, quaternary, surface,
|
|
192
|
+
error, success, warning, info, danger, gradient, disabled, hover, inverse {
|
|
193
|
+
@each $color in primary, secondary, tertiary, quaternary, accent, disabled,
|
|
194
|
+
hover, inverse {
|
|
195
|
+
&_$(type) {
|
|
196
|
+
&-item {
|
|
197
|
+
&-$(color) {
|
|
198
|
+
background: var(--color-$(type)-item-$(color));
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
&-$(color) {
|
|
202
|
+
background: var(--color-$(type)-$(color));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
6. Чтобы применить стили в зависимости от viewPort, для этого нужно указать в appearance
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
{
|
|
214
|
+
sizeMobile: 'm',
|
|
215
|
+
textSizeMobile: 'm',
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
или напрямую при использовании компонента
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
<Component sizeMobile="m"/>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
всего доступны 3 типа размеров
|
|
225
|
+
|
|
226
|
+
1. Mobile
|
|
227
|
+
2. Tablet
|
|
228
|
+
3. Desktop
|
|
229
|
+
|
|
230
|
+
подробнее об этом можно узнать в `UIContext.tsx`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title="Hooks / useMediaQueries" />
|
|
4
|
+
|
|
5
|
+
# `useMediaQueries`
|
|
6
|
+
Предназначен для определения и выполнения кода согласно значению `viewport`, список доступных `viewport` находится в файле `src/hooks/useMediaQueries/mediaQueries.json`
|
|
7
|
+
|
|
8
|
+
## API
|
|
9
|
+
|
|
10
|
+
### Параметры
|
|
11
|
+
|
|
12
|
+
<table>
|
|
13
|
+
<thead>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>Название</th>
|
|
16
|
+
<th>Тип</th>
|
|
17
|
+
<th>Значение</th>
|
|
18
|
+
<th>Описание</th>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<tbody>
|
|
22
|
+
<tr>
|
|
23
|
+
<td>userDevice</td>
|
|
24
|
+
<td>UserDeviceState</td>
|
|
25
|
+
<td>`{}`</td>
|
|
26
|
+
<td>Булевые флаги устройства пользователя</td>
|
|
27
|
+
</tr>
|
|
28
|
+
</tbody>
|
|
29
|
+
</table>
|
|
30
|
+
|
|
31
|
+
### Возвращает объект
|
|
32
|
+
|
|
33
|
+
`deviceTypes` - который является объектом в котором находятся все флаги
|
|
34
|
+
|
|
35
|
+
- `isMobile` —
|
|
36
|
+
- `isMobileHuge` —
|
|
37
|
+
- `isTablet` —
|
|
38
|
+
- `isDesktop` —
|
|
39
|
+
- `isDesktopMega —`
|
|
40
|
+
|
|
41
|
+
### Использование
|
|
42
|
+
|
|
43
|
+
```jsx
|
|
44
|
+
const Component = () => {
|
|
45
|
+
const { isMobile, isTablet, isDesktop } = useMediaQueries()
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div>
|
|
49
|
+
{isMobile && <p>isMobile</p>}
|
|
50
|
+
{isTablet && <p>isTablet</p>}
|
|
51
|
+
{isDesktop && <p>isDesktop</p>}
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
```
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks'
|
|
2
|
+
|
|
3
|
+
<Meta title="Hooks / useStyles" />
|
|
4
|
+
|
|
5
|
+
# `useStyles`
|
|
6
|
+
|
|
7
|
+
Хук конвертирует `props` компонента в `inline` стили.
|
|
8
|
+
|
|
9
|
+
Важно учитывать приоритет при котором будут применяться стили:
|
|
10
|
+
|
|
11
|
+
1. Сначала используется значение из props, соответствующее текущему устройству (Mobile например)
|
|
12
|
+
2. Если такого нет — используется значение из props без учёта устройства
|
|
13
|
+
3. Если и его нет — берётся значение из appearance-конфига для текущего устройства
|
|
14
|
+
4. И в последнюю очередь — значение из appearance-конфига без учёта устройства
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
### Параметры
|
|
19
|
+
|
|
20
|
+
<table>
|
|
21
|
+
<thead>
|
|
22
|
+
<tr>
|
|
23
|
+
<th>Название</th>
|
|
24
|
+
<th>Тип</th>
|
|
25
|
+
<th>Значение</th>
|
|
26
|
+
<th>Описание</th>
|
|
27
|
+
</tr>
|
|
28
|
+
</thead>
|
|
29
|
+
<tbody>
|
|
30
|
+
<tr>
|
|
31
|
+
<td>props</td>
|
|
32
|
+
<td>StyleAttributes</td>
|
|
33
|
+
<td>background</td>
|
|
34
|
+
<td>Props, могут быть любые inline-стили</td>
|
|
35
|
+
</tr>
|
|
36
|
+
</tbody>
|
|
37
|
+
</table>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Использование
|
|
41
|
+
|
|
42
|
+
Создаем ui компонент и используем хук
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const { dot: dotStyles, styles: badgeStyles } = useStyles(props)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Залогируем данные
|
|
49
|
+
```js
|
|
50
|
+
console.log('dotStyles', dotStyles)
|
|
51
|
+
console.log('badgeStyles', badgeStyles)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Добавим в JSX-разметку компонента стили
|
|
55
|
+
|
|
56
|
+
```jsx
|
|
57
|
+
<div style={badgeStyles}>
|
|
58
|
+
{dot && (
|
|
59
|
+
<div style={dotStyles}>
|
|
60
|
+
текст
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
При использовании прокидываем стили
|
|
67
|
+
|
|
68
|
+
```jsx
|
|
69
|
+
<Badge
|
|
70
|
+
marginDotMobile="10px"
|
|
71
|
+
paddingStylesMobile="10px"
|
|
72
|
+
dot={true}
|
|
73
|
+
{...args}
|
|
74
|
+
/>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Почему именно такое название пропсов?
|
|
78
|
+
Пропсы соответствуют такой структуре
|
|
79
|
+
|
|
80
|
+
<table>
|
|
81
|
+
<thead>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Во первых (margin)</th>
|
|
84
|
+
<th>Во вторых (Dot)</th>
|
|
85
|
+
<th>В третьих (Mobile)</th>
|
|
86
|
+
</tr>
|
|
87
|
+
</thead>
|
|
88
|
+
<tbody>
|
|
89
|
+
<tr>
|
|
90
|
+
<td>Указывается название стиля, которое будет применено (margin например)</td>
|
|
91
|
+
<td>Название к которому будет применяться стиль, в нашем случае это Dot</td>
|
|
92
|
+
<td>Для какого размера экрана принимать данные стили</td>
|
|
93
|
+
</tr>
|
|
94
|
+
</tbody>
|
|
95
|
+
</table>
|
|
96
|
+
|
|
97
|
+
И получим на выходе в логах, для мобильного разрешения экрана.
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
dotStyles - {margin: '10px'}
|
|
101
|
+
badgeStyles - {padding: '10px'}
|
|
102
|
+
```
|
|
@@ -26,8 +26,8 @@ export declare const datePickerAppearance: {
|
|
|
26
26
|
daySize: string;
|
|
27
27
|
dayTextSize: string;
|
|
28
28
|
iconFillSize: number;
|
|
29
|
-
iconLeft:
|
|
30
|
-
iconRight:
|
|
29
|
+
iconLeft: string;
|
|
30
|
+
iconRight: string;
|
|
31
31
|
};
|
|
32
32
|
sizeM: {
|
|
33
33
|
daySize: string;
|
|
@@ -36,15 +36,15 @@ export declare const datePickerAppearance: {
|
|
|
36
36
|
iconSize: number;
|
|
37
37
|
monthTextSize: string;
|
|
38
38
|
yearTextSize: string;
|
|
39
|
-
iconLeft:
|
|
40
|
-
iconRight:
|
|
39
|
+
iconLeft: string;
|
|
40
|
+
iconRight: string;
|
|
41
41
|
};
|
|
42
42
|
sizeL: {
|
|
43
43
|
daySize: string;
|
|
44
44
|
dayTextSize: string;
|
|
45
45
|
iconFillSize: number;
|
|
46
|
-
iconLeft:
|
|
47
|
-
iconRight:
|
|
46
|
+
iconLeft: string;
|
|
47
|
+
iconRight: string;
|
|
48
48
|
};
|
|
49
49
|
surfacePrimary: {
|
|
50
50
|
dayTextColor: string;
|
|
@@ -52,8 +52,8 @@ export declare const datePickerAppearance: {
|
|
|
52
52
|
iconFillHover: string;
|
|
53
53
|
iconItemFill: string;
|
|
54
54
|
iconShape: string;
|
|
55
|
-
iconLeft:
|
|
56
|
-
iconRight:
|
|
55
|
+
iconLeft: string;
|
|
56
|
+
iconRight: string;
|
|
57
57
|
monthTextColor: string;
|
|
58
58
|
monthTextWeight: number;
|
|
59
59
|
placeholderTextColor: string;
|
|
@@ -3,8 +3,8 @@ declare const datePickerSize: {
|
|
|
3
3
|
daySize: string;
|
|
4
4
|
dayTextSize: string;
|
|
5
5
|
iconFillSize: number;
|
|
6
|
-
iconLeft:
|
|
7
|
-
iconRight:
|
|
6
|
+
iconLeft: string;
|
|
7
|
+
iconRight: string;
|
|
8
8
|
};
|
|
9
9
|
sizeM: {
|
|
10
10
|
daySize: string;
|
|
@@ -13,15 +13,15 @@ declare const datePickerSize: {
|
|
|
13
13
|
iconSize: number;
|
|
14
14
|
monthTextSize: string;
|
|
15
15
|
yearTextSize: string;
|
|
16
|
-
iconLeft:
|
|
17
|
-
iconRight:
|
|
16
|
+
iconLeft: string;
|
|
17
|
+
iconRight: string;
|
|
18
18
|
};
|
|
19
19
|
sizeL: {
|
|
20
20
|
daySize: string;
|
|
21
21
|
dayTextSize: string;
|
|
22
22
|
iconFillSize: number;
|
|
23
|
-
iconLeft:
|
|
24
|
-
iconRight:
|
|
23
|
+
iconLeft: string;
|
|
24
|
+
iconRight: string;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
export { datePickerSize };
|
|
@@ -5,8 +5,8 @@ declare const datePickerAppearanceSurface: {
|
|
|
5
5
|
iconFillHover: string;
|
|
6
6
|
iconItemFill: string;
|
|
7
7
|
iconShape: string;
|
|
8
|
-
iconLeft:
|
|
9
|
-
iconRight:
|
|
8
|
+
iconLeft: string;
|
|
9
|
+
iconRight: string;
|
|
10
10
|
monthTextColor: string;
|
|
11
11
|
monthTextWeight: number;
|
|
12
12
|
placeholderTextColor: string;
|
|
@@ -25,7 +25,7 @@ declare const paginationAppearanceSurface: {
|
|
|
25
25
|
pageCountDropdownItemSize: string;
|
|
26
26
|
pageCountDropdownItemWidth: string;
|
|
27
27
|
pageCountDropdownShape: string;
|
|
28
|
-
pageCountInputIcon:
|
|
28
|
+
pageCountInputIcon: string;
|
|
29
29
|
pageCountInputIconColor: string;
|
|
30
30
|
pageCountInputIconFillSize: string;
|
|
31
31
|
pageCountInputTextColor: string;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
declare const searchAppearanceSize: {
|
|
2
2
|
sizeS: {
|
|
3
3
|
size: string;
|
|
4
|
-
iconBefore:
|
|
4
|
+
iconBefore: string;
|
|
5
5
|
iconBeforeSize: string;
|
|
6
|
-
iconClear:
|
|
6
|
+
iconClear: string;
|
|
7
7
|
iconClearSize: string;
|
|
8
8
|
};
|
|
9
9
|
sizeXS: {
|
|
10
10
|
size: string;
|
|
11
|
-
iconBefore:
|
|
11
|
+
iconBefore: string;
|
|
12
12
|
iconBeforeSize: string;
|
|
13
|
-
iconClear:
|
|
13
|
+
iconClear: string;
|
|
14
14
|
iconClearSize: string;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
@@ -9,5 +9,15 @@ declare const segmentedAppearanceSurface: {
|
|
|
9
9
|
indicatorFill: string;
|
|
10
10
|
shape: string;
|
|
11
11
|
};
|
|
12
|
+
surfaceSecondary: {
|
|
13
|
+
fill: string;
|
|
14
|
+
fillActive: string;
|
|
15
|
+
fillActiveHover: string;
|
|
16
|
+
fillHover: string;
|
|
17
|
+
labelTextActiveColor: string;
|
|
18
|
+
labelTextColor: string;
|
|
19
|
+
indicatorFill: string;
|
|
20
|
+
shape: string;
|
|
21
|
+
};
|
|
12
22
|
};
|
|
13
23
|
export { segmentedAppearanceSurface };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
type DeviceType = '' | 'desktop' | 'mobile' | 'tablet';
|
|
2
3
|
interface iUIProvider {
|
|
3
4
|
children?: ReactNode;
|
|
5
|
+
deviceCurrentMainType: DeviceType;
|
|
4
6
|
userDeviceState?: {
|
|
5
7
|
isDesktop?: boolean;
|
|
6
8
|
isMobile?: boolean;
|
|
@@ -12,5 +14,6 @@ declare function useUserDeviceContext(): {
|
|
|
12
14
|
isMobile: boolean;
|
|
13
15
|
isTablet: boolean;
|
|
14
16
|
isDesktop: boolean;
|
|
17
|
+
deviceCurrentMainType: string;
|
|
15
18
|
};
|
|
16
19
|
export { UIProvider, useUserDeviceContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.12",
|
|
4
4
|
"description": "UI components (Modal, Loader, Popup, etc)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Modal",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"@emotion/is-prop-valid": "^1.3.1",
|
|
99
99
|
"@itcase/common": "^1.2.23",
|
|
100
100
|
"@itcase/config": "^1.0.47",
|
|
101
|
-
"@itcase/icons": "^1.
|
|
102
|
-
"@itcase/storybook-config": "^1.1.
|
|
101
|
+
"@itcase/icons": "^1.1.1",
|
|
102
|
+
"@itcase/storybook-config": "^1.1.10",
|
|
103
103
|
"@itcase/tokens-am": "^1.1.7",
|
|
104
104
|
"@itcase/tokens-baikal": "^1.1.7",
|
|
105
105
|
"@itcase/types": "^1.0.3",
|
|
@@ -107,14 +107,14 @@
|
|
|
107
107
|
"date-fns": "^4.1.0",
|
|
108
108
|
"eslint-import-resolver-alias": "^1.1.2",
|
|
109
109
|
"eslint-plugin-import": "^2.31.0",
|
|
110
|
-
"framer-motion": "^12.
|
|
110
|
+
"framer-motion": "^12.14.0",
|
|
111
111
|
"js-cookie": "^3.0.5",
|
|
112
112
|
"lodash": "^4.17.21",
|
|
113
|
-
"motion": "^12.
|
|
113
|
+
"motion": "^12.14.0",
|
|
114
114
|
"rc-slider": "^11.1.8",
|
|
115
115
|
"react": "^18.3.1",
|
|
116
116
|
"react-dadata": "^2.27.4",
|
|
117
|
-
"react-datepicker": "^8.
|
|
117
|
+
"react-datepicker": "^8.4.0",
|
|
118
118
|
"react-dom": "^18.3.1",
|
|
119
119
|
"react-indiana-drag-scroll": "^3.0.3-alpha",
|
|
120
120
|
"react-inlinesvg": "^4.2.0",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"react-scroll": "^1.9.3",
|
|
127
127
|
"react-scrollbars-custom": "^4.1.1",
|
|
128
128
|
"react-select": "^5.10.1",
|
|
129
|
-
"swiper": "^11.2.
|
|
129
|
+
"swiper": "^11.2.8",
|
|
130
130
|
"uuid": "^11.1.0"
|
|
131
131
|
},
|
|
132
132
|
"devDependencies": {
|
|
@@ -168,12 +168,12 @@
|
|
|
168
168
|
"prettier": "^3.5.3",
|
|
169
169
|
"react-docgen-typescript": "^2.2.2",
|
|
170
170
|
"react-svg": "^16.3.0",
|
|
171
|
-
"rollup": "^4.41.
|
|
171
|
+
"rollup": "^4.41.1",
|
|
172
172
|
"rollup-plugin-copy": "^3.5.0",
|
|
173
173
|
"rollup-plugin-dts": "^6.2.1",
|
|
174
174
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
175
175
|
"rollup-preserve-directives": "^1.1.3",
|
|
176
|
-
"semantic-release": "^24.2.
|
|
176
|
+
"semantic-release": "^24.2.5",
|
|
177
177
|
"storybook": "^8.6.14",
|
|
178
178
|
"stylelint": "^16.19.1",
|
|
179
179
|
"typescript": "^5.8.3"
|