@true-engineering/true-react-common-ui-kit 3.4.0 → 3.6.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/README.md +10 -0
- package/dist/components/FiltersPane/FiltersPane.d.ts +1 -0
- package/dist/components/FiltersPane/FiltersPane.stories.d.ts +1 -0
- package/dist/components/FiltersPane/components/FilterMultiSelect/FilterMultiSelect.d.ts +1 -0
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +1 -0
- package/dist/components/FlexibleTable/FlexibleTable.stories.d.ts +1 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +1 -0
- package/dist/components/Select/CustomSelect.stories.d.ts +14 -0
- package/dist/components/Select/MultiSelect.stories.d.ts +1 -0
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.stories.d.ts +1 -0
- package/dist/components/Select/components/SelectList/SelectList.d.ts +1 -1
- package/dist/components/Selector/Selector.d.ts +1 -0
- package/dist/true-react-common-ui-kit.js +4 -3
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +4 -3
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Select/CustomSelect.stories.tsx +217 -0
- package/src/components/Select/Select.tsx +3 -2
- package/src/components/Select/components/SelectList/SelectList.tsx +2 -2
- package/src/theme/helpers.ts +4 -2
package/README.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
# Release Notes
|
|
12
12
|
|
|
13
|
+
## v3.6.0
|
|
14
|
+
|
|
15
|
+
- **Select**: Добавлена возможность передавать `defaultOptionLabel` как `ReactNode`
|
|
16
|
+
|
|
17
|
+
## v3.5.0
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Исправлена ошибка порядка вызова хуков при добавлении/удалении `tweakStyles` во время жизни компонента
|
|
22
|
+
|
|
13
23
|
## v3.4.0
|
|
14
24
|
|
|
15
25
|
- **Input**: Добавляет пропс onInput
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ComponentMeta, type ComponentStory } from '@storybook/react';
|
|
3
|
+
import { type ISelectProps } from './Select';
|
|
4
|
+
interface ISelectWithCustomProps<T> extends ISelectProps<T> {
|
|
5
|
+
shouldUsePopper?: boolean;
|
|
6
|
+
shouldRenderInBody?: boolean;
|
|
7
|
+
shouldHideOnScroll?: boolean;
|
|
8
|
+
canBeFlipped?: boolean;
|
|
9
|
+
scrollParent?: 'document' | 'auto';
|
|
10
|
+
}
|
|
11
|
+
declare function SelectWithCustomProps({ noMatchesLabel, shouldUsePopper, shouldRenderInBody, shouldHideOnScroll, canBeFlipped, scrollParent, ...restProps }: ISelectWithCustomProps<string>): JSX.Element;
|
|
12
|
+
declare const _default: ComponentMeta<typeof SelectWithCustomProps>;
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare const CustomSelect: ComponentStory<typeof SelectWithCustomProps>;
|
|
@@ -6,7 +6,7 @@ import { ISearchInputProps } from '../SearchInput';
|
|
|
6
6
|
import { IMultipleSelectValue } from './types';
|
|
7
7
|
import { ISelectStyles } from './Select.styles';
|
|
8
8
|
export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'tweakStyles'>, ICommonProps<ISelectStyles> {
|
|
9
|
-
defaultOptionLabel?:
|
|
9
|
+
defaultOptionLabel?: ReactNode;
|
|
10
10
|
allOptionsLabel?: string;
|
|
11
11
|
noMatchesLabel?: string;
|
|
12
12
|
loadingLabel?: ReactNode;
|
|
@@ -8,7 +8,7 @@ export interface ISelectListProps<Value> extends ICommonProps<ISelectListStyles>
|
|
|
8
8
|
noMatchesLabel?: string;
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
loadingLabel?: ReactNode;
|
|
11
|
-
defaultOptionLabel?:
|
|
11
|
+
defaultOptionLabel?: ReactNode;
|
|
12
12
|
allOptionsLabel?: string;
|
|
13
13
|
areAllOptionsSelected?: boolean;
|
|
14
14
|
shouldScrollToList?: boolean;
|
|
@@ -1921,13 +1921,14 @@ function _object_spread_props$L(target, source) {
|
|
|
1921
1921
|
}
|
|
1922
1922
|
return target;
|
|
1923
1923
|
}
|
|
1924
|
+
var EMPTY_STYLES = {};
|
|
1924
1925
|
var isTweakStyle = function(key) {
|
|
1925
1926
|
return key.startsWith("tweak");
|
|
1926
1927
|
};
|
|
1927
1928
|
var cleanStyles = function(tweakStyles) {
|
|
1928
1929
|
return isNotEmpty(tweakStyles) && Object.keys(tweakStyles).some(function(key) {
|
|
1929
1930
|
return !isTweakStyle(key);
|
|
1930
|
-
}) ? tweakStyles :
|
|
1931
|
+
}) ? tweakStyles : EMPTY_STYLES;
|
|
1931
1932
|
};
|
|
1932
1933
|
var checkStyles = function(componentName, styles) {
|
|
1933
1934
|
var invalidClasses = Object.keys(styles).reduce(function(acc, key) {
|
|
@@ -10961,7 +10962,7 @@ function SelectList(param) {
|
|
|
10961
10962
|
children: loadingLabel
|
|
10962
10963
|
}) : /* @__PURE__ */ jsxs(Fragment, {
|
|
10963
10964
|
children: [
|
|
10964
|
-
|
|
10965
|
+
isReactNodeNotEmpty(defaultOptionLabel) && /* @__PURE__ */ jsx(ScrollIntoViewIfNeeded, {
|
|
10965
10966
|
active: focusedIndex === DEFAULT_OPTION_INDEX,
|
|
10966
10967
|
options: {
|
|
10967
10968
|
block: "nearest"
|
|
@@ -11480,7 +11481,7 @@ function Select(props) {
|
|
|
11480
11481
|
var isMounted = useIsMounted();
|
|
11481
11482
|
var _useState = _sliced_to_array$k(useState(false), 2), isListOpen = _useState[0], setIsListOpen = _useState[1];
|
|
11482
11483
|
var _useState1 = _sliced_to_array$k(useState(false), 2), areOptionsLoading = _useState1[0], setAreOptionsLoading = _useState1[1];
|
|
11483
|
-
var hasDefaultOption =
|
|
11484
|
+
var hasDefaultOption = isReactNodeNotEmpty(defaultOptionLabel);
|
|
11484
11485
|
var _useState2 = _sliced_to_array$k(useState(DEFAULT_OPTION_INDEX), 2), focusedListCellIndex = _useState2[0], setFocusedListCellIndex = _useState2[1];
|
|
11485
11486
|
var _useState3 = _sliced_to_array$k(useState(""), 2), searchValue = _useState3[0], setSearchValue = _useState3[1];
|
|
11486
11487
|
var _useState4 = _sliced_to_array$k(useState(true), 2), shouldShowDefaultOption = _useState4[0], setShouldShowDefaultOption = _useState4[1];
|