@synerise/ds-context-selector 0.14.11 → 0.15.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/CHANGELOG.md +19 -0
- package/dist/ContextSelector.js +14 -7
- package/dist/ContextSelector.types.d.ts +1 -0
- package/package.json +3 -3
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.15.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.14.12...@synerise/ds-context-selector@0.15.0) (2022-12-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **filter:** readOnly state for conditions ([dfa4db3](https://github.com/Synerise/synerise-design/commit/dfa4db35826c0800859b7217dd1ea2f1497ac3c9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.14.12](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.14.11...@synerise/ds-context-selector@0.14.12) (2022-12-08)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @synerise/ds-context-selector
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.14.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.14.10...@synerise/ds-context-selector@0.14.11) (2022-12-07)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-context-selector
|
package/dist/ContextSelector.js
CHANGED
|
@@ -37,7 +37,9 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
37
37
|
getPopupContainerOverride = _ref.getPopupContainerOverride,
|
|
38
38
|
type = _ref.type,
|
|
39
39
|
dropdownProps = _ref.dropdownProps,
|
|
40
|
-
disabled = _ref.disabled
|
|
40
|
+
disabled = _ref.disabled,
|
|
41
|
+
_ref$readOnly = _ref.readOnly,
|
|
42
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
|
|
41
43
|
|
|
42
44
|
var _React$useState = React.useState(defaultDropdownVisibility != null ? defaultDropdownVisibility : false),
|
|
43
45
|
dropdownVisible = _React$useState[0],
|
|
@@ -59,8 +61,12 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
59
61
|
}
|
|
60
62
|
}, [opened]);
|
|
61
63
|
var triggerMode = React.useMemo(function () {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
if (selectedItem) {
|
|
65
|
+
return readOnly ? 'icon-label' : 'two-icons';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return readOnly ? 'simple' : 'label-icon';
|
|
69
|
+
}, [selectedItem, readOnly]);
|
|
64
70
|
var triggerColor = React.useMemo(function () {
|
|
65
71
|
if (!selectedItem) return 'blue';
|
|
66
72
|
return type === 'event' ? 'cyan' : 'green';
|
|
@@ -75,7 +81,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
75
81
|
disabled: disabled,
|
|
76
82
|
type: "primary",
|
|
77
83
|
mode: "icon-label",
|
|
78
|
-
onClick: handleClick
|
|
84
|
+
onClick: !readOnly ? handleClick : undefined
|
|
79
85
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
80
86
|
component: /*#__PURE__*/React.createElement(Add3M, null)
|
|
81
87
|
}), buttonLabel)) : /*#__PURE__*/React.createElement(Menu, {
|
|
@@ -88,10 +94,10 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
88
94
|
type: "custom-color",
|
|
89
95
|
color: triggerColor,
|
|
90
96
|
mode: triggerMode,
|
|
91
|
-
onClick: handleClick
|
|
97
|
+
onClick: !readOnly ? handleClick : undefined
|
|
92
98
|
}, selectedItem ? /*#__PURE__*/React.createElement(Icon, {
|
|
93
99
|
component: selectedItem.icon
|
|
94
|
-
}) : null, /*#__PURE__*/React.createElement(ItemWrapper, null, selectedItem ? selectedItem.name : buttonLabel), /*#__PURE__*/React.createElement(Icon, {
|
|
100
|
+
}) : null, /*#__PURE__*/React.createElement(ItemWrapper, null, selectedItem ? selectedItem.name : buttonLabel), !readOnly && /*#__PURE__*/React.createElement(Icon, {
|
|
95
101
|
component: /*#__PURE__*/React.createElement(AngleDownS, null)
|
|
96
102
|
})),
|
|
97
103
|
hoverTooltipProps: {
|
|
@@ -112,7 +118,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
112
118
|
} : undefined
|
|
113
119
|
}]
|
|
114
120
|
});
|
|
115
|
-
}, [texts, addMode, selectedItem, disabled, handleClick, triggerColor, triggerMode, getPopupContainerOverride]);
|
|
121
|
+
}, [texts, addMode, selectedItem, disabled, readOnly, handleClick, triggerColor, triggerMode, getPopupContainerOverride]);
|
|
116
122
|
var onDropdownVisibilityChange = React.useCallback(function (value) {
|
|
117
123
|
if (value) {
|
|
118
124
|
onActivate && onActivate('');
|
|
@@ -122,6 +128,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
122
128
|
setDropdownVisible(false);
|
|
123
129
|
}
|
|
124
130
|
}, [onActivate, onDeactivate]);
|
|
131
|
+
if (readOnly) return /*#__PURE__*/React.createElement(React.Fragment, null, customTriggerComponent != null ? customTriggerComponent : triggerButton);
|
|
125
132
|
return /*#__PURE__*/React.createElement("div", {
|
|
126
133
|
"data-popup-container": true
|
|
127
134
|
}, /*#__PURE__*/React.createElement(Dropdown, _extends({}, dropdownProps, {
|
|
@@ -37,6 +37,7 @@ export declare type ContextItemsInSubGroup = ContextItem & {
|
|
|
37
37
|
};
|
|
38
38
|
export declare type ContextProps = {
|
|
39
39
|
disabled?: boolean;
|
|
40
|
+
readOnly?: boolean;
|
|
40
41
|
defaultDropdownVisibility?: boolean;
|
|
41
42
|
selectedItem?: ContextItem | undefined;
|
|
42
43
|
onActivate?: (fieldType: string) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-context-selector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "ContextSelector UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"test:watch": "npm run test -- --watchAll",
|
|
27
27
|
"types": "tsc --noEmit"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "1ab09990244dd615bdfe696f365ae8075bd31762",
|
|
30
30
|
"sideEffects": [
|
|
31
31
|
"dist/style/*",
|
|
32
32
|
"*.less"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@synerise/ds-button": "^0.17.10",
|
|
37
37
|
"@synerise/ds-dropdown": "^0.17.44",
|
|
38
38
|
"@synerise/ds-icon": "^0.52.0",
|
|
39
|
-
"@synerise/ds-information-card": "^0.1.
|
|
39
|
+
"@synerise/ds-information-card": "^0.1.34",
|
|
40
40
|
"@synerise/ds-menu": "^0.17.1",
|
|
41
41
|
"@synerise/ds-result": "^0.6.17",
|
|
42
42
|
"@synerise/ds-scrollbar": "^0.5.3",
|