@snack-uikit/fields 0.24.1 → 0.25.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 +1 -0
- package/dist/components/FieldSelect/FieldSelectMultiple.d.ts +1 -1
- package/dist/components/FieldSelect/FieldSelectMultiple.js +2 -2
- package/dist/components/FieldSelect/FieldSelectSingle.d.ts +1 -1
- package/dist/components/FieldSelect/FieldSelectSingle.js +2 -2
- package/dist/components/FieldSelect/types.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/FieldSelect/FieldSelectMultiple.tsx +2 -0
- package/src/components/FieldSelect/FieldSelectSingle.tsx +2 -0
- package/src/components/FieldSelect/types.ts +4 -1
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.25.0 (2024-08-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **DPS-13067:** pass untouchableScrollbars prop ([0f7ac6d](https://github.com/cloud-ru-tech/snack-uikit/commit/0f7ac6d42ba8064cddebe8a70cfa9bf32ea7eaa8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.24.1 (2024-08-14)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -380,6 +380,7 @@ FieldStepper в основном предназначен для работы с
|
|
|
380
380
|
| open | `boolean` | - | |
|
|
381
381
|
| onOpenChange | `(open: boolean) => void` | - | |
|
|
382
382
|
| selectedOptionFormatter | `SelectedOptionFormatter` | - | |
|
|
383
|
+
| untouchableScrollbars | `boolean` | - | Отключает возможность взаимодействовать со скролбарами мышью. |
|
|
383
384
|
| dataFiltered | `boolean` | - | |
|
|
384
385
|
| dataError | `boolean` | - | |
|
|
385
386
|
| noDataState | `EmptyStateProps` | - | Экран при отстутствии данных |
|
|
@@ -23,4 +23,4 @@ export declare const FieldSelectMultiple: import("react").ForwardRefExoticCompon
|
|
|
23
23
|
open?: boolean;
|
|
24
24
|
onOpenChange?(open: boolean): void;
|
|
25
25
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
26
|
-
} & Pick<import("@snack-uikit/list").DroplistProps, "dataError" | "dataFiltered" | "noDataState" | "noResultsState" | "errorDataState">, "showCopyButton"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
26
|
+
} & Pick<import("@snack-uikit/list").DroplistProps, "untouchableScrollbars" | "dataError" | "dataFiltered" | "noDataState" | "noResultsState" | "errorDataState">, "showCopyButton"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -33,7 +33,7 @@ const defaultSelectedOptionFormatter = item =>
|
|
|
33
33
|
(item === null || item === void 0 ? void 0 : item.content.option) || '';
|
|
34
34
|
export const FieldSelectMultiple = forwardRef((props, ref) => {
|
|
35
35
|
var _a;
|
|
36
|
-
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showClearButton = true, onKeyDown: onInputKeyDownProp, validationState = 'default', search, autocomplete = false, prefixIcon, removeByBackspace = false, addOptionByEnter = false, open: openProp, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showClearButton", "onKeyDown", "validationState", "search", "autocomplete", "prefixIcon", "removeByBackspace", "addOptionByEnter", "open", "onOpenChange", "selectedOptionFormatter"]);
|
|
36
|
+
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showClearButton = true, onKeyDown: onInputKeyDownProp, validationState = 'default', search, autocomplete = false, prefixIcon, removeByBackspace = false, addOptionByEnter = false, untouchableScrollbars = false, open: openProp, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showClearButton", "onKeyDown", "validationState", "search", "autocomplete", "prefixIcon", "removeByBackspace", "addOptionByEnter", "untouchableScrollbars", "open", "onOpenChange", "selectedOptionFormatter"]);
|
|
37
37
|
const localRef = useRef(null);
|
|
38
38
|
const inputPlugRef = useRef(null);
|
|
39
39
|
const contentRef = useRef(null);
|
|
@@ -128,7 +128,7 @@ export const FieldSelectMultiple = forwardRef((props, ref) => {
|
|
|
128
128
|
updateInputValue();
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
|
-
}, dataFiltered: (_a = rest.dataFiltered) !== null && _a !== void 0 ? _a : Boolean(inputValue.length), size: size, open: !disabled && !readonly && open, onOpenChange: handleOpenChange, children: ({ onKeyDown }) => {
|
|
131
|
+
}, dataFiltered: (_a = rest.dataFiltered) !== null && _a !== void 0 ? _a : Boolean(inputValue.length), untouchableScrollbars: untouchableScrollbars, size: size, open: !disabled && !readonly && open, onOpenChange: handleOpenChange, children: ({ onKeyDown }) => {
|
|
132
132
|
var _a, _b, _c, _d;
|
|
133
133
|
return (_jsx(FieldContainerPrivate, { className: cn(styles.container, styles.tagContainer), validationState: fieldValidationState, disabled: disabled, readonly: readonly, focused: open, variant: 'single-line-container', inputRef: localRef, size: size, prefix: prefixIcon, children: _jsxs(_Fragment, { children: [_jsxs("div", { className: styles.contentWrapper, ref: contentRef, children: [selectedItems &&
|
|
134
134
|
selectedItems.map(option => {
|
|
@@ -21,4 +21,4 @@ export declare const FieldSelectSingle: import("react").ForwardRefExoticComponen
|
|
|
21
21
|
open?: boolean;
|
|
22
22
|
onOpenChange?(open: boolean): void;
|
|
23
23
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
24
|
-
} & Pick<import("@snack-uikit/list").DroplistProps, "dataError" | "dataFiltered" | "noDataState" | "noResultsState" | "errorDataState"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
24
|
+
} & Pick<import("@snack-uikit/list").DroplistProps, "untouchableScrollbars" | "dataError" | "dataFiltered" | "noDataState" | "noResultsState" | "errorDataState"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -31,7 +31,7 @@ const defaultSelectedOptionFormatter = item =>
|
|
|
31
31
|
(item === null || item === void 0 ? void 0 : item.content.option) || '';
|
|
32
32
|
export const FieldSelectSingle = forwardRef((props, ref) => {
|
|
33
33
|
var _a;
|
|
34
|
-
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showCopyButton = true, showClearButton = true, onKeyDown: onInputKeyDownProp, required = false, validationState = 'default', search, autocomplete = false, prefixIcon, addOptionByEnter = false, open: openProp, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showCopyButton", "showClearButton", "onKeyDown", "required", "validationState", "search", "autocomplete", "prefixIcon", "addOptionByEnter", "open", "onOpenChange", "selectedOptionFormatter"]);
|
|
34
|
+
const { id, name, placeholder, size = 's', options, value: valueProp, defaultValue, onChange: onChangeProp, disabled = false, readonly = false, searchable = true, showCopyButton = true, showClearButton = true, onKeyDown: onInputKeyDownProp, required = false, validationState = 'default', search, autocomplete = false, prefixIcon, addOptionByEnter = false, untouchableScrollbars = false, open: openProp, onOpenChange, selectedOptionFormatter = defaultSelectedOptionFormatter } = props, rest = __rest(props, ["id", "name", "placeholder", "size", "options", "value", "defaultValue", "onChange", "disabled", "readonly", "searchable", "showCopyButton", "showClearButton", "onKeyDown", "required", "validationState", "search", "autocomplete", "prefixIcon", "addOptionByEnter", "untouchableScrollbars", "open", "onOpenChange", "selectedOptionFormatter"]);
|
|
35
35
|
const localRef = useRef(null);
|
|
36
36
|
const [open = false, setOpen] = useValueControl({ value: openProp, onChange: onOpenChange });
|
|
37
37
|
const [value, setValue] = useValueControl({
|
|
@@ -128,7 +128,7 @@ export const FieldSelectSingle = forwardRef((props, ref) => {
|
|
|
128
128
|
mode: 'single',
|
|
129
129
|
value: value,
|
|
130
130
|
onChange: handleSelectionChange,
|
|
131
|
-
}, size: size, open: open, onOpenChange: handleOpenChange, trigger: 'click', triggerElemRef: localRef, children: ({ onKeyDown }) => (_jsxs(FieldContainerPrivate, { className: styles.container, validationState: fieldValidationState, disabled: disabled, readonly: readonly, focused: open, variant: 'single-line-container', inputRef: localRef, size: size, prefix: prefixIcon, children: [_jsx(InputPrivate, { id: id, name: name, type: 'text', disabled: disabled, placeholder: placeholder, ref: mergeRefs(ref, localRef), onChange: searchable ? setInputValue : undefined, value: searchable ? inputValue : selectedOptionFormatter(selectedItem), readonly: readonly, "data-test-id": 'field-select__input', onKeyDown: handleOnKeyDown(onKeyDown), onBlur: handleBlur, className: cn({
|
|
131
|
+
}, size: size, open: open, onOpenChange: handleOpenChange, trigger: 'click', triggerElemRef: localRef, untouchableScrollbars: untouchableScrollbars, children: ({ onKeyDown }) => (_jsxs(FieldContainerPrivate, { className: styles.container, validationState: fieldValidationState, disabled: disabled, readonly: readonly, focused: open, variant: 'single-line-container', inputRef: localRef, size: size, prefix: prefixIcon, children: [_jsx(InputPrivate, { id: id, name: name, type: 'text', disabled: disabled, placeholder: placeholder, ref: mergeRefs(ref, localRef), onChange: searchable ? setInputValue : undefined, value: searchable ? inputValue : selectedOptionFormatter(selectedItem), readonly: readonly, "data-test-id": 'field-select__input', onKeyDown: handleOnKeyDown(onKeyDown), onBlur: handleBlur, className: cn({
|
|
132
132
|
[styles.readonlyCursor]: !searchable,
|
|
133
133
|
}) }), _jsxs("div", { className: styles.postfix, children: [buttons, _jsx(ArrowIcon, { size: arrowIconSize, className: styles.arrowIcon })] })] })) })) })));
|
|
134
134
|
});
|
|
@@ -62,7 +62,7 @@ type FiledSelectCommonProps = WithSupportProps<{
|
|
|
62
62
|
open?: boolean;
|
|
63
63
|
onOpenChange?(open: boolean): void;
|
|
64
64
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
65
|
-
}> & Pick<DroplistProps, 'dataError' | 'noDataState' | 'noResultsState' | 'errorDataState' | 'dataFiltered'>;
|
|
65
|
+
}> & Pick<DroplistProps, 'dataError' | 'noDataState' | 'noResultsState' | 'errorDataState' | 'dataFiltered' | 'untouchableScrollbars'>;
|
|
66
66
|
export type FieldSelectSingleProps = FieldSelectPrivateProps & Omit<SelectionSingleState, 'mode'> & WrapperProps & FiledSelectCommonProps;
|
|
67
67
|
export type FieldSelectMultipleProps = FieldSelectPrivateProps & {
|
|
68
68
|
removeByBackspace?: boolean;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Fields",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.25.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@snack-uikit/dropdown": "0.2.4",
|
|
38
38
|
"@snack-uikit/icons": "0.22.0",
|
|
39
39
|
"@snack-uikit/input-private": "3.2.0",
|
|
40
|
-
"@snack-uikit/list": "0.
|
|
40
|
+
"@snack-uikit/list": "0.16.0",
|
|
41
41
|
"@snack-uikit/scroll": "0.6.0",
|
|
42
42
|
"@snack-uikit/skeleton": "0.3.4",
|
|
43
43
|
"@snack-uikit/slider": "0.1.15",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@snack-uikit/locale": "*"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "f28082de935a68b3cd19966d62b18ad6b98f4197"
|
|
63
63
|
}
|
|
@@ -46,6 +46,7 @@ export const FieldSelectMultiple = forwardRef<HTMLInputElement, FieldSelectMulti
|
|
|
46
46
|
prefixIcon,
|
|
47
47
|
removeByBackspace = false,
|
|
48
48
|
addOptionByEnter = false,
|
|
49
|
+
untouchableScrollbars = false,
|
|
49
50
|
open: openProp,
|
|
50
51
|
onOpenChange,
|
|
51
52
|
selectedOptionFormatter = defaultSelectedOptionFormatter,
|
|
@@ -185,6 +186,7 @@ export const FieldSelectMultiple = forwardRef<HTMLInputElement, FieldSelectMulti
|
|
|
185
186
|
},
|
|
186
187
|
}}
|
|
187
188
|
dataFiltered={rest.dataFiltered ?? Boolean(inputValue.length)}
|
|
189
|
+
untouchableScrollbars={untouchableScrollbars}
|
|
188
190
|
size={size}
|
|
189
191
|
open={!disabled && !readonly && open}
|
|
190
192
|
onOpenChange={handleOpenChange}
|
|
@@ -54,6 +54,7 @@ export const FieldSelectSingle = forwardRef<HTMLInputElement, FieldSelectSingleP
|
|
|
54
54
|
autocomplete = false,
|
|
55
55
|
prefixIcon,
|
|
56
56
|
addOptionByEnter = false,
|
|
57
|
+
untouchableScrollbars = false,
|
|
57
58
|
open: openProp,
|
|
58
59
|
onOpenChange,
|
|
59
60
|
selectedOptionFormatter = defaultSelectedOptionFormatter,
|
|
@@ -203,6 +204,7 @@ export const FieldSelectSingle = forwardRef<HTMLInputElement, FieldSelectSingleP
|
|
|
203
204
|
onOpenChange={handleOpenChange}
|
|
204
205
|
trigger='click'
|
|
205
206
|
triggerElemRef={localRef}
|
|
207
|
+
untouchableScrollbars={untouchableScrollbars}
|
|
206
208
|
>
|
|
207
209
|
{({ onKeyDown }) => (
|
|
208
210
|
<FieldContainerPrivate
|
|
@@ -120,7 +120,10 @@ type FiledSelectCommonProps = WithSupportProps<{
|
|
|
120
120
|
|
|
121
121
|
selectedOptionFormatter?: SelectedOptionFormatter;
|
|
122
122
|
}> &
|
|
123
|
-
Pick<
|
|
123
|
+
Pick<
|
|
124
|
+
DroplistProps,
|
|
125
|
+
'dataError' | 'noDataState' | 'noResultsState' | 'errorDataState' | 'dataFiltered' | 'untouchableScrollbars'
|
|
126
|
+
>;
|
|
124
127
|
|
|
125
128
|
export type FieldSelectSingleProps = FieldSelectPrivateProps &
|
|
126
129
|
Omit<SelectionSingleState, 'mode'> &
|