@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
package/dist/components/Modal.js
CHANGED
|
@@ -5,11 +5,10 @@ import ReactDOM from 'react-dom';
|
|
|
5
5
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
6
6
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
7
7
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
8
|
-
import { b as Title, I as Icon } from '../
|
|
9
|
-
import { O as Overlay } from '../
|
|
10
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
8
|
+
import { b as Title, I as Icon } from '../Icon_es_DkVkzTha.js';
|
|
9
|
+
import { O as Overlay } from '../Overlay_es_BS7OTFoy.js';
|
|
11
10
|
import { icons24, icons32, icons40 } from '@itcase/icons/default';
|
|
12
|
-
import { L as Loader } from '../
|
|
11
|
+
import { L as Loader } from '../Loader_es_CmSggwbR.js';
|
|
13
12
|
import 'lodash/camelCase';
|
|
14
13
|
import 'lodash/castArray';
|
|
15
14
|
import 'lodash/upperFirst';
|
|
@@ -26,10 +25,10 @@ import 'lodash/maxBy';
|
|
|
26
25
|
import 'react-inlinesvg';
|
|
27
26
|
import '../hoc/urlWithAssetPrefix.js';
|
|
28
27
|
import '../context/UrlAssetPrefix.js';
|
|
29
|
-
import '../
|
|
30
|
-
import '../
|
|
28
|
+
import '../Link_es_P2b6ya7P.js';
|
|
29
|
+
import '../Text_es_CnymlElo.js';
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
const modalAppearanceShape = {
|
|
33
32
|
circular: {
|
|
34
33
|
shape: 'circular',
|
|
35
34
|
},
|
|
@@ -54,7 +53,7 @@ var modalAppearanceShape = {
|
|
|
54
53
|
},
|
|
55
54
|
};
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
const modalAppearanceSize = {
|
|
58
57
|
sizeXL: {
|
|
59
58
|
size: 'xl',
|
|
60
59
|
titleTextSize: 'h2',
|
|
@@ -81,7 +80,7 @@ var modalAppearanceSize = {
|
|
|
81
80
|
},
|
|
82
81
|
};
|
|
83
82
|
|
|
84
|
-
|
|
83
|
+
const modalAppearanceStyle = {
|
|
85
84
|
solid: {
|
|
86
85
|
borderColor: 'none',
|
|
87
86
|
},
|
|
@@ -95,7 +94,7 @@ var modalAppearanceStyle = {
|
|
|
95
94
|
},
|
|
96
95
|
};
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
const modalAppearanceSurface = {
|
|
99
98
|
surfacePrimary: {
|
|
100
99
|
fill: 'surfacePrimary',
|
|
101
100
|
borderColor: 'surfaceBorderPrimary',
|
|
@@ -103,43 +102,46 @@ var modalAppearanceSurface = {
|
|
|
103
102
|
},
|
|
104
103
|
};
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
const modalAppearance = {
|
|
106
|
+
...modalAppearanceSurface,
|
|
107
|
+
...modalAppearanceShape,
|
|
108
|
+
...modalAppearanceStyle,
|
|
109
|
+
...modalAppearanceSize,
|
|
110
|
+
};
|
|
107
111
|
|
|
108
|
-
|
|
112
|
+
const modalConfig = {
|
|
109
113
|
appearance: modalAppearance,
|
|
110
|
-
setAppearance:
|
|
114
|
+
setAppearance: (appearanceConfig) => {
|
|
111
115
|
modalConfig.appearance = appearanceConfig;
|
|
112
116
|
},
|
|
113
117
|
};
|
|
114
|
-
|
|
115
|
-
var _a;
|
|
116
|
-
if (className === void 0) { className = ''; }
|
|
118
|
+
const getOrCreateModalElement = (modalQuerySelector, className = '') => {
|
|
117
119
|
// prettier-ignore
|
|
118
|
-
|
|
120
|
+
const classList = className && typeof className === 'string'
|
|
119
121
|
? className.split(' ').filter(Boolean)
|
|
120
122
|
: [];
|
|
121
|
-
|
|
123
|
+
let modalElement = document.querySelector(modalQuerySelector);
|
|
122
124
|
if (!modalElement) {
|
|
123
125
|
// Add modal element into the DOM on mount.
|
|
124
126
|
modalElement = document.createElement('div');
|
|
125
127
|
modalElement.setAttribute('id', 'modal-global');
|
|
126
128
|
modalElement.classList.add('modal');
|
|
127
129
|
if (classList.length) {
|
|
128
|
-
|
|
130
|
+
modalElement.classList.add(...classList);
|
|
129
131
|
}
|
|
130
132
|
document.body.prepend(modalElement);
|
|
131
133
|
}
|
|
132
134
|
return modalElement;
|
|
133
135
|
};
|
|
134
136
|
// Modal component that is an abstraction around the portal API.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
const Modal = React.forwardRef(function Modal(props, ref) {
|
|
138
|
+
const { id, dataTestId, dataTour, className, appearance, title, contentClassName, modalQuerySelector = '#modal-global', scroll = false, stickyHeader = false, isCloseOnBlur = true, isOpen: initialIsOpen = false, isOverlay = true, isDisabled, isScrollOnOpen = true, isSetFocusOnOpen = true, isSkeleton, onClickOverlay, onCloseModal, onOpenModal, children, } = props;
|
|
137
139
|
// Query DOM element
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
const [modalElement, setModalElement] = useState(null);
|
|
141
|
+
const [isOpen, setIsOpen] = useState(initialIsOpen);
|
|
142
|
+
const modalContentRef = useRef(null);
|
|
141
143
|
// const modalOverlayRef = useRef(null)
|
|
142
|
-
|
|
144
|
+
const addModalProps = useCallback((element) => {
|
|
143
145
|
// Change class need in "useEffect"
|
|
144
146
|
if (isOpen) {
|
|
145
147
|
// Show modal
|
|
@@ -152,7 +154,7 @@ var Modal = React.forwardRef(function Modal(props, ref) {
|
|
|
152
154
|
// "setTimeout" in this implementation is needs for set focus on modal
|
|
153
155
|
// after "onMouseDown" event on button
|
|
154
156
|
if (isSetFocusOnOpen) {
|
|
155
|
-
setTimeout(
|
|
157
|
+
setTimeout(() => {
|
|
156
158
|
if (modalContentRef.current) {
|
|
157
159
|
modalContentRef.current.focus();
|
|
158
160
|
}
|
|
@@ -165,7 +167,7 @@ var Modal = React.forwardRef(function Modal(props, ref) {
|
|
|
165
167
|
}
|
|
166
168
|
}, [isOpen, isScrollOnOpen, isSetFocusOnOpen]);
|
|
167
169
|
// Show modal with children content
|
|
168
|
-
|
|
170
|
+
const openModal = useCallback(() => {
|
|
169
171
|
setIsOpen(true);
|
|
170
172
|
// Callback
|
|
171
173
|
if (typeof onOpenModal === 'function') {
|
|
@@ -186,10 +188,10 @@ var Modal = React.forwardRef(function Modal(props, ref) {
|
|
|
186
188
|
*/
|
|
187
189
|
}, [onOpenModal]);
|
|
188
190
|
// Hide modal and unmount children content
|
|
189
|
-
|
|
191
|
+
const closeModal = useCallback((event) => {
|
|
190
192
|
if (event) {
|
|
191
193
|
// prettier-ignore
|
|
192
|
-
|
|
194
|
+
const hasRelatedTarget = (event.relatedTarget &&
|
|
193
195
|
modalElement &&
|
|
194
196
|
modalElement.contains(event.relatedTarget));
|
|
195
197
|
if (hasRelatedTarget) {
|
|
@@ -200,31 +202,31 @@ var Modal = React.forwardRef(function Modal(props, ref) {
|
|
|
200
202
|
// Callback
|
|
201
203
|
onCloseModal && onCloseModal();
|
|
202
204
|
}, [modalElement, onCloseModal]);
|
|
203
|
-
useEffect(
|
|
205
|
+
useEffect(() => {
|
|
204
206
|
if (!modalElement) {
|
|
205
207
|
return;
|
|
206
208
|
}
|
|
207
209
|
addModalProps(modalElement);
|
|
208
210
|
}, [isOpen]); // eslint-disable-line
|
|
209
|
-
useLayoutEffect(
|
|
210
|
-
|
|
211
|
+
useLayoutEffect(() => {
|
|
212
|
+
const element = getOrCreateModalElement(modalQuerySelector, className);
|
|
211
213
|
setModalElement(element);
|
|
212
214
|
if (element) {
|
|
213
215
|
addModalProps(element);
|
|
214
216
|
}
|
|
215
217
|
}, [addModalProps, className, modalQuerySelector]);
|
|
216
218
|
// Save ref things
|
|
217
|
-
useImperativeHandle(ref,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
useImperativeHandle(ref, () => ({ modalElement, openModal, closeModal, isOpen }), [isOpen, openModal, closeModal, modalElement]);
|
|
220
|
+
const appearanceConfig = useAppearanceConfig(appearance, modalConfig, isDisabled);
|
|
221
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
222
|
+
const { fillClass, titleTextColor, titleTextColorHover, titleTextSize, titleTextTruncate, titleTextWeight, titleTextWidth, titleTextWrap, borderColorClass, borderTypeClass, borderWidthClass, elevationClass, overlayFill, overlayOpacity, shapeClass, shapeStrengthClass, sizeClass, closeIconAppearance, closeIconAppearanceSize, closeIconFillSize, closeIconImage, closeIconShape, closeIconSize, } = propsGenerator;
|
|
221
223
|
// @ts-expect-error
|
|
222
|
-
|
|
224
|
+
const { styles: modalStyles } = useStyles(props);
|
|
223
225
|
// Use a portal to render the children into the element
|
|
224
226
|
return (modalElement &&
|
|
225
227
|
ReactDOM.createPortal(
|
|
226
228
|
// Any valid React child: JSX, strings, arrays, etc.
|
|
227
|
-
isOpen ? (jsxs(React.Fragment, { children: [jsxs("div", { id: id, className: clsx('modal__content', contentClassName, fillClass &&
|
|
229
|
+
isOpen ? (jsxs(React.Fragment, { children: [jsxs("div", { id: id, className: clsx('modal__content', contentClassName, fillClass && `fill_${fillClass}`, borderWidthClass && `border-width_${borderWidthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderTypeClass && `border_type_${borderTypeClass}`, shapeClass && `shape_${shapeClass}`, sizeClass && `modal_size_${sizeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, borderColorClass && `border-color_${borderColorClass}`, borderWidthClass && `border-width_${borderWidthClass}`, borderTypeClass && `border_type_${borderTypeClass}`, elevationClass && `elevation_${elevationClass}`, scroll && !stickyHeader && `modal-scroll_${scroll}`, stickyHeader && 'modal-scroll_header_sticky', isSkeleton && 'modal_skeleton'), ref: modalContentRef, "data-test-id": dataTestId, "data-tour": dataTour, style: modalStyles, tabIndex: 0, onBlur: isCloseOnBlur ? closeModal : undefined, children: [(title || closeIconImage) && (jsxs("div", { className: clsx('modal__header'), children: [title && (jsx(Title, { className: "modal__title", width: titleTextWidth, size: titleTextSize, textColor: titleTextColor, textColorHover: titleTextColorHover, textTruncate: titleTextTruncate, textWeight: titleTextWeight, textWrap: titleTextWrap, children: title })), closeIconImage && (jsx("div", { className: "modal__close", onClick: closeModal, children: jsx(Icon, { appearance: `${closeIconAppearance} ${closeIconAppearanceSize}`, fillSize: closeIconFillSize, iconSize: closeIconSize, shape: closeIconShape, SvgImage: closeIconImage }) }))] })), jsx("div", { className: "modal__content-wrapper", children: children })] }), jsx(Overlay, { className: "modal__overlay",
|
|
228
230
|
// ref={modalOverlayRef}
|
|
229
231
|
fill: overlayFill, opacity: overlayOpacity, isOverlay: isOverlay, onClick: onClickOverlay })] })) : null,
|
|
230
232
|
// A DOM element
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
2
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import React, { useState, useCallback, useImperativeHandle } from 'react';
|
|
4
3
|
import clsx from 'clsx';
|
|
@@ -6,7 +5,7 @@ import { Sheet } from 'react-modal-sheet';
|
|
|
6
5
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
7
6
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
8
7
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
9
|
-
import { b as Title } from '../
|
|
8
|
+
import { b as Title } from '../Icon_es_DkVkzTha.js';
|
|
10
9
|
import 'lodash/camelCase';
|
|
11
10
|
import 'lodash/castArray';
|
|
12
11
|
import 'lodash/upperFirst';
|
|
@@ -23,10 +22,10 @@ import 'lodash/maxBy';
|
|
|
23
22
|
import 'react-inlinesvg';
|
|
24
23
|
import '../hoc/urlWithAssetPrefix.js';
|
|
25
24
|
import '../context/UrlAssetPrefix.js';
|
|
26
|
-
import '../
|
|
27
|
-
import '../
|
|
25
|
+
import '../Link_es_P2b6ya7P.js';
|
|
26
|
+
import '../Text_es_CnymlElo.js';
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
const modalSheetBottomAppearance = {
|
|
30
29
|
sizeL: {
|
|
31
30
|
size: 'l',
|
|
32
31
|
titleTextSize: 'h4',
|
|
@@ -40,31 +39,31 @@ var modalSheetBottomAppearance = {
|
|
|
40
39
|
},
|
|
41
40
|
};
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
const modalSheetBottomConfig = {
|
|
44
43
|
appearance: modalSheetBottomAppearance};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
const ModalSheetBottom = React.forwardRef(function Modal(props, ref) {
|
|
45
|
+
const { appearance, initialIsOpen, title, isDisabled, closeButton, onCloseModalSheetBottom, onOpenModalSheetBottom, children, } = props;
|
|
46
|
+
const [isOpen, setIsOpen] = useState(initialIsOpen);
|
|
47
|
+
const openModalSheetBottom = useCallback(() => {
|
|
49
48
|
setIsOpen(true);
|
|
50
49
|
onOpenModalSheetBottom && onOpenModalSheetBottom();
|
|
51
50
|
}, [onOpenModalSheetBottom]);
|
|
52
|
-
|
|
51
|
+
const closeModalSheetBottom = useCallback(() => {
|
|
53
52
|
setIsOpen(false);
|
|
54
53
|
onCloseModalSheetBottom && onCloseModalSheetBottom();
|
|
55
54
|
}, [onCloseModalSheetBottom]);
|
|
56
55
|
// Save ref things
|
|
57
|
-
useImperativeHandle(ref,
|
|
56
|
+
useImperativeHandle(ref, () => ({
|
|
58
57
|
openModal: openModalSheetBottom,
|
|
59
58
|
closeModal: closeModalSheetBottom,
|
|
60
59
|
isOpen: isOpen,
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
}), [isOpen, openModalSheetBottom, closeModalSheetBottom]);
|
|
61
|
+
const appearanceConfig = useAppearanceConfig(appearance, modalSheetBottomConfig, isDisabled);
|
|
62
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
63
|
+
const { titleTextColor, titleTextColorHover, titleTextSize, titleTextTruncate, titleTextWeight, titleTextWidth, titleTextWrap, zeroPadding, } = propsGenerator;
|
|
65
64
|
// @ts-expect-error
|
|
66
|
-
|
|
67
|
-
return (jsxs(Sheet,
|
|
65
|
+
const { styles } = useStyles(props);
|
|
66
|
+
return (jsxs(Sheet, { className: "modal-sheet-bottom", isOpen: isOpen, onClose: closeModalSheetBottom, ...props, children: [jsxs(Sheet.Container, { className: "modal-sheet-bottom__container", style: styles, children: [jsx(Sheet.Header, { className: "modal-sheet-bottom__header", children: closeButton && (jsx("div", { className: "modal-sheet-bottom__close", onClick: closeModalSheetBottom, children: closeButton })) }), jsx(Sheet.Content, { className: "modal-sheet-bottom__content", children: jsx(Sheet.Scroller, { autoPadding: true, children: jsxs("div", { className: clsx('modal-sheet-bottom__content-wrapper', zeroPadding && 'modal-sheet-bottom__content-reset-padding'), children: [title && (jsx(Title, { className: "modal__title", width: titleTextWidth, size: titleTextSize, textColor: titleTextColor, textColorHover: titleTextColorHover, textTruncate: titleTextTruncate, textWeight: titleTextWeight, textWrap: titleTextWrap, children: title })), children] }) }) })] }), jsx(Sheet.Backdrop, { className: "modal-sheet-bottom__backdrop", onClick: closeModalSheetBottom })] }));
|
|
68
67
|
});
|
|
69
68
|
|
|
70
69
|
export { ModalSheetBottom, modalSheetBottomAppearance };
|
|
@@ -3,9 +3,8 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useAppearanceConfig } from '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
4
4
|
import { useDevicePropsGenerator } from '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
5
5
|
import { useStyles } from '../hooks/useStyles/useStyles.js';
|
|
6
|
-
import { I as Icon } from '../
|
|
7
|
-
import { T as Text } from '../
|
|
8
|
-
import { _ as __assign } from '../tslib.es6_es_Bwu1Cn-t.js';
|
|
6
|
+
import { I as Icon } from '../Icon_es_DkVkzTha.js';
|
|
7
|
+
import { T as Text } from '../Text_es_CnymlElo.js';
|
|
9
8
|
import { icons20 } from '@itcase/icons/default';
|
|
10
9
|
import { useNotifications, useNotificationsAPI } from '../context/Notifications.js';
|
|
11
10
|
import '../context/UIContext.js';
|
|
@@ -24,9 +23,9 @@ import 'lodash/maxBy';
|
|
|
24
23
|
import 'react-inlinesvg';
|
|
25
24
|
import '../hoc/urlWithAssetPrefix.js';
|
|
26
25
|
import '../context/UrlAssetPrefix.js';
|
|
27
|
-
import '../
|
|
26
|
+
import '../Link_es_P2b6ya7P.js';
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
const notificationAppearanceDefault = {
|
|
30
29
|
defaultPrimary: {
|
|
31
30
|
fill: 'surfacePrimary',
|
|
32
31
|
fillHover: 'surfacePrimaryHover',
|
|
@@ -42,7 +41,7 @@ var notificationAppearanceDefault = {
|
|
|
42
41
|
},
|
|
43
42
|
};
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
const notificationAppearanceError = {
|
|
46
45
|
errorPrimary: {
|
|
47
46
|
fill: 'errorPrimary',
|
|
48
47
|
fillHover: 'errorPrimaryHover',
|
|
@@ -58,7 +57,7 @@ var notificationAppearanceError = {
|
|
|
58
57
|
},
|
|
59
58
|
};
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
const notificationAppearanceInfo = {
|
|
62
61
|
infoPrimary: {
|
|
63
62
|
fill: 'infoPrimary',
|
|
64
63
|
fillHover: 'infoPrimaryHover',
|
|
@@ -74,9 +73,9 @@ var notificationAppearanceInfo = {
|
|
|
74
73
|
},
|
|
75
74
|
};
|
|
76
75
|
|
|
77
|
-
|
|
76
|
+
const notificationAppearanceSize = {};
|
|
78
77
|
|
|
79
|
-
|
|
78
|
+
const notificationAppearanceStyle = {
|
|
80
79
|
solid: {
|
|
81
80
|
borderColor: 'none',
|
|
82
81
|
},
|
|
@@ -90,7 +89,7 @@ var notificationAppearanceStyle = {
|
|
|
90
89
|
},
|
|
91
90
|
};
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
const notificationAppearanceSuccess = {
|
|
94
93
|
successPrimary: {
|
|
95
94
|
fill: 'successPrimary',
|
|
96
95
|
fillHover: 'successPrimaryHover',
|
|
@@ -106,7 +105,7 @@ var notificationAppearanceSuccess = {
|
|
|
106
105
|
},
|
|
107
106
|
};
|
|
108
107
|
|
|
109
|
-
|
|
108
|
+
const notificationAppearanceWarning = {
|
|
110
109
|
warningPrimary: {
|
|
111
110
|
fill: 'warningPrimary',
|
|
112
111
|
fillHover: 'warningPrimaryHover',
|
|
@@ -122,29 +121,37 @@ var notificationAppearanceWarning = {
|
|
|
122
121
|
},
|
|
123
122
|
};
|
|
124
123
|
|
|
125
|
-
|
|
124
|
+
const notificationAppearance = {
|
|
125
|
+
...notificationAppearanceDefault,
|
|
126
|
+
...notificationAppearanceSize,
|
|
127
|
+
...notificationAppearanceStyle,
|
|
128
|
+
...notificationAppearanceError,
|
|
129
|
+
...notificationAppearanceInfo,
|
|
130
|
+
...notificationAppearanceSuccess,
|
|
131
|
+
...notificationAppearanceWarning,
|
|
132
|
+
};
|
|
126
133
|
|
|
127
|
-
|
|
134
|
+
const notificationConfig = {
|
|
128
135
|
appearance: notificationAppearance,
|
|
129
|
-
setAppearance:
|
|
136
|
+
setAppearance: (appearanceConfig) => {
|
|
130
137
|
notificationConfig.appearance = appearanceConfig;
|
|
131
138
|
},
|
|
132
139
|
};
|
|
133
140
|
function Notification(props) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
141
|
+
const { id, dataTestId, dataTour, className, appearance, title, desc, before, after, close, isSkeleton, onClickClose, } = props;
|
|
142
|
+
const appearanceConfig = useAppearanceConfig(appearance, notificationConfig);
|
|
143
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
144
|
+
const { fillClass, titleTextColor, titleTextSize, descTextColor, descTextSize, elevationClass, sizeClass, widthClass, closeIcon, closeIconFill, closeIconFillIcon, closeIconFillSize, closeIconShape, closeIconSize, closeIconSrc, } = propsGenerator;
|
|
138
145
|
// @ts-expect-error
|
|
139
|
-
|
|
140
|
-
return (jsxs("div", { className: clsx('notification__item', elevationClass &&
|
|
146
|
+
const { styles: notificationStyles } = useStyles(props);
|
|
147
|
+
return (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, jsxs("div", { className: clsx(className, 'notification__item-wrapper'), children: [title && (jsx(Text, { className: "notification__item-title", size: titleTextSize, textColor: titleTextColor, children: title })), desc && (jsx(Text, { className: "notification__item-text", size: descTextSize, textColor: descTextColor, children: desc })), close && (closeIcon || closeIconSrc) && (jsx(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] }));
|
|
141
148
|
}
|
|
142
149
|
|
|
143
150
|
function NotificationWrapper(props) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return (jsx("div", { className: clsx('notification', className), children: jsx("div", { className: "notification__wrapper", children: notifications.map(
|
|
151
|
+
const notifications = useNotifications();
|
|
152
|
+
const { hideNotifications } = useNotificationsAPI();
|
|
153
|
+
const { className, close } = props;
|
|
154
|
+
return (jsx("div", { className: clsx('notification', className), children: jsx("div", { className: "notification__wrapper", children: notifications.map((notification, i) => (jsx(Notification, { id: notification.id, appearance: notification.appearance, title: notification.title, status: notification.status, text: notification.text, close: close, onClickClose: hideNotifications }, i))) }) }));
|
|
148
155
|
}
|
|
149
156
|
|
|
150
157
|
export { Notification, NotificationWrapper, notificationAppearance, notificationConfig };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export { O as Overlay, a as overlayAppearance, o as overlayConfig } from '../
|
|
1
|
+
export { O as Overlay, a as overlayAppearance, o as overlayConfig } from '../Overlay_es_BS7OTFoy.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import 'clsx';
|
|
4
4
|
import '../hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
5
|
-
import '../tslib.es6_es_Bwu1Cn-t.js';
|
|
6
5
|
import 'react';
|
|
7
6
|
import '../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
8
7
|
import 'lodash/camelCase';
|