@consta/uikit 3.17.1 → 3.18.0
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/Attach/package.json +1 -1
- package/Attachment/package.json +1 -1
- package/Avatar/package.json +1 -1
- package/Badge/package.json +1 -1
- package/BasicSelectDeprecated/package.json +1 -1
- package/Breadcrumbs/package.json +1 -1
- package/BreadcrumbsCanary/package.json +1 -1
- package/Button/package.json +1 -1
- package/CHANGELOG.md +29 -40
- package/Calendar/package.json +1 -1
- package/Card/package.json +1 -1
- package/Checkbox/package.json +1 -1
- package/CheckboxGroup/package.json +1 -1
- package/ChoiceGroup/package.json +1 -1
- package/Collapse/package.json +1 -1
- package/CollapseGroup/package.json +1 -1
- package/Combobox/package.json +1 -1
- package/ComboboxDeprecated/package.json +1 -1
- package/ContextMenu/package.json +1 -1
- package/ContextMenuCanary/es.js +1 -0
- package/ContextMenuCanary/index.d.ts +1 -0
- package/ContextMenuCanary/index.js +4 -0
- package/ContextMenuCanary/package.json +9 -0
- package/DatePickerCanary/package.json +1 -1
- package/DateTimeCanary/package.json +1 -1
- package/DragNDropField/package.json +1 -1
- package/EventInterceptor/package.json +1 -1
- package/FieldCaption/package.json +1 -1
- package/FieldLabel/package.json +1 -1
- package/File/package.json +1 -1
- package/FileField/package.json +1 -1
- package/FileIcon/package.json +1 -1
- package/FileIconAvi/package.json +1 -1
- package/FileIconBmp/package.json +1 -1
- package/FileIconCsv/package.json +1 -1
- package/FileIconDoc/package.json +1 -1
- package/FileIconExe/package.json +1 -1
- package/FileIconGif/package.json +1 -1
- package/FileIconJpg/package.json +1 -1
- package/FileIconJson/package.json +1 -1
- package/FileIconLoading/package.json +1 -1
- package/FileIconMov/package.json +1 -1
- package/FileIconMp3/package.json +1 -1
- package/FileIconMp4/package.json +1 -1
- package/FileIconPdf/package.json +1 -1
- package/FileIconPng/package.json +1 -1
- package/FileIconPtt/package.json +1 -1
- package/FileIconRar/package.json +1 -1
- package/FileIconRtf/package.json +1 -1
- package/FileIconTiff/package.json +1 -1
- package/FileIconTxt/package.json +1 -1
- package/FileIconUndefined/package.json +1 -1
- package/FileIconWav/package.json +1 -1
- package/FileIconXls/package.json +1 -1
- package/FileIconZip/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Header/package.json +1 -1
- package/Icon/package.json +1 -1
- package/IconAdd/package.json +1 -1
- package/IconAddToComparison/package.json +1 -1
- package/IconAlert/package.json +1 -1
- package/IconAlignBlocksLeft/package.json +1 -1
- package/IconAlignBlocksRight/package.json +1 -1
- package/IconAlignCenter/package.json +1 -1
- package/IconAlignJustify/package.json +1 -1
- package/IconAlignLeft/package.json +1 -1
- package/IconAlignRight/package.json +1 -1
- package/IconAllDone/package.json +1 -1
- package/IconArrowDown/package.json +1 -1
- package/IconArrowLeft/package.json +1 -1
- package/IconArrowRight/package.json +1 -1
- package/IconArrowUp/package.json +1 -1
- package/IconArtBrush/package.json +1 -1
- package/IconAttach/package.json +1 -1
- package/IconBackward/package.json +1 -1
- package/IconBag/package.json +1 -1
- package/IconBarrier/package.json +1 -1
- package/IconBento/package.json +1 -1
- package/IconBold/package.json +1 -1
- package/IconBook/package.json +1 -1
- package/IconBookmarkFilled/package.json +1 -1
- package/IconBookmarkStroked/package.json +1 -1
- package/IconCalculator/package.json +1 -1
- package/IconCalendar/package.json +1 -1
- package/IconCamera/package.json +1 -1
- package/IconCancel/package.json +1 -1
- package/IconCards/package.json +1 -1
- package/IconChat/package.json +1 -1
- package/IconCheck/package.json +1 -1
- package/IconClose/package.json +1 -1
- package/IconCollapse/package.json +1 -1
- package/IconColorFill/package.json +1 -1
- package/IconColorText/package.json +1 -1
- package/IconColumns/package.json +1 -1
- package/IconComment/package.json +1 -1
- package/IconConnection/package.json +1 -1
- package/IconCopy/package.json +1 -1
- package/IconCrown/package.json +1 -1
- package/IconCursorMouse/package.json +1 -1
- package/IconDataNull/package.json +1 -1
- package/IconDiamond/package.json +1 -1
- package/IconDinosaur/package.json +1 -1
- package/IconDisconnection/package.json +1 -1
- package/IconDocAdd/package.json +1 -1
- package/IconDocBlank/package.json +1 -1
- package/IconDocDelete/package.json +1 -1
- package/IconDocExport/package.json +1 -1
- package/IconDocFilled/package.json +1 -1
- package/IconDown/package.json +1 -1
- package/IconDownload/package.json +1 -1
- package/IconDrag/package.json +1 -1
- package/IconDraggable/package.json +1 -1
- package/IconDrillingRig/package.json +1 -1
- package/IconDrop/package.json +1 -1
- package/IconEdit/package.json +1 -1
- package/IconExit/package.json +1 -1
- package/IconExpand/package.json +1 -1
- package/IconEye/package.json +1 -1
- package/IconEyeClose/package.json +1 -1
- package/IconFavorite/package.json +1 -1
- package/IconFilter/package.json +1 -1
- package/IconFitToDefault/package.json +1 -1
- package/IconFlagFilled/package.json +1 -1
- package/IconFlagStroked/package.json +1 -1
- package/IconFolders/package.json +1 -1
- package/IconForward/package.json +1 -1
- package/IconFunnel/package.json +1 -1
- package/IconGas/package.json +1 -1
- package/IconGeo/package.json +1 -1
- package/IconGrouping/package.json +1 -1
- package/IconHamburger/package.json +1 -1
- package/IconHand/package.json +1 -1
- package/IconHealth/package.json +1 -1
- package/IconHome/package.json +1 -1
- package/IconInComparison/package.json +1 -1
- package/IconInfo/package.json +1 -1
- package/IconIntroduction/package.json +1 -1
- package/IconIpad/package.json +1 -1
- package/IconItalic/package.json +1 -1
- package/IconKebab/package.json +1 -1
- package/IconLaptop/package.json +1 -1
- package/IconLayers/package.json +1 -1
- package/IconLeaf/package.json +1 -1
- package/IconLightningBolt/package.json +1 -1
- package/IconLineAndBarChart/package.json +1 -1
- package/IconLink/package.json +1 -1
- package/IconList/package.json +1 -1
- package/IconListNumbered/package.json +1 -1
- package/IconLock/package.json +1 -1
- package/IconLogicalElement/package.json +1 -1
- package/IconMBU/package.json +1 -1
- package/IconMGRP/package.json +1 -1
- package/IconMLSP/package.json +1 -1
- package/IconMMP/package.json +1 -1
- package/IconMail/package.json +1 -1
- package/IconMap/package.json +1 -1
- package/IconMaxHeight/package.json +1 -1
- package/IconMaxWidth/package.json +1 -1
- package/IconMeatball/package.json +1 -1
- package/IconMic/package.json +1 -1
- package/IconMolecules/package.json +1 -1
- package/IconMoon/package.json +1 -1
- package/IconNodeEnd/package.json +1 -1
- package/IconNodeStart/package.json +1 -1
- package/IconNodeStep/package.json +1 -1
- package/IconNodes/package.json +1 -1
- package/IconOpenInNew/package.json +1 -1
- package/IconOperators/package.json +1 -1
- package/IconPanelBottom/package.json +1 -1
- package/IconPanelLeft/package.json +1 -1
- package/IconPanelRight/package.json +1 -1
- package/IconPanelTop/package.json +1 -1
- package/IconPaste/package.json +1 -1
- package/IconPause/package.json +1 -1
- package/IconPhone/package.json +1 -1
- package/IconPhoto/package.json +1 -1
- package/IconPicture/package.json +1 -1
- package/IconPlay/package.json +1 -1
- package/IconPressure/package.json +1 -1
- package/IconPriceLabel/package.json +1 -1
- package/IconProcessing/package.json +1 -1
- package/IconQuestion/package.json +1 -1
- package/IconQuote/package.json +1 -1
- package/IconRUO/package.json +1 -1
- package/IconRUS/package.json +1 -1
- package/IconRecord/package.json +1 -1
- package/IconRemove/package.json +1 -1
- package/IconRemoveFromComparison/package.json +1 -1
- package/IconReply/package.json +1 -1
- package/IconResize/package.json +1 -1
- package/IconRestart/package.json +1 -1
- package/IconRevert/package.json +1 -1
- package/IconRing/package.json +1 -1
- package/IconRouble/package.json +1 -1
- package/IconRuler/package.json +1 -1
- package/IconSave/package.json +1 -1
- package/IconScreen/package.json +1 -1
- package/IconSearch/package.json +1 -1
- package/IconSelect/package.json +1 -1
- package/IconSelectOpen/package.json +1 -1
- package/IconSendMessage/package.json +1 -1
- package/IconSettings/package.json +1 -1
- package/IconShape/package.json +1 -1
- package/IconShuffle/package.json +1 -1
- package/IconSmile/package.json +1 -1
- package/IconSortDown/package.json +1 -1
- package/IconSortDownCenter/package.json +1 -1
- package/IconSortUp/package.json +1 -1
- package/IconSortUpCenter/package.json +1 -1
- package/IconStop/package.json +1 -1
- package/IconStorage/package.json +1 -1
- package/IconStrikethrough/package.json +1 -1
- package/IconSun/package.json +1 -1
- package/IconTable/package.json +1 -1
- package/IconTable2/package.json +1 -1
- package/IconTarget/package.json +1 -1
- package/IconTeam/package.json +1 -1
- package/IconTechResponse/package.json +1 -1
- package/IconTest/package.json +1 -1
- package/IconThumbUp/package.json +1 -1
- package/IconTie/package.json +1 -1
- package/IconTop/package.json +1 -1
- package/IconTrash/package.json +1 -1
- package/IconType/package.json +1 -1
- package/IconUnderline/package.json +1 -1
- package/IconUnlock/package.json +1 -1
- package/IconUnsort/package.json +1 -1
- package/IconUnsortCenter/package.json +1 -1
- package/IconUpload/package.json +1 -1
- package/IconUser/package.json +1 -1
- package/IconVZD/package.json +1 -1
- package/IconVideo/package.json +1 -1
- package/IconWarning/package.json +1 -1
- package/IconWatch/package.json +1 -1
- package/IconWideScreen/package.json +1 -1
- package/IconWorld/package.json +1 -1
- package/IconWrench/package.json +1 -1
- package/Informer/package.json +1 -1
- package/LayoutCanary/package.json +1 -1
- package/Loader/package.json +1 -1
- package/MixCard/package.json +1 -1
- package/MixFocus/package.json +1 -1
- package/MixPopoverAnimate/package.json +1 -1
- package/MixPopoverArrow/es.js +1 -0
- package/MixPopoverArrow/index.d.ts +1 -0
- package/MixPopoverArrow/index.js +4 -0
- package/MixPopoverArrow/package.json +9 -0
- package/MixSpace/package.json +1 -1
- package/MixVisuallyHidden/package.json +1 -1
- package/Modal/package.json +1 -1
- package/MultiComboboxDeprecated/package.json +1 -1
- package/Pagination/package.json +1 -1
- package/Popover/package.json +1 -1
- package/PortalWithTheme/package.json +1 -1
- package/ProgressSpin/package.json +1 -1
- package/ProgressStepBarCanary/package.json +1 -1
- package/Radio/package.json +1 -1
- package/RadioGroup/package.json +1 -1
- package/Responses/package.json +1 -1
- package/Responses403/package.json +1 -1
- package/Responses404/package.json +1 -1
- package/Responses500/package.json +1 -1
- package/Responses503/package.json +1 -1
- package/ResponsesConnectionError/package.json +1 -1
- package/ResponsesDeleted/package.json +1 -1
- package/ResponsesEmptyBox/package.json +1 -1
- package/ResponsesEmptyPockets/package.json +1 -1
- package/ResponsesExit/package.json +1 -1
- package/ResponsesImage/package.json +1 -1
- package/ResponsesImage403/package.json +1 -1
- package/ResponsesImage404/package.json +1 -1
- package/ResponsesImage500/package.json +1 -1
- package/ResponsesImage503/package.json +1 -1
- package/ResponsesImageConnectionError/package.json +1 -1
- package/ResponsesImageDeleted/package.json +1 -1
- package/ResponsesImageEmptyBox/package.json +1 -1
- package/ResponsesImageEmptyPockets/package.json +1 -1
- package/ResponsesImageNothingFound/package.json +1 -1
- package/ResponsesImageSuccess/package.json +1 -1
- package/ResponsesNothingFound/package.json +1 -1
- package/ResponsesSuccess/package.json +1 -1
- package/Select/package.json +1 -1
- package/Sidebar/package.json +1 -1
- package/Skeleton/package.json +1 -1
- package/SliderCanary/package.json +1 -1
- package/SnackBar/package.json +1 -1
- package/Steps/package.json +1 -1
- package/Switch/package.json +1 -1
- package/SwitchGroup/package.json +1 -1
- package/Table/package.json +1 -1
- package/Tabs/package.json +1 -1
- package/Tag/package.json +1 -1
- package/TagBase/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextField/package.json +1 -1
- package/Theme/package.json +1 -1
- package/ThemeToggler/package.json +1 -1
- package/Timer/package.json +1 -1
- package/Tooltip/package.json +1 -1
- package/User/package.json +1 -1
- package/UserSelect/package.json +1 -1
- package/UserSelectDeprecated/package.json +1 -1
- package/__internal__/cjs-src/components/Card/Card.d.ts +1 -0
- package/__internal__/cjs-src/components/Card/Card.js +8 -4
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenu.css +18 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuCanary.d.ts +4 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuCanary.js +30 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuItem/ContextMenuItem.css +74 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuItem/ContextMenuItem.d.ts +3 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuItem/ContextMenuItem.js +45 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuLevel/ContextMenuLevel.css +73 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuLevel/ContextMenuLevel.d.ts +4 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuLevel/ContextMenuLevel.js +102 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuLevels/ContextMenuLevels.d.ts +2 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuLevels/ContextMenuLevels.js +74 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/helper.d.ts +95 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/helper.js +119 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/types.d.ts +141 -0
- package/__internal__/cjs-src/components/ContextMenuCanary/types.js +14 -0
- package/__internal__/cjs-src/components/EventInterceptor/EventInterceptor.d.ts +2 -2
- package/__internal__/cjs-src/components/EventInterceptor/eventInterceptorMap.d.ts +2 -81
- package/__internal__/cjs-src/components/EventInterceptor/types.d.ts +1 -0
- package/__internal__/cjs-src/components/EventInterceptor/types.js +2 -0
- package/__internal__/cjs-src/components/EventInterceptor/usePropsHandler.d.ts +2 -2
- package/__internal__/cjs-src/components/SelectComponents/SelectDropdown/SelectDropdown.css +0 -1
- package/__internal__/cjs-src/components/Sidebar/Sidebar.css +5 -0
- package/__internal__/cjs-src/components/Sidebar/Sidebar.js +1 -1
- package/__internal__/cjs-src/components/Tag/Tag.d.ts +1 -0
- package/__internal__/cjs-src/components/Tag/Tag.js +8 -4
- package/__internal__/cjs-src/components/ThemeToggler/ThemeToggler.d.ts +2 -30
- package/__internal__/cjs-src/components/ThemeToggler/ThemeToggler.js +23 -37
- package/__internal__/cjs-src/components/ThemeToggler/helpers.d.ts +274 -0
- package/__internal__/cjs-src/components/ThemeToggler/helpers.js +27 -0
- package/__internal__/cjs-src/components/ThemeToggler/types.d.ts +45 -0
- package/__internal__/cjs-src/components/ThemeToggler/types.js +5 -0
- package/__internal__/cjs-src/components/Tooltip/Tooltip.css +1 -89
- package/__internal__/cjs-src/components/Tooltip/Tooltip.js +3 -2
- package/__internal__/cjs-src/mixs/MixPopoverArrow/MixPopoverArrow.css +88 -0
- package/__internal__/cjs-src/mixs/MixPopoverArrow/MixPopoverArrow.d.ts +8 -0
- package/__internal__/cjs-src/mixs/MixPopoverArrow/MixPopoverArrow.js +6 -0
- package/__internal__/src/components/Card/Card.d.ts +1 -0
- package/__internal__/src/components/Card/Card.js +7 -3
- package/__internal__/src/components/ContextMenuCanary/ContextMenu.css +18 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuCanary.d.ts +4 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuCanary.js +27 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuItem/ContextMenuItem.css +74 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuItem/ContextMenuItem.d.ts +3 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuItem/ContextMenuItem.js +42 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuLevel/ContextMenuLevel.css +73 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuLevel/ContextMenuLevel.d.ts +4 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuLevel/ContextMenuLevel.js +99 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuLevels/ContextMenuLevels.d.ts +2 -0
- package/__internal__/src/components/ContextMenuCanary/ContextMenuLevels/ContextMenuLevels.js +71 -0
- package/__internal__/src/components/ContextMenuCanary/helper.d.ts +95 -0
- package/__internal__/src/components/ContextMenuCanary/helper.js +115 -0
- package/__internal__/src/components/ContextMenuCanary/types.d.ts +141 -0
- package/__internal__/src/components/ContextMenuCanary/types.js +11 -0
- package/__internal__/src/components/EventInterceptor/EventInterceptor.d.ts +2 -2
- package/__internal__/src/components/EventInterceptor/eventInterceptorMap.d.ts +2 -81
- package/__internal__/src/components/EventInterceptor/types.d.ts +1 -0
- package/__internal__/src/components/EventInterceptor/types.js +0 -0
- package/__internal__/src/components/EventInterceptor/usePropsHandler.d.ts +2 -2
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.css +0 -1
- package/__internal__/src/components/Sidebar/Sidebar.css +5 -0
- package/__internal__/src/components/Sidebar/Sidebar.js +1 -1
- package/__internal__/src/components/Tag/Tag.d.ts +1 -0
- package/__internal__/src/components/Tag/Tag.js +7 -3
- package/__internal__/src/components/ThemeToggler/ThemeToggler.d.ts +2 -30
- package/__internal__/src/components/ThemeToggler/ThemeToggler.js +21 -35
- package/__internal__/src/components/ThemeToggler/helpers.d.ts +274 -0
- package/__internal__/src/components/ThemeToggler/helpers.js +23 -0
- package/__internal__/src/components/ThemeToggler/types.d.ts +45 -0
- package/__internal__/src/components/ThemeToggler/types.js +2 -0
- package/__internal__/src/components/Tooltip/Tooltip.css +1 -89
- package/__internal__/src/components/Tooltip/Tooltip.js +3 -2
- package/__internal__/src/mixs/MixPopoverArrow/MixPopoverArrow.css +88 -0
- package/__internal__/src/mixs/MixPopoverArrow/MixPopoverArrow.d.ts +8 -0
- package/__internal__/src/mixs/MixPopoverArrow/MixPopoverArrow.js +3 -0
- package/createIcon/package.json +1 -1
- package/createResponsesImage/package.json +1 -1
- package/package.json +3 -1
- package/useBreakpoints/package.json +1 -1
- package/useChoiceGroup/package.json +1 -1
- package/useChoiceGroupIndexed/package.json +1 -1
- package/useClickOutside/package.json +1 -1
- package/useComponentSize/package.json +1 -1
- package/useDebounce/package.json +1 -1
- package/useFlag/package.json +1 -1
- package/useForkRef/package.json +1 -1
- package/useGlobalKeys/package.json +1 -1
- package/useHideElementsInLine/package.json +1 -1
- package/useKeys/package.json +1 -1
- package/useMutableRef/package.json +1 -1
- package/useOverflow/package.json +1 -1
- package/usePrevious/package.json +1 -1
- package/useRefs/package.json +1 -1
- package/useResizeObserved/package.json +1 -1
- package/useScrollElements/package.json +1 -1
- package/useScrollPosition/package.json +1 -1
- package/useSelect/package.json +1 -1
- package/useSortSteps/package.json +1 -1
- package/useThemeVars/package.json +1 -1
- package/useTimer/package.json +1 -1
- package/withTooltip/package.json +1 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { __assign, __values } from "tslib";
|
|
2
|
+
import { isNotNil } from '../../utils/type-guards';
|
|
3
|
+
var defaultGetItemKey = function (item) { return item.key; };
|
|
4
|
+
var defaultGetItemRightSide = function (item) {
|
|
5
|
+
return item.rightSide;
|
|
6
|
+
};
|
|
7
|
+
var defaultGetItemLeftSide = function (item) {
|
|
8
|
+
return item.leftSide;
|
|
9
|
+
};
|
|
10
|
+
var defaultGetItemRightIcon = function (item) {
|
|
11
|
+
return item.rightIcon;
|
|
12
|
+
};
|
|
13
|
+
var defaultGetItemLeftIcon = function (item) {
|
|
14
|
+
return item.leftIcon;
|
|
15
|
+
};
|
|
16
|
+
var defaultGetItemStatus = function (item) {
|
|
17
|
+
return item.status;
|
|
18
|
+
};
|
|
19
|
+
var defaultGetItemDisabled = function (item) {
|
|
20
|
+
return item.disabled;
|
|
21
|
+
};
|
|
22
|
+
var defaultGetItemLabel = function (item) {
|
|
23
|
+
return item.label;
|
|
24
|
+
};
|
|
25
|
+
var defaultGetItemOnClick = function (item) {
|
|
26
|
+
return item.onClick;
|
|
27
|
+
};
|
|
28
|
+
var defaultGetItemSubMenu = function (item) {
|
|
29
|
+
return item.subMenu;
|
|
30
|
+
};
|
|
31
|
+
var defaultGetItemAs = function (item) { return item.as; };
|
|
32
|
+
var defaultGetItemAttributes = function (item) {
|
|
33
|
+
return item.attributes;
|
|
34
|
+
};
|
|
35
|
+
var defaultGetItemGroupId = function (item) {
|
|
36
|
+
return item.groupId;
|
|
37
|
+
};
|
|
38
|
+
var defaultGetGroupId = function (group) { return group.id; };
|
|
39
|
+
var defaultGetGroupLabel = function (group) {
|
|
40
|
+
return group.label;
|
|
41
|
+
};
|
|
42
|
+
export function withDefaultGetters(props) {
|
|
43
|
+
return __assign(__assign({}, props), { getItemKey: props.getItemKey || defaultGetItemKey, getItemLabel: props.getItemLabel || defaultGetItemLabel, getItemRightSide: props.getItemRightSide || defaultGetItemRightSide, getItemLeftSide: props.getItemLeftSide || defaultGetItemLeftSide, getItemRightIcon: props.getItemRightIcon || defaultGetItemRightIcon, getItemLeftIcon: props.getItemLeftIcon || defaultGetItemLeftIcon, getItemSubMenu: props.getItemSubMenu || defaultGetItemSubMenu, getItemStatus: props.getItemStatus || defaultGetItemStatus, getItemDisabled: props.getItemDisabled || defaultGetItemDisabled, getItemOnClick: props.getItemOnClick || defaultGetItemOnClick, getItemAs: props.getItemAs || defaultGetItemAs, getItemAttributes: props.getItemAttributes || defaultGetItemAttributes, getItemGroupId: props.getItemGroupId || defaultGetItemGroupId, getGroupId: props.getGroupId || defaultGetGroupId, getGroupLabel: props.getGroupLabel || defaultGetGroupLabel });
|
|
44
|
+
}
|
|
45
|
+
export var getGroup = function (group, props) {
|
|
46
|
+
var getGroupId = props.getGroupId, getGroupLabel = props.getGroupLabel;
|
|
47
|
+
return {
|
|
48
|
+
id: getGroupId(group),
|
|
49
|
+
name: getGroupLabel(group)
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
var findItem = function (params) {
|
|
53
|
+
var e_1, _a;
|
|
54
|
+
var _b;
|
|
55
|
+
var items = params.items, getItemKey = params.getItemKey, getItemSubMenu = params.getItemSubMenu, key = params.key, getItemLabel = params.getItemLabel;
|
|
56
|
+
try {
|
|
57
|
+
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
58
|
+
var item = items_1_1.value;
|
|
59
|
+
if ((_b = getItemKey(item)) !== null && _b !== void 0 ? _b : getItemLabel(item) === key) {
|
|
60
|
+
return item;
|
|
61
|
+
}
|
|
62
|
+
var subItems = typeof getItemSubMenu === 'function' && getItemSubMenu(item);
|
|
63
|
+
if (subItems) {
|
|
64
|
+
var subItem = findItem({
|
|
65
|
+
items: subItems,
|
|
66
|
+
key: key,
|
|
67
|
+
getItemLabel: getItemLabel,
|
|
68
|
+
getItemKey: getItemKey,
|
|
69
|
+
getItemSubMenu: getItemSubMenu
|
|
70
|
+
});
|
|
71
|
+
if (subItem) {
|
|
72
|
+
return subItem;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
78
|
+
finally {
|
|
79
|
+
try {
|
|
80
|
+
if (items_1_1 && !items_1_1.done && (_a = items_1["return"])) _a.call(items_1);
|
|
81
|
+
}
|
|
82
|
+
finally { if (e_1) throw e_1.error; }
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
};
|
|
86
|
+
export var getLevels = function (params) {
|
|
87
|
+
var levels = params.levels, items = params.items, getItemKey = params.getItemKey, getItemSubMenu = params.getItemSubMenu, getItemLabel = params.getItemLabel;
|
|
88
|
+
return levels.map(function (level) { return (__assign(__assign({}, level), { items: level.items
|
|
89
|
+
.map(function (item) {
|
|
90
|
+
var _a;
|
|
91
|
+
return findItem({
|
|
92
|
+
items: items,
|
|
93
|
+
getItemSubMenu: getItemSubMenu,
|
|
94
|
+
getItemKey: getItemKey,
|
|
95
|
+
getItemLabel: getItemLabel,
|
|
96
|
+
key: (_a = getItemKey(item)) !== null && _a !== void 0 ? _a : getItemLabel(item)
|
|
97
|
+
});
|
|
98
|
+
})
|
|
99
|
+
.filter(isNotNil) })); });
|
|
100
|
+
};
|
|
101
|
+
export var getItemIndex = function (groupId, itemIndex) {
|
|
102
|
+
return groupId + "-" + itemIndex;
|
|
103
|
+
};
|
|
104
|
+
export var sizeMapHeader = {
|
|
105
|
+
xs: '2xs',
|
|
106
|
+
s: '2xs',
|
|
107
|
+
m: 'xs',
|
|
108
|
+
l: 's'
|
|
109
|
+
};
|
|
110
|
+
export var sizeMapIcon = {
|
|
111
|
+
xs: 'xs',
|
|
112
|
+
s: 's',
|
|
113
|
+
m: 's',
|
|
114
|
+
l: 's'
|
|
115
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ClickOutsideHandler } from '../../hooks/useClickOutside/useClickOutside';
|
|
3
|
+
import { IconComponent } from '../../icons/Icon/Icon';
|
|
4
|
+
import { PropsWithAsAttributes } from '../../utils/types/PropsWithAsAttributes';
|
|
5
|
+
import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
6
|
+
import { Direction, Position } from '../Popover/Popover';
|
|
7
|
+
export declare const contextMenuSizes: readonly ["m", "xs", "s", "l"];
|
|
8
|
+
export declare type ContextMenuPropSize = typeof contextMenuSizes[number];
|
|
9
|
+
export declare const contextMenuDefaultSize: ContextMenuPropSize;
|
|
10
|
+
export declare const contextMenuStatus: readonly ["alert", "success", "warning"];
|
|
11
|
+
export declare type ContextMenuStatus = typeof contextMenuStatus[number];
|
|
12
|
+
export declare const contextMenuDefaultStatus: ContextMenuStatus;
|
|
13
|
+
export declare const contextMenuPropSubMenuDirections: readonly ["rightStartUp", "rightStartDown", "leftStartUp", "leftStartDown"];
|
|
14
|
+
export declare type ContextMenuPropSubMenuDirection = typeof contextMenuPropSubMenuDirections[number];
|
|
15
|
+
export declare const contextMenuPropDefaultSubMenuDirection: ContextMenuPropSubMenuDirection;
|
|
16
|
+
export declare type ContextMenuPropOnClick<ITEM> = (params: {
|
|
17
|
+
e: React.MouseEvent<HTMLDivElement>;
|
|
18
|
+
item: ITEM;
|
|
19
|
+
}) => void;
|
|
20
|
+
export declare type ContextMenuGroupDefault = {
|
|
21
|
+
label?: string;
|
|
22
|
+
id: number;
|
|
23
|
+
};
|
|
24
|
+
export declare type ContextMenuItemDefault = {
|
|
25
|
+
label: string | number;
|
|
26
|
+
key?: string | number;
|
|
27
|
+
rightSide?: React.ReactNode;
|
|
28
|
+
rightIcon?: IconComponent;
|
|
29
|
+
leftSide?: React.ReactNode;
|
|
30
|
+
leftIcon?: IconComponent;
|
|
31
|
+
subMenu?: ContextMenuItemDefault[];
|
|
32
|
+
status?: ContextMenuStatus;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
groupId?: number;
|
|
35
|
+
onClick?: ContextMenuPropOnClick<ContextMenuItemDefault>;
|
|
36
|
+
as?: keyof JSX.IntrinsicElements;
|
|
37
|
+
attributes?: JSX.IntrinsicElements[keyof JSX.IntrinsicElements];
|
|
38
|
+
};
|
|
39
|
+
export declare type ContextMenuPropSortGroup = (a: string | number, b: string | number) => number;
|
|
40
|
+
export declare type ContextMenuPropGetItemLabel<ITEM> = (item: ITEM) => string | number;
|
|
41
|
+
export declare type ContextMenuPropGetItemRightSide<ITEM> = (item: ITEM) => React.ReactNode | undefined;
|
|
42
|
+
export declare type ContextMenuPropGetItemLeftSide<ITEM> = (item: ITEM) => React.ReactNode | undefined;
|
|
43
|
+
export declare type ContextMenuPropGetItemSubMenu<ITEM> = (item: ITEM) => ITEM[] | undefined;
|
|
44
|
+
export declare type ContextMenuPropGetItemStatus<ITEM> = (item: ITEM) => ContextMenuStatus | undefined;
|
|
45
|
+
export declare type ContextMenuPropGetItemKey<ITEM> = (item: ITEM) => string | number | undefined;
|
|
46
|
+
export declare type ContextMenuPropGetItemOnClick<ITEM> = (item: ITEM) => ContextMenuPropOnClick<ITEM> | undefined;
|
|
47
|
+
export declare type ContextMenuPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;
|
|
48
|
+
export declare type ContextMenuPropGetItemAs<ITEM> = (item: ITEM) => keyof JSX.IntrinsicElements | undefined;
|
|
49
|
+
export declare type ContextMenuPropGetItemAttributes<ITEM> = (item: ITEM) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | undefined;
|
|
50
|
+
export declare type ContextMenuPropGetItemGroupId<ITEM> = (item: ITEM) => number | undefined;
|
|
51
|
+
export declare type ContextMenuPropGetItemRightIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
|
|
52
|
+
export declare type ContextMenuPropGetItemLeftIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
|
|
53
|
+
export declare type ContextMenuPropGetGroupLabel<GROUP> = (group: GROUP) => string | undefined;
|
|
54
|
+
export declare type ContextMenuPropGetGroupId<GROUP> = (group: GROUP) => number;
|
|
55
|
+
declare type PositioningProps = {
|
|
56
|
+
anchorRef: React.RefObject<HTMLElement>;
|
|
57
|
+
position?: never;
|
|
58
|
+
} | {
|
|
59
|
+
anchorRef?: never;
|
|
60
|
+
position: Position;
|
|
61
|
+
};
|
|
62
|
+
export declare type MappersItem<ITEM> = {
|
|
63
|
+
getItemLabel?: ContextMenuPropGetItemLabel<ITEM>;
|
|
64
|
+
getItemRightSide?: ContextMenuPropGetItemRightSide<ITEM>;
|
|
65
|
+
getItemLeftSide?: ContextMenuPropGetItemLeftSide<ITEM>;
|
|
66
|
+
getItemSubMenu?: ContextMenuPropGetItemSubMenu<ITEM>;
|
|
67
|
+
getItemStatus?: ContextMenuPropGetItemStatus<ITEM>;
|
|
68
|
+
getItemDisabled?: ContextMenuPropGetItemDisabled<ITEM>;
|
|
69
|
+
getItemKey?: ContextMenuPropGetItemKey<ITEM>;
|
|
70
|
+
getItemOnClick?: ContextMenuPropGetItemOnClick<ITEM>;
|
|
71
|
+
getItemAs?: ContextMenuPropGetItemAs<ITEM>;
|
|
72
|
+
getItemAttributes?: ContextMenuPropGetItemAttributes<ITEM>;
|
|
73
|
+
getItemGroupId?: ContextMenuPropGetItemGroupId<ITEM>;
|
|
74
|
+
getItemLeftIcon?: ContextMenuPropGetItemLeftIcon<ITEM>;
|
|
75
|
+
getItemRightIcon?: ContextMenuPropGetItemRightIcon<ITEM>;
|
|
76
|
+
};
|
|
77
|
+
export declare type MappersGroup<GROUP> = {
|
|
78
|
+
getGroupLabel?: ContextMenuPropGetGroupLabel<GROUP>;
|
|
79
|
+
getGroupId?: ContextMenuPropGetGroupId<GROUP>;
|
|
80
|
+
};
|
|
81
|
+
export declare type Level<ITEM> = {
|
|
82
|
+
items: ITEM[];
|
|
83
|
+
activeItem?: string;
|
|
84
|
+
direction?: Direction;
|
|
85
|
+
possibleDirections?: readonly Direction[];
|
|
86
|
+
offset?: number;
|
|
87
|
+
} & PositioningProps;
|
|
88
|
+
export declare type AddLevel<ITEM> = (params: {
|
|
89
|
+
level: number;
|
|
90
|
+
items: ITEM[];
|
|
91
|
+
anchorRef?: React.RefObject<HTMLElement>;
|
|
92
|
+
activeItem: string;
|
|
93
|
+
}) => void;
|
|
94
|
+
export declare type ContextMenuProps<ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault> = PropsWithHTMLAttributesAndRef<{
|
|
95
|
+
items: ITEM[];
|
|
96
|
+
size?: ContextMenuPropSize;
|
|
97
|
+
direction?: Direction;
|
|
98
|
+
offset?: number;
|
|
99
|
+
groups?: GROUP[];
|
|
100
|
+
sortGroup?: ContextMenuPropSortGroup;
|
|
101
|
+
onItemClick?: ContextMenuPropOnClick<ITEM>;
|
|
102
|
+
possibleDirections?: readonly Direction[];
|
|
103
|
+
subMenuDirection?: ContextMenuPropSubMenuDirection;
|
|
104
|
+
spareDirection?: Direction;
|
|
105
|
+
onSetDirection?: (direction: Direction) => void;
|
|
106
|
+
onClickOutside?: ClickOutsideHandler;
|
|
107
|
+
isOpen?: boolean;
|
|
108
|
+
} & MappersItem<ITEM> & MappersGroup<GROUP> & PositioningProps, HTMLDivElement> & (GROUP extends {
|
|
109
|
+
id: ContextMenuGroupDefault['id'] | unknown;
|
|
110
|
+
} ? {} : {
|
|
111
|
+
getGroupId: ContextMenuPropGetGroupId<GROUP>;
|
|
112
|
+
}) & (ITEM extends {
|
|
113
|
+
label: ContextMenuItemDefault['label'];
|
|
114
|
+
} ? {} : {
|
|
115
|
+
getItemLabel: ContextMenuPropGetItemLabel<ITEM>;
|
|
116
|
+
});
|
|
117
|
+
export declare type ContextMenuComponent = <ITEM = ContextMenuItemDefault, GROUP = ContextMenuGroupDefault>(props: ContextMenuProps<ITEM, GROUP>) => React.ReactElement | null;
|
|
118
|
+
export declare type ContextMenuLevelProps<ITEM, GROUP> = Omit<ContextMenuProps<ITEM, GROUP>, 'subMenuDirection' | 'onClickOutside' | keyof MappersItem<ITEM> | keyof MappersGroup<GROUP>> & {
|
|
119
|
+
levelDepth: number;
|
|
120
|
+
addLevel: AddLevel<ITEM>;
|
|
121
|
+
deleteLevel: (level: number) => void;
|
|
122
|
+
activeItem?: string;
|
|
123
|
+
onSetDirection?: (direction: Direction) => void;
|
|
124
|
+
hoveredParenLevel: number;
|
|
125
|
+
setHoveredParenLevel: (level: number) => void;
|
|
126
|
+
} & Required<MappersItem<ITEM>> & Required<MappersGroup<GROUP>>;
|
|
127
|
+
export declare type ContextMenuLevelComponent = <ITEM, GROUP>(props: ContextMenuLevelProps<ITEM, GROUP>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
128
|
+
export declare type ContextMenuItemProps<AS extends keyof JSX.IntrinsicElements = 'div'> = PropsWithAsAttributes<Omit<ContextMenuItemDefault, 'onClick' | 'attributes'> & {
|
|
129
|
+
size?: ContextMenuPropSize;
|
|
130
|
+
active: boolean;
|
|
131
|
+
withSubMenu: boolean;
|
|
132
|
+
}, AS> & React.RefAttributes<HTMLDivElement>;
|
|
133
|
+
export declare type ContextMenuItemComponent = <AS extends keyof JSX.IntrinsicElements = 'div'>(props: ContextMenuItemProps<AS>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
134
|
+
export declare type GetLevelsParams<ITEM> = {
|
|
135
|
+
levels: Level<ITEM>[];
|
|
136
|
+
items: ITEM[];
|
|
137
|
+
getItemSubMenu: ContextMenuPropGetItemSubMenu<ITEM>;
|
|
138
|
+
getItemKey: ContextMenuPropGetItemKey<ITEM>;
|
|
139
|
+
getItemLabel: ContextMenuPropGetItemLabel<ITEM>;
|
|
140
|
+
};
|
|
141
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var contextMenuSizes = ['m', 'xs', 's', 'l'];
|
|
2
|
+
export var contextMenuDefaultSize = contextMenuSizes[0];
|
|
3
|
+
export var contextMenuStatus = ['alert', 'success', 'warning'];
|
|
4
|
+
export var contextMenuDefaultStatus = contextMenuStatus[0];
|
|
5
|
+
export var contextMenuPropSubMenuDirections = [
|
|
6
|
+
'rightStartUp',
|
|
7
|
+
'rightStartDown',
|
|
8
|
+
'leftStartUp',
|
|
9
|
+
'leftStartDown',
|
|
10
|
+
];
|
|
11
|
+
export var contextMenuPropDefaultSubMenuDirection = contextMenuPropSubMenuDirections[0];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { eventInterceptorMap } from './eventInterceptorMap';
|
|
3
|
+
import { EventInterceptorComponentName } from './types';
|
|
3
4
|
export declare type EventInterceptorMap = typeof eventInterceptorMap;
|
|
4
|
-
export declare type EventInterceptorMapKeys = keyof EventInterceptorMap;
|
|
5
5
|
export declare type EventInterceptorProps = {
|
|
6
|
-
component:
|
|
6
|
+
component: EventInterceptorComponentName;
|
|
7
7
|
event?: string;
|
|
8
8
|
options: {
|
|
9
9
|
[key: string]: any;
|
|
@@ -1,81 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const eventInterceptorMap:
|
|
3
|
-
readonly Button: <T extends import("../Button/Button").Props>(props: T, handler: import("./EventInterceptor").EventInterceptorHandler, ref: import("react").RefObject<HTMLElement>) => T;
|
|
4
|
-
readonly Checkbox: <P extends {
|
|
5
|
-
checked: boolean | undefined;
|
|
6
|
-
size?: "m" | "l" | undefined;
|
|
7
|
-
view?: "ghost" | "primary" | undefined;
|
|
8
|
-
align?: "center" | "top" | undefined;
|
|
9
|
-
disabled?: boolean | undefined;
|
|
10
|
-
intermediate?: boolean | undefined;
|
|
11
|
-
label?: string | undefined;
|
|
12
|
-
onChange?: import("../Checkbox/Checkbox").CheckboxPropOnChange | undefined;
|
|
13
|
-
name?: string | undefined;
|
|
14
|
-
onFocus?: ((event: import("react").FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
15
|
-
onBlur?: ((event: import("react").FocusEvent<HTMLInputElement>) => void) | undefined;
|
|
16
|
-
autoFocus?: boolean | undefined;
|
|
17
|
-
readOnly?: boolean | undefined;
|
|
18
|
-
required?: boolean | undefined;
|
|
19
|
-
step?: string | number | undefined;
|
|
20
|
-
tabIndex?: number | undefined;
|
|
21
|
-
inputRef?: ((instance: HTMLInputElement | null) => void) | import("react").RefObject<HTMLInputElement> | null | undefined;
|
|
22
|
-
children?: undefined;
|
|
23
|
-
} & Pick<import("react").HTMLAttributes<HTMLLabelElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & import("react").RefAttributes<HTMLLabelElement>>(props: P, handler: import("./EventInterceptor").EventInterceptorHandler, ref: import("react").RefObject<HTMLLabelElement>) => P;
|
|
24
|
-
readonly Select: <PROPS extends import("../Select/helpers").SelectProps<import("../Select/helpers").DefaultItem, import("../Select/helpers").DefaultGroup>>(props: PROPS, handler: import("./EventInterceptor").EventInterceptorHandler, ref: import("react").RefObject<HTMLDivElement | null>) => PROPS;
|
|
25
|
-
readonly SnackBar: <P_1 extends import("../SnackBar/types").SnackBarProps<import("../SnackBar/types").SnackBarItemDefault>>(props: P_1, handler: import("./EventInterceptor").EventInterceptorHandler) => P_1;
|
|
26
|
-
readonly TextField: <P_2 extends {
|
|
27
|
-
className?: string | undefined;
|
|
28
|
-
value?: string | null | undefined;
|
|
29
|
-
cols?: number | undefined;
|
|
30
|
-
onChange?: import("../TextField/helpers").TextFieldPropOnChange | undefined;
|
|
31
|
-
id?: string | number | undefined;
|
|
32
|
-
name?: string | undefined;
|
|
33
|
-
type?: string | undefined;
|
|
34
|
-
disabled?: boolean | undefined;
|
|
35
|
-
maxLength?: number | undefined;
|
|
36
|
-
size?: "xs" | "s" | "m" | "l" | undefined;
|
|
37
|
-
view?: "default" | "clear" | undefined;
|
|
38
|
-
form?: "default" | "round" | "brick" | "brickRound" | "roundBrick" | "brickDefault" | "defaultBrick" | "clearRound" | "roundClear" | "clearDefault" | "defaultClear" | "brickClear" | "clearBrick" | "clearClear" | undefined;
|
|
39
|
-
state?: "alert" | "success" | "warning" | undefined;
|
|
40
|
-
status?: "alert" | "success" | "warning" | undefined;
|
|
41
|
-
width?: "default" | "full" | undefined;
|
|
42
|
-
onFocus?: ((event: import("react").FocusEvent<HTMLElement>) => void) | undefined;
|
|
43
|
-
onBlur?: ((event: import("react").FocusEvent<HTMLElement>) => void) | undefined;
|
|
44
|
-
autoFocus?: boolean | undefined;
|
|
45
|
-
placeholder?: string | undefined;
|
|
46
|
-
leftSide?: string | import("react").FC<import("../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
47
|
-
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
48
|
-
size?: "xs" | "s" | "m" | undefined;
|
|
49
|
-
}, HTMLSpanElement>> | undefined;
|
|
50
|
-
rightSide?: string | import("react").FC<import("../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
51
|
-
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
52
|
-
size?: "xs" | "s" | "m" | undefined;
|
|
53
|
-
}, HTMLSpanElement>> | undefined;
|
|
54
|
-
withClearButton?: boolean | undefined;
|
|
55
|
-
autoComplete?: "on" | "off" | "tel" | "url" | "email" | "name" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "photo" | undefined;
|
|
56
|
-
max?: string | number | undefined;
|
|
57
|
-
min?: string | number | undefined;
|
|
58
|
-
readOnly?: boolean | undefined;
|
|
59
|
-
required?: boolean | undefined;
|
|
60
|
-
step?: string | number | number[] | undefined;
|
|
61
|
-
tabIndex?: number | undefined;
|
|
62
|
-
inputContainerRef?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
63
|
-
inputRef?: ((instance: HTMLInputElement | HTMLTextAreaElement | null) => void) | import("react").RefObject<HTMLInputElement | HTMLTextAreaElement> | null | undefined;
|
|
64
|
-
ariaLabel?: string | undefined;
|
|
65
|
-
iconSize?: "xs" | "s" | "m" | undefined;
|
|
66
|
-
children?: undefined;
|
|
67
|
-
label?: string | undefined;
|
|
68
|
-
caption?: string | undefined;
|
|
69
|
-
labelPosition?: "left" | "top" | undefined;
|
|
70
|
-
focused?: boolean | undefined;
|
|
71
|
-
} & Pick<import("react").HTMLAttributes<HTMLDivElement>, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "lang" | "slot" | "spellCheck" | "style" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & {
|
|
72
|
-
rows?: undefined;
|
|
73
|
-
minRows?: undefined;
|
|
74
|
-
maxRows?: undefined;
|
|
75
|
-
} & {
|
|
76
|
-
rightSide?: string | import("react").FC<import("../../utils/types/PropsWithHTMLAttributes").PropsWithHTMLAttributesAndRef<{
|
|
77
|
-
view?: "link" | "alert" | "brand" | "ghost" | "primary" | "secondary" | "success" | "warning" | "disabled" | undefined;
|
|
78
|
-
size?: "xs" | "s" | "m" | undefined;
|
|
79
|
-
}, HTMLSpanElement>> | undefined;
|
|
80
|
-
} & import("react").RefAttributes<HTMLElement>>(props: P_2, handler: import("./EventInterceptor").EventInterceptorHandler, ref: import("react").RefObject<HTMLDivElement>) => P_2;
|
|
81
|
-
};
|
|
1
|
+
import { EventInterceptorComponentName } from './types';
|
|
2
|
+
export declare const eventInterceptorMap: Partial<Record<EventInterceptorComponentName, ((...args: any[]) => any) | undefined>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type EventInterceptorComponentName = 'Attachment' | 'Avatar' | 'Badge' | 'Breadcrumbs' | 'Button' | 'Calendar' | 'Card' | 'Checkbox' | 'CheckboxGroup' | 'ChoiceGroup' | 'Collapse' | 'CollapseGroup' | 'Combobox' | 'ContextMenu' | 'DatePicker' | 'DateTime' | 'DragNDropField' | 'File' | 'FileField' | 'Grid' | 'Header' | 'Informer' | 'Layout' | 'Loader' | 'Modal' | 'Pagination' | 'Popover' | 'ProgressSpin' | 'ProgressStepBar' | 'Radio' | 'RadioGroup' | 'Select' | 'Sidebar' | 'Skeleton' | 'Slider' | 'SnackBar' | 'Steps' | 'Switch' | 'SwitchGroup' | 'Table' | 'Tabs' | 'Tag' | 'TagBase' | 'Text' | 'TextField' | 'ThemeToggler' | 'Timer' | 'Tooltip' | 'User' | 'UserSelect';
|
|
File without changes
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export declare const usePropsHandler: <PROPS extends {}>(componentName:
|
|
2
|
+
import { EventInterceptorComponentName } from './types';
|
|
3
|
+
export declare const usePropsHandler: <PROPS extends {}>(componentName: EventInterceptorComponentName, props: PROPS, ref?: ((instance: HTMLElement | null) => void) | React.RefObject<HTMLElement> | null | undefined) => PROPS;
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
overflow: hidden;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.Sidebar:not(.Sidebar_hasOverlay) {
|
|
23
|
+
pointer-events: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
.Sidebar_position_top {
|
|
23
27
|
-webkit-box-orient: vertical;
|
|
24
28
|
-webkit-box-direction: normal;
|
|
@@ -65,6 +69,7 @@
|
|
|
65
69
|
background-color: var(--color-bg-default);
|
|
66
70
|
-webkit-box-shadow: var(--shadow-modal);
|
|
67
71
|
box-shadow: var(--shadow-modal);
|
|
72
|
+
pointer-events: auto;
|
|
68
73
|
}
|
|
69
74
|
|
|
70
75
|
.Sidebar-Window_position_right,
|
|
@@ -47,7 +47,7 @@ export var Sidebar = function (props) {
|
|
|
47
47
|
useGlobalKeys({
|
|
48
48
|
Escape: function (e) { return isOpen && onEsc && onEsc(e); }
|
|
49
49
|
});
|
|
50
|
-
return (React.createElement(CSSTransition, { "in": isOpen, unmountOnExit: true, className: cnSidebar({ position: position }), classNames: cnForCssTransition(cnSidebar), timeout: 200, nodeRef: portalRef },
|
|
50
|
+
return (React.createElement(CSSTransition, { "in": isOpen, unmountOnExit: true, className: cnSidebar({ position: position, hasOverlay: hasOverlay }), classNames: cnForCssTransition(cnSidebar), timeout: 200, nodeRef: portalRef },
|
|
51
51
|
React.createElement(PortalWithTheme, { preset: theme, ref: portalRef, container: container, className: rootClassName, style: typeof (style === null || style === void 0 ? void 0 : style.zIndex) === 'number' ? { zIndex: style.zIndex } : undefined },
|
|
52
52
|
hasOverlay && React.createElement("div", { className: cnSidebar('Overlay'), "aria-label": "Overlay" }),
|
|
53
53
|
React.createElement("div", __assign({}, otherProps, { style: __assign(__assign({}, style), (typeof (style === null || style === void 0 ? void 0 : style.zIndex) === 'number' && { zIndex: (style === null || style === void 0 ? void 0 : style.zIndex) + 1 })), className: cnSidebar('Window', { size: size, position: position }, [className]), ref: ref }),
|
|
@@ -59,5 +59,6 @@ export declare function getParams(mode: TagPropMode, checked?: PropsWithModeChec
|
|
|
59
59
|
withAction?: TagBaseProps['withAction'];
|
|
60
60
|
as: keyof JSX.IntrinsicElements;
|
|
61
61
|
};
|
|
62
|
+
export declare const COMPONENT_NAME: "Tag";
|
|
62
63
|
export declare const Tag: Component;
|
|
63
64
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import { useForkRef } from '../../hooks/useForkRef/useForkRef';
|
|
4
|
+
import { usePropsHandler } from '../EventInterceptor/usePropsHandler';
|
|
3
5
|
import { TagBase } from '../TagBase/TagBase';
|
|
4
6
|
export var tagPropMode = ['button', 'check', 'cancel', 'link', 'info'];
|
|
5
7
|
export var tagPropModeDefault = tagPropMode[0];
|
|
@@ -44,8 +46,10 @@ export function getParams(mode, checked, onClick, onChange, onCancel) {
|
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
48
|
}
|
|
49
|
+
export var COMPONENT_NAME = 'Tag';
|
|
47
50
|
export var Tag = forwardRef(function (props, ref) {
|
|
48
|
-
var
|
|
51
|
+
var tagRef = useRef(null);
|
|
52
|
+
var _a = usePropsHandler(COMPONENT_NAME, props, tagRef), _b = _a.mode, mode = _b === void 0 ? tagPropModeDefault : _b, onChange = _a.onChange, checked = _a.checked, onCancel = _a.onCancel, onClick = _a.onClick, otherProps = __rest(_a, ["mode", "onChange", "checked", "onCancel", "onClick"]);
|
|
49
53
|
var params = getParams(mode, checked, onClick, onChange, onCancel);
|
|
50
|
-
return React.createElement(TagBase, __assign({}, otherProps, params, { ref: ref }));
|
|
54
|
+
return React.createElement(TagBase, __assign({}, otherProps, params, { ref: useForkRef([ref, tagRef]) }));
|
|
51
55
|
});
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
4
|
-
import { Direction } from '../Popover/Popover';
|
|
5
|
-
export declare const themeTogglerPropSize: readonly ["m", "l", "s", "xs"];
|
|
6
|
-
export declare type ThemeTogglerPropSize = typeof themeTogglerPropSize[number];
|
|
7
|
-
export declare const themeTogglerPropSizeDefault: ThemeTogglerPropSize;
|
|
8
|
-
export declare type ThemePropSetValue<ITEM> = (props: {
|
|
9
|
-
e: React.MouseEvent;
|
|
10
|
-
value: ITEM;
|
|
11
|
-
}) => void;
|
|
12
|
-
export declare type ThemePropGetKey<ITEM> = (item: ITEM) => string | number;
|
|
13
|
-
export declare type ThemePropGetLabel<ITEM> = (item: ITEM) => string;
|
|
14
|
-
export declare type ThemePropGetIcon<ITEM> = (item: ITEM) => IconComponent;
|
|
15
|
-
export declare type Props<ITEM> = PropsWithHTMLAttributesAndRef<{
|
|
16
|
-
size?: ThemeTogglerPropSize;
|
|
17
|
-
className?: string;
|
|
18
|
-
items: ITEM[];
|
|
19
|
-
value: ITEM;
|
|
20
|
-
onChange: ThemePropSetValue<ITEM>;
|
|
21
|
-
getItemKey?: ThemePropGetKey<ITEM>;
|
|
22
|
-
getItemLabel: ThemePropGetLabel<ITEM>;
|
|
23
|
-
getItemIcon: ThemePropGetIcon<ITEM>;
|
|
24
|
-
direction?: Direction;
|
|
25
|
-
possibleDirections?: readonly Direction[];
|
|
26
|
-
children?: never;
|
|
27
|
-
}, HTMLButtonElement>;
|
|
28
|
-
declare type ThemeToggler = <ITEM>(props: Props<ITEM>) => React.ReactElement | null;
|
|
29
|
-
export declare const ThemeToggler: ThemeToggler;
|
|
30
|
-
export {};
|
|
1
|
+
import { ThemeTogglerComponent } from './types';
|
|
2
|
+
export declare const ThemeToggler: ThemeTogglerComponent;
|
|
@@ -1,55 +1,40 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { forwardRef, useRef } from 'react';
|
|
3
3
|
import { useChoiceGroup } from '../../hooks/useChoiceGroup/useChoiceGroup';
|
|
4
|
+
import { useFlag } from '../../hooks/useFlag/useFlag';
|
|
5
|
+
import { useForkRef } from '../../hooks/useForkRef/useForkRef';
|
|
4
6
|
import { IconCheck } from '../../icons/IconCheck/IconCheck';
|
|
5
7
|
import { getByMap } from '../../utils/getByMap';
|
|
6
|
-
import { setRef } from '../../utils/setRef';
|
|
7
8
|
import { Button } from '../Button/Button';
|
|
9
|
+
import { isNotMultipleParams } from '../Combobox/helpers';
|
|
8
10
|
import { ContextMenu } from '../ContextMenu/ContextMenu';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
xs: 'xs'
|
|
16
|
-
};
|
|
17
|
-
var contextMenuSizeMap = {
|
|
18
|
-
l: 'l',
|
|
19
|
-
m: 'm',
|
|
20
|
-
s: 's',
|
|
21
|
-
xs: 's'
|
|
22
|
-
};
|
|
23
|
-
export var ThemeToggler = React.forwardRef(function (props, componentRef) {
|
|
24
|
-
var _a = props.size, size = _a === void 0 ? themeTogglerPropSizeDefault : _a, items = props.items, value = props.value, onChange = props.onChange, getItemKey = props.getItemKey, getItemLabel = props.getItemLabel, getItemIcon = props.getItemIcon, direction = props.direction, possibleDirections = props.possibleDirections, style = props.style, otherProps = __rest(props, ["size", "items", "value", "onChange", "getItemKey", "getItemLabel", "getItemIcon", "direction", "possibleDirections", "style"]);
|
|
25
|
-
var ref = useRef(null);
|
|
26
|
-
var _b = __read(useState(false), 2), isOpen = _b[0], setIsOpen = _b[1];
|
|
27
|
-
useEffect(function () {
|
|
28
|
-
if (componentRef) {
|
|
29
|
-
setRef(componentRef, ref.current);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
var _c = useChoiceGroup({
|
|
11
|
+
import { contextMenuSizeMap, iconSizeMap, withDefaultGetters } from './helpers';
|
|
12
|
+
import { themeTogglerPropSizeDefault } from './types';
|
|
13
|
+
function ThemeTogglerRender(props, ref) {
|
|
14
|
+
var _a = withDefaultGetters(props), _b = _a.size, size = _b === void 0 ? themeTogglerPropSizeDefault : _b, items = _a.items, value = _a.value, onChange = _a.onChange, getItemKey = _a.getItemKey, getItemLabel = _a.getItemLabel, getItemIcon = _a.getItemIcon, direction = _a.direction, possibleDirections = _a.possibleDirections, style = _a.style, otherProps = __rest(_a, ["size", "items", "value", "onChange", "getItemKey", "getItemLabel", "getItemIcon", "direction", "possibleDirections", "style"]);
|
|
15
|
+
var _c = __read(useFlag(false), 2), isOpen = _c[0], setIsOpen = _c[1];
|
|
16
|
+
var _d = useChoiceGroup({
|
|
33
17
|
value: value,
|
|
34
18
|
getKey: getItemKey || getItemLabel,
|
|
35
19
|
callBack: onChange,
|
|
36
20
|
multiple: false
|
|
37
|
-
}), getOnChange =
|
|
21
|
+
}), getOnChange = _d.getOnChange, getChecked = _d.getChecked;
|
|
22
|
+
var anchorRef = useRef(null);
|
|
23
|
+
var buttonRef = useForkRef([anchorRef, ref]);
|
|
38
24
|
var iconSize = getByMap(iconSizeMap, size);
|
|
39
25
|
var contextMenuSize = getByMap(contextMenuSizeMap, size);
|
|
40
|
-
var getButtonIcon = function () { return getItemIcon(items.find(function (theme) { return getChecked(theme); })); };
|
|
26
|
+
var getButtonIcon = function () { var _a; return getItemIcon((_a = items.find(function (theme) { return getChecked(theme); })) !== null && _a !== void 0 ? _a : items[0]); };
|
|
41
27
|
var onButtonClick = function (e) {
|
|
42
28
|
if (items.length > 2) {
|
|
43
|
-
setIsOpen(
|
|
29
|
+
setIsOpen.toogle();
|
|
44
30
|
}
|
|
45
31
|
else {
|
|
46
|
-
|
|
47
|
-
getOnChange(items[isFirstThemeSelected ? 1 : 0])(e);
|
|
32
|
+
getOnChange(items[getChecked(items[0]) ? 1 : 0])(e);
|
|
48
33
|
}
|
|
49
34
|
};
|
|
50
35
|
var renderIcons = function (item) {
|
|
51
36
|
var Icon = getItemIcon(item);
|
|
52
|
-
return React.createElement(Icon, { size: iconSize });
|
|
37
|
+
return Icon ? React.createElement(Icon, { size: iconSize }) : isNotMultipleParams;
|
|
53
38
|
};
|
|
54
39
|
var renderChecks = function (item) {
|
|
55
40
|
return getChecked(item) && React.createElement(IconCheck, { size: iconSize });
|
|
@@ -58,6 +43,7 @@ export var ThemeToggler = React.forwardRef(function (props, componentRef) {
|
|
|
58
43
|
return null;
|
|
59
44
|
}
|
|
60
45
|
return (React.createElement(React.Fragment, null,
|
|
61
|
-
React.createElement(Button, __assign({}, otherProps, { ref:
|
|
62
|
-
items.length > 2 && isOpen && (React.createElement(ContextMenu, { offset:
|
|
63
|
-
}
|
|
46
|
+
React.createElement(Button, __assign({}, otherProps, { ref: buttonRef, iconLeft: getButtonIcon(), onClick: onButtonClick, onlyIcon: true, size: size, view: "clear", style: style })),
|
|
47
|
+
items.length > 2 && isOpen && (React.createElement(ContextMenu, { offset: "s", items: items, getLabel: getItemLabel, anchorRef: anchorRef, direction: direction, possibleDirections: possibleDirections, getLeftSideBar: renderIcons, getRightSideBar: renderChecks, onClickOutside: setIsOpen.off, getItemOnClick: getOnChange, size: contextMenuSize, style: typeof (style === null || style === void 0 ? void 0 : style.zIndex) === 'number' ? { zIndex: style.zIndex + 1 } : undefined }))));
|
|
48
|
+
}
|
|
49
|
+
export var ThemeToggler = forwardRef(ThemeTogglerRender);
|