@synerise/ds-context-selector 0.24.5 → 0.24.7
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/CHANGELOG.md +19 -0
- package/dist/ContextSelector.d.ts +2 -2
- package/dist/ContextSelector.js +14 -14
- package/dist/ContextSelector.types.d.ts +2 -1
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.24.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.24.6...@synerise/ds-context-selector@0.24.7) (2024-09-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-context-selector
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.24.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.24.5...@synerise/ds-context-selector@0.24.6) (2024-08-30)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **context-selector:** reuse renderHoverTooltip for selected item ([57e8a14](https://github.com/Synerise/synerise-design/commit/57e8a148e70bccd54c6d4540fb36c14d492f110b))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.24.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.24.4...@synerise/ds-context-selector@0.24.5) (2024-08-27)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-context-selector
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { ContextProps } from './ContextSelector.types';
|
|
3
|
-
declare const ContextSelector: React.
|
|
3
|
+
declare const ContextSelector: ({ defaultDropdownVisibility, selectedItem, onSelectItem, onSetGroup, groups, items, texts, opened, addMode, loading, customTriggerComponent, trigger, menuItemHeight, dropdownWrapperStyles, onClickOutsideEvents, onClickOutside, onSearch, hideSearchField, hasMoreItems, onFetchData, onActivate, onDeactivate, onOpen, getPopupContainerOverride, type, dropdownProps, disabled, errorText, readOnly, getMenuEntryProps, }: ContextProps) => React.JSX.Element;
|
|
4
4
|
export default ContextSelector;
|
package/dist/ContextSelector.js
CHANGED
|
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
10
10
|
import Button from '@synerise/ds-button';
|
|
11
11
|
import Icon, { Add3M, AngleDownS } from '@synerise/ds-icon';
|
|
12
12
|
import Menu from '@synerise/ds-menu';
|
|
@@ -51,41 +51,41 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
51
51
|
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
52
52
|
getMenuEntryProps = _ref.getMenuEntryProps;
|
|
53
53
|
|
|
54
|
-
var
|
|
55
|
-
dropdownVisible =
|
|
56
|
-
setDropdownVisible =
|
|
54
|
+
var _useState = useState(defaultDropdownVisibility != null ? defaultDropdownVisibility : false),
|
|
55
|
+
dropdownVisible = _useState[0],
|
|
56
|
+
setDropdownVisible = _useState[1];
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
useEffect(function () {
|
|
59
59
|
setDropdownVisible(defaultDropdownVisibility != null ? defaultDropdownVisibility : false);
|
|
60
60
|
}, [defaultDropdownVisibility]);
|
|
61
|
-
var handleChange =
|
|
61
|
+
var handleChange = useCallback(function (val) {
|
|
62
62
|
setDropdownVisible(false);
|
|
63
63
|
onSelectItem(val);
|
|
64
64
|
}, [onSelectItem]);
|
|
65
|
-
var handleOnSetGroup =
|
|
65
|
+
var handleOnSetGroup = useCallback(function (val) {
|
|
66
66
|
onSetGroup && onSetGroup(val);
|
|
67
67
|
}, [onSetGroup]);
|
|
68
|
-
|
|
68
|
+
useEffect(function () {
|
|
69
69
|
if (opened) {
|
|
70
70
|
setDropdownVisible(true);
|
|
71
71
|
}
|
|
72
72
|
}, [opened]);
|
|
73
|
-
var triggerMode =
|
|
73
|
+
var triggerMode = useMemo(function () {
|
|
74
74
|
if (selectedItem) {
|
|
75
75
|
return readOnly ? 'icon-label' : 'two-icons';
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
return readOnly ? 'simple' : 'label-icon';
|
|
79
79
|
}, [selectedItem, readOnly]);
|
|
80
|
-
var triggerColor =
|
|
80
|
+
var triggerColor = useMemo(function () {
|
|
81
81
|
if (!selectedItem) return 'blue';
|
|
82
82
|
return type === 'event' ? 'cyan' : 'green';
|
|
83
83
|
}, [selectedItem, type]);
|
|
84
|
-
var handleClick =
|
|
84
|
+
var handleClick = useCallback(function () {
|
|
85
85
|
onOpen && onOpen();
|
|
86
86
|
setDropdownVisible(true);
|
|
87
87
|
}, [onOpen]);
|
|
88
|
-
var triggerButton =
|
|
88
|
+
var triggerButton = useMemo(function () {
|
|
89
89
|
var buttonLabel = texts.buttonLabel;
|
|
90
90
|
var hasError = Boolean(errorText);
|
|
91
91
|
return addMode && !selectedItem ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
@@ -119,7 +119,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
119
119
|
popupPlacement: 'top',
|
|
120
120
|
getPopupContainer: getPopupContainerOverride || getPopupContainer
|
|
121
121
|
},
|
|
122
|
-
renderHoverTooltip: selectedItem ? function () {
|
|
122
|
+
renderHoverTooltip: selectedItem ? selectedItem.renderHoverTooltip || function () {
|
|
123
123
|
return /*#__PURE__*/React.createElement(InformationCard, _extends({
|
|
124
124
|
icon: selectedItem.icon,
|
|
125
125
|
subtitle: selectedItem.subtitle,
|
|
@@ -135,7 +135,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
135
135
|
}, getMenuEntryProps == null ? void 0 : getMenuEntryProps(selectedItem))]
|
|
136
136
|
});
|
|
137
137
|
}, [texts, addMode, selectedItem, disabled, readOnly, handleClick, triggerColor, triggerMode, getPopupContainerOverride, errorText, getMenuEntryProps]);
|
|
138
|
-
var onDropdownVisibilityChange =
|
|
138
|
+
var onDropdownVisibilityChange = useCallback(function (value) {
|
|
139
139
|
if (value) {
|
|
140
140
|
onActivate && onActivate('');
|
|
141
141
|
setDropdownVisible(true);
|
|
@@ -4,13 +4,14 @@ import { ItemSize } from '@synerise/ds-menu';
|
|
|
4
4
|
import { DropdownProps } from '@synerise/ds-dropdown/dist/Dropdown';
|
|
5
5
|
import type { FactorsProps } from '@synerise/ds-factors';
|
|
6
6
|
import { InformationCardProps } from '@synerise/ds-information-card';
|
|
7
|
+
import { ListItemProps } from '@synerise/ds-list-item';
|
|
7
8
|
export type ContextTexts = {
|
|
8
9
|
buttonLabel: string;
|
|
9
10
|
searchPlaceholder: string;
|
|
10
11
|
loadingResults: string;
|
|
11
12
|
noResults: string;
|
|
12
13
|
};
|
|
13
|
-
export type ContextItem = {
|
|
14
|
+
export type ContextItem = Pick<ListItemProps, 'renderHoverTooltip' | 'hoverTooltipProps' | 'disabled'> & {
|
|
14
15
|
id: ReactText | null;
|
|
15
16
|
name: string;
|
|
16
17
|
icon: ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-context-selector",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.7",
|
|
4
4
|
"description": "ContextSelector UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -27,25 +27,25 @@
|
|
|
27
27
|
"test:watch": "npm run test -- --watchAll",
|
|
28
28
|
"types": "tsc --noEmit"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "6fe94d574f25c5267c7593dec9399527f441b23a",
|
|
31
31
|
"sideEffects": [
|
|
32
32
|
"dist/style/*",
|
|
33
33
|
"*.less"
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-button": "^0.21.
|
|
38
|
-
"@synerise/ds-dropdown": "^0.18.
|
|
39
|
-
"@synerise/ds-factors": "^0.
|
|
40
|
-
"@synerise/ds-icon": "^0.65.
|
|
41
|
-
"@synerise/ds-information-card": "^0.5.
|
|
42
|
-
"@synerise/ds-list-item": "^0.4.
|
|
43
|
-
"@synerise/ds-menu": "^0.19.
|
|
44
|
-
"@synerise/ds-result": "^0.7.
|
|
45
|
-
"@synerise/ds-scrollbar": "^0.11.
|
|
46
|
-
"@synerise/ds-skeleton": "^0.6.
|
|
47
|
-
"@synerise/ds-tabs": "^0.15.
|
|
48
|
-
"@synerise/ds-utils": "^0.
|
|
37
|
+
"@synerise/ds-button": "^0.21.8",
|
|
38
|
+
"@synerise/ds-dropdown": "^0.18.12",
|
|
39
|
+
"@synerise/ds-factors": "^0.25.0",
|
|
40
|
+
"@synerise/ds-icon": "^0.65.3",
|
|
41
|
+
"@synerise/ds-information-card": "^0.5.6",
|
|
42
|
+
"@synerise/ds-list-item": "^0.4.8",
|
|
43
|
+
"@synerise/ds-menu": "^0.19.12",
|
|
44
|
+
"@synerise/ds-result": "^0.7.2",
|
|
45
|
+
"@synerise/ds-scrollbar": "^0.11.8",
|
|
46
|
+
"@synerise/ds-skeleton": "^0.6.6",
|
|
47
|
+
"@synerise/ds-tabs": "^0.15.5",
|
|
48
|
+
"@synerise/ds-utils": "^0.29.0",
|
|
49
49
|
"react-window": "1.8.5",
|
|
50
50
|
"uuid": "^8.3.2"
|
|
51
51
|
},
|