@synerise/ds-context-selector 0.16.13 → 0.16.14
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
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.16.14](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.16.13...@synerise/ds-context-selector@0.16.14) (2023-05-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **condition:** adds validation errors support ([0da0a99](https://github.com/Synerise/synerise-design/commit/0da0a99436920398787a1128e26d5432af2d89e2))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.16.13](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@0.16.12...@synerise/ds-context-selector@0.16.13) (2023-04-26)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-context-selector
|
package/dist/ContextSelector.js
CHANGED
|
@@ -8,7 +8,7 @@ import Dropdown from '@synerise/ds-dropdown';
|
|
|
8
8
|
import InformationCard from '@synerise/ds-information-card';
|
|
9
9
|
import { getPopupContainer } from '@synerise/ds-utils';
|
|
10
10
|
import ContextSelectorDropdown from './ContextSelectorDropdown/ContextSelectorDropdown';
|
|
11
|
-
import { ItemWrapper } from './ContextSelector.styles';
|
|
11
|
+
import { ItemWrapper, ErrorWrapper } from './ContextSelector.styles';
|
|
12
12
|
|
|
13
13
|
var ContextSelector = function ContextSelector(_ref) {
|
|
14
14
|
var defaultDropdownVisibility = _ref.defaultDropdownVisibility,
|
|
@@ -38,6 +38,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
38
38
|
type = _ref.type,
|
|
39
39
|
dropdownProps = _ref.dropdownProps,
|
|
40
40
|
disabled = _ref.disabled,
|
|
41
|
+
errorText = _ref.errorText,
|
|
41
42
|
_ref$readOnly = _ref.readOnly,
|
|
42
43
|
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly;
|
|
43
44
|
|
|
@@ -77,7 +78,9 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
77
78
|
}, [onOpen]);
|
|
78
79
|
var triggerButton = React.useMemo(function () {
|
|
79
80
|
var buttonLabel = texts.buttonLabel;
|
|
81
|
+
var hasError = Boolean(errorText);
|
|
80
82
|
return addMode && !selectedItem ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
83
|
+
error: hasError,
|
|
81
84
|
disabled: disabled,
|
|
82
85
|
type: "primary",
|
|
83
86
|
mode: "icon-label",
|
|
@@ -90,6 +93,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
90
93
|
asInfoCardContainer: true,
|
|
91
94
|
dataSource: [{
|
|
92
95
|
text: /*#__PURE__*/React.createElement(Button, {
|
|
96
|
+
error: hasError,
|
|
93
97
|
disabled: disabled,
|
|
94
98
|
type: "custom-color",
|
|
95
99
|
color: triggerColor,
|
|
@@ -118,7 +122,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
118
122
|
} : undefined
|
|
119
123
|
}]
|
|
120
124
|
});
|
|
121
|
-
}, [texts, addMode, selectedItem, disabled, readOnly, handleClick, triggerColor, triggerMode, getPopupContainerOverride]);
|
|
125
|
+
}, [texts, addMode, selectedItem, disabled, readOnly, handleClick, triggerColor, triggerMode, getPopupContainerOverride, errorText]);
|
|
122
126
|
var onDropdownVisibilityChange = React.useCallback(function (value) {
|
|
123
127
|
if (value) {
|
|
124
128
|
onActivate && onActivate('');
|
|
@@ -129,7 +133,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
129
133
|
}
|
|
130
134
|
}, [onActivate, onDeactivate]);
|
|
131
135
|
if (readOnly) return /*#__PURE__*/React.createElement(React.Fragment, null, customTriggerComponent != null ? customTriggerComponent : triggerButton);
|
|
132
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
136
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
133
137
|
"data-popup-container": true
|
|
134
138
|
}, /*#__PURE__*/React.createElement(Dropdown, _extends({}, dropdownProps, {
|
|
135
139
|
getPopupContainer: getPopupContainerOverride || getPopupContainer,
|
|
@@ -154,7 +158,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
154
158
|
hasMoreItems: hasMoreItems,
|
|
155
159
|
onFetchData: onFetchData
|
|
156
160
|
})
|
|
157
|
-
}), customTriggerComponent != null ? customTriggerComponent : triggerButton));
|
|
161
|
+
}), customTriggerComponent != null ? customTriggerComponent : triggerButton)), errorText && /*#__PURE__*/React.createElement(ErrorWrapper, null, errorText));
|
|
158
162
|
};
|
|
159
163
|
|
|
160
164
|
export default ContextSelector;
|
|
@@ -5,5 +5,6 @@ export declare const ItemsList: import("styled-components").StyledComponent<type
|
|
|
5
5
|
export declare const SearchResult: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
6
6
|
export declare const SearchResultHighlight: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
7
7
|
export declare const Title: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
-
export declare const ItemWrapper: import("styled-components").StyledComponent<"
|
|
8
|
+
export declare const ItemWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
9
|
+
export declare const ErrorWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
10
|
export declare const LoaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -30,13 +30,17 @@ export var Title = styled.div.withConfig({
|
|
|
30
30
|
})(["font-size:10px;line-height:1.6;font-weight:500;text-transform:uppercase;color:", ";padding:8px 12px;"], function (props) {
|
|
31
31
|
return props.theme.palette['grey-500'];
|
|
32
32
|
});
|
|
33
|
-
export var ItemWrapper = styled.
|
|
33
|
+
export var ItemWrapper = styled.span.withConfig({
|
|
34
34
|
displayName: "ContextSelectorstyles__ItemWrapper",
|
|
35
35
|
componentId: "sc-1tuu6xk-6"
|
|
36
|
-
})(["max-width:200px;overflow:hidden;text-overflow:ellipsis;
|
|
37
|
-
|
|
36
|
+
})(["max-width:200px;overflow:hidden;text-overflow:ellipsis;"]);
|
|
37
|
+
export var ErrorWrapper = styled.div.withConfig({
|
|
38
|
+
displayName: "ContextSelectorstyles__ErrorWrapper",
|
|
39
|
+
componentId: "sc-1tuu6xk-7"
|
|
40
|
+
})(["color:", ";margin-top:8px;"], function (props) {
|
|
41
|
+
return props.theme.palette['red-600'];
|
|
38
42
|
});
|
|
39
43
|
export var LoaderWrapper = styled.div.withConfig({
|
|
40
44
|
displayName: "ContextSelectorstyles__LoaderWrapper",
|
|
41
|
-
componentId: "sc-1tuu6xk-
|
|
45
|
+
componentId: "sc-1tuu6xk-8"
|
|
42
46
|
})(["width:100%;display:flex;align-items:center;justify-content:center;padding:32px 0;"]);
|
|
@@ -64,6 +64,7 @@ export declare type ContextProps = {
|
|
|
64
64
|
hasMoreItems?: boolean;
|
|
65
65
|
type?: 'default' | 'attribute' | 'event';
|
|
66
66
|
dropdownProps?: Omit<DropdownProps, 'trigger' | 'getPopupContainer' | 'onVisibleChange' | 'visible' | 'overlay'>;
|
|
67
|
+
errorText?: React.ReactNode | string;
|
|
67
68
|
};
|
|
68
69
|
export declare type ContextDropdownProps = {
|
|
69
70
|
setDropdownVisible: (show: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-context-selector",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.14",
|
|
4
4
|
"description": "ContextSelector UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"test:watch": "npm run test -- --watchAll",
|
|
27
27
|
"types": "tsc --noEmit"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "5808615a55859820c255189f77977725ec79cd7d",
|
|
30
30
|
"sideEffects": [
|
|
31
31
|
"dist/style/*",
|
|
32
32
|
"*.less"
|
|
33
33
|
],
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@synerise/ds-button": "^0.17.
|
|
37
|
-
"@synerise/ds-dropdown": "^0.17.
|
|
36
|
+
"@synerise/ds-button": "^0.17.15",
|
|
37
|
+
"@synerise/ds-dropdown": "^0.17.64",
|
|
38
38
|
"@synerise/ds-icon": "^0.56.0",
|
|
39
|
-
"@synerise/ds-information-card": "^0.3.
|
|
40
|
-
"@synerise/ds-menu": "^0.17.
|
|
41
|
-
"@synerise/ds-result": "^0.6.
|
|
39
|
+
"@synerise/ds-information-card": "^0.3.14",
|
|
40
|
+
"@synerise/ds-menu": "^0.17.8",
|
|
41
|
+
"@synerise/ds-result": "^0.6.22",
|
|
42
42
|
"@synerise/ds-scrollbar": "^0.6.2",
|
|
43
|
-
"@synerise/ds-tabs": "^0.13.
|
|
43
|
+
"@synerise/ds-tabs": "^0.13.60",
|
|
44
44
|
"@synerise/ds-utils": "^0.19.0",
|
|
45
45
|
"classnames": "^2.2.6",
|
|
46
46
|
"react-window": "1.8.5"
|