@synerise/ds-context-selector 1.0.5 → 1.1.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 +11 -0
- package/README.md +28 -25
- package/dist/ContextSelector.d.ts +1 -1
- package/dist/ContextSelector.js +4 -3
- package/dist/ContextSelector.types.d.ts +2 -1
- package/dist/ContextSelectorDropdown/ContextSelectorDropdown.js +1 -1
- package/dist/ContextSelectorDropdown/ContextSelectorDropdownItem.js +2 -2
- package/dist/hooks/useTexts.js +1 -1
- package/package.json +4 -4
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
|
+
# [1.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@1.0.5...@synerise/ds-context-selector@1.1.0) (2025-04-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **context-selector:** add isError prop ([e9794d5](https://github.com/Synerise/synerise-design/commit/e9794d5e15a63bbf3afbdeb1d2f6369c76d4afec))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.0.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-context-selector@1.0.4...@synerise/ds-context-selector@1.0.5) (2025-04-02)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-context-selector
|
package/README.md
CHANGED
|
@@ -81,31 +81,34 @@ import ContextSelector from '@synerise/ds-context-selector'
|
|
|
81
81
|
|
|
82
82
|
## API
|
|
83
83
|
|
|
84
|
-
| Property | Description
|
|
85
|
-
|
|
86
|
-
| groups | Groups of items
|
|
87
|
-
| items | Array of items
|
|
88
|
-
| menuItemHeight | Size of single menu item
|
|
89
|
-
| onSelectItem | Callback called when user selects item
|
|
90
|
-
| defaultDropdownVisibility | default visibility of dropdown
|
|
91
|
-
| opened | Whether if dropdown should opens from outside of component
|
|
92
|
-
| texts | Translations object
|
|
93
|
-
| selectedItem | Selected item
|
|
94
|
-
| addMode | If true trigger doesn't change style when value is set
|
|
95
|
-
| customTriggerComponent | Add custom trigger
|
|
96
|
-
| trigger | Add custom trigger to modal
|
|
97
|
-
| getMenuEntryProps | Configure tooltip (information-card by default)
|
|
98
|
-
| dropdownWrapperStyles | Apply custom styles to dropdown wrapper
|
|
99
|
-
| onClickOutsideEvents | Overwrite default events for document listener
|
|
100
|
-
| onClickOutside | Callback called when user click outside dropdown
|
|
101
|
-
| onSearch | Callback called when user enter any char in search input
|
|
102
|
-
| hideSearchField | Whether to hide the search field in the dropdown
|
|
103
|
-
| onFetchData | Callback called when user scrolls to the end of dropdown list
|
|
104
|
-
| onActivate | Callback called when user opens dropdown
|
|
105
|
-
| onDeactivate | Callback called when user closes dropdown
|
|
106
|
-
| hasMoreItems | Whether if onFetchData should be called
|
|
107
|
-
| getPopupContainerOverride | Popup container function for child tooltips and dropdowns
|
|
108
|
-
| dropdownProps | Limited part of props for dropdown on ContextSelector component
|
|
84
|
+
| Property | Description | Type | Default |
|
|
85
|
+
|---------------------------|------------------------------------------------------------------|------------------------------------------------------------------------------------------|-----------------------|
|
|
86
|
+
| groups | Groups of items | ContextGroup[] | [] |
|
|
87
|
+
| items | Array of items | ContextItem[] | [] |
|
|
88
|
+
| menuItemHeight | Size of single menu item | ItemSize.LARGE \ ItemSize.DEFAULT | ItemSize.DEFAULT |
|
|
89
|
+
| onSelectItem | Callback called when user selects item | (item: ContextItem \ ContextGroup \ undefined) => void | - |
|
|
90
|
+
| defaultDropdownVisibility | default visibility of dropdown | boolean | false |
|
|
91
|
+
| opened | Whether if dropdown should opens from outside of component | boolean | false |
|
|
92
|
+
| texts | Translations object | ContextTexts | - |
|
|
93
|
+
| selectedItem | Selected item | ContextItem \ undefined | undefined |
|
|
94
|
+
| addMode | If true trigger doesn't change style when value is set | ContextItem \ undefined | undefined |
|
|
95
|
+
| customTriggerComponent | Add custom trigger | React.ReactNode | undefined |
|
|
96
|
+
| trigger | Add custom trigger to modal | 'click' \ 'hover' \ 'contextMenu' | 'click |
|
|
97
|
+
| getMenuEntryProps | Configure tooltip (information-card by default) | (arg: ParameterValueType) => MenuItemProps \ undefined | undefined |
|
|
98
|
+
| dropdownWrapperStyles | Apply custom styles to dropdown wrapper | CSSProperties \ undefined | - |
|
|
99
|
+
| onClickOutsideEvents | Overwrite default events for document listener | HandledEventsType[] \ undefined | - |
|
|
100
|
+
| onClickOutside | Callback called when user click outside dropdown | () => void \ undefined | - |
|
|
101
|
+
| onSearch | Callback called when user enter any char in search input | (query: string) => void | - |
|
|
102
|
+
| hideSearchField | Whether to hide the search field in the dropdown | boolean | false |
|
|
103
|
+
| onFetchData | Callback called when user scrolls to the end of dropdown list | () => void | - |
|
|
104
|
+
| onActivate | Callback called when user opens dropdown | (fieldType: string) => void | - |
|
|
105
|
+
| onDeactivate | Callback called when user closes dropdown | () => void | - |
|
|
106
|
+
| hasMoreItems | Whether if onFetchData should be called | boolean | - |
|
|
107
|
+
| getPopupContainerOverride | Popup container function for child tooltips and dropdowns | (trigger: HTMLElement \ null) => HTMLElement; | |
|
|
108
|
+
| dropdownProps | Limited part of props for dropdown on ContextSelector component | Omit<DropdownProps, 'trigger' 'getPopupContainer' 'onVisibleChange' 'visible' 'overlay'> | - |
|
|
109
|
+
| errorText | Error message to display below component | ReactNode | - |
|
|
110
|
+
| isError | Render trigger with error styles, even if errorText is empty | boolean | - |
|
|
111
|
+
|
|
109
112
|
|
|
110
113
|
|
|
111
114
|
### ContextGroup
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ContextProps } from './ContextSelector.types';
|
|
3
|
-
declare const ContextSelector: ({ defaultDropdownVisibility, selectedItem, onSelectItem, onSetGroup, groups, items, recentItems, texts, opened, addMode, loading, customTriggerComponent, trigger, menuItemHeight, dropdownWrapperStyles, onClickOutsideEvents, onClickOutside, onSearch, hideSearchField, hasMoreItems, onFetchData, onActivate, onDeactivate, onOpen, getPopupContainerOverride, type, dropdownProps, disabled, errorText, readOnly, getMenuEntryProps, dropdownDimensionsConfig, }: ContextProps) => React.JSX.Element;
|
|
3
|
+
declare const ContextSelector: ({ defaultDropdownVisibility, selectedItem, onSelectItem, onSetGroup, groups, items, recentItems, texts, opened, addMode, loading, customTriggerComponent, trigger, menuItemHeight, dropdownWrapperStyles, onClickOutsideEvents, onClickOutside, onSearch, hideSearchField, hasMoreItems, onFetchData, onActivate, onDeactivate, onOpen, getPopupContainerOverride, type, dropdownProps, disabled, errorText, isError, readOnly, getMenuEntryProps, dropdownDimensionsConfig, }: ContextProps) => React.JSX.Element;
|
|
4
4
|
export default ContextSelector;
|
package/dist/ContextSelector.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import Button from '@synerise/ds-button';
|
|
4
4
|
import Icon, { Add3M, AngleDownS } from '@synerise/ds-icon';
|
|
@@ -42,6 +42,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
42
42
|
dropdownProps = _ref.dropdownProps,
|
|
43
43
|
disabled = _ref.disabled,
|
|
44
44
|
errorText = _ref.errorText,
|
|
45
|
+
isError = _ref.isError,
|
|
45
46
|
_ref$readOnly = _ref.readOnly,
|
|
46
47
|
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
47
48
|
getMenuEntryProps = _ref.getMenuEntryProps,
|
|
@@ -99,7 +100,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
99
100
|
}, [onOpen]);
|
|
100
101
|
var triggerButton = useMemo(function () {
|
|
101
102
|
var buttonLabel = allTexts.buttonLabel;
|
|
102
|
-
var hasError = Boolean(errorText);
|
|
103
|
+
var hasError = Boolean(errorText) || isError;
|
|
103
104
|
return addMode && !selectedItem ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
104
105
|
error: hasError,
|
|
105
106
|
disabled: disabled,
|
|
@@ -146,7 +147,7 @@ var ContextSelector = function ContextSelector(_ref) {
|
|
|
146
147
|
} : undefined
|
|
147
148
|
}, getMenuEntryProps == null ? void 0 : getMenuEntryProps(selectedItem))]
|
|
148
149
|
});
|
|
149
|
-
}, [allTexts, addMode, selectedItem, disabled, readOnly, handleClick, triggerColor, triggerMode, getPopupContainerOverride,
|
|
150
|
+
}, [allTexts, errorText, isError, addMode, selectedItem, disabled, readOnly, handleClick, triggerColor, triggerMode, getPopupContainerOverride, getMenuEntryProps]);
|
|
150
151
|
var onDropdownVisibilityChange = useCallback(function (value) {
|
|
151
152
|
if (value) {
|
|
152
153
|
onActivate && onActivate('');
|
|
@@ -77,7 +77,8 @@ export type ContextProps = {
|
|
|
77
77
|
hasMoreItems?: boolean;
|
|
78
78
|
type?: 'default' | 'attribute' | 'event';
|
|
79
79
|
dropdownProps?: Omit<DropdownProps, 'trigger' | 'getPopupContainer' | 'onVisibleChange' | 'visible' | 'overlay'>;
|
|
80
|
-
errorText?: ReactNode
|
|
80
|
+
errorText?: ReactNode;
|
|
81
|
+
isError?: boolean;
|
|
81
82
|
getMenuEntryProps?: FactorsProps['getMenuEntryProps'];
|
|
82
83
|
dropdownDimensionsConfig?: {
|
|
83
84
|
defaultHeight?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _ITEM_SIZE;
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { v4 as uuid } from 'uuid';
|
|
5
5
|
import { VariableSizeList } from 'react-window';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["id", "icon"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutPropertiesLoose(
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Icon, { CheckS } from '@synerise/ds-icon';
|
|
6
6
|
import ListItem from '@synerise/ds-list-item';
|
package/dist/hooks/useTexts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useIntl } from 'react-intl';
|
|
4
4
|
export var useTexts = function useTexts(defaultTexts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-context-selector",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ContextSelector UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"types": "tsc --noEmit",
|
|
29
29
|
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "55537c6449492265a1d50c1e055ef7cc03c7935e",
|
|
32
32
|
"sideEffects": [
|
|
33
33
|
"dist/style/*",
|
|
34
34
|
"*.less"
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@synerise/ds-button": "^1.1.3",
|
|
39
39
|
"@synerise/ds-divider": "^1.0.4",
|
|
40
40
|
"@synerise/ds-dropdown": "^1.0.4",
|
|
41
|
-
"@synerise/ds-factors": "^1.1.
|
|
41
|
+
"@synerise/ds-factors": "^1.1.4",
|
|
42
42
|
"@synerise/ds-icon": "^1.3.0",
|
|
43
|
-
"@synerise/ds-information-card": "^1.0.
|
|
43
|
+
"@synerise/ds-information-card": "^1.0.5",
|
|
44
44
|
"@synerise/ds-list-item": "^1.0.4",
|
|
45
45
|
"@synerise/ds-menu": "^1.0.4",
|
|
46
46
|
"@synerise/ds-result": "^1.0.4",
|