@itcase/ui 1.8.123 → 1.8.124
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/Avatar_cjs_mojzcWRL.js +161 -0
- package/dist/Avatar_es_BFom0nAS.js +157 -0
- package/dist/{Button_cjs_Ce97psFT.js → Button_cjs_CZz8OjWi.js} +39 -27
- package/dist/{Button_es_CZss7cXh.js → Button_es_Cn3wtv3M.js} +39 -27
- package/dist/ChipsGroup_cjs_Dgskkc1e.js +344 -0
- package/dist/{ChipsGroup_es_ayPPUwQ7.js → ChipsGroup_es_BVQ7_n0k.js} +48 -35
- package/dist/DatePicker_cjs_Lzrr9Amf.js +182 -0
- package/dist/DatePicker_es_D1LvY5RT.js +178 -0
- package/dist/Divider_cjs_DrmV2ezS.js +105 -0
- package/dist/Divider_es_BiYozVBS.js +101 -0
- package/dist/DropdownItem_cjs_rKLdFxSj.js +211 -0
- package/dist/DropdownItem_es_B-1qtEa7.js +206 -0
- package/dist/Group_cjs_DmfeUcFI.js +59 -0
- package/dist/Group_es_BU5k8f5S.js +55 -0
- package/dist/{Icon_cjs_Cz6IyOkb.js → Icon_cjs_DpFxIFv5.js} +170 -121
- package/dist/{Icon_es_BrwLifge.js → Icon_es_D5eiycFI.js} +170 -121
- package/dist/Image_cjs_CBDMUzv_.js +29 -0
- package/dist/Image_es_BHec4iVN.js +27 -0
- package/dist/{Input_cjs_DRPK_RHK.js → Input_cjs_DDi5JVAV.js} +27 -19
- package/dist/{Input_es_Cv5nEb_n.js → Input_es_BnCXATnh.js} +27 -19
- package/dist/{Label_cjs_DMoaOoHi.js → Label_cjs_C-x9blCL.js} +45 -33
- package/dist/{Label_es_SULlg9bL.js → Label_es_DCqpSw_F.js} +45 -33
- package/dist/{Link_cjs_C5UsZUiF.js → Link_cjs_qKXVfU8e.js} +43 -30
- package/dist/{Link_es_XiqbdwLp.js → Link_es_P2b6ya7P.js} +43 -30
- package/dist/Loader_cjs_DIDsIq3J.js +143 -0
- package/dist/Loader_es_CmSggwbR.js +139 -0
- package/dist/Overlay_cjs_tGA2fU43.js +42 -0
- package/dist/Overlay_es_BS7OTFoy.js +38 -0
- package/dist/{Scrollbar_cjs_DcKOfcNp.js → Scrollbar_cjs_Cp-7v2Mt.js} +1 -1
- package/dist/{Scrollbar_es_CThJeCLF.js → Scrollbar_es_CcMgNvGi.js} +1 -1
- package/dist/Text_cjs_BDTjOTVB.js +69 -0
- package/dist/Text_es_CnymlElo.js +65 -0
- package/dist/cjs/components/Accordion.js +37 -34
- package/dist/cjs/components/Avatar.js +5 -6
- package/dist/cjs/components/AvatarStack/stories/__mock__.js +1 -1
- package/dist/cjs/components/AvatarStack.js +17 -16
- package/dist/cjs/components/Badge.js +3 -4
- package/dist/cjs/components/Breadcrumbs/stories/__mock__.js +1 -1
- package/dist/cjs/components/Breadcrumbs.js +27 -23
- package/dist/cjs/components/Button.js +5 -6
- package/dist/cjs/components/Cell/stories/__mock__.js +1 -1
- package/dist/cjs/components/Cell.js +28 -25
- package/dist/cjs/components/Checkbox.js +33 -26
- package/dist/cjs/components/Checkmark.js +28 -23
- package/dist/cjs/components/Chips/stories/__mock__.js +1 -1
- package/dist/cjs/components/Chips.js +4 -5
- package/dist/cjs/components/Choice/stories/__mock__.js +2 -2
- package/dist/cjs/components/Choice.js +46 -40
- package/dist/cjs/components/Code.js +34 -26
- package/dist/cjs/components/CookiesWarning.js +23 -23
- package/dist/cjs/components/Dadata.js +14 -9
- package/dist/cjs/components/DatePeriod.js +32 -30
- package/dist/cjs/components/DatePicker.js +8 -9
- package/dist/cjs/components/Divider.js +1 -2
- package/dist/cjs/components/Dot.js +5 -6
- package/dist/cjs/components/Drawer.js +23 -21
- package/dist/cjs/components/Dropdown/stories/__mock__.js +6 -6
- package/dist/cjs/components/Dropdown.js +5 -6
- package/dist/cjs/components/Flex.js +11 -12
- package/dist/cjs/components/Grid.js +15 -16
- package/dist/cjs/components/Group.js +1 -2
- package/dist/cjs/components/HTMLContent.js +5 -6
- package/dist/cjs/components/HeroTitle.js +17 -16
- package/dist/cjs/components/Icon.js +3 -4
- package/dist/cjs/components/Image.js +1 -2
- package/dist/cjs/components/Input.js +1 -2
- package/dist/cjs/components/InputPassword.js +34 -26
- package/dist/cjs/components/Label.js +4 -5
- package/dist/cjs/components/Link.js +1 -2
- package/dist/cjs/components/List.js +39 -28
- package/dist/cjs/components/Loader.js +2 -3
- package/dist/cjs/components/Logo.js +10 -11
- package/dist/cjs/components/MenuItem.js +36 -33
- package/dist/cjs/components/Modal.js +40 -38
- package/dist/cjs/components/ModalSheetBottom.js +17 -18
- package/dist/cjs/components/Notification/stories/__mock__.js +1 -1
- package/dist/cjs/components/Notification.js +31 -24
- package/dist/cjs/components/Overlay.js +1 -2
- package/dist/cjs/components/Pagination.js +43 -41
- package/dist/cjs/components/Radio.js +34 -26
- package/dist/cjs/components/RangeSlider.js +8 -9
- package/dist/cjs/components/Response/img.js +1 -1
- package/dist/cjs/components/Response.js +45 -34
- package/dist/cjs/components/SVGContent.js +6 -7
- package/dist/cjs/components/ScrollOnDrag/stories/__mock__.js +2 -2
- package/dist/cjs/components/ScrollOnDrag.js +7 -8
- package/dist/cjs/components/ScrollToView.js +8 -9
- package/dist/cjs/components/Scrollbar/stories/__mock__.js +1 -1
- package/dist/cjs/components/Scrollbar.js +1 -1
- package/dist/cjs/components/Search.js +39 -31
- package/dist/cjs/components/Segmented/stories/__mock__.js +23 -10
- package/dist/cjs/components/Segmented.js +46 -41
- package/dist/cjs/components/Select.js +118 -113
- package/dist/cjs/components/Swiper/stories/__mock__.js +3 -3
- package/dist/cjs/components/Swiper.js +27 -29
- package/dist/cjs/components/Switch.js +33 -26
- package/dist/cjs/components/Tab/stories/__mock__.js +1 -1
- package/dist/cjs/components/Tab.js +33 -27
- package/dist/cjs/components/Text.js +1 -2
- package/dist/cjs/components/Textarea.js +26 -18
- package/dist/cjs/components/Tile.js +21 -17
- package/dist/cjs/components/Title.js +3 -4
- package/dist/cjs/components/Tooltip.js +3 -4
- package/dist/cjs/components/Video/stories/__mocks__.js +1 -1
- package/dist/cjs/components/Video.js +3 -4
- package/dist/cjs/components/Warning.js +26 -20
- package/dist/cjs/context/Notifications.js +38 -42
- package/dist/cjs/context/UIContext.js +19 -17
- package/dist/cjs/context/UrlAssetPrefix.js +3 -3
- package/dist/cjs/hoc/urlWithAssetPrefix.js +13 -16
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.helpers.js +13 -40
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.interface.js +1 -1
- package/dist/cjs/hooks/useActiveClasses/useActiveClasses.js +25 -29
- package/dist/cjs/hooks/useAppearanceConfig/useAppearanceConfig.js +13 -15
- package/dist/cjs/hooks/useAppearanceConfig.js +0 -1
- package/dist/cjs/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js +21 -28
- package/dist/cjs/hooks/useDevicePropsGenerator.js +0 -1
- package/dist/cjs/hooks/useDeviceTargetClass.js +0 -1
- package/dist/cjs/hooks/useStyles/styleAttributes.js +1 -1
- package/dist/cjs/hooks/useStyles/useStyles.js +0 -1
- package/dist/cjs/hooks/useStyles.js +0 -1
- package/dist/cjs/hooks/useViewportFix.js +5 -5
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/utils/setViewportProperty.js +3 -3
- package/dist/components/Accordion.js +37 -34
- package/dist/components/Avatar.js +5 -6
- package/dist/components/AvatarStack/stories/__mock__.js +1 -1
- package/dist/components/AvatarStack.js +17 -16
- package/dist/components/Badge.js +3 -4
- package/dist/components/Breadcrumbs/stories/__mock__.js +1 -1
- package/dist/components/Breadcrumbs.js +27 -23
- package/dist/components/Button.js +5 -6
- package/dist/components/Cell/stories/__mock__.js +1 -1
- package/dist/components/Cell.js +28 -25
- package/dist/components/Checkbox.js +33 -26
- package/dist/components/Checkmark.js +28 -23
- package/dist/components/Chips/stories/__mock__.js +1 -1
- package/dist/components/Chips.js +4 -5
- package/dist/components/Choice/stories/__mock__.js +2 -2
- package/dist/components/Choice.js +46 -40
- package/dist/components/Code.js +34 -26
- package/dist/components/CookiesWarning.js +23 -23
- package/dist/components/Dadata.js +14 -9
- package/dist/components/DatePeriod.js +32 -30
- package/dist/components/DatePicker.js +8 -9
- package/dist/components/Divider.js +1 -2
- package/dist/components/Dot.js +5 -6
- package/dist/components/Drawer.js +23 -21
- package/dist/components/Dropdown/stories/__mock__.js +6 -6
- package/dist/components/Dropdown.js +5 -6
- package/dist/components/Flex.js +11 -12
- package/dist/components/Grid.js +15 -16
- package/dist/components/Group.js +1 -2
- package/dist/components/HTMLContent.js +5 -6
- package/dist/components/HeroTitle.js +17 -16
- package/dist/components/Icon.js +3 -4
- package/dist/components/Image.js +1 -2
- package/dist/components/Input.js +1 -2
- package/dist/components/InputPassword.js +34 -26
- package/dist/components/Label.js +4 -5
- package/dist/components/Link.js +1 -2
- package/dist/components/List.js +39 -28
- package/dist/components/Loader.js +2 -3
- package/dist/components/Logo.js +10 -11
- package/dist/components/MenuItem.js +36 -33
- package/dist/components/Modal.js +40 -38
- package/dist/components/ModalSheetBottom.js +17 -18
- package/dist/components/Notification/stories/__mock__.js +1 -1
- package/dist/components/Notification.js +31 -24
- package/dist/components/Overlay.js +1 -2
- package/dist/components/Pagination.js +43 -41
- package/dist/components/Radio.js +34 -26
- package/dist/components/RangeSlider.js +8 -9
- package/dist/components/Response/img.js +1 -1
- package/dist/components/Response.js +45 -34
- package/dist/components/SVGContent.js +6 -7
- package/dist/components/ScrollOnDrag/stories/__mock__.js +2 -2
- package/dist/components/ScrollOnDrag.js +7 -8
- package/dist/components/ScrollToView.js +8 -9
- package/dist/components/Scrollbar/stories/__mock__.js +1 -1
- package/dist/components/Scrollbar.js +1 -1
- package/dist/components/Search.js +39 -31
- package/dist/components/Segmented/stories/__mock__.js +23 -10
- package/dist/components/Segmented.js +46 -41
- package/dist/components/Select.js +118 -113
- package/dist/components/Swiper/stories/__mock__.js +3 -3
- package/dist/components/Swiper.js +27 -29
- package/dist/components/Switch.js +33 -26
- package/dist/components/Tab/stories/__mock__.js +1 -1
- package/dist/components/Tab.js +33 -27
- package/dist/components/Text.js +1 -2
- package/dist/components/Textarea.js +26 -18
- package/dist/components/Tile.js +21 -17
- package/dist/components/Title.js +3 -4
- package/dist/components/Tooltip.js +3 -4
- package/dist/components/Video/stories/__mocks__.js +1 -1
- package/dist/components/Video.js +3 -4
- package/dist/components/Warning.js +26 -20
- package/dist/context/Notifications.js +38 -42
- package/dist/context/UIContext.js +19 -17
- package/dist/context/UrlAssetPrefix.js +3 -3
- package/dist/css/components/Tile/Tile.css +3 -3
- package/dist/hoc/urlWithAssetPrefix.js +13 -16
- package/dist/hooks/useActiveClasses/useActiveClasses.helpers.js +13 -40
- package/dist/hooks/useActiveClasses/useActiveClasses.interface.js +1 -1
- package/dist/hooks/useActiveClasses/useActiveClasses.js +25 -29
- package/dist/hooks/useAppearanceConfig/useAppearanceConfig.js +13 -15
- package/dist/hooks/useAppearanceConfig.js +0 -1
- package/dist/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js +21 -28
- package/dist/hooks/useDevicePropsGenerator.js +0 -1
- package/dist/hooks/useDeviceTargetClass.js +0 -1
- package/dist/hooks/useStyles/styleAttributes.js +1 -1
- package/dist/hooks/useStyles/useStyles.js +0 -1
- package/dist/hooks/useStyles.js +0 -1
- package/dist/hooks/useViewportFix.js +5 -5
- package/dist/hooks.js +1 -1
- package/dist/types/components/Select/SelectContainer.d.ts +1 -1
- package/dist/utils/setViewportProperty.js +3 -3
- package/package.json +3 -3
- package/dist/Avatar_cjs_CLJnKU39.js +0 -157
- package/dist/Avatar_es_BgN-fbOj.js +0 -153
- package/dist/ChipsGroup_cjs_C8L3ZeD_.js +0 -331
- package/dist/DatePicker_cjs_BzEtDAb8.js +0 -183
- package/dist/DatePicker_es_DRyCMO0I.js +0 -179
- package/dist/Divider_cjs_DUYtmwn2.js +0 -97
- package/dist/Divider_es_CCLBFIx6.js +0 -93
- package/dist/DropdownItem_cjs_Bhss6lyM.js +0 -207
- package/dist/DropdownItem_es_BXl6lPJx.js +0 -202
- package/dist/Group_cjs_CsJ6ICKK.js +0 -59
- package/dist/Group_es_DRqIIM9m.js +0 -55
- package/dist/Image_cjs_DRhhc66R.js +0 -29
- package/dist/Image_es_BpMidmve.js +0 -27
- package/dist/Loader_cjs_D3lnxPlI.js +0 -132
- package/dist/Loader_es_BUSqFrCd.js +0 -128
- package/dist/Overlay_cjs_CcfJYN5o.js +0 -41
- package/dist/Overlay_es_DF3DAdxS.js +0 -37
- package/dist/Text_cjs_0EINiUq4.js +0 -68
- package/dist/Text_es_CwV9rjFD.js +0 -64
- package/dist/tslib.es6_cjs_CCZ3TN_7.js +0 -59
- package/dist/tslib.es6_es_Bwu1Cn-t.js +0 -56
|
@@ -1,61 +1,57 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import { CLASS_RULES, toKebabCase, formatState } from './useActiveClasses.helpers.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.entries(CLASS_RULES).forEach(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var key = _a.key, stateFn = _a.stateFn;
|
|
12
|
-
var value = propsGenerator[key];
|
|
4
|
+
const useActiveClasses = (params) => {
|
|
5
|
+
const { isDisabled, propsGenerator, suffixes = [], isActive } = params;
|
|
6
|
+
const rootClassesArray = [];
|
|
7
|
+
Object.entries(CLASS_RULES).forEach(([rulesName, rules]) => {
|
|
8
|
+
const kebabRuleName = toKebabCase(rulesName);
|
|
9
|
+
rules.forEach(({ key, stateFn }) => {
|
|
10
|
+
const value = propsGenerator[key];
|
|
13
11
|
if (!value) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
if (stateFn) {
|
|
17
|
-
|
|
15
|
+
const active = stateFn({ isDisabled, isActive });
|
|
18
16
|
if (!active) {
|
|
19
17
|
return;
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
rootClassesArray.push(
|
|
20
|
+
const stateName = formatState(key);
|
|
21
|
+
rootClassesArray.push(`${kebabRuleName}${stateName}_${value}`);
|
|
24
22
|
});
|
|
25
23
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Object.entries(CLASS_RULES).forEach(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var propKey = rulesName + suffix + withoutPrefixRulesName;
|
|
35
|
-
var value = propsGenerator[propKey];
|
|
24
|
+
const rootClasses = clsx(rootClassesArray);
|
|
25
|
+
const suffixClasses = suffixes.reduce((acc, suffix) => {
|
|
26
|
+
const classes = [];
|
|
27
|
+
Object.entries(CLASS_RULES).forEach(([rulesName, rules]) => {
|
|
28
|
+
rules.forEach(({ key, stateFn }) => {
|
|
29
|
+
const withoutPrefixRulesName = key.replace(rulesName, '');
|
|
30
|
+
const propKey = rulesName + suffix + withoutPrefixRulesName;
|
|
31
|
+
const value = propsGenerator[propKey];
|
|
36
32
|
if (!value) {
|
|
37
33
|
return;
|
|
38
34
|
}
|
|
39
35
|
if (stateFn) {
|
|
40
|
-
|
|
36
|
+
const active = stateFn({ isDisabled, isActive });
|
|
41
37
|
if (!active) {
|
|
42
38
|
return;
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
classes.push(
|
|
41
|
+
const state = formatState(propKey);
|
|
42
|
+
const kebabName = toKebabCase(rulesName);
|
|
43
|
+
classes.push(`${kebabName}${state}_${value}`);
|
|
48
44
|
});
|
|
49
45
|
});
|
|
50
|
-
|
|
46
|
+
const suffixKey = suffix === 'HTMLContent'
|
|
51
47
|
? 'htmlContent'
|
|
52
48
|
: (suffix[0].toLowerCase() + suffix.slice(1));
|
|
53
49
|
acc[suffixKey] = clsx(classes);
|
|
54
50
|
return acc;
|
|
55
51
|
}, {});
|
|
56
52
|
return {
|
|
57
|
-
rootClasses
|
|
58
|
-
suffixClasses
|
|
53
|
+
rootClasses,
|
|
54
|
+
suffixClasses,
|
|
59
55
|
};
|
|
60
56
|
};
|
|
61
57
|
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import { _ as __assign } from '../../tslib.es6_es_Bwu1Cn-t.js';
|
|
2
1
|
import { useMemo } from 'react';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _a, _b, _c, _d, _e, _f;
|
|
3
|
+
const useAppearanceConfig = (appearance, componentConfig, isDisabled) => {
|
|
4
|
+
const appearanceConfig = useMemo(() => {
|
|
7
5
|
if (appearance) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}, {});
|
|
6
|
+
const appearanceProps = appearance.split(' ').reduce((resultConfig, appearanceKey) => ({
|
|
7
|
+
...resultConfig,
|
|
8
|
+
...componentConfig.appearance?.[appearanceKey],
|
|
9
|
+
}), {});
|
|
12
10
|
if (isDisabled &&
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
-
Object.assign(appearanceProps,
|
|
16
|
-
|
|
11
|
+
(componentConfig?.appearance?.disabled ||
|
|
12
|
+
componentConfig?.appearance?.disabledPrimary)) {
|
|
13
|
+
Object.assign(appearanceProps, componentConfig?.appearance?.disabled ||
|
|
14
|
+
componentConfig?.appearance?.disabledPrimary);
|
|
17
15
|
}
|
|
18
16
|
return appearanceProps;
|
|
19
17
|
}
|
|
20
18
|
if (isDisabled) {
|
|
21
|
-
return (
|
|
22
|
-
|
|
19
|
+
return (componentConfig?.appearance?.disabled ||
|
|
20
|
+
componentConfig?.appearance?.disabledPrimary);
|
|
23
21
|
}
|
|
24
22
|
return {};
|
|
25
|
-
}, [appearance, componentConfig
|
|
23
|
+
}, [appearance, componentConfig?.appearance, isDisabled]);
|
|
26
24
|
return appearanceConfig;
|
|
27
25
|
};
|
|
28
26
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as __spreadArray } from '../../tslib.es6_es_Bwu1Cn-t.js';
|
|
2
1
|
import { useMemo } from 'react';
|
|
3
2
|
import camelCase from 'lodash/camelCase';
|
|
4
3
|
import castArray from 'lodash/castArray';
|
|
@@ -48,17 +47,17 @@ function useDevicePropsGenerator(componentProps, appearanceConfig) {
|
|
|
48
47
|
* - titleTextSizeDesktop
|
|
49
48
|
* ---------
|
|
50
49
|
**/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
getProp
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
const { deviceCurrentMainType } = useUserDeviceContext();
|
|
51
|
+
const devicePropsGenerator = useMemo(() => {
|
|
52
|
+
const propsGenerator = {
|
|
53
|
+
getProp(propKey) {
|
|
54
|
+
const propsForDeviceKey = `${propKey}${upperFirst(deviceCurrentMainType)}`;
|
|
55
|
+
const valueForDevice = componentProps[propsForDeviceKey];
|
|
56
|
+
const valueDefault = componentProps[propKey];
|
|
57
|
+
const appearanceForDevice = appearanceConfig?.[propsForDeviceKey];
|
|
58
|
+
const appearanceDefault = appearanceConfig?.[propKey];
|
|
60
59
|
// prettier-ignore
|
|
61
|
-
|
|
60
|
+
const targetPropsValue = (
|
|
62
61
|
// Value for device from props is first priority
|
|
63
62
|
valueForDevice ||
|
|
64
63
|
// Value without device from props is second priority
|
|
@@ -70,12 +69,10 @@ function useDevicePropsGenerator(componentProps, appearanceConfig) {
|
|
|
70
69
|
return targetPropsValue;
|
|
71
70
|
},
|
|
72
71
|
// eslint-disable-next-line perfectionist/sort-objects
|
|
73
|
-
getClassName
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return getStyleAttributeKey(attr);
|
|
78
|
-
});
|
|
72
|
+
getClassName(propKey, params) {
|
|
73
|
+
const { prefix = '', replace = [/([A-Z])/g, '-$1'] } = params || {};
|
|
74
|
+
const targetClassValue = this.getProp(String(propKey));
|
|
75
|
+
const styleAttributeKeys = styleAttributes.map((attr) => getStyleAttributeKey(attr));
|
|
79
76
|
if (styleAttributeKeys.includes(String(propKey)) &&
|
|
80
77
|
(typeof targetClassValue === 'number' ||
|
|
81
78
|
(typeof targetClassValue === 'string' &&
|
|
@@ -83,36 +80,32 @@ function useDevicePropsGenerator(componentProps, appearanceConfig) {
|
|
|
83
80
|
return '';
|
|
84
81
|
}
|
|
85
82
|
if (targetClassValue) {
|
|
86
|
-
|
|
83
|
+
let cleanClassValue = String(targetClassValue);
|
|
87
84
|
if (!cleanClassValue.includes('.')) {
|
|
88
85
|
cleanClassValue = camelCase(cleanClassValue);
|
|
89
86
|
}
|
|
90
87
|
if (replace) {
|
|
91
|
-
|
|
88
|
+
const replaceList = castArray(replace);
|
|
92
89
|
cleanClassValue = cleanClassValue.replace(replaceList[0],
|
|
93
90
|
// @ts-expect-error
|
|
94
91
|
replaceList[1] || '');
|
|
95
92
|
}
|
|
96
93
|
// prettier-ignore
|
|
97
|
-
return
|
|
94
|
+
return `${prefix}${cleanClassValue}`.toLowerCase();
|
|
98
95
|
}
|
|
99
96
|
// If target key not exists in props and appearance config - return empty class
|
|
100
97
|
return '';
|
|
101
98
|
},
|
|
102
99
|
};
|
|
103
|
-
|
|
104
|
-
get
|
|
105
|
-
var args = [];
|
|
106
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
107
|
-
args[_i - 3] = arguments[_i];
|
|
108
|
-
}
|
|
100
|
+
const generatorProxyHandler = {
|
|
101
|
+
get(target, propKey, receiver, ...args) {
|
|
109
102
|
if (typeof propKey === 'string') {
|
|
110
103
|
// If object does not have the property being retrieved
|
|
111
104
|
if (!Reflect.has(target, propKey)) {
|
|
112
105
|
// And property ended on "Class" keyword
|
|
113
106
|
if (propKey.endsWith('Class')) {
|
|
114
107
|
// prettier-ignore
|
|
115
|
-
|
|
108
|
+
const shortProp = propKey.substring(0, propKey.lastIndexOf('Class'));
|
|
116
109
|
// Return prop from props for device as formatted class name
|
|
117
110
|
return target.getClassName(shortProp);
|
|
118
111
|
}
|
|
@@ -121,7 +114,7 @@ function useDevicePropsGenerator(componentProps, appearanceConfig) {
|
|
|
121
114
|
}
|
|
122
115
|
// Return object property. Original "get".
|
|
123
116
|
// @ts-expect-error
|
|
124
|
-
return Reflect.get
|
|
117
|
+
return Reflect.get(target, propKey, receiver, ...args);
|
|
125
118
|
}
|
|
126
119
|
// In some cases, like in Chrome browser, sometime "prop" is not string.
|
|
127
120
|
// We return this object as is.
|
|
@@ -2,7 +2,6 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import camelCase from 'lodash/camelCase';
|
|
3
3
|
import castArray from 'lodash/castArray';
|
|
4
4
|
import { useUserDeviceContext } from '../context/UIContext.js';
|
|
5
|
-
import '../tslib.es6_es_Bwu1Cn-t.js';
|
|
6
5
|
import 'react/jsx-runtime';
|
|
7
6
|
import './useMediaQueries/useMediaQueries.js';
|
|
8
7
|
import 'react-responsive';
|
|
@@ -33,7 +33,7 @@ var styleAttributes = [
|
|
|
33
33
|
/**
|
|
34
34
|
* Grid
|
|
35
35
|
*/
|
|
36
|
-
'gridTemplateColumns', 'gridArea', 'gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplate', 'gridTemplateAreas', 'gridTemplateRows', 'gridColumn', 'gridColumnGap', 'gridRow', 'gridRowGap',
|
|
36
|
+
'gridTemplateColumns', 'gridArea', 'gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplate', 'gridTemplateAreas', 'gridTemplateRows', 'gridColumn', 'gridColumnStart', 'gridColumnEnd', 'gridColumnGap', 'gridRow', 'gridRowStart', 'gridRowEnd', 'gridRowGap',
|
|
37
37
|
/**
|
|
38
38
|
* Filter
|
|
39
39
|
*/
|
|
@@ -6,7 +6,6 @@ import '../../context/Notifications.js';
|
|
|
6
6
|
import { useUserDeviceContext } from '../../context/UIContext.js';
|
|
7
7
|
import { getStyleAttributeKey } from '../../hooks.js';
|
|
8
8
|
import styleAttributes from './styleAttributes.js';
|
|
9
|
-
import '../../tslib.es6_es_Bwu1Cn-t.js';
|
|
10
9
|
import 'react/jsx-runtime';
|
|
11
10
|
import 'uuid';
|
|
12
11
|
import '@itcase/common';
|
package/dist/hooks/useStyles.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
|
|
3
3
|
function useViewportFix() {
|
|
4
|
-
useEffect(
|
|
4
|
+
useEffect(() => {
|
|
5
5
|
// https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
6
|
-
|
|
6
|
+
const setViewportProperty = () => {
|
|
7
7
|
// "vh" unit is equal to 1% of the height of the initial containing block
|
|
8
8
|
// https://www.w3.org/R/css-values-3/#viewport-relative-lengths
|
|
9
|
-
|
|
9
|
+
const vh = window.innerHeight * 0.01;
|
|
10
10
|
/** NOTE:
|
|
11
11
|
* In JavaScript, you can always get the value of the current viewport
|
|
12
12
|
* by using the global variable window.innerHeight. This value takes
|
|
@@ -26,13 +26,13 @@ function useViewportFix() {
|
|
|
26
26
|
* to assign as our viewport height unit value.
|
|
27
27
|
* Then we politely asked JS to create the CSS variable "--vh" at the ":root":
|
|
28
28
|
*/
|
|
29
|
-
document.documentElement.style.setProperty('--vh',
|
|
29
|
+
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
|
30
30
|
};
|
|
31
31
|
// Update the value of "--vh" after render
|
|
32
32
|
setViewportProperty();
|
|
33
33
|
// Update the value of "--vh" by listening to the window resize event
|
|
34
34
|
window.addEventListener('resize', setViewportProperty);
|
|
35
|
-
return
|
|
35
|
+
return () => {
|
|
36
36
|
window.removeEventListener('resize', setViewportProperty);
|
|
37
37
|
};
|
|
38
38
|
}, []);
|
package/dist/hooks.js
CHANGED
|
@@ -3,4 +3,4 @@ import { GroupBase, SelectInstance } from 'react-select';
|
|
|
3
3
|
import type { SelectConfig, SelectProps } from './Select.interface';
|
|
4
4
|
declare const selectConfig: SelectConfig;
|
|
5
5
|
declare const SelectContainer: React.ForwardRefExoticComponent<Omit<SelectProps<unknown, boolean, GroupBase<unknown>>, "ref"> & React.RefAttributes<SelectInstance<unknown, boolean, GroupBase<unknown>>>>;
|
|
6
|
-
export {
|
|
6
|
+
export { selectConfig, SelectContainer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
document.documentElement.style.setProperty('--vh',
|
|
1
|
+
const setViewportProperty = () => {
|
|
2
|
+
const vh = window.innerHeight * 0.01;
|
|
3
|
+
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
export { setViewportProperty };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itcase/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.124",
|
|
4
4
|
"description": "UI components (Modal, Loader, Popup, etc)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Modal",
|
|
@@ -101,9 +101,9 @@
|
|
|
101
101
|
},
|
|
102
102
|
"dependencies": {
|
|
103
103
|
"@emotion/is-prop-valid": "^1.4.0",
|
|
104
|
-
"@itcase/common": "^1.2.
|
|
104
|
+
"@itcase/common": "^1.2.31",
|
|
105
105
|
"@itcase/icons": "^1.2.19",
|
|
106
|
-
"@itcase/storybook-config": "^1.2.
|
|
106
|
+
"@itcase/storybook-config": "^1.2.7",
|
|
107
107
|
"@itcase/tokens-am": "^1.1.19",
|
|
108
108
|
"@itcase/tokens-baikal": "^1.1.17",
|
|
109
109
|
"@itcase/tokens-palette": "^1.1.11",
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var clsx = require('clsx');
|
|
6
|
-
var useAppearanceConfig = require('./cjs/hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
7
|
-
var useDevicePropsGenerator = require('./cjs/hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
8
|
-
var Icon = require('./Icon_cjs_Cz6IyOkb.js');
|
|
9
|
-
var Image = require('./Image_cjs_DRhhc66R.js');
|
|
10
|
-
var Text = require('./Text_cjs_0EINiUq4.js');
|
|
11
|
-
var tslib_es6 = require('./tslib.es6_cjs_CCZ3TN_7.js');
|
|
12
|
-
|
|
13
|
-
var avatarAppearanceDefault = {
|
|
14
|
-
surfacePrimary: {
|
|
15
|
-
fill: 'surfacePrimary',
|
|
16
|
-
textColor: 'surfaceTextPrimary',
|
|
17
|
-
badgeAppearance: 'accentPrimary solid circular',
|
|
18
|
-
},
|
|
19
|
-
surfaceSecondary: {
|
|
20
|
-
fill: 'surfaceSecondary',
|
|
21
|
-
textColor: 'surfaceTextPrimary',
|
|
22
|
-
badgeAppearance: 'accentPrimary solid circular',
|
|
23
|
-
},
|
|
24
|
-
surfaceTertiary: {
|
|
25
|
-
fill: 'surfaceTertiary',
|
|
26
|
-
textColor: 'surfaceTextPrimary',
|
|
27
|
-
badgeAppearance: 'accentPrimary solid circular',
|
|
28
|
-
},
|
|
29
|
-
surfaceQuaternary: {
|
|
30
|
-
fill: 'surfaceQuaternary',
|
|
31
|
-
textColor: 'surfaceTextPrimary',
|
|
32
|
-
badgeAppearance: 'accentPrimary solid circular',
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
var avatarAppearanceShape = {
|
|
37
|
-
circular: {
|
|
38
|
-
shape: 'circular',
|
|
39
|
-
},
|
|
40
|
-
rounded: {
|
|
41
|
-
shape: 'rounded',
|
|
42
|
-
},
|
|
43
|
-
roundedXL: {
|
|
44
|
-
shape: 'rounded',
|
|
45
|
-
shapeStrength: '2m',
|
|
46
|
-
},
|
|
47
|
-
roundedL: {
|
|
48
|
-
shape: 'rounded',
|
|
49
|
-
shapeStrength: '1_5m',
|
|
50
|
-
},
|
|
51
|
-
roundedM: {
|
|
52
|
-
shape: 'rounded',
|
|
53
|
-
shapeStrength: '1m',
|
|
54
|
-
},
|
|
55
|
-
roundedS: {
|
|
56
|
-
shape: 'rounded',
|
|
57
|
-
shapeStrength: '0_5m',
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
var avatarAppearanceSize = {
|
|
62
|
-
size16: {
|
|
63
|
-
size: '16',
|
|
64
|
-
textSize: 'xxl',
|
|
65
|
-
badgeAppearanceSize: 'sizeXXS',
|
|
66
|
-
iconFillSize: '12',
|
|
67
|
-
},
|
|
68
|
-
size20: {
|
|
69
|
-
size: '20',
|
|
70
|
-
textSize: 'xxl',
|
|
71
|
-
badgeAppearanceSize: 'sizeXXS',
|
|
72
|
-
iconFillSize: '12',
|
|
73
|
-
},
|
|
74
|
-
size24: {
|
|
75
|
-
size: '24',
|
|
76
|
-
textSize: 'l',
|
|
77
|
-
badgeAppearanceSize: 'sizeXXS',
|
|
78
|
-
iconFillSize: '12',
|
|
79
|
-
},
|
|
80
|
-
size32: {
|
|
81
|
-
size: '32',
|
|
82
|
-
textSize: 'l',
|
|
83
|
-
badgeAppearanceSize: 'sizeXS',
|
|
84
|
-
iconFillSize: '12',
|
|
85
|
-
},
|
|
86
|
-
size40: {
|
|
87
|
-
size: '40',
|
|
88
|
-
textSize: 'l',
|
|
89
|
-
badgeAppearanceSize: 'sizeS',
|
|
90
|
-
iconFillSize: '12',
|
|
91
|
-
},
|
|
92
|
-
size56: {
|
|
93
|
-
size: '56',
|
|
94
|
-
textSize: 'xxl',
|
|
95
|
-
badgeAppearanceSize: 'sizeM',
|
|
96
|
-
iconFillSize: '16',
|
|
97
|
-
},
|
|
98
|
-
size96: {
|
|
99
|
-
size: '96',
|
|
100
|
-
textSize: 'xxl',
|
|
101
|
-
badgeAppearanceSize: 'sizeXL',
|
|
102
|
-
iconFillSize: '32',
|
|
103
|
-
},
|
|
104
|
-
size144: {
|
|
105
|
-
size: '144',
|
|
106
|
-
textSize: 'xxl',
|
|
107
|
-
badgeAppearanceSize: 'sizeXXL',
|
|
108
|
-
iconFillSize: '40',
|
|
109
|
-
},
|
|
110
|
-
size240: {
|
|
111
|
-
size: '240',
|
|
112
|
-
textSize: 'xxl',
|
|
113
|
-
badgeAppearanceSize: 'sizeXXL',
|
|
114
|
-
iconFillSize: '40',
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
var avatarAppearanceStyle = {
|
|
119
|
-
solid: {
|
|
120
|
-
borderColor: 'none',
|
|
121
|
-
},
|
|
122
|
-
outlined: {
|
|
123
|
-
fill: 'none',
|
|
124
|
-
},
|
|
125
|
-
full: {
|
|
126
|
-
borderColor: 'none',
|
|
127
|
-
},
|
|
128
|
-
ghost: {
|
|
129
|
-
fill: 'none',
|
|
130
|
-
borderColor: 'none',
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
var avatarAppearance = tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign(tslib_es6.__assign({}, avatarAppearanceSize), avatarAppearanceStyle), avatarAppearanceShape), avatarAppearanceDefault);
|
|
135
|
-
|
|
136
|
-
var avatarConfig = {
|
|
137
|
-
appearance: avatarAppearance,
|
|
138
|
-
setAppearance: function (appearanceConfig) {
|
|
139
|
-
avatarConfig.appearance = appearanceConfig;
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
function Avatar(props) {
|
|
143
|
-
var className = props.className, appearance = props.appearance, src = props.src, _a = props.firstName, firstName = _a === void 0 ? '' : _a, _b = props.secondName, secondName = _b === void 0 ? '' : _b, count = props.count, before = props.before, after = props.after, isSkeleton = props.isSkeleton, onClick = props.onClick;
|
|
144
|
-
var avatarChars = React.useMemo(function () {
|
|
145
|
-
var firstChar = ((firstName === null || firstName === void 0 ? void 0 : firstName[0]) || '').toUpperCase();
|
|
146
|
-
var secondChar = ((secondName === null || secondName === void 0 ? void 0 : secondName[0]) || '').toUpperCase();
|
|
147
|
-
return "".concat(firstChar).concat(secondChar);
|
|
148
|
-
}, [firstName, secondName]);
|
|
149
|
-
var appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, avatarConfig);
|
|
150
|
-
var propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
151
|
-
var size = propsGenerator.size, fillClass = propsGenerator.fillClass, fillHoverClass = propsGenerator.fillHoverClass, textColor = propsGenerator.textColor, textSize = propsGenerator.textSize, textWeight = propsGenerator.textWeight, badge = propsGenerator.badge, badgeAppearance = propsGenerator.badgeAppearance, badgeAppearanceSize = propsGenerator.badgeAppearanceSize, badgeShape = propsGenerator.badgeShape, badgeSize = propsGenerator.badgeSize, badgeTextColor = propsGenerator.badgeTextColor, badgeTextSize = propsGenerator.badgeTextSize, badgeValue = propsGenerator.badgeValue, icon = propsGenerator.icon, iconFill = propsGenerator.iconFill, iconFillHover = propsGenerator.iconFillHover, iconFillSize = propsGenerator.iconFillSize, iconItemFill = propsGenerator.iconItemFill, iconShape = propsGenerator.iconShape, iconSize = propsGenerator.iconSize, iconSrc = propsGenerator.iconSrc, placeholderUrl = propsGenerator.placeholderUrl, shapeClass = propsGenerator.shapeClass, shapeStrengthClass = propsGenerator.shapeStrengthClass, sizeClass = propsGenerator.sizeClass;
|
|
152
|
-
return (jsxRuntime.jsx("div", { className: clsx(className, 'avatar', size && "avatar_size_".concat(sizeClass), (badgeValue || badgeAppearance || badgeSize) && 'avatar_status', isSkeleton && "avatar_skeleton", onClick && 'cursor_type_pointer'), onClick: onClick, children: jsxRuntime.jsxs("div", { className: clsx('avatar__wrapper', fillClass && "fill_".concat(fillClass), fillHoverClass && "fill_hover_".concat(fillHoverClass), shapeClass && "shape_".concat(shapeClass), shapeStrengthClass && "shape-strength_".concat(shapeStrengthClass)), children: [before, src ? (jsxRuntime.jsx(Image.Image, { className: clsx('avatar__image', shapeClass && "shape_".concat(shapeClass), shapeStrengthClass && "shape-strength_".concat(shapeStrengthClass)), src: src, placeholderUrl: placeholderUrl })) : (jsxRuntime.jsx(Text.Text, { className: "avatar__text", size: textSize, textColor: textColor, textWeight: textWeight, children: avatarChars || count })), (icon || iconSrc) && (jsxRuntime.jsx(Icon.Icon, { className: "avatar__icon", fill: iconFill, fillHover: iconFillHover, fillSize: iconFillSize, iconFill: iconItemFill, iconSize: iconSize, imageSrc: iconSrc, shape: iconShape, SvgImage: icon })), (badge || badgeValue) && (jsxRuntime.jsx(Icon.Badge, { className: "avatar__badge", appearance: "".concat(badgeAppearance, " ").concat(badgeAppearanceSize), size: badgeSize, textColor: badgeTextColor, textSize: badgeTextSize, shape: badgeShape, value: badgeValue })), after] }) }));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
exports.Avatar = Avatar;
|
|
156
|
-
exports.avatarAppearance = avatarAppearance;
|
|
157
|
-
exports.avatarConfig = avatarConfig;
|