@vkontakte/vkui 4.41.0 → 4.42.1
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/.cache/.eslintcache +1 -1
- package/.cache/.stylelintcache +1 -1
- package/.cache/.tsbuildinfo +13 -11
- package/.cache/ts/src/components/Checkbox/Checkbox.d.ts +4 -3
- package/dist/cjs/components/Checkbox/Checkbox.d.ts +4 -3
- package/dist/cjs/components/Checkbox/Checkbox.js +12 -2
- package/dist/cjs/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/cjs/components/ChipsSelect/ChipsSelect.js +2 -2
- package/dist/cjs/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/cjs/components/CustomScrollView/CustomScrollView.js +3 -1
- package/dist/cjs/components/CustomScrollView/CustomScrollView.js.map +1 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.js +7 -3
- package/dist/cjs/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cjs/components/Dropdown/Dropdown.js +4 -1
- package/dist/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/Search/Search.js +4 -3
- package/dist/cjs/components/Search/Search.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +4 -3
- package/dist/components/Checkbox/Checkbox.js +12 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/ChipsSelect/ChipsSelect.js +2 -2
- package/dist/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/components/CustomScrollView/CustomScrollView.js +3 -1
- package/dist/components/CustomScrollView/CustomScrollView.js.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.js +7 -3
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components/Dropdown/Dropdown.js +4 -1
- package/dist/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/components/Search/Search.js +4 -3
- package/dist/components/Search/Search.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/Button/Button.css +1 -1
- package/dist/cssm/components/Checkbox/Checkbox.d.ts +4 -3
- package/dist/cssm/components/Checkbox/Checkbox.js +12 -2
- package/dist/cssm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/cssm/components/ChipsSelect/ChipsSelect.js +2 -2
- package/dist/cssm/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/cssm/components/CustomScrollView/CustomScrollView.js +3 -1
- package/dist/cssm/components/CustomScrollView/CustomScrollView.js.map +1 -1
- package/dist/cssm/components/CustomSelect/CustomSelect.js +7 -3
- package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cssm/components/Dropdown/Dropdown.js +4 -1
- package/dist/cssm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/cssm/components/Search/Search.js +4 -3
- package/dist/cssm/components/Search/Search.js.map +1 -1
- package/dist/cssm/components/Tooltip/Tooltip.js +1 -0
- package/dist/cssm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cssm/styles/components.css +1 -1
- package/dist/vkui.css +1 -1
- package/dist/vkui.css.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.css +2 -1
- package/src/components/Checkbox/Checkbox.tsx +20 -2
- package/src/components/ChipsSelect/ChipsSelect.tsx +46 -43
- package/src/components/CustomScrollView/CustomScrollView.tsx +6 -1
- package/src/components/CustomSelect/CustomSelect.tsx +2 -1
- package/src/components/Dropdown/Dropdown.tsx +4 -1
- package/src/components/Search/Search.tsx +9 -3
- package/src/components/Tooltip/Tooltip.tsx +1 -0
package/package.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ACTIVE_EFFECT_DELAY,
|
|
4
|
+
TappableProps,
|
|
5
|
+
Tappable,
|
|
6
|
+
} from "../Tappable/Tappable";
|
|
3
7
|
import { classNames } from "../../lib/classNames";
|
|
4
8
|
import { IOS, VKCOM } from "../../lib/platform";
|
|
5
9
|
|
|
@@ -30,7 +34,11 @@ export interface CheckboxProps
|
|
|
30
34
|
extends React.InputHTMLAttributes<HTMLInputElement>,
|
|
31
35
|
HasRootRef<HTMLLabelElement>,
|
|
32
36
|
HasRef<HTMLInputElement>,
|
|
33
|
-
AdaptivityProps
|
|
37
|
+
AdaptivityProps,
|
|
38
|
+
Pick<
|
|
39
|
+
TappableProps,
|
|
40
|
+
"hoverMode" | "activeMode" | "hasHover" | "hasActive" | "focusVisibleMode"
|
|
41
|
+
> {
|
|
34
42
|
description?: React.ReactNode;
|
|
35
43
|
indeterminate?: boolean;
|
|
36
44
|
defaultIndeterminate?: boolean;
|
|
@@ -51,6 +59,11 @@ export const Checkbox = ({
|
|
|
51
59
|
indeterminate,
|
|
52
60
|
defaultIndeterminate,
|
|
53
61
|
sizeY,
|
|
62
|
+
hoverMode,
|
|
63
|
+
activeMode,
|
|
64
|
+
hasHover,
|
|
65
|
+
hasActive,
|
|
66
|
+
focusVisibleMode,
|
|
54
67
|
onChange,
|
|
55
68
|
...restProps
|
|
56
69
|
}: CheckboxProps) => {
|
|
@@ -115,6 +128,11 @@ export const Checkbox = ({
|
|
|
115
128
|
disabled={restProps.disabled}
|
|
116
129
|
activeEffectDelay={platform === IOS ? 100 : ACTIVE_EFFECT_DELAY}
|
|
117
130
|
getRootRef={getRootRef}
|
|
131
|
+
hoverMode={hoverMode}
|
|
132
|
+
activeMode={activeMode}
|
|
133
|
+
hasHover={hasHover}
|
|
134
|
+
hasActive={hasActive}
|
|
135
|
+
focusVisibleMode={focusVisibleMode}
|
|
118
136
|
>
|
|
119
137
|
<VisuallyHiddenInput
|
|
120
138
|
{...restProps}
|
|
@@ -362,49 +362,52 @@ export const ChipsSelect = <Option extends ChipOption>(
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
return (
|
|
365
|
-
<
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
aria-disabled={disabled}
|
|
377
|
-
aria-readonly={restProps.readOnly}
|
|
378
|
-
after={
|
|
379
|
-
<IconButton
|
|
380
|
-
vkuiClass="ChipsSelect__dropdown"
|
|
381
|
-
activeMode=""
|
|
382
|
-
hoverMode=""
|
|
383
|
-
// TODO: add label customization
|
|
384
|
-
aria-label={opened ? "Скрыть" : "Развернуть"}
|
|
385
|
-
onClick={toggleOpened}
|
|
386
|
-
>
|
|
387
|
-
<DropdownIcon vkuiClass="ChipsSelect__icon" opened={opened} />
|
|
388
|
-
</IconButton>
|
|
389
|
-
}
|
|
390
|
-
before={before}
|
|
391
|
-
>
|
|
392
|
-
<ChipsInputBase
|
|
393
|
-
{...restProps}
|
|
394
|
-
tabIndex={tabIndex}
|
|
395
|
-
value={selectedOptions}
|
|
396
|
-
inputValue={fieldValue}
|
|
397
|
-
getNewOptionData={getNewOptionData}
|
|
398
|
-
getOptionLabel={getOptionLabel}
|
|
399
|
-
getOptionValue={getOptionValue}
|
|
400
|
-
renderChip={renderChipWrapper}
|
|
401
|
-
onFocus={handleFocus}
|
|
402
|
-
onKeyDown={handleKeyDown}
|
|
403
|
-
placeholder={placeholder}
|
|
404
|
-
getRef={getRef}
|
|
365
|
+
<React.Fragment>
|
|
366
|
+
<FormField
|
|
367
|
+
vkuiClass={classNames(
|
|
368
|
+
"ChipsSelect",
|
|
369
|
+
opened && "Select--open",
|
|
370
|
+
opened &&
|
|
371
|
+
(isPopperDirectionTop ? "Select--pop-up" : "Select--pop-down")
|
|
372
|
+
)}
|
|
373
|
+
getRootRef={rootRef}
|
|
374
|
+
style={style}
|
|
375
|
+
className={className}
|
|
405
376
|
disabled={disabled}
|
|
406
|
-
|
|
407
|
-
|
|
377
|
+
role="application"
|
|
378
|
+
aria-disabled={disabled}
|
|
379
|
+
aria-readonly={restProps.readOnly}
|
|
380
|
+
after={
|
|
381
|
+
<IconButton
|
|
382
|
+
vkuiClass="ChipsSelect__dropdown"
|
|
383
|
+
activeMode=""
|
|
384
|
+
hoverMode=""
|
|
385
|
+
// TODO: add label customization
|
|
386
|
+
aria-label={opened ? "Скрыть" : "Развернуть"}
|
|
387
|
+
onClick={toggleOpened}
|
|
388
|
+
>
|
|
389
|
+
<DropdownIcon vkuiClass="ChipsSelect__icon" opened={opened} />
|
|
390
|
+
</IconButton>
|
|
391
|
+
}
|
|
392
|
+
before={before}
|
|
393
|
+
>
|
|
394
|
+
<ChipsInputBase
|
|
395
|
+
{...restProps}
|
|
396
|
+
tabIndex={tabIndex}
|
|
397
|
+
value={selectedOptions}
|
|
398
|
+
inputValue={fieldValue}
|
|
399
|
+
getNewOptionData={getNewOptionData}
|
|
400
|
+
getOptionLabel={getOptionLabel}
|
|
401
|
+
getOptionValue={getOptionValue}
|
|
402
|
+
renderChip={renderChipWrapper}
|
|
403
|
+
onFocus={handleFocus}
|
|
404
|
+
onKeyDown={handleKeyDown}
|
|
405
|
+
placeholder={placeholder}
|
|
406
|
+
getRef={getRef}
|
|
407
|
+
disabled={disabled}
|
|
408
|
+
onInputChange={handleInputChange}
|
|
409
|
+
/>
|
|
410
|
+
</FormField>
|
|
408
411
|
{opened && (
|
|
409
412
|
<CustomSelectDropdown
|
|
410
413
|
targetRef={rootRef}
|
|
@@ -475,6 +478,6 @@ export const ChipsSelect = <Option extends ChipOption>(
|
|
|
475
478
|
)}
|
|
476
479
|
</CustomSelectDropdown>
|
|
477
480
|
)}
|
|
478
|
-
</
|
|
481
|
+
</React.Fragment>
|
|
479
482
|
);
|
|
480
483
|
};
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
TrackerOptionsProps,
|
|
9
9
|
useTrackerVisibility,
|
|
10
10
|
} from "./useTrackerVisibility";
|
|
11
|
+
import { stopPropagation } from "../../lib/utils";
|
|
11
12
|
import "./CustomScrollView.css";
|
|
12
13
|
|
|
13
14
|
export interface CustomScrollViewProps extends DOMProps, TrackerOptionsProps {
|
|
@@ -183,7 +184,11 @@ export const CustomScrollView = ({
|
|
|
183
184
|
|
|
184
185
|
return (
|
|
185
186
|
<div vkuiClass="CustomScrollView" className={className}>
|
|
186
|
-
<div
|
|
187
|
+
<div
|
|
188
|
+
vkuiClass="CustomScrollView__barY"
|
|
189
|
+
ref={barY}
|
|
190
|
+
onClick={stopPropagation}
|
|
191
|
+
>
|
|
187
192
|
<div
|
|
188
193
|
vkuiClass={classNames(
|
|
189
194
|
"CustomScrollView__trackerY",
|
|
@@ -242,7 +242,7 @@ function CustomSelectComponent(props: CustomSelectProps) {
|
|
|
242
242
|
}, [props.value]);
|
|
243
243
|
|
|
244
244
|
useIsomorphicLayoutEffect(() => {
|
|
245
|
-
if (nativeSelectValue
|
|
245
|
+
if (options.some(({ value }) => nativeSelectValue === value)) {
|
|
246
246
|
const event = new Event("change", { bubbles: true });
|
|
247
247
|
|
|
248
248
|
selectElRef.current?.dispatchEvent(event);
|
|
@@ -709,6 +709,7 @@ function CustomSelectComponent(props: CustomSelectProps) {
|
|
|
709
709
|
onFocus={onFocus}
|
|
710
710
|
onBlur={onBlur}
|
|
711
711
|
vkuiClass={openedClassNames}
|
|
712
|
+
before={before}
|
|
712
713
|
after={icon}
|
|
713
714
|
selectType={selectType}
|
|
714
715
|
>
|
|
@@ -138,7 +138,10 @@ export const Dropdown = ({
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
useGlobalEventListener(document, "click", handleOutsideClick
|
|
141
|
+
useGlobalEventListener(document, "click", handleOutsideClick, {
|
|
142
|
+
capture: true,
|
|
143
|
+
passive: true,
|
|
144
|
+
});
|
|
142
145
|
const targetEnterListener = useEventListener("mouseenter", handleTargetEnter);
|
|
143
146
|
const targetClickEvent = useEventListener("click", handleTargetClick);
|
|
144
147
|
const targetLeaveListener = useEventListener("mouseleave", handleTargetLeave);
|
|
@@ -170,7 +170,7 @@ const SearchComponent = ({
|
|
|
170
170
|
)}
|
|
171
171
|
</div>
|
|
172
172
|
</label>
|
|
173
|
-
<div vkuiClass="Search__after"
|
|
173
|
+
<div vkuiClass="Search__after">
|
|
174
174
|
<div vkuiClass="Search__icons">
|
|
175
175
|
{icon && (
|
|
176
176
|
<Touch onStart={onIconClickStart} vkuiClass="Search__icon">
|
|
@@ -178,13 +178,19 @@ const SearchComponent = ({
|
|
|
178
178
|
</Touch>
|
|
179
179
|
)}
|
|
180
180
|
{!!value && (
|
|
181
|
-
<Touch
|
|
181
|
+
<Touch
|
|
182
|
+
onStart={onIconCancelClickStart}
|
|
183
|
+
onClick={onCancel}
|
|
184
|
+
vkuiClass="Search__icon"
|
|
185
|
+
>
|
|
182
186
|
{platform === IOS ? <Icon16Clear /> : <Icon24Cancel />}
|
|
183
187
|
</Touch>
|
|
184
188
|
)}
|
|
185
189
|
</div>
|
|
186
190
|
{platform === IOS && after && (
|
|
187
|
-
<div vkuiClass="Search__after-in"
|
|
191
|
+
<div vkuiClass="Search__after-in" onClick={onCancel}>
|
|
192
|
+
{after}
|
|
193
|
+
</div>
|
|
188
194
|
)}
|
|
189
195
|
</div>
|
|
190
196
|
</div>
|
|
@@ -305,6 +305,7 @@ export const Tooltip = ({
|
|
|
305
305
|
|
|
306
306
|
const { document } = useDOM();
|
|
307
307
|
useGlobalEventListener(document, "click", isShown && onClose, {
|
|
308
|
+
capture: true,
|
|
308
309
|
passive: true,
|
|
309
310
|
});
|
|
310
311
|
// NOTE: setting isShown to true used to trigger usePopper().forceUpdate()
|