@expressms/smartapp-ui 2.8.2-alpha.10 → 2.8.2-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main/assets/icons/arrow-back.svg +3 -0
- package/build/main/assets/icons/arrow-down.svg +3 -0
- package/build/main/assets/icons/arrow-up.svg +3 -0
- package/build/main/assets/icons/attachment-loader.svg +3 -0
- package/build/main/assets/icons/button-loader.svg +3 -0
- package/build/main/assets/icons/cancel-cross.svg +3 -0
- package/build/main/assets/icons/check-mark.svg +4 -0
- package/build/main/assets/icons/clear.svg +3 -0
- package/build/main/assets/icons/close-stories.svg +4 -0
- package/build/main/assets/icons/close.svg +10 -0
- package/build/main/assets/icons/contact-info.svg +12 -0
- package/build/main/assets/icons/corporate-user.svg +10 -0
- package/build/main/assets/icons/crown.svg +5 -0
- package/build/main/assets/icons/delete-chip.svg +3 -0
- package/build/main/assets/icons/download.svg +4 -0
- package/build/main/assets/icons/error.svg +5 -0
- package/build/main/assets/icons/external-link.svg +3 -0
- package/build/main/assets/icons/eye-off.svg +10 -0
- package/build/main/assets/icons/eye.svg +10 -0
- package/build/main/assets/icons/file.svg +3 -0
- package/build/main/assets/icons/info.svg +5 -0
- package/build/main/assets/icons/loader.svg +3 -0
- package/build/main/assets/icons/logout.svg +4 -0
- package/build/main/assets/icons/magnifying-glass.svg +3 -0
- package/build/main/assets/icons/mail.svg +3 -0
- package/build/main/assets/icons/more.svg +3 -0
- package/build/main/assets/icons/my-contact-user.svg +10 -0
- package/build/main/assets/icons/notification-close.svg +3 -0
- package/build/main/assets/icons/notification-error.svg +3 -0
- package/build/main/assets/icons/notification-failure.svg +3 -0
- package/build/main/assets/icons/notification-info.svg +5 -0
- package/build/main/assets/icons/notification-success.svg +4 -0
- package/build/main/assets/icons/notification-warning.svg +5 -0
- package/build/main/assets/icons/order.svg +6 -0
- package/build/main/assets/icons/plus.svg +4 -0
- package/build/main/assets/icons/private.svg +12 -0
- package/build/main/assets/icons/refresh.svg +3 -0
- package/build/main/assets/icons/story-loader.svg +3 -0
- package/build/main/assets/icons/tick.svg +10 -0
- package/build/main/assets/icons/trash.svg +3 -0
- package/build/main/assets/icons/unread-mails.svg +4 -0
- package/build/main/assets/storybook/index.js +21 -0
- package/build/main/assets/storybook/index.js.map +1 -0
- package/build/main/components/ActionModal/ActionModal.js +55 -0
- package/build/main/components/ActionModal/ActionModal.js.map +1 -0
- package/build/main/components/ActionModal/index.js +2 -0
- package/build/main/components/ActionModal/index.js.map +1 -0
- package/build/main/components/ActionModal/types.js +2 -0
- package/build/main/components/ActionModal/types.js.map +1 -0
- package/build/main/components/AttachedFile/AttachedFile.js +60 -0
- package/build/main/components/AttachedFile/AttachedFile.js.map +1 -0
- package/build/main/components/AttachedFile/index.js +2 -0
- package/build/main/components/AttachedFile/index.js.map +1 -0
- package/build/main/components/AttachedFile/types.js +2 -0
- package/build/main/components/AttachedFile/types.js.map +1 -0
- package/build/main/components/Avatar/Avatar.js +131 -0
- package/build/main/components/Avatar/Avatar.js.map +1 -0
- package/build/main/components/Avatar/index.js +2 -0
- package/build/main/components/Avatar/index.js.map +1 -0
- package/build/main/components/Avatar/types.js +9 -0
- package/build/main/components/Avatar/types.js.map +1 -0
- package/build/main/components/Button/Button.js +57 -0
- package/build/main/components/Button/Button.js.map +1 -0
- package/build/main/components/Button/index.js +2 -0
- package/build/main/components/Button/index.js.map +1 -0
- package/build/main/components/Button/types.js +11 -0
- package/build/main/components/Button/types.js.map +1 -0
- package/build/main/components/CachedImage/CachedImage.js +59 -0
- package/build/main/components/CachedImage/CachedImage.js.map +1 -0
- package/build/main/components/CachedImage/helpers.js +40 -0
- package/build/main/components/CachedImage/helpers.js.map +1 -0
- package/build/main/components/CachedImage/index.js +2 -0
- package/build/main/components/CachedImage/index.js.map +1 -0
- package/build/main/components/CachedImage/types.js +2 -0
- package/build/main/components/CachedImage/types.js.map +1 -0
- package/build/main/components/Calendar/Calendar.js +48 -0
- package/build/main/components/Calendar/Calendar.js.map +1 -0
- package/build/main/components/Calendar/index.js +2 -0
- package/build/main/components/Calendar/index.js.map +1 -0
- package/build/main/components/Calendar/types.js +2 -0
- package/build/main/components/Calendar/types.js.map +1 -0
- package/build/main/components/Charts/ChartBar/ChartBar.js +46 -0
- package/build/main/components/Charts/ChartBar/ChartBar.js.map +1 -0
- package/build/main/components/Charts/ChartLegend/ChartLegend.js +71 -0
- package/build/main/components/Charts/ChartLegend/ChartLegend.js.map +1 -0
- package/build/main/components/Charts/ChartLine/ChartLine.js +41 -0
- package/build/main/components/Charts/ChartLine/ChartLine.js.map +1 -0
- package/build/main/components/Charts/ChartPie/ChartPie.js +63 -0
- package/build/main/components/Charts/ChartPie/ChartPie.js.map +1 -0
- package/build/main/components/Charts/colors.js +4 -0
- package/build/main/components/Charts/colors.js.map +1 -0
- package/build/main/components/Charts/constants.js +43 -0
- package/build/main/components/Charts/constants.js.map +1 -0
- package/build/main/components/Charts/helpers.js +73 -0
- package/build/main/components/Charts/helpers.js.map +1 -0
- package/build/main/components/Charts/index.js +4 -0
- package/build/main/components/Charts/index.js.map +1 -0
- package/build/main/components/Charts/types.js +2 -0
- package/build/main/components/Charts/types.js.map +1 -0
- package/build/main/components/Charts/useEvents.js +45 -0
- package/build/main/components/Charts/useEvents.js.map +1 -0
- package/build/main/components/Charts/usePieEvents.js +57 -0
- package/build/main/components/Charts/usePieEvents.js.map +1 -0
- package/build/main/components/Checkbox/Checkbox.js +38 -0
- package/build/main/components/Checkbox/Checkbox.js.map +1 -0
- package/build/main/components/Checkbox/index.js +2 -0
- package/build/main/components/Checkbox/index.js.map +1 -0
- package/build/main/components/Checkbox/types.js +2 -0
- package/build/main/components/Checkbox/types.js.map +1 -0
- package/build/main/components/Chip/Chip.js +35 -0
- package/build/main/components/Chip/Chip.js.map +1 -0
- package/build/main/components/Chip/index.js +2 -0
- package/build/main/components/Chip/index.js.map +1 -0
- package/build/main/components/Chip/types.js +2 -0
- package/build/main/components/Chip/types.js.map +1 -0
- package/build/main/components/ConfirmationModal/ConfirmationModal.js +70 -0
- package/build/main/components/ConfirmationModal/ConfirmationModal.js.map +1 -0
- package/build/main/components/ConfirmationModal/index.js +2 -0
- package/build/main/components/ConfirmationModal/index.js.map +1 -0
- package/build/main/components/ConfirmationModal/types.js +2 -0
- package/build/main/components/ConfirmationModal/types.js.map +1 -0
- package/build/main/components/ContextMenu/ContextMenu.js +82 -0
- package/build/main/components/ContextMenu/ContextMenu.js.map +1 -0
- package/build/main/components/ContextMenu/index.js +2 -0
- package/build/main/components/ContextMenu/index.js.map +1 -0
- package/build/main/components/ContextMenu/types.js +2 -0
- package/build/main/components/ContextMenu/types.js.map +1 -0
- package/build/main/components/CustomSelect/CustomSelect.js +220 -0
- package/build/main/components/CustomSelect/CustomSelect.js.map +1 -0
- package/build/main/components/CustomSelect/index.js +2 -0
- package/build/main/components/CustomSelect/index.js.map +1 -0
- package/build/main/components/CustomSelect/selectStyles.js +67 -0
- package/build/main/components/CustomSelect/selectStyles.js.map +1 -0
- package/build/main/components/CustomSelect/types.js +2 -0
- package/build/main/components/CustomSelect/types.js.map +1 -0
- package/build/main/components/CustomSelectProfiles/CustomSelectProfiles.js +57 -0
- package/build/main/components/CustomSelectProfiles/CustomSelectProfiles.js.map +1 -0
- package/build/main/components/CustomSelectProfiles/index.js +2 -0
- package/build/main/components/CustomSelectProfiles/index.js.map +1 -0
- package/build/main/components/CustomSelectProfiles/types.js +2 -0
- package/build/main/components/CustomSelectProfiles/types.js.map +1 -0
- package/build/main/components/DragAndDrop/DragAndDrop.js +57 -0
- package/build/main/components/DragAndDrop/DragAndDrop.js.map +1 -0
- package/build/main/components/DragAndDrop/index.js +2 -0
- package/build/main/components/DragAndDrop/index.js.map +1 -0
- package/build/main/components/DragAndDrop/types.js +2 -0
- package/build/main/components/DragAndDrop/types.js.map +1 -0
- package/build/main/components/DraggablePopup/DraggablePopup.js +124 -0
- package/build/main/components/DraggablePopup/DraggablePopup.js.map +1 -0
- package/build/main/components/DraggablePopup/index.js +2 -0
- package/build/main/components/DraggablePopup/index.js.map +1 -0
- package/build/main/components/DraggablePopup/types.js +2 -0
- package/build/main/components/DraggablePopup/types.js.map +1 -0
- package/build/main/components/Error/Error.js +23 -0
- package/build/main/components/Error/Error.js.map +1 -0
- package/build/main/components/Error/index.js +2 -0
- package/build/main/components/Error/index.js.map +1 -0
- package/build/main/components/Error/types.js +2 -0
- package/build/main/components/Error/types.js.map +1 -0
- package/build/main/components/Flex/Flex.js +49 -0
- package/build/main/components/Flex/Flex.js.map +1 -0
- package/build/main/components/Flex/HFlex/HFlex.js +16 -0
- package/build/main/components/Flex/HFlex/HFlex.js.map +1 -0
- package/build/main/components/Flex/HFlex/index.js +2 -0
- package/build/main/components/Flex/HFlex/index.js.map +1 -0
- package/build/main/components/Flex/VFlex/VFlex.js +16 -0
- package/build/main/components/Flex/VFlex/VFlex.js.map +1 -0
- package/build/main/components/Flex/VFlex/index.js +2 -0
- package/build/main/components/Flex/VFlex/index.js.map +1 -0
- package/build/main/components/Flex/index.js +4 -0
- package/build/main/components/Flex/index.js.map +1 -0
- package/build/main/components/Flex/types.js +2 -0
- package/build/main/components/Flex/types.js.map +1 -0
- package/build/main/components/Header/Header.js +124 -0
- package/build/main/components/Header/Header.js.map +1 -0
- package/build/main/components/Header/index.js +2 -0
- package/build/main/components/Header/index.js.map +1 -0
- package/build/main/components/Header/types.js +2 -0
- package/build/main/components/Header/types.js.map +1 -0
- package/build/main/components/Input/Input.js +207 -0
- package/build/main/components/Input/Input.js.map +1 -0
- package/build/main/components/Input/index.js +2 -0
- package/build/main/components/Input/index.js.map +1 -0
- package/build/main/components/Input/types.js +2 -0
- package/build/main/components/Input/types.js.map +1 -0
- package/build/main/components/ListItem/ListItem.js +208 -0
- package/build/main/components/ListItem/ListItem.js.map +1 -0
- package/build/main/components/ListItem/index.js +2 -0
- package/build/main/components/ListItem/index.js.map +1 -0
- package/build/main/components/ListItem/types.js +2 -0
- package/build/main/components/ListItem/types.js.map +1 -0
- package/build/main/components/Loader/Loader.js +44 -0
- package/build/main/components/Loader/Loader.js.map +1 -0
- package/build/main/components/Loader/index.js +2 -0
- package/build/main/components/Loader/index.js.map +1 -0
- package/build/main/components/Loader/types.js +2 -0
- package/build/main/components/Loader/types.js.map +1 -0
- package/build/main/components/Modal/Modal.js +125 -0
- package/build/main/components/Modal/Modal.js.map +1 -0
- package/build/main/components/Modal/index.js +2 -0
- package/build/main/components/Modal/index.js.map +1 -0
- package/build/main/components/Modal/types.js +2 -0
- package/build/main/components/Modal/types.js.map +1 -0
- package/build/main/components/Notification/Notification.js +197 -0
- package/build/main/components/Notification/Notification.js.map +1 -0
- package/build/main/components/Notification/index.js +2 -0
- package/build/main/components/Notification/index.js.map +1 -0
- package/build/main/components/Notification/types.js +2 -0
- package/build/main/components/Notification/types.js.map +1 -0
- package/build/main/components/Profile/Profile.js +42 -0
- package/build/main/components/Profile/Profile.js.map +1 -0
- package/build/main/components/Profile/index.js +2 -0
- package/build/main/components/Profile/index.js.map +1 -0
- package/build/main/components/Profile/types.js +2 -0
- package/build/main/components/Profile/types.js.map +1 -0
- package/build/main/components/ProgressBar/ProgressBar.js +66 -0
- package/build/main/components/ProgressBar/ProgressBar.js.map +1 -0
- package/build/main/components/ProgressBar/index.js +2 -0
- package/build/main/components/ProgressBar/index.js.map +1 -0
- package/build/main/components/ProgressBar/types.js +2 -0
- package/build/main/components/ProgressBar/types.js.map +1 -0
- package/build/main/components/RadioButton/RadioButton.js +37 -0
- package/build/main/components/RadioButton/RadioButton.js.map +1 -0
- package/build/main/components/RadioButton/index.js +2 -0
- package/build/main/components/RadioButton/index.js.map +1 -0
- package/build/main/components/RadioButton/types.js +2 -0
- package/build/main/components/RadioButton/types.js.map +1 -0
- package/build/main/components/ScrollBar/ScrollBar.js +63 -0
- package/build/main/components/ScrollBar/ScrollBar.js.map +1 -0
- package/build/main/components/ScrollBar/index.js +2 -0
- package/build/main/components/ScrollBar/index.js.map +1 -0
- package/build/main/components/ScrollBar/types.js +2 -0
- package/build/main/components/ScrollBar/types.js.map +1 -0
- package/build/main/components/Skeleton/Skeleton.js +59 -0
- package/build/main/components/Skeleton/Skeleton.js.map +1 -0
- package/build/main/components/Skeleton/index.js +2 -0
- package/build/main/components/Skeleton/index.js.map +1 -0
- package/build/main/components/Skeleton/types.js +2 -0
- package/build/main/components/Skeleton/types.js.map +1 -0
- package/build/main/components/Stories/Stories.js +296 -0
- package/build/main/components/Stories/Stories.js.map +1 -0
- package/build/main/components/Stories/index.js +2 -0
- package/build/main/components/Stories/index.js.map +1 -0
- package/build/main/components/Stories/types.js +11 -0
- package/build/main/components/Stories/types.js.map +1 -0
- package/build/main/components/Switcher/Switcher.js +34 -0
- package/build/main/components/Switcher/Switcher.js.map +1 -0
- package/build/main/components/Switcher/index.js +2 -0
- package/build/main/components/Switcher/index.js.map +1 -0
- package/build/main/components/Switcher/types.js +2 -0
- package/build/main/components/Switcher/types.js.map +1 -0
- package/build/main/components/SyncLoader/SyncLoader.js +65 -0
- package/build/main/components/SyncLoader/SyncLoader.js.map +1 -0
- package/build/main/components/SyncLoader/index.js +2 -0
- package/build/main/components/SyncLoader/index.js.map +1 -0
- package/build/main/components/SyncLoader/types.js +2 -0
- package/build/main/components/SyncLoader/types.js.map +1 -0
- package/build/main/components/Textarea/Textarea.js +96 -0
- package/build/main/components/Textarea/Textarea.js.map +1 -0
- package/build/main/components/Textarea/index.js +2 -0
- package/build/main/components/Textarea/index.js.map +1 -0
- package/build/main/components/Textarea/types.js +2 -0
- package/build/main/components/Textarea/types.js.map +1 -0
- package/build/main/components/Toggle/Toggle.js +38 -0
- package/build/main/components/Toggle/Toggle.js.map +1 -0
- package/build/main/components/Toggle/index.js +2 -0
- package/build/main/components/Toggle/index.js.map +1 -0
- package/build/main/components/Toggle/types.js +2 -0
- package/build/main/components/Toggle/types.js.map +1 -0
- package/build/main/components/UserDropdown/ContactBottomSheet/ContactBottomSheet.js +31 -0
- package/build/main/components/UserDropdown/ContactBottomSheet/ContactBottomSheet.js.map +1 -0
- package/build/main/components/UserDropdown/ContactInfo/ContactInfo.js +70 -0
- package/build/main/components/UserDropdown/ContactInfo/ContactInfo.js.map +1 -0
- package/build/main/components/UserDropdown/LoadingMessage/LoadingMessage.js +23 -0
- package/build/main/components/UserDropdown/LoadingMessage/LoadingMessage.js.map +1 -0
- package/build/main/components/UserDropdown/MenuList/MenuList.js +81 -0
- package/build/main/components/UserDropdown/MenuList/MenuList.js.map +1 -0
- package/build/main/components/UserDropdown/MultiValueLabel/MultiValueLabel.js +40 -0
- package/build/main/components/UserDropdown/MultiValueLabel/MultiValueLabel.js.map +1 -0
- package/build/main/components/UserDropdown/Option/Option.js +91 -0
- package/build/main/components/UserDropdown/Option/Option.js.map +1 -0
- package/build/main/components/UserDropdown/UserDropdown.js +434 -0
- package/build/main/components/UserDropdown/UserDropdown.js.map +1 -0
- package/build/main/components/UserDropdown/helpers.d.ts +1 -0
- package/build/main/components/UserDropdown/helpers.js +93 -0
- package/build/main/components/UserDropdown/helpers.js.map +1 -0
- package/build/main/components/UserDropdown/index.js +2 -0
- package/build/main/components/UserDropdown/index.js.map +1 -0
- package/build/main/components/UserDropdown/selectStyles.js +75 -0
- package/build/main/components/UserDropdown/selectStyles.js.map +1 -0
- package/build/main/components/UserDropdown/types.js +2 -0
- package/build/main/components/UserDropdown/types.js.map +1 -0
- package/build/main/components/types.js +2 -0
- package/build/main/components/types.js.map +1 -0
- package/build/main/constants/constants.js +161 -0
- package/build/main/constants/constants.js.map +1 -0
- package/build/main/constants/index.js +3 -0
- package/build/main/constants/index.js.map +1 -0
- package/build/main/constants/types.js +2 -0
- package/build/main/constants/types.js.map +1 -0
- package/build/main/helpers/index.js +89 -0
- package/build/main/helpers/index.js.map +1 -0
- package/build/main/hooks/useModal.js +60 -0
- package/build/main/hooks/useModal.js.map +1 -0
- package/build/main/index.js +37 -0
- package/build/main/index.js.map +1 -0
- package/build/main/styles/index.js +2 -0
- package/build/main/styles/index.js.map +1 -0
- package/build/main/styles/main.js +0 -0
- package/build/main/styles/styles.scss +14 -0
- package/package.json +4 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/ConfirmationModal/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import Checkbox from '../Checkbox';
|
|
16
|
+
import { generateId, isWebPlatform } from '../../helpers';
|
|
17
|
+
import { CONTEXT_MENU_SAFE_SPACE, PLATFORM } from '../../constants';
|
|
18
|
+
import '../../styles/styles.scss';
|
|
19
|
+
var FIT_CONTENT = 'fit-content';
|
|
20
|
+
var ContextMenu = function (_a) {
|
|
21
|
+
var _b;
|
|
22
|
+
var isMenuOpen = _a.isMenuOpen, _c = _a.isClickForbidden, isClickForbidden = _c === void 0 ? false : _c, _d = _a.isCloseOnItemClick, isCloseOnItemClick = _d === void 0 ? true : _d, _e = _a.position, x = _e.x, y = _e.y, menuWidth = _a.menuWidth, containerClassName = _a.containerClassName, menuClassName = _a.menuClassName, itemClassName = _a.itemClassName, containerStyles = _a.containerStyles, _f = _a.menuStyles, menuStyles = _f === void 0 ? {} : _f, _g = _a.itemStyles, itemStyles = _g === void 0 ? {} : _g, items = _a.items, closeMenu = _a.closeMenu, _h = _a.platform, platform = _h === void 0 ? PLATFORM.web : _h;
|
|
23
|
+
var elementRef = useRef(null);
|
|
24
|
+
var _j = useState(0), contextMenuWidth = _j[0], setContextMenuWidth = _j[1];
|
|
25
|
+
var _k = useState(((_b = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0), contextMenuHeight = _k[0], setContextMenuHeight = _k[1];
|
|
26
|
+
var clientHeight = document.documentElement.clientHeight;
|
|
27
|
+
var clientWidth = document.documentElement.clientWidth;
|
|
28
|
+
var handleContextMenu = function (event) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
!isClickForbidden && closeMenu();
|
|
31
|
+
};
|
|
32
|
+
var handleMenuItemClick = function (action) { return !isClickForbidden && action(); };
|
|
33
|
+
var handleMenuClose = function (_a) {
|
|
34
|
+
var event = _a.event, _b = _a.isItemClick, isItemClick = _b === void 0 ? true : _b;
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
if (isItemClick && !isCloseOnItemClick)
|
|
37
|
+
return;
|
|
38
|
+
if (!isClickForbidden)
|
|
39
|
+
closeMenu();
|
|
40
|
+
};
|
|
41
|
+
var handleSortItems = function (_a, _b) {
|
|
42
|
+
var isFixedA = _a.isFixedUnderLine;
|
|
43
|
+
var isFixedB = _b.isFixedUnderLine;
|
|
44
|
+
return Number(!!isFixedA) - Number(!!isFixedB);
|
|
45
|
+
};
|
|
46
|
+
useLayoutEffect(function () {
|
|
47
|
+
var elementRefCurrent = elementRef.current;
|
|
48
|
+
if (elementRefCurrent) {
|
|
49
|
+
var offsetHeight = elementRefCurrent.offsetHeight;
|
|
50
|
+
var width = elementRefCurrent.getBoundingClientRect().width;
|
|
51
|
+
setContextMenuHeight(offsetHeight);
|
|
52
|
+
setContextMenuWidth(menuWidth || width);
|
|
53
|
+
}
|
|
54
|
+
}, [isMenuOpen, menuWidth]);
|
|
55
|
+
var renderMenuItemIcon = function (icon) { return icon && _jsx("div", __assign({ className: "smartapp-context-menu__item--content__icon" }, { children: icon })); };
|
|
56
|
+
var sortedContextMenuItems = items.sort(handleSortItems);
|
|
57
|
+
var firstIndexUnderLine = sortedContextMenuItems.findIndex(function (_a) {
|
|
58
|
+
var isFixedUnderLine = _a.isFixedUnderLine;
|
|
59
|
+
return isFixedUnderLine;
|
|
60
|
+
});
|
|
61
|
+
var contextMenuItems = sortedContextMenuItems.map(function (_a, index) {
|
|
62
|
+
var _b = _a.isNegativeAction, isNegativeAction = _b === void 0 ? false : _b, _c = _a.isSelected, isSelected = _c === void 0 ? false : _c, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, _e = _a.isWithCheckbox, isWithCheckbox = _e === void 0 ? false : _e, _f = _a.isChecked, isChecked = _f === void 0 ? false : _f, _g = _a.isFixedUnderLine, isFixedUnderLine = _g === void 0 ? false : _g, title = _a.title, icon = _a.icon, action = _a.action;
|
|
63
|
+
return (_jsxs("button", __assign({ className: classNames('smartapp-context-menu__item', {
|
|
64
|
+
'smartapp-context-menu__item--checkbox': isWithCheckbox,
|
|
65
|
+
'smartapp-context-menu__item--negative': isNegativeAction,
|
|
66
|
+
'smartapp-context-menu__item--selected': isSelected,
|
|
67
|
+
'smartapp-context-menu__item--disabled': isDisabled,
|
|
68
|
+
'smartapp-context-menu__item--fixed-under-line': isFixedUnderLine && index === firstIndexUnderLine,
|
|
69
|
+
'smartapp-context-menu__item--hover': isWebPlatform(platform) && !isWithCheckbox,
|
|
70
|
+
}, itemClassName), disabled: isDisabled, style: itemStyles, onClick: function () { return handleMenuItemClick(action); } }, { children: [_jsxs("div", __assign({ className: classNames('smartapp-context-menu__item--content', {
|
|
71
|
+
'smartapp-context-menu__item--content__fixed-under-line': isFixedUnderLine,
|
|
72
|
+
'smartapp-context-menu__item--checkbox__content': isWithCheckbox,
|
|
73
|
+
'smartapp-context-menu__item--disabled__content': isDisabled,
|
|
74
|
+
}) }, { children: [!isFixedUnderLine && renderMenuItemIcon(icon), _jsx("span", { children: title }), isFixedUnderLine && renderMenuItemIcon(icon)] })), isWithCheckbox && _jsx(Checkbox, { id: generateId(), isChecked: isChecked, isDisabled: isDisabled })] }), title));
|
|
75
|
+
});
|
|
76
|
+
var contextMenuStyles = __assign({ top: y + contextMenuHeight > clientHeight ? clientHeight - contextMenuHeight - CONTEXT_MENU_SAFE_SPACE : y, left: x + contextMenuWidth > clientWidth ? clientWidth - contextMenuWidth - CONTEXT_MENU_SAFE_SPACE : x, width: contextMenuWidth || FIT_CONTENT }, menuStyles);
|
|
77
|
+
if (!isMenuOpen)
|
|
78
|
+
return null;
|
|
79
|
+
return (_jsx("div", __assign({ className: classNames('smartapp-context-menu', containerClassName), style: containerStyles, onClick: function (event) { return handleMenuClose({ event: event, isItemClick: false }); }, onContextMenu: handleContextMenu }, { children: _jsx("div", __assign({ ref: elementRef, className: classNames('smartapp-context-menu__items', menuClassName), style: contextMenuStyles, onClick: function (event) { return handleMenuClose({ event: event }); } }, { children: contextMenuItems })) })));
|
|
80
|
+
};
|
|
81
|
+
export default ContextMenu;
|
|
82
|
+
//# sourceMappingURL=ContextMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../../src/components/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAc,EAAgB,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9E,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAEnE,OAAO,0BAA0B,CAAA;AAOjC,IAAM,WAAW,GAAG,aAAa,CAAA;AAEjC,IAAM,WAAW,GAAG,UAAC,EAeD;;QAdlB,UAAU,gBAAA,EACV,wBAAwB,EAAxB,gBAAgB,mBAAG,KAAK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1G,IAAI,EAAE,CAAC,GAAG,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,GAAG,gBAAgB,GAAG,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACvG,KAAK,EAAE,gBAAgB,IAAI,WAAW,IACnC,UAAU,CACd,CAAA;IAED,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAA;IAE5B,OAAO,CACL,uBACE,SAAS,EAAE,UAAU,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,EAClE,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,UAAC,KAAK,IAAK,OAAA,eAAe,CAAC,EAAE,KAAK,OAAA,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAA9C,CAA8C,EAClE,aAAa,EAAE,iBAAiB,gBAEhC,uBACE,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,UAAU,CAAC,8BAA8B,EAAE,aAAa,CAAC,EACpE,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,UAAC,KAAK,IAAK,OAAA,eAAe,CAAC,EAAE,KAAK,OAAA,EAAE,CAAC,EAA1B,CAA0B,gBAE7C,gBAAgB,IACb,IACF,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ContextMenu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/ContextMenu/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
14
|
+
import Select, { components } from 'react-select';
|
|
15
|
+
import CreatableSelect from 'react-select/creatable';
|
|
16
|
+
import Popup from 'reactjs-popup';
|
|
17
|
+
import { isEmpty, max, omit } from 'lodash';
|
|
18
|
+
import classNames from 'classnames';
|
|
19
|
+
import ListItem from '../ListItem';
|
|
20
|
+
import { Skeleton } from '../Skeleton';
|
|
21
|
+
import { isValueEqualToZero } from '../../helpers';
|
|
22
|
+
import { CREATABLE_MENU_LIST_MAX_HEIGHT, ENTER_KEY, FILL_TYPE, MENU_LIST_MAX_HEIGHT, MENU_POSITIONS, POPUP_ON_EVENT_TYPE } from '../../constants';
|
|
23
|
+
import { DEFAULT_INDICATOR_COLOR, NOT_INTERACTIVE_ELEMENT } from '../ListItem/ListItem';
|
|
24
|
+
import selectStyles from './selectStyles';
|
|
25
|
+
import { ReactComponent as ArrowUpIcon } from '../../assets/icons/arrow-up.svg';
|
|
26
|
+
import { ReactComponent as ArrowDownIcon } from '../../assets/icons/arrow-down.svg';
|
|
27
|
+
import { ReactComponent as ClearIcon } from '../../assets/icons/clear.svg';
|
|
28
|
+
import '../../styles/styles.scss';
|
|
29
|
+
var DropdownIndicator = function (props) {
|
|
30
|
+
var isHidden = props.isHidden, menuIsOpen = props.selectProps.menuIsOpen;
|
|
31
|
+
return !isHidden ? _jsx(components.DropdownIndicator, __assign({}, props, { children: menuIsOpen ? _jsx(ArrowUpIcon, {}) : _jsx(ArrowDownIcon, {}) })) : null;
|
|
32
|
+
};
|
|
33
|
+
var ClearIndicator = function (props) { return (_jsx(components.ClearIndicator, __assign({}, props, { children: _jsx(ClearIcon, {}) }))); };
|
|
34
|
+
export var generateListItemTextRect = function (listItemTextRef) {
|
|
35
|
+
var listItemTextRefCurrent = listItemTextRef.current;
|
|
36
|
+
var listItemTextRect = listItemTextRefCurrent === null || listItemTextRefCurrent === void 0 ? void 0 : listItemTextRefCurrent.getBoundingClientRect();
|
|
37
|
+
var _a = listItemTextRefCurrent || {}, _b = _a.scrollWidth, scrollWidth = _b === void 0 ? 0 : _b, _c = _a.clientWidth, clientWidth = _c === void 0 ? 0 : _c;
|
|
38
|
+
var _d = listItemTextRect || {}, _e = _d.left, left = _e === void 0 ? 0 : _e, _f = _d.top, top = _f === void 0 ? 0 : _f, _g = _d.right, right = _g === void 0 ? 0 : _g;
|
|
39
|
+
return {
|
|
40
|
+
scrollWidth: scrollWidth,
|
|
41
|
+
clientWidth: clientWidth,
|
|
42
|
+
left: left + POPUP_LEFT_INDENT,
|
|
43
|
+
top: top + POPUP_TOP_INDENT,
|
|
44
|
+
maxWidth: right - left - POPUP_LEFT_INDENT - OPTION_INDENTS,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var Option = function (props) {
|
|
48
|
+
var label = props.label, isSelected = props.isSelected, isOptionsWithTooltip = props.isOptionsWithTooltip, _a = props.data, isCreatable = _a.isCreatable, isDisabled = _a.isDisabled, _b = _a.element, element = _b === void 0 ? NOT_INTERACTIVE_ELEMENT.noElement : _b, secondaryText = _a.secondaryText, secondaryTextColor = _a.secondaryTextColor, color = _a.color, styles = _a.styles, onDisabledOptionClick = props.onDisabledOptionClick;
|
|
49
|
+
var optionComponentRef = useRef(null);
|
|
50
|
+
var listItemTextRef = useRef(null);
|
|
51
|
+
var _c = useState(''), listItemTextWidth = _c[0], setListItemTextWidth = _c[1];
|
|
52
|
+
var _d = useState(0), popupLeft = _d[0], setPopupLeft = _d[1];
|
|
53
|
+
var _e = useState(0), popupTop = _e[0], setPopupTop = _e[1];
|
|
54
|
+
var _f = useState(0), popupMaxWidth = _f[0], setPopupMaxWidth = _f[1];
|
|
55
|
+
var _g = generateListItemTextRect(listItemTextRef), scrollWidth = _g.scrollWidth, clientWidth = _g.clientWidth, left = _g.left, top = _g.top, maxWidth = _g.maxWidth;
|
|
56
|
+
var isTooltipAvailable = scrollWidth > clientWidth;
|
|
57
|
+
var generateListItemTextWidth = function () {
|
|
58
|
+
var _a;
|
|
59
|
+
var listItemTextElement = (_a = optionComponentRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.smartapp-list-item__text');
|
|
60
|
+
if (!listItemTextElement)
|
|
61
|
+
return '';
|
|
62
|
+
var _b = window.getComputedStyle(listItemTextElement), paddingLeft = _b.paddingLeft, paddingRight = _b.paddingRight;
|
|
63
|
+
return paddingLeft || paddingRight ? "calc(100% - ".concat(paddingLeft, " - ").concat(paddingRight, ")") : '';
|
|
64
|
+
};
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
setPopupLeft(left);
|
|
67
|
+
setPopupTop(top);
|
|
68
|
+
setPopupMaxWidth(maxWidth);
|
|
69
|
+
}, [left, top, maxWidth]);
|
|
70
|
+
useLayoutEffect(function () {
|
|
71
|
+
setListItemTextWidth(generateListItemTextWidth());
|
|
72
|
+
}, []);
|
|
73
|
+
var handleOptionClick = function () { return isDisabled && onDisabledOptionClick(); };
|
|
74
|
+
var renderListItem = function () { return (_jsx(ListItem, { textRef: listItemTextRef, type: "not-interactive", element: element, text: label, secondaryText: secondaryText, secondaryTextColor: secondaryTextColor, color: color, isSelected: isSelected && !isCreatable, isDisabled: isDisabled, textStyles: __assign(__assign({}, styles), { width: listItemTextWidth }) })); };
|
|
75
|
+
return (_jsx("div", __assign({ onClick: handleOptionClick }, { children: _jsx(components.Option, __assign({}, props, { innerRef: optionComponentRef, className: classNames({ 'smartapp-option-with-tooltip': isOptionsWithTooltip }) }, { children: isTooltipAvailable ? (_jsx(Popup, __assign({ className: "select-label", contentStyle: {
|
|
76
|
+
'--select-label-content-left': "".concat(popupLeft, "px"),
|
|
77
|
+
'--select-label-content-top': "".concat(popupTop, "px"),
|
|
78
|
+
'--select-label-content-max-width': "".concat(popupMaxWidth, "px"),
|
|
79
|
+
}, on: [POPUP_ON_EVENT_TYPE.hover], mouseEnterDelay: POPUP_APPEARANCE_DELAY, trigger: function () { return _jsx("div", __assign({ className: "w-100" }, { children: renderListItem() })); } }, { children: _jsx("div", { children: label }) }))) : (renderListItem()) })) })));
|
|
80
|
+
};
|
|
81
|
+
var SingleValueComponent = function (props) {
|
|
82
|
+
var isDisabled = props.isDisabled, _a = props.data, _b = _a.element, element = _b === void 0 ? NOT_INTERACTIVE_ELEMENT.noElement : _b, _c = _a.color, color = _c === void 0 ? DEFAULT_INDICATOR_COLOR : _c, children = props.children;
|
|
83
|
+
var renderIndicatorElement = function () {
|
|
84
|
+
var _a;
|
|
85
|
+
var indicatorColorClassName = "smartapp-list-item__indicator--".concat(color);
|
|
86
|
+
var className = classNames('smartapp-list-item__indicator', indicatorColorClassName, (_a = {},
|
|
87
|
+
_a["".concat(indicatorColorClassName, "__disabled")] = isDisabled,
|
|
88
|
+
_a));
|
|
89
|
+
return element === NOT_INTERACTIVE_ELEMENT.indicator ? _jsx("div", { className: className }) : null;
|
|
90
|
+
};
|
|
91
|
+
return (_jsxs(components.SingleValue, __assign({}, props, { children: [renderIndicatorElement(), _jsx("div", __assign({ className: "smartapp-custom-select__selected-value" }, { children: children }))] })));
|
|
92
|
+
};
|
|
93
|
+
var MenuList = function (props) {
|
|
94
|
+
var selectWidth = props.selectWidth, optionHeight = props.optionHeight, setOptionHeight = props.setOptionHeight, children = props.children;
|
|
95
|
+
var menuListRef = useRef(null);
|
|
96
|
+
useLayoutEffect(function () {
|
|
97
|
+
var _a;
|
|
98
|
+
if (menuListRef.current && isValueEqualToZero(optionHeight)) {
|
|
99
|
+
var options = (_a = menuListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('[role="option"]');
|
|
100
|
+
var optionsHeights = Array.from(options).map(function (option) { return option.getBoundingClientRect().height; });
|
|
101
|
+
!isEmpty(optionsHeights) && setOptionHeight(max(optionsHeights));
|
|
102
|
+
}
|
|
103
|
+
}, [optionHeight, setOptionHeight, selectWidth]);
|
|
104
|
+
return (_jsx(components.MenuList, __assign({}, props, { innerRef: menuListRef }, { children: children })));
|
|
105
|
+
};
|
|
106
|
+
var LoadingMessage = function (_a) {
|
|
107
|
+
var _b = _a.isCreatableSelect, isCreatableSelect = _b === void 0 ? false : _b;
|
|
108
|
+
var ref = useRef(null);
|
|
109
|
+
return (_jsx("div", __assign({ ref: ref, className: classNames('smartapp-custom-select__loading-message', { 'smartapp-custom-select__loading-message--creatable': isCreatableSelect }) }, { children: Array.from({ length: LOADING_MESSAGE_ITEMS }, function (_, index) { return (_jsxs("div", __assign({ className: classNames('smartapp-custom-select__loading-message--item', {
|
|
110
|
+
'smartapp-custom-select__loading-message--item__creatable': isCreatableSelect,
|
|
111
|
+
}) }, { children: [_jsx(Skeleton, { containerRef: ref, className: "smartapp-custom-select__loading-message--item__first", borderRadius: 8 }), isCreatableSelect && _jsx(Skeleton, { containerRef: ref, className: "smartapp-custom-select__loading-message--item__second", borderRadius: 8 })] }), index)); }) })));
|
|
112
|
+
};
|
|
113
|
+
var NoOptionsMessage = function (props) {
|
|
114
|
+
var noOptionsMessage = props.noOptionsMessage, children = props.children;
|
|
115
|
+
return noOptionsMessage ? _jsx(components.NoOptionsMessage, __assign({}, props, { children: children })) : null;
|
|
116
|
+
};
|
|
117
|
+
var Input = function (props) { return _jsx(components.Input, __assign({}, props, { isHidden: false })); };
|
|
118
|
+
var IndicatorSeparator = function () { return null; };
|
|
119
|
+
var LoadingIndicator = function () { return null; };
|
|
120
|
+
var POPUP_LEFT_INDENT = 13;
|
|
121
|
+
var POPUP_TOP_INDENT = 26;
|
|
122
|
+
var OPTION_INDENTS = 24;
|
|
123
|
+
var POPUP_APPEARANCE_DELAY = 1000;
|
|
124
|
+
var LOADING_MESSAGE_ITEMS = 6;
|
|
125
|
+
var IS_CREATABLE_FIELD_NAME = 'isCreatable';
|
|
126
|
+
var EMPTY_SELECTED_VALUE = { value: '', label: '' };
|
|
127
|
+
var ACTIONS = {
|
|
128
|
+
clear: 'clear',
|
|
129
|
+
inputChange: 'input-change',
|
|
130
|
+
};
|
|
131
|
+
var CustomSelect = function (_a) {
|
|
132
|
+
var _b = _a.isLoading, isLoading = _b === void 0 ? false : _b, _c = _a.isSearchable, isSearchable = _c === void 0 ? false : _c, _d = _a.isCreatable, isCreatable = _d === void 0 ? false : _d, _e = _a.isDisabled, isDisabled = _e === void 0 ? false : _e, _f = _a.isOptionsWithTooltip, isOptionsWithTooltip = _f === void 0 ? false : _f, _g = _a.fillType, fillType = _g === void 0 ? FILL_TYPE.primary : _g, _h = _a.width, width = _h === void 0 ? 100 : _h, menuListMaxHeight = _a.menuListMaxHeight, containerClassName = _a.containerClassName, containerStyles = _a.containerStyles, title = _a.title, placeholder = _a.placeholder, hint = _a.hint, noOptionsMessage = _a.noOptionsMessage, error = _a.error, _j = _a.menuPosition, menuPosition = _j === void 0 ? MENU_POSITIONS.bottom : _j, menuLocation = _a.menuLocation, defaultValue = _a.defaultValue, options = _a.options, onChange = _a.onChange, _k = _a.onDisabledOptionClick, onDisabledOptionClick = _k === void 0 ? function () { } : _k, _l = _a.onMenuOpen, onMenuOpen = _l === void 0 ? function () { } : _l;
|
|
133
|
+
var selectRef = useRef(null);
|
|
134
|
+
var _m = useState(), value = _m[0], setValue = _m[1];
|
|
135
|
+
var _o = useState(''), inputValue = _o[0], setInputValue = _o[1];
|
|
136
|
+
var _p = useState(false), isInputFocused = _p[0], setIsInputFocused = _p[1];
|
|
137
|
+
var _q = useState(0), optionHeight = _q[0], setOptionHeight = _q[1];
|
|
138
|
+
var selectRefCurrent = selectRef.current;
|
|
139
|
+
var isSelectClearable = isInputFocused && !isEmpty(inputValue);
|
|
140
|
+
useLayoutEffect(function () { return setOptionHeight(0); }, [width]);
|
|
141
|
+
useEffect(function () {
|
|
142
|
+
if (defaultValue) {
|
|
143
|
+
setValue(defaultValue);
|
|
144
|
+
setInputValue(defaultValue.label);
|
|
145
|
+
}
|
|
146
|
+
// eslint-disable-next-line
|
|
147
|
+
}, [defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.label]);
|
|
148
|
+
var generateMenuListMaxHeight = function () {
|
|
149
|
+
var defaultMenuListMaxHeight = isCreatable ? CREATABLE_MENU_LIST_MAX_HEIGHT : MENU_LIST_MAX_HEIGHT;
|
|
150
|
+
return menuListMaxHeight || defaultMenuListMaxHeight;
|
|
151
|
+
};
|
|
152
|
+
var renderTitle = function () {
|
|
153
|
+
return title && (_jsx("div", __assign({ className: "smartapp-custom-select__title" }, { children: _jsx("div", __assign({ className: "smartapp-custom-select__title--text" }, { children: title })) })));
|
|
154
|
+
};
|
|
155
|
+
var renderHint = function () { return hint && _jsx("div", __assign({ className: "smartapp-custom-select__hint" }, { children: hint })); };
|
|
156
|
+
var renderError = function () { return error && _jsx("div", __assign({ className: "smartapp-custom-select__error" }, { children: error })); };
|
|
157
|
+
var OptionComponent = function (props) { return (_jsx(Option, __assign({}, props, { isOptionsWithTooltip: isOptionsWithTooltip, onDisabledOptionClick: onDisabledOptionClick }))); };
|
|
158
|
+
var MenuListComponent = function (props) { return _jsx(MenuList, __assign({}, props, { selectWidth: width, optionHeight: optionHeight, setOptionHeight: setOptionHeight })); };
|
|
159
|
+
var generateStyles = function () {
|
|
160
|
+
return selectStyles({ isDisabled: isDisabled, isError: !isEmpty(error), fillType: fillType, menuListMaxHeight: generateMenuListMaxHeight(), optionHeight: optionHeight });
|
|
161
|
+
};
|
|
162
|
+
var creatableFilterOption = function () { return !(value === null || value === void 0 ? void 0 : value.isCreatable); };
|
|
163
|
+
var handleChange = function (option, _a) {
|
|
164
|
+
var action = _a.action;
|
|
165
|
+
var isClearAction = action === ACTIONS.clear;
|
|
166
|
+
var nextSelectedValue = isClearAction ? EMPTY_SELECTED_VALUE : option;
|
|
167
|
+
onChange(nextSelectedValue);
|
|
168
|
+
setValue(nextSelectedValue);
|
|
169
|
+
setInputValue(nextSelectedValue.label);
|
|
170
|
+
isClearAction ? selectRefCurrent === null || selectRefCurrent === void 0 ? void 0 : selectRefCurrent.focus() : selectRefCurrent === null || selectRefCurrent === void 0 ? void 0 : selectRefCurrent.blur();
|
|
171
|
+
};
|
|
172
|
+
var handleInputChange = function (inputValue, _a) {
|
|
173
|
+
var action = _a.action;
|
|
174
|
+
if (action === ACTIONS.inputChange) {
|
|
175
|
+
var nextSelectedValue = { value: inputValue, label: inputValue, isCreatable: !isEmpty(inputValue) };
|
|
176
|
+
setInputValue(inputValue);
|
|
177
|
+
setValue(nextSelectedValue);
|
|
178
|
+
onChange(isCreatable ? omit(nextSelectedValue, [IS_CREATABLE_FIELD_NAME]) : EMPTY_SELECTED_VALUE);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
var handleFocus = function () {
|
|
182
|
+
setTimeout(function () {
|
|
183
|
+
var _a;
|
|
184
|
+
var inputValueLength = inputValue.length;
|
|
185
|
+
(_a = selectRefCurrent === null || selectRefCurrent === void 0 ? void 0 : selectRefCurrent.inputRef) === null || _a === void 0 ? void 0 : _a.setSelectionRange(inputValueLength, inputValueLength);
|
|
186
|
+
}, 0);
|
|
187
|
+
setIsInputFocused(true);
|
|
188
|
+
};
|
|
189
|
+
var handleBlur = function () { return setIsInputFocused(false); };
|
|
190
|
+
var handleCreatableKeyDown = function (event) {
|
|
191
|
+
var key = event.key, code = event.code;
|
|
192
|
+
if (code === ENTER_KEY || key === ENTER_KEY) {
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
selectRefCurrent === null || selectRefCurrent === void 0 ? void 0 : selectRefCurrent.blur();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
return (_jsxs("div", __assign({ className: classNames('smartapp-custom-select', containerClassName), style: __assign({ width: "".concat(width, "%") }, containerStyles) }, { children: [renderTitle(), isCreatable ? (_jsx(CreatableSelect, { ref: selectRef, menuPlacement: menuPosition, menuPosition: menuLocation, isLoading: isLoading, isDisabled: isDisabled, isClearable: isSelectClearable, controlShouldRenderValue: isDisabled, filterOption: creatableFilterOption, options: options, value: (value === null || value === void 0 ? void 0 : value.label) ? value : null, styles: generateStyles(), placeholder: placeholder, inputValue: isDisabled ? '' : inputValue, onInputChange: handleInputChange, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onKeyDown: handleCreatableKeyDown, onMenuOpen: onMenuOpen, loadingMessage: function () { return _jsx(LoadingMessage, { isCreatableSelect: true }); }, components: {
|
|
198
|
+
Input: Input,
|
|
199
|
+
Option: OptionComponent,
|
|
200
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
201
|
+
DropdownIndicator: function (props) { return _jsx(DropdownIndicator, __assign({}, props, { isHidden: isSelectClearable })); },
|
|
202
|
+
MenuList: MenuListComponent,
|
|
203
|
+
LoadingIndicator: LoadingIndicator,
|
|
204
|
+
NoOptionsMessage: function () { return null; },
|
|
205
|
+
ClearIndicator: ClearIndicator,
|
|
206
|
+
SingleValue: SingleValueComponent,
|
|
207
|
+
} })) : (_jsx(Select, { ref: selectRef, menuPlacement: menuPosition, menuPosition: menuLocation, isLoading: isLoading, isDisabled: isDisabled, isSearchable: isSearchable, isClearable: isSearchable && isSelectClearable, controlShouldRenderValue: isDisabled || !isSearchable, options: options, value: (value === null || value === void 0 ? void 0 : value.label) ? value : null, styles: generateStyles(), placeholder: placeholder, inputValue: isDisabled || !isSearchable ? '' : inputValue, onInputChange: handleInputChange, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, onMenuOpen: onMenuOpen, noOptionsMessage: function () { return noOptionsMessage; }, loadingMessage: function () { return _jsx(LoadingMessage, {}); }, components: {
|
|
208
|
+
Input: Input,
|
|
209
|
+
Option: OptionComponent,
|
|
210
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
211
|
+
DropdownIndicator: function (props) { return _jsx(DropdownIndicator, __assign({}, props, { isHidden: isSearchable && isSelectClearable })); },
|
|
212
|
+
SingleValue: SingleValueComponent,
|
|
213
|
+
MenuList: MenuListComponent,
|
|
214
|
+
LoadingIndicator: LoadingIndicator,
|
|
215
|
+
ClearIndicator: ClearIndicator,
|
|
216
|
+
NoOptionsMessage: function (props) { return _jsx(NoOptionsMessage, __assign({}, props, { noOptionsMessage: noOptionsMessage })); },
|
|
217
|
+
} })), renderHint(), renderError()] })));
|
|
218
|
+
};
|
|
219
|
+
export default CustomSelect;
|
|
220
|
+
//# sourceMappingURL=CustomSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomSelect.js","sourceRoot":"","sources":["../../../../src/components/CustomSelect/CustomSelect.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3E,OAAO,MAAM,EAAE,EAAc,UAAU,EAAgC,MAAM,cAAc,CAAA;AAC3F,OAAO,eAAe,MAAM,wBAAwB,CAAA;AACpD,OAAO,KAAK,MAAM,eAAe,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,QAAQ,MAAM,aAAa,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,8BAA8B,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACjJ,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEvF,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,cAAc,IAAI,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,cAAc,I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,EACZ,WAAW,EAAE,KACV,CACP,CAAA;AACH,CAAC,CAAA;AACD,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/CustomSelect/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { isEmpty } from 'lodash';
|
|
13
|
+
import { isPrimaryFillType } from '../../helpers';
|
|
14
|
+
import { COLORS } from '../../constants';
|
|
15
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
16
|
+
export default (function (_a) {
|
|
17
|
+
var isDisabled = _a.isDisabled, isError = _a.isError, fillType = _a.fillType, menuListMaxHeight = _a.menuListMaxHeight, optionHeight = _a.optionHeight;
|
|
18
|
+
return ({
|
|
19
|
+
control: function (provided, _a) {
|
|
20
|
+
var menuIsOpen = _a.menuIsOpen;
|
|
21
|
+
var borderColor = menuIsOpen ? 'var(--color-border-focused)' : 'var(--color-border)';
|
|
22
|
+
var hoverBorderColor = menuIsOpen ? 'var(--color-border-focused)' : 'var(--color-border-hover)';
|
|
23
|
+
var background = isPrimaryFillType(fillType) ? 'var(--color-input-secondary)' : 'var(--color-input-tertiary)';
|
|
24
|
+
var disabledBackground = 'var(--color-bg-tertiary)';
|
|
25
|
+
return __assign(__assign({}, provided), { background: isDisabled ? disabledBackground : background, borderRadius: '10px', borderColor: isError ? 'var(--color-border-error)' : isDisabled ? disabledBackground : borderColor, boxShadow: 'none', cursor: 'pointer', transition: 'border-color 250ms ease-in-out, background 250ms ease-in-out', '&:hover': {
|
|
26
|
+
borderColor: isError ? 'var(--color-border-error)' : hoverBorderColor,
|
|
27
|
+
} });
|
|
28
|
+
},
|
|
29
|
+
menu: function (provided) { return (__assign(__assign({}, provided), { background: COLORS.transparent, border: '1px solid var(--color-item)', borderRadius: '8px', boxShadow: "0 3px 17px 0 ".concat(COLORS.selectBoxShadow), margin: '4px 0', zIndex: 2, '&:has(> div:first-child:empty)': {
|
|
30
|
+
display: 'none',
|
|
31
|
+
} })); },
|
|
32
|
+
menuList: function (provided, _a) {
|
|
33
|
+
var isLoading = _a.isLoading, options = _a.options;
|
|
34
|
+
var isLoadingState = isLoading && isEmpty(options);
|
|
35
|
+
var paddingBottom = isLoadingState ? '0' : '4px';
|
|
36
|
+
return __assign(__assign({}, provided), { maxHeight: isLoadingState ? '240px' : "".concat(menuListMaxHeight, "px"), display: 'flex', flexDirection: 'column', gap: '4px', background: 'var(--color-item)', borderRadius: '8px', padding: "4px 4px ".concat(paddingBottom, " 4px"), scrollbarColor: "var(--color-scrollbar-thumb) ".concat(COLORS.transparent), '::-webkit-scrollbar-thumb': {
|
|
37
|
+
background: 'var(--color-scrollbar-thumb)',
|
|
38
|
+
}, '::-webkit-scrollbar-track': {
|
|
39
|
+
background: COLORS.transparent,
|
|
40
|
+
} });
|
|
41
|
+
},
|
|
42
|
+
valueContainer: function (provided) { return (__assign(__assign({}, provided), { padding: '12.5px 8px 12.5px 16px' })); },
|
|
43
|
+
dropdownIndicator: function (provided) { return (__assign(__assign({}, provided), { color: 'var(--color-icon-complementary) !important', padding: '14px 16px 14px 0', opacity: isDisabled && '0.5' })); },
|
|
44
|
+
clearIndicator: function (provided) { return (__assign(__assign({}, provided), { color: 'var(--color-icon-secondary) !important', marginRight: '8px' })); },
|
|
45
|
+
loadingMessage: function (provided) { return (__assign(__assign({}, provided), { padding: '2px', overflowY: 'hidden' })); },
|
|
46
|
+
placeholder: function (provided) { return (__assign(__assign({}, provided), { fontFamily: "Open Sans, 'sans-serif'", fontSize: '14px', fontWeight: '400', lineHeight: '19px', color: 'var(--color-text-tertiary)', margin: 0 })); },
|
|
47
|
+
input: function (provided) { return (__assign(__assign({}, provided), { fontSize: '14px', fontWeight: '400', lineHeight: '19px', color: 'var(--color-text-primary)', caretColor: 'var(--color-icon-accent)', padding: 0, margin: 0, overflow: 'auto' })); },
|
|
48
|
+
noOptionsMessage: function (provided) { return (__assign(__assign({}, provided), { fontSize: '14px', fontWeight: 400, lineHeight: '20px', color: 'var(--color-text-secondary)', padding: '14px' })); },
|
|
49
|
+
singleValue: function (provided) { return (__assign(__assign({}, provided), { display: 'flex', alignItems: 'center', gap: '8px', fontFamily: "Open Sans, 'sans-serif'", fontSize: '14px', fontWeight: 400, lineHeight: '19px', color: isDisabled ? 'var(--color-text-secondary)' : 'var(--color-text-primary)', margin: 0 })); },
|
|
50
|
+
option: function (provided) { return (__assign(__assign({}, provided), { display: 'flex', alignItems: 'center', minHeight: optionHeight ? "".concat(optionHeight, "px") : 'auto', height: optionHeight ? "".concat(optionHeight, "px") : 'auto', background: "".concat(COLORS.transparent, " !important"), padding: '0', cursor: 'pointer', '.smartapp-list-item__not-interactive': {
|
|
51
|
+
whiteSpace: 'normal',
|
|
52
|
+
}, '&.smartapp-option-with-tooltip': {
|
|
53
|
+
'.smartapp-list-item__text > div:nth-child(1)': {
|
|
54
|
+
textOverflow: 'ellipsis',
|
|
55
|
+
whiteSpace: 'nowrap',
|
|
56
|
+
overflow: 'hidden',
|
|
57
|
+
},
|
|
58
|
+
}, '.smartapp-list-item__text': {
|
|
59
|
+
gap: 0,
|
|
60
|
+
'& > div:nth-child(2)': {
|
|
61
|
+
fontSize: '12px',
|
|
62
|
+
lineHeight: '16px',
|
|
63
|
+
},
|
|
64
|
+
} })); },
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=sel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UAAU,EAAE,GAAG,EACf,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,2BAA2B,EAC/E,MAAM,EAAE,CAAC,IACT,EAX8B,CAW9B;QAEF,MAAM,EAAE,UAAC,QAAa,IAAK,OAAA,uBACtB,QAAQ,KACX,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,UAAG,YAAY,OAAI,CAAC,CAAC,CAAC,MAAM,EACtD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,UAAG,YAAY,OAAI,CAAC,CAAC,CAAC,MAAM,EACnD,UAAU,EAAE,UAAG,MAAM,CAAC,WAAW,gBAAa,EAC9C,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,SAAS,EAEjB,sCAAsC,EAAE;gBACtC,UAAU,EAAE,QAAQ;aACrB,EAED,gCAAgC,EAAE;gBAChC,8CAA8C,EAAE;oBAC9C,YAAY,EAAE,UAAU;oBACxB,UAAU,EAAE,QAAQ;oBACpB,QAAQ,EAAE,QAAQ;iBACnB;aACF,EAED,2BAA2B,EAAE;gBAC3B,GAAG,EAAE,CAAC;gBAEN,sBAAsB,EAAE;oBACtB,QAAQ,EAAE,MAAM;oBAChB,UAAU,EAAE,MAAM;iBACnB;aACF,IACD,EA9ByB,CA8BzB;KACH,CAAC;AA7JoG,CA6JpG,EAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/CustomSelect/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import Select, { components } from 'react-select';
|
|
25
|
+
import Avatar from '../Avatar';
|
|
26
|
+
import '../../styles/styles.scss';
|
|
27
|
+
var Control = function (_a) {
|
|
28
|
+
var _b, _c, _d;
|
|
29
|
+
var children = _a.children, props = __rest(_a, ["children"]);
|
|
30
|
+
return (_jsxs(components.Control, __assign({}, props, { children: [((_b = props.selectProps) === null || _b === void 0 ? void 0 : _b.value) && (_jsx("div", __assign({ className: "smartapp-custom-select-profiles__control" }, { children: _jsx("span", { children: _jsx(Avatar, { size: 32, username: (_d = (_c = props === null || props === void 0 ? void 0 : props.selectProps) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.username }) }) }))), children] })));
|
|
31
|
+
};
|
|
32
|
+
var Option = function (_a) {
|
|
33
|
+
var _b, _c, _d;
|
|
34
|
+
var props = __rest(_a, []);
|
|
35
|
+
return (_jsx(components.Option, __assign({}, props, { children: _jsxs("div", __assign({ className: "smartapp-custom-select-profiles__option" }, { children: [_jsx("div", __assign({ className: "smartapp-custom-select-profiles__option--avatar" }, { children: _jsx(Avatar, { size: 32, username: (_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.username }) })), _jsxs("div", __assign({ className: "smartapp-custom-select-profiles__option--info" }, { children: [_jsxs("p", __assign({ className: "smartapp-custom-select-profiles__option--info__title" }, { children: [(_c = props === null || props === void 0 ? void 0 : props.data) === null || _c === void 0 ? void 0 : _c.username, " "] })), _jsxs("p", __assign({ className: "smartapp-custom-select-profiles__option--info__email" }, { children: [(_d = props === null || props === void 0 ? void 0 : props.data) === null || _d === void 0 ? void 0 : _d.email, " "] }))] }))] })) })));
|
|
36
|
+
};
|
|
37
|
+
var DropdownIndicator = function (props) { return _jsx(components.DropdownIndicator, __assign({}, props)); };
|
|
38
|
+
var IndicatorSeparator = function () { return null; };
|
|
39
|
+
var CustomSelectProfiles = function (_a) {
|
|
40
|
+
var options = _a.options, defaultValue = _a.defaultValue, placeholder = _a.placeholder, onChange = _a.onChange, _b = _a.width, width = _b === void 0 ? 100 : _b;
|
|
41
|
+
var customStyles = {
|
|
42
|
+
option: function (provided, state) { return (__assign(__assign({}, provided), { cursor: 'pointer', color: '#000000', background: state.isSelected ? 'rgba(71, 153, 227, 0.1)' : '#ffffff', display: 'flex', textOverflow: 'ellipsis', width: "".concat(width, "%"), padding: '10px 0', '&:focus': {
|
|
43
|
+
background: '#ffffff',
|
|
44
|
+
color: 'none',
|
|
45
|
+
}, '&:hover': {
|
|
46
|
+
background: 'rgba(71, 153, 227, 0.1)',
|
|
47
|
+
} })); },
|
|
48
|
+
control: function (provided) { return (__assign(__assign({}, provided), { width: "".concat(width, "%"), textOverflow: 'ellipsis', padding: '5px 0 5px 5px' })); },
|
|
49
|
+
};
|
|
50
|
+
return (_jsx("div", __assign({ className: "smartapp-custom-select-profiles" }, { children: _jsx(Select
|
|
51
|
+
/* @ts-ignore */
|
|
52
|
+
, {
|
|
53
|
+
/* @ts-ignore */
|
|
54
|
+
onChange: function (option) { return onChange(option); }, options: options, defaultValue: defaultValue, styles: customStyles, getOptionLabel: function (option) { return option.username; }, getOptionValue: function (option) { return option.email; }, placeholder: _jsx("div", __assign({ className: "smartapp-custom-select-profiles__placeholder" }, { children: placeholder })), components: { Option: Option, Control: Control, DropdownIndicator: DropdownIndicator, IndicatorSeparator: IndicatorSeparator } }) })));
|
|
55
|
+
};
|
|
56
|
+
export default CustomSelectProfiles;
|
|
57
|
+
//# sourceMappingURL=CustomSelectProfiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomSelectProfiles.js","sourceRoot":"","sources":["../../../../src/components/CustomSelectProfiles/CustomSelectProfiles.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,MAAM,EAAE,EAAE,UAAU,EAA0B,MAAM,cAAc,CAAA;AACzE,OAAO,MAAM,MAAM,WAAW,CAAA;AAE9B,OAAO,0BAA0B,CAAA;AAEjC,IAAM,OAAO,GAAG,UAAC,EAA2B;;IAAzB,IAAA,QAAQ,cAAA,EAAK,KAAK,cAApB,YAAsB,CAAF;IAAY,OAAA,CAC/C,MAAC,UAAU,CAAC,OAAO,eAAK,KAAK,eAC1B,CAAA,MAAA,KAAK,CAAC,WAAW,0CAAE,KAAK,KAAI,CAC3B,uBAAK,SAAS,EAAC,0CAA0C,gBACvD,yBACE,KAAC,MAAM,IAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAA,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,0CAAE,KAAK,0CAAE,QAAQ,GAAI,GAC9D,IACH,CACP,EACA,QAAQ,KACU,CACtB,CAAA;CAAA,CAAA;AAED,IAAM,MAAM,GAAG,UAAC,EAAiB;;QAAZ,KAAK,cAAV,EAAY,CAAF;IAAY,OAAA,CACpC,KAAC,UAAU,CAAC,MAAM,eAAK,KAAK,cAC1B,wBAAK,SAAS,EAAC,yCAAyC,iBACtD,uBAAK,SAAS,EAAC,iDAAiD,gBAC9D,KAAC,MAAM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;QACF,OAAO,EAAE,UAAC,QAAa,IAAK,OAAA,uBACvB,QAAQ,KACX,KAAK,EAAE,UAAG,KAAK,MAAG,EAClB,YAAY,EAAE,UAAU,EACxB,OAAO,EAAE,eAAe,IACxB,EAL0B,CAK1B;KACH,CAAA;IAED,OAAO,CACL,uBAAK,SAAS,EAAC,iCAAiC,gBAC9C,KAAC,MAAM;QACL,gBAAgB;;YAAhB,gBAAgB;YAChB,QAAQ,EAAE,UAAC,MAAM,IAAK,OAAA,QAAQ,CAAC,MAAM,CAAC,EAAhB,CAAgB,EACtC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,QAAQ,EAAf,CAAe,EAC3C,cAAc,EAAE,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,KAAK,EAAZ,CAAY,EACxC,WAAW,EAAE,uBAAK,SAAS,EAAC,8CAA8C,gBAAE,WAAW,IAAO,EAC9F,UAAU,EAAE,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,iBAAiB,mBAAA,EAAE,kBAAkB,oBAAA,EAAE,GACtE,IACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/CustomSelectProfiles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/CustomSelectProfiles/types.ts"],"names":[],"mappings":""}
|