@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.
Files changed (64) hide show
  1. package/.cache/.eslintcache +1 -1
  2. package/.cache/.stylelintcache +1 -1
  3. package/.cache/.tsbuildinfo +13 -11
  4. package/.cache/ts/src/components/Checkbox/Checkbox.d.ts +4 -3
  5. package/dist/cjs/components/Checkbox/Checkbox.d.ts +4 -3
  6. package/dist/cjs/components/Checkbox/Checkbox.js +12 -2
  7. package/dist/cjs/components/Checkbox/Checkbox.js.map +1 -1
  8. package/dist/cjs/components/ChipsSelect/ChipsSelect.js +2 -2
  9. package/dist/cjs/components/ChipsSelect/ChipsSelect.js.map +1 -1
  10. package/dist/cjs/components/CustomScrollView/CustomScrollView.js +3 -1
  11. package/dist/cjs/components/CustomScrollView/CustomScrollView.js.map +1 -1
  12. package/dist/cjs/components/CustomSelect/CustomSelect.js +7 -3
  13. package/dist/cjs/components/CustomSelect/CustomSelect.js.map +1 -1
  14. package/dist/cjs/components/Dropdown/Dropdown.js +4 -1
  15. package/dist/cjs/components/Dropdown/Dropdown.js.map +1 -1
  16. package/dist/cjs/components/Search/Search.js +4 -3
  17. package/dist/cjs/components/Search/Search.js.map +1 -1
  18. package/dist/cjs/components/Tooltip/Tooltip.js +1 -0
  19. package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
  20. package/dist/components/Checkbox/Checkbox.d.ts +4 -3
  21. package/dist/components/Checkbox/Checkbox.js +12 -2
  22. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  23. package/dist/components/ChipsSelect/ChipsSelect.js +2 -2
  24. package/dist/components/ChipsSelect/ChipsSelect.js.map +1 -1
  25. package/dist/components/CustomScrollView/CustomScrollView.js +3 -1
  26. package/dist/components/CustomScrollView/CustomScrollView.js.map +1 -1
  27. package/dist/components/CustomSelect/CustomSelect.js +7 -3
  28. package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
  29. package/dist/components/Dropdown/Dropdown.js +4 -1
  30. package/dist/components/Dropdown/Dropdown.js.map +1 -1
  31. package/dist/components/Search/Search.js +4 -3
  32. package/dist/components/Search/Search.js.map +1 -1
  33. package/dist/components/Tooltip/Tooltip.js +1 -0
  34. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  35. package/dist/components.css +1 -1
  36. package/dist/components.css.map +1 -1
  37. package/dist/cssm/components/Button/Button.css +1 -1
  38. package/dist/cssm/components/Checkbox/Checkbox.d.ts +4 -3
  39. package/dist/cssm/components/Checkbox/Checkbox.js +12 -2
  40. package/dist/cssm/components/Checkbox/Checkbox.js.map +1 -1
  41. package/dist/cssm/components/ChipsSelect/ChipsSelect.js +2 -2
  42. package/dist/cssm/components/ChipsSelect/ChipsSelect.js.map +1 -1
  43. package/dist/cssm/components/CustomScrollView/CustomScrollView.js +3 -1
  44. package/dist/cssm/components/CustomScrollView/CustomScrollView.js.map +1 -1
  45. package/dist/cssm/components/CustomSelect/CustomSelect.js +7 -3
  46. package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
  47. package/dist/cssm/components/Dropdown/Dropdown.js +4 -1
  48. package/dist/cssm/components/Dropdown/Dropdown.js.map +1 -1
  49. package/dist/cssm/components/Search/Search.js +4 -3
  50. package/dist/cssm/components/Search/Search.js.map +1 -1
  51. package/dist/cssm/components/Tooltip/Tooltip.js +1 -0
  52. package/dist/cssm/components/Tooltip/Tooltip.js.map +1 -1
  53. package/dist/cssm/styles/components.css +1 -1
  54. package/dist/vkui.css +1 -1
  55. package/dist/vkui.css.map +1 -1
  56. package/package.json +1 -1
  57. package/src/components/Button/Button.css +2 -1
  58. package/src/components/Checkbox/Checkbox.tsx +20 -2
  59. package/src/components/ChipsSelect/ChipsSelect.tsx +46 -43
  60. package/src/components/CustomScrollView/CustomScrollView.tsx +6 -1
  61. package/src/components/CustomSelect/CustomSelect.tsx +2 -1
  62. package/src/components/Dropdown/Dropdown.tsx +4 -1
  63. package/src/components/Search/Search.tsx +9 -3
  64. package/src/components/Tooltip/Tooltip.tsx +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/vkui",
3
- "version": "4.41.0",
3
+ "version": "4.42.1",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -18,7 +18,8 @@
18
18
  }
19
19
 
20
20
  .Button--singleIcon {
21
- min-width: var(--vkui--size_button_small_height--compact);
21
+ width: var(--vkui--size_button_small_height--compact);
22
+ min-width: initial;
22
23
  }
23
24
 
24
25
  .Button--stretched {
@@ -1,5 +1,9 @@
1
1
  import * as React from "react";
2
- import { ACTIVE_EFFECT_DELAY, Tappable } from "../Tappable/Tappable";
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
- <FormField
366
- vkuiClass={classNames(
367
- "ChipsSelect",
368
- opened && "Select--open",
369
- opened && (isPopperDirectionTop ? "Select--pop-up" : "Select--pop-down")
370
- )}
371
- getRootRef={rootRef}
372
- style={style}
373
- className={className}
374
- disabled={disabled}
375
- role="application"
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
- onInputChange={handleInputChange}
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
- </FormField>
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 vkuiClass="CustomScrollView__barY" ref={barY}>
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 !== undefined) {
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" onClick={onCancel}>
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 onStart={onIconCancelClickStart} vkuiClass="Search__icon">
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">{after}</div>
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()