@itcase/ui 1.8.123 → 1.8.125
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_AwXEUY8j.js +161 -0
- package/dist/Avatar_es_BtlaCRc5.js +157 -0
- package/dist/{Button_cjs_Ce97psFT.js → Button_cjs_C34BU1BK.js} +46 -34
- package/dist/{Button_es_CZss7cXh.js → Button_es_DnlzLBUT.js} +46 -34
- package/dist/ChipsGroup_cjs_DfAKN5CA.js +344 -0
- package/dist/{ChipsGroup_es_ayPPUwQ7.js → ChipsGroup_es_DBKY2UyF.js} +48 -35
- package/dist/DatePicker_cjs_DfbeIL2m.js +182 -0
- package/dist/DatePicker_es_BIJNx427.js +178 -0
- package/dist/Divider_cjs_DrmV2ezS.js +105 -0
- package/dist/Divider_es_BiYozVBS.js +101 -0
- package/dist/DropdownItem_cjs_vHuzXW9M.js +211 -0
- package/dist/DropdownItem_es_DVHWWgnU.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_BVLGzj7Y.js} +170 -157
- package/dist/{Icon_es_BrwLifge.js → Icon_es_DkVkzTha.js} +170 -157
- package/dist/Image_cjs_BUM81t4Y.js +28 -0
- package/dist/Image_es_C-IjVkKX.js +26 -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_DwAmukik.js} +45 -33
- package/dist/{Label_es_SULlg9bL.js → Label_es_B2kcstsG.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 -29
- 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 -29
- 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/Button/Button.appearance.d.ts +232 -232
- package/dist/types/components/Button/Button.d.ts +4 -4
- package/dist/types/components/Button/Button.interface.d.ts +5 -5
- package/dist/types/components/Pagination/Pagination.d.ts +1 -1
- package/dist/types/components/Select/SelectContainer.d.ts +1 -1
- package/dist/types/components/Text/Text.appearance.d.ts +58 -58
- package/dist/types/components/Text/Text.interface.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,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib_es6 = require('../../tslib.es6_cjs_CCZ3TN_7.js');
|
|
4
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var clsx = require('clsx');
|
|
@@ -8,7 +7,7 @@ var reactModalSheet = require('react-modal-sheet');
|
|
|
8
7
|
var useAppearanceConfig = require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
9
8
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
10
9
|
var useStyles = require('../hooks/useStyles/useStyles.js');
|
|
11
|
-
var Icon = require('../../
|
|
10
|
+
var Icon = require('../../Icon_cjs_BVLGzj7Y.js');
|
|
12
11
|
require('lodash/camelCase');
|
|
13
12
|
require('lodash/castArray');
|
|
14
13
|
require('lodash/upperFirst');
|
|
@@ -25,10 +24,10 @@ require('lodash/maxBy');
|
|
|
25
24
|
require('react-inlinesvg');
|
|
26
25
|
require('../hoc/urlWithAssetPrefix.js');
|
|
27
26
|
require('../context/UrlAssetPrefix.js');
|
|
28
|
-
require('../../
|
|
29
|
-
require('../../
|
|
27
|
+
require('../../Link_cjs_qKXVfU8e.js');
|
|
28
|
+
require('../../Text_cjs_BDTjOTVB.js');
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
const modalSheetBottomAppearance = {
|
|
32
31
|
sizeL: {
|
|
33
32
|
size: 'l',
|
|
34
33
|
titleTextSize: 'h4',
|
|
@@ -42,31 +41,31 @@ var modalSheetBottomAppearance = {
|
|
|
42
41
|
},
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
const modalSheetBottomConfig = {
|
|
46
45
|
appearance: modalSheetBottomAppearance};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const ModalSheetBottom = React.forwardRef(function Modal(props, ref) {
|
|
47
|
+
const { appearance, initialIsOpen, title, isDisabled, closeButton, onCloseModalSheetBottom, onOpenModalSheetBottom, children, } = props;
|
|
48
|
+
const [isOpen, setIsOpen] = React.useState(initialIsOpen);
|
|
49
|
+
const openModalSheetBottom = React.useCallback(() => {
|
|
51
50
|
setIsOpen(true);
|
|
52
51
|
onOpenModalSheetBottom && onOpenModalSheetBottom();
|
|
53
52
|
}, [onOpenModalSheetBottom]);
|
|
54
|
-
|
|
53
|
+
const closeModalSheetBottom = React.useCallback(() => {
|
|
55
54
|
setIsOpen(false);
|
|
56
55
|
onCloseModalSheetBottom && onCloseModalSheetBottom();
|
|
57
56
|
}, [onCloseModalSheetBottom]);
|
|
58
57
|
// Save ref things
|
|
59
|
-
React.useImperativeHandle(ref,
|
|
58
|
+
React.useImperativeHandle(ref, () => ({
|
|
60
59
|
openModal: openModalSheetBottom,
|
|
61
60
|
closeModal: closeModalSheetBottom,
|
|
62
61
|
isOpen: isOpen,
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
}), [isOpen, openModalSheetBottom, closeModalSheetBottom]);
|
|
63
|
+
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, modalSheetBottomConfig, isDisabled);
|
|
64
|
+
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
65
|
+
const { titleTextColor, titleTextColorHover, titleTextSize, titleTextTruncate, titleTextWeight, titleTextWidth, titleTextWrap, zeroPadding, } = propsGenerator;
|
|
67
66
|
// @ts-expect-error
|
|
68
|
-
|
|
69
|
-
return (jsxRuntime.jsxs(reactModalSheet.Sheet,
|
|
67
|
+
const { styles } = useStyles.useStyles(props);
|
|
68
|
+
return (jsxRuntime.jsxs(reactModalSheet.Sheet, { className: "modal-sheet-bottom", isOpen: isOpen, onClose: closeModalSheetBottom, ...props, children: [jsxRuntime.jsxs(reactModalSheet.Sheet.Container, { className: "modal-sheet-bottom__container", style: styles, children: [jsxRuntime.jsx(reactModalSheet.Sheet.Header, { className: "modal-sheet-bottom__header", children: closeButton && (jsxRuntime.jsx("div", { className: "modal-sheet-bottom__close", onClick: closeModalSheetBottom, children: closeButton })) }), jsxRuntime.jsx(reactModalSheet.Sheet.Content, { className: "modal-sheet-bottom__content", children: jsxRuntime.jsx(reactModalSheet.Sheet.Scroller, { autoPadding: true, children: jsxRuntime.jsxs("div", { className: clsx('modal-sheet-bottom__content-wrapper', zeroPadding && 'modal-sheet-bottom__content-reset-padding'), children: [title && (jsxRuntime.jsx(Icon.Title, { className: "modal__title", width: titleTextWidth, size: titleTextSize, textColor: titleTextColor, textColorHover: titleTextColorHover, textTruncate: titleTextTruncate, textWeight: titleTextWeight, textWrap: titleTextWrap, children: title })), children] }) }) })] }), jsxRuntime.jsx(reactModalSheet.Sheet.Backdrop, { className: "modal-sheet-bottom__backdrop", onClick: closeModalSheetBottom })] }));
|
|
70
69
|
});
|
|
71
70
|
|
|
72
71
|
exports.ModalSheetBottom = ModalSheetBottom;
|
|
@@ -5,9 +5,8 @@ var clsx = require('clsx');
|
|
|
5
5
|
var useAppearanceConfig = require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
6
6
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
7
7
|
var useStyles = require('../hooks/useStyles/useStyles.js');
|
|
8
|
-
var Icon = require('../../
|
|
9
|
-
var Text = require('../../
|
|
10
|
-
var tslib_es6 = require('../../tslib.es6_cjs_CCZ3TN_7.js');
|
|
8
|
+
var Icon = require('../../Icon_cjs_BVLGzj7Y.js');
|
|
9
|
+
var Text = require('../../Text_cjs_BDTjOTVB.js');
|
|
11
10
|
var _default = require('@itcase/icons/default');
|
|
12
11
|
var Notifications = require('../context/Notifications.js');
|
|
13
12
|
require('../context/UIContext.js');
|
|
@@ -26,9 +25,9 @@ require('lodash/maxBy');
|
|
|
26
25
|
require('react-inlinesvg');
|
|
27
26
|
require('../hoc/urlWithAssetPrefix.js');
|
|
28
27
|
require('../context/UrlAssetPrefix.js');
|
|
29
|
-
require('../../
|
|
28
|
+
require('../../Link_cjs_qKXVfU8e.js');
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
const notificationAppearanceDefault = {
|
|
32
31
|
defaultPrimary: {
|
|
33
32
|
fill: 'surfacePrimary',
|
|
34
33
|
fillHover: 'surfacePrimaryHover',
|
|
@@ -44,7 +43,7 @@ var notificationAppearanceDefault = {
|
|
|
44
43
|
},
|
|
45
44
|
};
|
|
46
45
|
|
|
47
|
-
|
|
46
|
+
const notificationAppearanceError = {
|
|
48
47
|
errorPrimary: {
|
|
49
48
|
fill: 'errorPrimary',
|
|
50
49
|
fillHover: 'errorPrimaryHover',
|
|
@@ -60,7 +59,7 @@ var notificationAppearanceError = {
|
|
|
60
59
|
},
|
|
61
60
|
};
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
const notificationAppearanceInfo = {
|
|
64
63
|
infoPrimary: {
|
|
65
64
|
fill: 'infoPrimary',
|
|
66
65
|
fillHover: 'infoPrimaryHover',
|
|
@@ -76,9 +75,9 @@ var notificationAppearanceInfo = {
|
|
|
76
75
|
},
|
|
77
76
|
};
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
const notificationAppearanceSize = {};
|
|
80
79
|
|
|
81
|
-
|
|
80
|
+
const notificationAppearanceStyle = {
|
|
82
81
|
solid: {
|
|
83
82
|
borderColor: 'none',
|
|
84
83
|
},
|
|
@@ -92,7 +91,7 @@ var notificationAppearanceStyle = {
|
|
|
92
91
|
},
|
|
93
92
|
};
|
|
94
93
|
|
|
95
|
-
|
|
94
|
+
const notificationAppearanceSuccess = {
|
|
96
95
|
successPrimary: {
|
|
97
96
|
fill: 'successPrimary',
|
|
98
97
|
fillHover: 'successPrimaryHover',
|
|
@@ -108,7 +107,7 @@ var notificationAppearanceSuccess = {
|
|
|
108
107
|
},
|
|
109
108
|
};
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
const notificationAppearanceWarning = {
|
|
112
111
|
warningPrimary: {
|
|
113
112
|
fill: 'warningPrimary',
|
|
114
113
|
fillHover: 'warningPrimaryHover',
|
|
@@ -124,29 +123,37 @@ var notificationAppearanceWarning = {
|
|
|
124
123
|
},
|
|
125
124
|
};
|
|
126
125
|
|
|
127
|
-
|
|
126
|
+
const notificationAppearance = {
|
|
127
|
+
...notificationAppearanceDefault,
|
|
128
|
+
...notificationAppearanceSize,
|
|
129
|
+
...notificationAppearanceStyle,
|
|
130
|
+
...notificationAppearanceError,
|
|
131
|
+
...notificationAppearanceInfo,
|
|
132
|
+
...notificationAppearanceSuccess,
|
|
133
|
+
...notificationAppearanceWarning,
|
|
134
|
+
};
|
|
128
135
|
|
|
129
|
-
|
|
136
|
+
const notificationConfig = {
|
|
130
137
|
appearance: notificationAppearance,
|
|
131
|
-
setAppearance:
|
|
138
|
+
setAppearance: (appearanceConfig) => {
|
|
132
139
|
notificationConfig.appearance = appearanceConfig;
|
|
133
140
|
},
|
|
134
141
|
};
|
|
135
142
|
function Notification(props) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
const { id, dataTestId, dataTour, className, appearance, title, desc, before, after, close, isSkeleton, onClickClose, } = props;
|
|
144
|
+
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, notificationConfig);
|
|
145
|
+
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
146
|
+
const { fillClass, titleTextColor, titleTextSize, descTextColor, descTextSize, elevationClass, sizeClass, widthClass, closeIcon, closeIconFill, closeIconFillIcon, closeIconFillSize, closeIconShape, closeIconSize, closeIconSrc, } = propsGenerator;
|
|
140
147
|
// @ts-expect-error
|
|
141
|
-
|
|
142
|
-
return (jsxRuntime.jsxs("div", { className: clsx('notification__item', elevationClass &&
|
|
148
|
+
const { styles: notificationStyles } = useStyles.useStyles(props);
|
|
149
|
+
return (jsxRuntime.jsxs("div", { className: clsx('notification__item', elevationClass && `elevation_${elevationClass}`, sizeClass && `notification__item_set_${sizeClass}`, widthClass && `width_${widthClass}`, fillClass && `fill_${fillClass}`, isSkeleton && `notification__item_skeleton`), "data-test-id": dataTestId, "data-tour": dataTour, style: notificationStyles, children: [before, jsxRuntime.jsxs("div", { className: clsx(className, 'notification__item-wrapper'), children: [title && (jsxRuntime.jsx(Text.Text, { className: "notification__item-title", size: titleTextSize, textColor: titleTextColor, children: title })), desc && (jsxRuntime.jsx(Text.Text, { className: "notification__item-text", size: descTextSize, textColor: descTextColor, children: desc })), close && (closeIcon || closeIconSrc) && (jsxRuntime.jsx(Icon.Icon, { className: clsx('notification__item-close', 'cursor_type_pointer'), fill: closeIconFill, fillSize: closeIconFillSize, iconFill: closeIconFillIcon, iconSize: closeIconSize, imageSrc: closeIconSrc, shape: closeIconShape, SvgImage: closeIcon, onClick: () => onClickClose && onClickClose(id) }))] }), after] }));
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
function NotificationWrapper(props) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return (jsxRuntime.jsx("div", { className: clsx('notification', className), children: jsxRuntime.jsx("div", { className: "notification__wrapper", children: notifications.map(
|
|
153
|
+
const notifications = Notifications.useNotifications();
|
|
154
|
+
const { hideNotifications } = Notifications.useNotificationsAPI();
|
|
155
|
+
const { className, close } = props;
|
|
156
|
+
return (jsxRuntime.jsx("div", { className: clsx('notification', className), children: jsxRuntime.jsx("div", { className: "notification__wrapper", children: notifications.map((notification, i) => (jsxRuntime.jsx(Notification, { id: notification.id, appearance: notification.appearance, title: notification.title, status: notification.status, text: notification.text, close: close, onClickClose: hideNotifications }, i))) }) }));
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
exports.Notification = Notification;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var Overlay = require('../../
|
|
3
|
+
var Overlay = require('../../Overlay_cjs_tGA2fU43.js');
|
|
4
4
|
require('react/jsx-runtime');
|
|
5
5
|
require('clsx');
|
|
6
6
|
require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
7
|
-
require('../../tslib.es6_cjs_CCZ3TN_7.js');
|
|
8
7
|
require('react');
|
|
9
8
|
require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
10
9
|
require('lodash/camelCase');
|
|
@@ -8,10 +8,9 @@ var ReactPaginate = require('react-paginate');
|
|
|
8
8
|
var useAppearanceConfig = require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
9
9
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
10
10
|
var useStyles = require('../hooks/useStyles/useStyles.js');
|
|
11
|
-
var DropdownItem = require('../../
|
|
12
|
-
var Icon = require('../../
|
|
13
|
-
var Text = require('../../
|
|
14
|
-
var tslib_es6 = require('../../tslib.es6_cjs_CCZ3TN_7.js');
|
|
11
|
+
var DropdownItem = require('../../DropdownItem_cjs_vHuzXW9M.js');
|
|
12
|
+
var Icon = require('../../Icon_cjs_BVLGzj7Y.js');
|
|
13
|
+
var Text = require('../../Text_cjs_BDTjOTVB.js');
|
|
15
14
|
var _default = require('@itcase/icons/default');
|
|
16
15
|
require('lodash/camelCase');
|
|
17
16
|
require('lodash/castArray');
|
|
@@ -26,13 +25,13 @@ require('../utils/setViewportProperty.js');
|
|
|
26
25
|
require('../hooks.js');
|
|
27
26
|
require('../hooks/useStyles/styleAttributes.js');
|
|
28
27
|
require('lodash/maxBy');
|
|
29
|
-
require('../../
|
|
28
|
+
require('../../Divider_cjs_DrmV2ezS.js');
|
|
30
29
|
require('react-inlinesvg');
|
|
31
30
|
require('../hoc/urlWithAssetPrefix.js');
|
|
32
31
|
require('../context/UrlAssetPrefix.js');
|
|
33
|
-
require('../../
|
|
32
|
+
require('../../Link_cjs_qKXVfU8e.js');
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
const paginationAppearanceAccent = {
|
|
36
35
|
accent: {
|
|
37
36
|
fill: 'accentPrimary',
|
|
38
37
|
fillHover: 'accentPrimaryHover',
|
|
@@ -74,7 +73,7 @@ var paginationAppearanceAccent = {
|
|
|
74
73
|
},
|
|
75
74
|
};
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
const paginationAppearanceSize = {
|
|
78
77
|
sizeL: {
|
|
79
78
|
size: 'l',
|
|
80
79
|
labelTextSize: 'l',
|
|
@@ -151,7 +150,7 @@ var paginationAppearanceSize = {
|
|
|
151
150
|
},
|
|
152
151
|
};
|
|
153
152
|
|
|
154
|
-
|
|
153
|
+
const paginationAppearanceStyle = {
|
|
155
154
|
solid: {
|
|
156
155
|
borderColor: 'none',
|
|
157
156
|
},
|
|
@@ -165,7 +164,7 @@ var paginationAppearanceStyle = {
|
|
|
165
164
|
},
|
|
166
165
|
};
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
const paginationAppearanceSurface = {
|
|
169
168
|
surfacePrimary: {
|
|
170
169
|
fill: 'surfacePrimary',
|
|
171
170
|
fillHover: 'surfaceTertiary',
|
|
@@ -196,57 +195,62 @@ var paginationAppearanceSurface = {
|
|
|
196
195
|
},
|
|
197
196
|
};
|
|
198
197
|
|
|
199
|
-
|
|
198
|
+
const paginationAppearance = {
|
|
199
|
+
...paginationAppearanceSurface,
|
|
200
|
+
...paginationAppearanceAccent,
|
|
201
|
+
...paginationAppearanceSize,
|
|
202
|
+
...paginationAppearanceStyle,
|
|
203
|
+
};
|
|
200
204
|
|
|
201
|
-
|
|
205
|
+
const paginationConfig = {
|
|
202
206
|
appearance: paginationAppearance,
|
|
203
|
-
setAppearance:
|
|
207
|
+
setAppearance: (appearanceConfig) => {
|
|
204
208
|
paginationConfig.appearance = appearanceConfig;
|
|
205
209
|
},
|
|
206
210
|
};
|
|
207
211
|
function Pagination(props) {
|
|
208
|
-
|
|
212
|
+
const { className, appearance, allItemsCount = 0, dataTestId, dataTour, pageCountArray = [10, 20, 50, 100], pageCountDesc = 'кол-во строк', pageCountDropdownItemDividerDirection, pageNumber = 0, perPageCount = 0, isPageCount, isDisabled, isPageCountDropdownReversed = false, isPageLabelBuilder, isSkeleton, onChangePage, onChangePerPageCount,
|
|
209
213
|
/**
|
|
210
214
|
* @deprecated The method should not be used
|
|
211
215
|
*/
|
|
212
|
-
onPageChange
|
|
216
|
+
onPageChange,
|
|
213
217
|
/**
|
|
214
218
|
* @deprecated The method should not be used
|
|
215
219
|
*/
|
|
216
|
-
onPerPageCountChange = props
|
|
217
|
-
|
|
220
|
+
onPerPageCountChange, } = props;
|
|
221
|
+
const _onChangePage = React.useMemo(() => {
|
|
218
222
|
if (onPageChange) {
|
|
219
223
|
console.warn('@itcase/ui Pagination warning: "onPageChange" is deprecated, use "onChangePage" instead.');
|
|
220
224
|
return onPageChange;
|
|
221
225
|
}
|
|
222
226
|
return onChangePage;
|
|
223
227
|
}, [onChangePage, onPageChange]);
|
|
224
|
-
|
|
228
|
+
const _onChangePerPageCount = React.useMemo(() => {
|
|
225
229
|
if (onPerPageCountChange) {
|
|
226
230
|
console.warn('@itcase/ui Pagination warning: "onPerPageCountChange" is deprecated, use "onChangePerPageCount" instead.');
|
|
227
231
|
return onPerPageCountChange;
|
|
228
232
|
}
|
|
229
233
|
return onChangePerPageCount;
|
|
230
234
|
}, [onChangePerPageCount, onPerPageCountChange]);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
const [isOpenDropdown, setIsOpenDropdown] = React.useState(false);
|
|
236
|
+
const [activeDropdownItem, setActiveDropdownItem] = React.useState(perPageCount);
|
|
237
|
+
const pageCountDropdownArray = React.useMemo(() => {
|
|
234
238
|
return isPageCountDropdownReversed
|
|
235
|
-
? pageCountArray
|
|
239
|
+
? pageCountArray?.reverse()
|
|
236
240
|
: pageCountArray;
|
|
237
241
|
}, [isPageCountDropdownReversed, pageCountArray]);
|
|
238
242
|
// Toggle command menu
|
|
239
|
-
|
|
240
|
-
setIsOpenDropdown(
|
|
243
|
+
const onClickCommandMenuButton = React.useCallback(() => {
|
|
244
|
+
setIsOpenDropdown((state) => !state);
|
|
241
245
|
}, []);
|
|
242
|
-
|
|
246
|
+
const handleDropdownItemClick = React.useCallback((event, item) => {
|
|
243
247
|
event.stopPropagation();
|
|
244
248
|
_onChangePerPageCount && _onChangePerPageCount(item);
|
|
245
249
|
setActiveDropdownItem(item);
|
|
246
250
|
setIsOpenDropdown(false);
|
|
247
251
|
}, [_onChangePerPageCount]);
|
|
248
252
|
// Calculate count of pages for all items
|
|
249
|
-
|
|
253
|
+
const paginationPagesCount = React.useMemo(() => {
|
|
250
254
|
if (allItemsCount && allItemsCount > 0) {
|
|
251
255
|
// Round up. "perPageCount" may be is a query params "limit"
|
|
252
256
|
return ceil(allItemsCount / perPageCount);
|
|
@@ -254,29 +258,27 @@ function Pagination(props) {
|
|
|
254
258
|
return 0;
|
|
255
259
|
}, [allItemsCount, perPageCount]);
|
|
256
260
|
// Index for pagination state
|
|
257
|
-
|
|
258
|
-
|
|
261
|
+
const paginationPageIndex = React.useMemo(() => {
|
|
262
|
+
const intPageNumber = parseInt(pageNumber);
|
|
259
263
|
// For pagination need index of page, not number
|
|
260
264
|
if (!isNaN(intPageNumber) && intPageNumber > 1) {
|
|
261
265
|
return intPageNumber - 1;
|
|
262
266
|
}
|
|
263
267
|
return 0;
|
|
264
268
|
}, [pageNumber]);
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
return (jsxRuntime.jsxs("div", { className: clsx('pagination', sizeClass &&
|
|
270
|
-
|
|
269
|
+
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, paginationConfig, isDisabled);
|
|
270
|
+
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
271
|
+
const { justifyContentClass, fillActiveClass, fillActiveHoverClass, fillClass, fillHoverClass, fillInputClass, fillInputHoverClass, textColorClass, textSizeClass, builderIcon, builderIconFill, builderIconFillIcon, builderIconFillSize, builderIconSize, marginPagesDisplayed, nextIcon, nextIconFill, nextIconFillIcon, nextIconFillSize, nextIconSize, pageCountDescTextColor, pageCountDescTextSize, pageCountDropdownAlignment, pageCountDropdownElevation, pageCountDropdownFill, pageCountDropdownItemDividerFill, pageCountDropdownItemDividerSize, pageCountDropdownItemFill, pageCountDropdownItemFillActive, pageCountDropdownItemFillActiveHover, pageCountDropdownItemFillHover, pageCountDropdownItemLabelAlign, pageCountDropdownItemLabelColor, pageCountDropdownItemLabelColorActive, pageCountDropdownItemLabelColorActiveHover, pageCountDropdownItemLabelColorHover, pageCountDropdownItemLabelSize, pageCountDropdownItemLabelWrap, pageCountDropdownItemShowDivider, pageCountDropdownItemSize, pageCountDropdownItemWidth, pageCountDropdownShape, pageCountInputIcon, pageCountInputIconColor, pageCountInputIconFillSize, pageCountInputIconSrc, pageCountInputTextColor, pageCountInputTextSize, pageRangeDisplayed, previousIcon, previousIconFill, previousIconFillIcon, previousIconFillSize, previousIconSize, sizeClass, } = propsGenerator;
|
|
272
|
+
const { styles: paginationStyles } = useStyles.useStyles(props);
|
|
273
|
+
return (allItemsCount > perPageCount && (jsxRuntime.jsxs("div", { className: clsx('pagination', sizeClass && `pagination_size_${sizeClass}`, isSkeleton && `pagination_skeleton`), "data-test-id": dataTestId, "data-tour": dataTour, style: paginationStyles, children: [jsxRuntime.jsx(ReactPaginate, { activeClassName: clsx('pagination__item_state_active cursor_type_default', fillActiveClass && `fill_active_${fillActiveClass}`, fillHoverClass && `fill_hover_${fillHoverClass}`), activeLinkClassName: "pagination__item-link_state_active", breakClassName: "pagination__item pagination__item_break", breakLabel: "...", breakLinkClassName: "pagination__item-link", containerClassName: clsx(className, 'pagination__container', justifyContentClass &&
|
|
274
|
+
`pagination_justify-content_${justifyContentClass}`), disabledClassName: "pagination__item_state_disabled cursor_type_default", disabledLinkClassName: "pagination__item_state_disabled",
|
|
271
275
|
// pages settings
|
|
272
|
-
forcePage: paginationPageIndex, marginPagesDisplayed: marginPagesDisplayed, nextClassName: clsx('pagination__item pagination__item_next', sizeClass &&
|
|
276
|
+
forcePage: paginationPageIndex, marginPagesDisplayed: marginPagesDisplayed, nextClassName: clsx('pagination__item pagination__item_next', sizeClass && `pagination__item_size_${sizeClass}`, fillClass && `fill_${fillClass}`),
|
|
273
277
|
// next button
|
|
274
|
-
nextLabel: jsxRuntime.jsx(Icon.Icon, { fill: nextIconFill, fillSize: nextIconFillSize, iconFill: nextIconFillIcon, iconSize: nextIconSize, shape: "circular", SvgImage: nextIcon }), nextLinkClassName: "pagination__item-link", pageClassName: clsx('pagination__item', sizeClass &&
|
|
275
|
-
(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
pageCountDropdownItemShowDivider, isActive: false, onClick: function (event) { return handleDropdownItemClick(event, item); } }, item));
|
|
279
|
-
}) })] })] }))] }));
|
|
278
|
+
nextLabel: jsxRuntime.jsx(Icon.Icon, { fill: nextIconFill, fillSize: nextIconFillSize, iconFill: nextIconFillIcon, iconSize: nextIconSize, shape: "circular", SvgImage: nextIcon }), nextLinkClassName: "pagination__item-link", pageClassName: clsx('pagination__item', sizeClass && `pagination__item_size_${sizeClass}`, fillClass && `fill_${fillClass}`), pageCount: paginationPagesCount, pageLabelBuilder: isPageLabelBuilder &&
|
|
279
|
+
(() => (jsxRuntime.jsx(Icon.Icon, { fill: builderIconFill, fillSize: builderIconFillSize, iconFill: builderIconFillIcon, iconSize: builderIconSize, shape: "circular", SvgImage: builderIcon }))), pageLinkClassName: clsx('pagination__item-link', textSizeClass && `pagination__item-link_size_${textSizeClass}`, textColorClass && 'text', textColorClass && `text-color_${textColorClass}`), pageRangeDisplayed: pageRangeDisplayed, previousClassName: clsx('pagination__item pagination__item_previous', sizeClass && `pagination__item_size_${sizeClass}`, fillClass && `fill_${fillClass}`), previousLabel: jsxRuntime.jsx(Icon.Icon, { fill: previousIconFill, fillSize: previousIconFillSize, iconFill: previousIconFillIcon, iconSize: previousIconSize, shape: "circular", SvgImage: previousIcon }), previousLinkClassName: "pagination__item-link", onPageChange: _onChangePage }), isPageCount && (jsxRuntime.jsxs("div", { className: clsx(className, 'pagination__count'), children: [jsxRuntime.jsx(Text.Text, { className: "pagination__count-text", size: pageCountDescTextSize, textColor: pageCountDescTextColor, children: pageCountDesc }), jsxRuntime.jsxs("div", { className: clsx('pagination__input', 'cursor_type_pointer', fillClass && `fill_${fillInputClass}`, fillHoverClass && `fill_hover_${fillInputHoverClass}`), onClick: onClickCommandMenuButton, children: [jsxRuntime.jsx(Text.Text, { size: pageCountInputTextSize, textColor: pageCountInputTextColor, children: activeDropdownItem }), jsxRuntime.jsx(Icon.Icon, { fillSize: pageCountInputIconFillSize, iconFill: pageCountInputIconColor, imageSrc: pageCountInputIconSrc, SvgImage: pageCountInputIcon }), jsxRuntime.jsx(DropdownItem.Dropdown, { className: "pagination__dropdown", alignment: pageCountDropdownAlignment, fill: pageCountDropdownFill, elevation: pageCountDropdownElevation, setIsOpen: setIsOpenDropdown, shape: pageCountDropdownShape, isOpen: isOpenDropdown, children: pageCountDropdownArray.map((item, index) => activeDropdownItem === item ? (jsxRuntime.jsx(DropdownItem.DropdownItem, { width: pageCountDropdownItemWidth, size: pageCountDropdownItemSize, fill: pageCountDropdownItemFill, fillActive: pageCountDropdownItemFillActive, fillActiveHover: pageCountDropdownItemFillActiveHover, fillHover: pageCountDropdownItemFillHover, label: item.toString(), labelTextAlign: pageCountDropdownItemLabelAlign, labelTextColor: pageCountDropdownItemLabelColor, labelTextColorActive: pageCountDropdownItemLabelColorActive, labelTextColorActiveHover: pageCountDropdownItemLabelColorActiveHover, labelTextColorHover: pageCountDropdownItemLabelColorHover, labelTextSize: pageCountDropdownItemLabelSize, labelTextWrap: pageCountDropdownItemLabelWrap, dividerDirection: pageCountDropdownItemDividerDirection, dividerFill: pageCountDropdownItemDividerFill, dividerSize: pageCountDropdownItemDividerSize, showDivider: index < pageCountArray.length - 1 &&
|
|
280
|
+
pageCountDropdownItemShowDivider, isActive: true, onClick: (event) => handleDropdownItemClick(event, item) }, item)) : (jsxRuntime.jsx(DropdownItem.DropdownItem, { width: pageCountDropdownItemWidth, size: pageCountDropdownItemSize, fill: pageCountDropdownItemFill, fillHover: pageCountDropdownItemFillHover, label: item.toString(), labelTextAlign: pageCountDropdownItemLabelAlign, labelTextColor: pageCountDropdownItemLabelColor, labelTextColorHover: pageCountDropdownItemLabelColorHover, labelTextSize: pageCountDropdownItemLabelSize, labelTextWrap: pageCountDropdownItemLabelWrap, dividerDirection: pageCountDropdownItemDividerDirection, dividerFill: pageCountDropdownItemDividerFill, dividerSize: pageCountDropdownItemDividerSize, showDivider: index < pageCountArray.length - 1 &&
|
|
281
|
+
pageCountDropdownItemShowDivider, isActive: false, onClick: (event) => handleDropdownItemClick(event, item) }, item))) })] })] }))] })));
|
|
280
282
|
}
|
|
281
283
|
|
|
282
284
|
exports.Pagination = Pagination;
|
|
@@ -4,8 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
var useAppearanceConfig = require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
6
6
|
var useDevicePropsGenerator = require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
7
|
-
var Text = require('../../
|
|
8
|
-
var tslib_es6 = require('../../tslib.es6_cjs_CCZ3TN_7.js');
|
|
7
|
+
var Text = require('../../Text_cjs_BDTjOTVB.js');
|
|
9
8
|
require('react');
|
|
10
9
|
require('lodash/camelCase');
|
|
11
10
|
require('lodash/castArray');
|
|
@@ -22,7 +21,7 @@ require('../hooks/useStyles/styleAttributes.js');
|
|
|
22
21
|
require('../hooks/useStyles/useStyles.js');
|
|
23
22
|
require('lodash/maxBy');
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
const radioAppearanceDefault = {
|
|
26
25
|
defaultPrimary: {
|
|
27
26
|
fill: 'surfaceSecondary',
|
|
28
27
|
fillCheckmark: 'surfaceQuaternary',
|
|
@@ -40,7 +39,7 @@ var radioAppearanceDefault = {
|
|
|
40
39
|
},
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
const radioAppearanceDisabled = {
|
|
44
43
|
disabledPrimary: {
|
|
45
44
|
fill: 'surfaceDisabled',
|
|
46
45
|
fillCheckmark: 'surfaceQuaternary',
|
|
@@ -54,7 +53,7 @@ var radioAppearanceDisabled = {
|
|
|
54
53
|
},
|
|
55
54
|
};
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
const radioAppearanceError = {
|
|
58
57
|
errorPrimary: {
|
|
59
58
|
fill: 'errorTertiary',
|
|
60
59
|
fillCheckmark: 'errorPrimary',
|
|
@@ -68,7 +67,7 @@ var radioAppearanceError = {
|
|
|
68
67
|
},
|
|
69
68
|
};
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
const radioAppearanceRequire = {
|
|
72
71
|
requirePrimary: {
|
|
73
72
|
fill: 'warningTertiary',
|
|
74
73
|
fillCheckmark: 'warningPrimary',
|
|
@@ -82,7 +81,7 @@ var radioAppearanceRequire = {
|
|
|
82
81
|
},
|
|
83
82
|
};
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
const radioAppearanceShape = {
|
|
86
85
|
circular: {
|
|
87
86
|
shape: 'circular',
|
|
88
87
|
},
|
|
@@ -107,7 +106,7 @@ var radioAppearanceShape = {
|
|
|
107
106
|
},
|
|
108
107
|
};
|
|
109
108
|
|
|
110
|
-
|
|
109
|
+
const radioAppearanceSize = {
|
|
111
110
|
sizeM: {
|
|
112
111
|
size: 'm',
|
|
113
112
|
labelTextSize: 's',
|
|
@@ -125,7 +124,7 @@ var radioAppearanceSize = {
|
|
|
125
124
|
},
|
|
126
125
|
};
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
const radioAppearanceStyle = {
|
|
129
128
|
solid: {
|
|
130
129
|
fill: 'none',
|
|
131
130
|
fillHover: 'none',
|
|
@@ -149,7 +148,7 @@ var radioAppearanceStyle = {
|
|
|
149
148
|
},
|
|
150
149
|
};
|
|
151
150
|
|
|
152
|
-
|
|
151
|
+
const radioAppearanceSuccess = {
|
|
153
152
|
successPrimary: {
|
|
154
153
|
fill: 'successTertiary',
|
|
155
154
|
fillCheckmark: 'accentItemSecondary',
|
|
@@ -163,33 +162,42 @@ var radioAppearanceSuccess = {
|
|
|
163
162
|
},
|
|
164
163
|
};
|
|
165
164
|
|
|
166
|
-
|
|
165
|
+
const radioAppearance = {
|
|
166
|
+
...radioAppearanceDefault,
|
|
167
|
+
...radioAppearanceError,
|
|
168
|
+
...radioAppearanceSuccess,
|
|
169
|
+
...radioAppearanceRequire,
|
|
170
|
+
...radioAppearanceDisabled,
|
|
171
|
+
...radioAppearanceSize,
|
|
172
|
+
...radioAppearanceShape,
|
|
173
|
+
...radioAppearanceStyle,
|
|
174
|
+
};
|
|
167
175
|
|
|
168
|
-
|
|
176
|
+
const radioConfig = {
|
|
169
177
|
appearance: radioAppearance,
|
|
170
|
-
setAppearance:
|
|
178
|
+
setAppearance: (appearanceConfig) => {
|
|
171
179
|
radioConfig.appearance = appearanceConfig;
|
|
172
180
|
},
|
|
173
181
|
};
|
|
174
182
|
function Radio(props) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return (jsxRuntime.jsxs(Tag, { className: clsx(className, 'radio', fillClass &&
|
|
180
|
-
? fillRadioClass &&
|
|
181
|
-
: fillRadioActiveClass &&
|
|
182
|
-
? fillRadioHoverClass &&
|
|
183
|
+
const { id, className, appearance, label, desc, isDisabled, checked, tag: Tag = 'label', value, isActive, isSkeleton, onChange, } = props;
|
|
184
|
+
const appearanceConfig = useAppearanceConfig.useAppearanceConfig(appearance, radioConfig, isDisabled);
|
|
185
|
+
const propsGenerator = useDevicePropsGenerator.useDevicePropsGenerator(props, appearanceConfig);
|
|
186
|
+
const { fillCheckmarkClass, fillClass, fillHoverClass, fillRadioActiveClass, fillRadioActiveHoverClass, fillRadioClass, fillRadioHoverClass, labelTextColor, labelTextSize, labelTextWeight, descTextColor, descTextSize, descTextWeight, borderRadioColorClass, borderRadioColorActiveClass, borderRadioColorActiveHoverClass, borderRadioColorHoverClass, shapeClass, shapeStrengthClass, sizeClass, } = propsGenerator;
|
|
187
|
+
return (jsxRuntime.jsxs(Tag, { className: clsx(className, 'radio', fillClass && `fill_${fillClass}`, fillHoverClass && `fill_${fillHoverClass}`, isSkeleton && 'radio_skeleton', sizeClass && `radio_size_${sizeClass}`, !checked || !isActive
|
|
188
|
+
? fillRadioClass && `radio_fill_${fillRadioClass}`
|
|
189
|
+
: fillRadioActiveClass && `radio_fill_active_${fillRadioActiveClass}`, !checked || !isActive
|
|
190
|
+
? fillRadioHoverClass && `radio_fill_hover_${fillRadioHoverClass}`
|
|
183
191
|
: fillRadioActiveHoverClass &&
|
|
184
|
-
|
|
192
|
+
`radio_fill_active_hover_${fillRadioActiveHoverClass}`, !checked || !isActive
|
|
185
193
|
? borderRadioColorClass &&
|
|
186
|
-
|
|
194
|
+
`radio_border-color_${borderRadioColorClass}`
|
|
187
195
|
: borderRadioColorActiveClass &&
|
|
188
|
-
|
|
196
|
+
`radio_border-color_active_${borderRadioColorActiveClass}`, !checked || !isActive
|
|
189
197
|
? borderRadioColorHoverClass &&
|
|
190
|
-
|
|
198
|
+
`radio_border-color_hover_${borderRadioColorHoverClass}`
|
|
191
199
|
: borderRadioColorActiveHoverClass &&
|
|
192
|
-
|
|
200
|
+
`radio_border-color_active_hover_${borderRadioColorActiveHoverClass}`), htmlFor: id, children: [jsxRuntime.jsxs("div", { className: clsx('radio__item'), children: [jsxRuntime.jsx("input", { id: String(id), className: "radio__input", type: "radio", disabled: isDisabled && 'disabled', checked: checked, value: value, onChange: onChange }), jsxRuntime.jsx("div", { className: clsx('radio__state', shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`), children: "\u00A0" }), jsxRuntime.jsx("div", { className: clsx('radio__state-checkmark', checked && fillCheckmarkClass && `fill_${fillCheckmarkClass}`), children: "\u00A0" })] }), label && (jsxRuntime.jsx(Text.Text, { className: "radio__label", size: labelTextSize, textColor: labelTextColor, textWeight: labelTextWeight, children: label })), desc && (jsxRuntime.jsx(Text.Text, { className: "radio__desc", size: descTextSize, textColor: descTextColor, textWeight: descTextWeight, children: desc }))] }));
|
|
193
201
|
}
|
|
194
202
|
|
|
195
203
|
exports.Radio = Radio;
|