@vkontakte/vkui 4.30.0 → 4.31.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.
Files changed (200) hide show
  1. package/.cache/.eslintcache +1 -1
  2. package/.cache/.stylelintcache +1 -1
  3. package/.cache/.tsbuildinfo +38 -27
  4. package/.cache/ts/src/components/Calendar/Calendar.d.ts +1 -1
  5. package/.cache/ts/src/components/CalendarHeader/CalendarHeader.d.ts +2 -0
  6. package/.cache/ts/src/components/CalendarRange/CalendarRange.d.ts +1 -1
  7. package/.cache/ts/src/components/DateInput/DateInput.d.ts +1 -1
  8. package/.cache/ts/src/components/DateRangeInput/DateRangeInput.d.ts +1 -1
  9. package/.cache/ts/src/hooks/useAdaptivity.d.ts +1 -0
  10. package/.cache/ts/src/index.d.ts +1 -0
  11. package/dist/cjs/components/ActionSheet/ActionSheet.js +2 -9
  12. package/dist/cjs/components/ActionSheet/ActionSheet.js.map +1 -1
  13. package/dist/cjs/components/Calendar/Calendar.d.ts +1 -1
  14. package/dist/cjs/components/Calendar/Calendar.js +6 -2
  15. package/dist/cjs/components/Calendar/Calendar.js.map +1 -1
  16. package/dist/cjs/components/CalendarHeader/CalendarHeader.d.ts +2 -0
  17. package/dist/cjs/components/CalendarHeader/CalendarHeader.js +15 -9
  18. package/dist/cjs/components/CalendarHeader/CalendarHeader.js.map +1 -1
  19. package/dist/cjs/components/CalendarRange/CalendarRange.d.ts +1 -1
  20. package/dist/cjs/components/CalendarRange/CalendarRange.js +7 -3
  21. package/dist/cjs/components/CalendarRange/CalendarRange.js.map +1 -1
  22. package/dist/cjs/components/DateInput/DateInput.d.ts +1 -1
  23. package/dist/cjs/components/DateInput/DateInput.js +7 -3
  24. package/dist/cjs/components/DateInput/DateInput.js.map +1 -1
  25. package/dist/cjs/components/DateRangeInput/DateRangeInput.d.ts +1 -1
  26. package/dist/cjs/components/DateRangeInput/DateRangeInput.js +6 -2
  27. package/dist/cjs/components/DateRangeInput/DateRangeInput.js.map +1 -1
  28. package/dist/cjs/components/ModalCard/ModalCard.js +3 -1
  29. package/dist/cjs/components/ModalCard/ModalCard.js.map +1 -1
  30. package/dist/cjs/components/ModalCardBase/ModalCardBase.js +4 -2
  31. package/dist/cjs/components/ModalCardBase/ModalCardBase.js.map +1 -1
  32. package/dist/cjs/components/ModalPage/ModalPage.js +6 -2
  33. package/dist/cjs/components/ModalPage/ModalPage.js.map +1 -1
  34. package/dist/cjs/components/ModalPageHeader/ModalPageHeader.js +2 -10
  35. package/dist/cjs/components/ModalPageHeader/ModalPageHeader.js.map +1 -1
  36. package/dist/cjs/components/ModalRoot/ModalRootAdaptive.js +3 -4
  37. package/dist/cjs/components/ModalRoot/ModalRootAdaptive.js.map +1 -1
  38. package/dist/cjs/components/PanelHeader/PanelHeader.js +8 -6
  39. package/dist/cjs/components/PanelHeader/PanelHeader.js.map +1 -1
  40. package/dist/cjs/components/PopoutRoot/PopoutRoot.js +3 -1
  41. package/dist/cjs/components/PopoutRoot/PopoutRoot.js.map +1 -1
  42. package/dist/cjs/hooks/useAdaptivity.d.ts +1 -0
  43. package/dist/cjs/hooks/useAdaptivity.js +18 -1
  44. package/dist/cjs/hooks/useAdaptivity.js.map +1 -1
  45. package/dist/cjs/index.d.ts +1 -0
  46. package/dist/cjs/index.js +8 -0
  47. package/dist/cjs/index.js.map +1 -1
  48. package/dist/components/ActionSheet/ActionSheet.js +2 -8
  49. package/dist/components/ActionSheet/ActionSheet.js.map +1 -1
  50. package/dist/components/Calendar/Calendar.d.ts +1 -1
  51. package/dist/components/Calendar/Calendar.js +6 -2
  52. package/dist/components/Calendar/Calendar.js.map +1 -1
  53. package/dist/components/CalendarHeader/CalendarHeader.d.ts +2 -0
  54. package/dist/components/CalendarHeader/CalendarHeader.js +15 -9
  55. package/dist/components/CalendarHeader/CalendarHeader.js.map +1 -1
  56. package/dist/components/CalendarRange/CalendarRange.d.ts +1 -1
  57. package/dist/components/CalendarRange/CalendarRange.js +7 -3
  58. package/dist/components/CalendarRange/CalendarRange.js.map +1 -1
  59. package/dist/components/DateInput/DateInput.d.ts +1 -1
  60. package/dist/components/DateInput/DateInput.js +7 -3
  61. package/dist/components/DateInput/DateInput.js.map +1 -1
  62. package/dist/components/DateRangeInput/DateRangeInput.d.ts +1 -1
  63. package/dist/components/DateRangeInput/DateRangeInput.js +6 -2
  64. package/dist/components/DateRangeInput/DateRangeInput.js.map +1 -1
  65. package/dist/components/ModalCard/ModalCard.js +3 -2
  66. package/dist/components/ModalCard/ModalCard.js.map +1 -1
  67. package/dist/components/ModalCardBase/ModalCardBase.js +5 -4
  68. package/dist/components/ModalCardBase/ModalCardBase.js.map +1 -1
  69. package/dist/components/ModalPage/ModalPage.js +5 -3
  70. package/dist/components/ModalPage/ModalPage.js.map +1 -1
  71. package/dist/components/ModalPageHeader/ModalPageHeader.js +2 -9
  72. package/dist/components/ModalPageHeader/ModalPageHeader.js.map +1 -1
  73. package/dist/components/ModalRoot/ModalRootAdaptive.js +3 -5
  74. package/dist/components/ModalRoot/ModalRootAdaptive.js.map +1 -1
  75. package/dist/components/PanelHeader/PanelHeader.js +8 -6
  76. package/dist/components/PanelHeader/PanelHeader.js.map +1 -1
  77. package/dist/components/PopoutRoot/PopoutRoot.js +3 -2
  78. package/dist/components/PopoutRoot/PopoutRoot.js.map +1 -1
  79. package/dist/components.css +18 -18
  80. package/dist/components.css.map +1 -1
  81. package/dist/cssm/components/ActionSheet/ActionSheet.js +2 -8
  82. package/dist/cssm/components/ActionSheet/ActionSheet.js.map +1 -1
  83. package/dist/cssm/components/Button/Button.css +9 -9
  84. package/dist/cssm/components/ButtonGroup/ButtonGroup.css +1 -1
  85. package/dist/cssm/components/Calendar/Calendar.css +1 -1
  86. package/dist/cssm/components/Calendar/Calendar.d.ts +1 -1
  87. package/dist/cssm/components/Calendar/Calendar.js +6 -2
  88. package/dist/cssm/components/Calendar/Calendar.js.map +1 -1
  89. package/dist/cssm/components/CalendarDay/CalendarDay.css +1 -1
  90. package/dist/cssm/components/CalendarDays/CalendarDays.css +1 -1
  91. package/dist/cssm/components/CalendarHeader/CalendarHeader.css +1 -1
  92. package/dist/cssm/components/CalendarHeader/CalendarHeader.d.ts +2 -0
  93. package/dist/cssm/components/CalendarHeader/CalendarHeader.js +15 -9
  94. package/dist/cssm/components/CalendarHeader/CalendarHeader.js.map +1 -1
  95. package/dist/cssm/components/CalendarRange/CalendarRange.css +1 -1
  96. package/dist/cssm/components/CalendarRange/CalendarRange.d.ts +1 -1
  97. package/dist/cssm/components/CalendarRange/CalendarRange.js +7 -3
  98. package/dist/cssm/components/CalendarRange/CalendarRange.js.map +1 -1
  99. package/dist/cssm/components/CalendarTime/CalendarTime.css +1 -1
  100. package/dist/cssm/components/Card/Card.css +2 -2
  101. package/dist/cssm/components/CardScroll/CardScroll.css +1 -1
  102. package/dist/cssm/components/Cell/Cell.css +1 -1
  103. package/dist/cssm/components/CellButton/CellButton.css +1 -1
  104. package/dist/cssm/components/Checkbox/Checkbox.css +1 -1
  105. package/dist/cssm/components/ChipsInput/ChipsInput.css +1 -1
  106. package/dist/cssm/components/CustomSelectDropdown/CustomSelectDropdown.css +1 -1
  107. package/dist/cssm/components/CustomSelectOption/CustomSelectOption.css +1 -1
  108. package/dist/cssm/components/DateInput/DateInput.d.ts +1 -1
  109. package/dist/cssm/components/DateInput/DateInput.js +7 -3
  110. package/dist/cssm/components/DateInput/DateInput.js.map +1 -1
  111. package/dist/cssm/components/DateRangeInput/DateRangeInput.d.ts +1 -1
  112. package/dist/cssm/components/DateRangeInput/DateRangeInput.js +6 -2
  113. package/dist/cssm/components/DateRangeInput/DateRangeInput.js.map +1 -1
  114. package/dist/cssm/components/FixedLayout/FixedLayout.css +1 -1
  115. package/dist/cssm/components/FormField/FormField.css +2 -2
  116. package/dist/cssm/components/FormLayoutGroup/FormLayoutGroup.css +1 -1
  117. package/dist/cssm/components/HorizontalScroll/HorizontalScrollArrow.css +1 -1
  118. package/dist/cssm/components/Input/Input.css +1 -1
  119. package/dist/cssm/components/InputLike/InputLike.css +1 -1
  120. package/dist/cssm/components/InputLike/InputLikeDivider.css +1 -1
  121. package/dist/cssm/components/ModalCard/ModalCard.js +3 -2
  122. package/dist/cssm/components/ModalCard/ModalCard.js.map +1 -1
  123. package/dist/cssm/components/ModalCardBase/ModalCardBase.js +5 -4
  124. package/dist/cssm/components/ModalCardBase/ModalCardBase.js.map +1 -1
  125. package/dist/cssm/components/ModalPage/ModalPage.js +5 -3
  126. package/dist/cssm/components/ModalPage/ModalPage.js.map +1 -1
  127. package/dist/cssm/components/ModalPageHeader/ModalPageHeader.js +2 -9
  128. package/dist/cssm/components/ModalPageHeader/ModalPageHeader.js.map +1 -1
  129. package/dist/cssm/components/ModalRoot/ModalRootAdaptive.js +3 -5
  130. package/dist/cssm/components/ModalRoot/ModalRootAdaptive.js.map +1 -1
  131. package/dist/cssm/components/Pagination/Pagination.css +1 -1
  132. package/dist/cssm/components/PanelHeader/PanelHeader.js +8 -6
  133. package/dist/cssm/components/PanelHeader/PanelHeader.js.map +1 -1
  134. package/dist/cssm/components/PopoutRoot/PopoutRoot.js +3 -2
  135. package/dist/cssm/components/PopoutRoot/PopoutRoot.js.map +1 -1
  136. package/dist/cssm/components/Popper/Popper.css +1 -1
  137. package/dist/cssm/components/Radio/Radio.css +1 -1
  138. package/dist/cssm/components/RadioGroup/RadioGroup.css +1 -1
  139. package/dist/cssm/components/Removable/Removable.css +1 -1
  140. package/dist/cssm/components/RichCell/RichCell.css +1 -1
  141. package/dist/cssm/components/SegmentedControl/SegmentedControl.css +1 -1
  142. package/dist/cssm/components/SegmentedControl/SegmentedControlOption/SegmentedControlOption.css +1 -1
  143. package/dist/cssm/components/SimpleCell/SimpleCell.css +1 -1
  144. package/dist/cssm/components/Typography/Caption/Caption.css +1 -1
  145. package/dist/cssm/components/Typography/Paragraph/Paragraph.css +1 -1
  146. package/dist/cssm/components/Typography/Subhead/Subhead.css +1 -1
  147. package/dist/cssm/components/Typography/Title/Title.css +1 -1
  148. package/dist/cssm/hooks/useAdaptivity.d.ts +1 -0
  149. package/dist/cssm/hooks/useAdaptivity.js +13 -1
  150. package/dist/cssm/hooks/useAdaptivity.js.map +1 -1
  151. package/dist/cssm/index.d.ts +1 -0
  152. package/dist/cssm/index.js +1 -0
  153. package/dist/cssm/index.js.map +1 -1
  154. package/dist/cssm/styles/components.css +18 -18
  155. package/dist/cssm/styles/themes.css +1 -1
  156. package/dist/hooks/useAdaptivity.d.ts +1 -0
  157. package/dist/hooks/useAdaptivity.js +13 -1
  158. package/dist/hooks/useAdaptivity.js.map +1 -1
  159. package/dist/index.d.ts +1 -0
  160. package/dist/index.js +1 -0
  161. package/dist/index.js.map +1 -1
  162. package/dist/vkui.css +19 -19
  163. package/dist/vkui.css.map +1 -1
  164. package/jest.unit.config.js +1 -0
  165. package/package.json +4 -2
  166. package/postcss-custom-properties-fallback/__tests__/custom_properties.css +5 -0
  167. package/postcss-custom-properties-fallback/index.js +83 -0
  168. package/src/components/ActionSheet/ActionSheet.tsx +2 -6
  169. package/src/components/Calendar/Calendar.tsx +6 -0
  170. package/src/components/CalendarHeader/CalendarHeader.css +3 -0
  171. package/src/components/CalendarHeader/CalendarHeader.tsx +18 -2
  172. package/src/components/CalendarRange/CalendarRange.tsx +6 -0
  173. package/src/components/Cell/Cell.css +1 -1
  174. package/src/components/CellButton/CellButton.css +1 -1
  175. package/src/components/Checkbox/Checkbox.css +1 -1
  176. package/src/components/DateInput/DateInput.tsx +7 -1
  177. package/src/components/DateRangeInput/DateRangeInput.tsx +6 -0
  178. package/src/components/FixedLayout/FixedLayout.css +10 -2
  179. package/src/components/FormItem/FormItem.css +1 -0
  180. package/src/components/FormLayoutGroup/FormLayoutGroup.css +2 -1
  181. package/src/components/ModalCard/ModalCard.tsx +3 -8
  182. package/src/components/ModalCardBase/ModalCardBase.tsx +6 -10
  183. package/src/components/ModalPage/ModalPage.tsx +6 -9
  184. package/src/components/ModalPageHeader/ModalPageHeader.tsx +2 -6
  185. package/src/components/ModalRoot/ModalRootAdaptive.tsx +3 -9
  186. package/src/components/ModalRoot/Readme.md +1 -1
  187. package/src/components/PanelHeader/PanelHeader.tsx +19 -18
  188. package/src/components/PanelHeader/Readme.md +2 -2
  189. package/src/components/PopoutRoot/PopoutRoot.tsx +3 -8
  190. package/src/components/Popper/Popper.css +14 -2
  191. package/src/components/Radio/Radio.css +1 -1
  192. package/src/components/RadioGroup/RadioGroup.css +1 -1
  193. package/src/components/Removable/Removable.css +2 -2
  194. package/src/components/RichCell/RichCell.css +1 -1
  195. package/src/components/SimpleCell/SimpleCell.css +1 -1
  196. package/src/components/Tooltip/Readme.md +35 -47
  197. package/src/hooks/useAdaptivity.ts +15 -0
  198. package/src/index.ts +1 -0
  199. package/src/styles/constants.css +1 -0
  200. package/tsconfig.json +1 -0
@@ -4,6 +4,7 @@ module.exports = {
4
4
  roots: [
5
5
  path.join(__dirname, "src"),
6
6
  path.join(__dirname, "postcss-plugin-vk-sans"),
7
+ path.join(__dirname, "postcss-custom-properties-fallback"),
7
8
  ],
8
9
  setupFilesAfterEnv: [path.join(__dirname, "src/testing/setup.ts")],
9
10
  collectCoverage: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vkontakte/vkui",
3
- "version": "4.30.0",
3
+ "version": "4.31.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  "@vkontakte/eslint-config": "2.5.0",
48
48
  "@vkontakte/icons": "^1.145.1",
49
49
  "@vkontakte/vk-bridge": "^2.1.3",
50
- "@vkontakte/vkui-tokens": "4.7.0",
50
+ "@vkontakte/vkui-tokens": "4.10.0",
51
51
  "autoprefixer": "^10.4.2",
52
52
  "babel-jest": "^26.6.3",
53
53
  "babel-loader": "^8.2.3",
@@ -86,6 +86,8 @@
86
86
  "postcss-import": "^14.0.2",
87
87
  "postcss-loader": "^6.2.1",
88
88
  "postcss-modules": "^4.3.0",
89
+ "postcss-value-parser": "^4.2.0",
90
+ "postcss-values-parser": "^6.0.2",
89
91
  "prettier": "^2.5.1",
90
92
  "process": "^0.11.10",
91
93
  "prop-types": "^15.6.2",
@@ -0,0 +1,5 @@
1
+ /* stylelint-disable-next-line vkui/atomic */
2
+ :root {
3
+ --color: red;
4
+ --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
5
+ }
@@ -0,0 +1,83 @@
1
+ /* stylelint-disable */
2
+ const fs = require("fs");
3
+ const valueParser = require("postcss-value-parser");
4
+ const { nodeToString, parse: parseValues } = require("postcss-values-parser");
5
+ const { parse } = require("postcss");
6
+
7
+ const isTransformableDecl = (decl) =>
8
+ /(^|[^\w-])var\([\W\w]+\)/.test(decl.value);
9
+
10
+ function parseCustomProperties(importFrom) {
11
+ const customProperties = new Map();
12
+
13
+ parse(fs.readFileSync(importFrom, "utf8")).walkRules((rule) => {
14
+ if (rule.selector === ":root") {
15
+ rule.walkDecls((decl) => {
16
+ if (decl.prop.startsWith("--")) {
17
+ customProperties.set(
18
+ decl.prop,
19
+ parseValues(String(decl.value)).nodes
20
+ );
21
+ }
22
+ });
23
+ }
24
+ });
25
+
26
+ return customProperties;
27
+ }
28
+
29
+ module.exports = (opts) => {
30
+ return {
31
+ postcssPlugin: "custom-properties-fallback",
32
+ prepare() {
33
+ const customProperties = parseCustomProperties(opts.importFrom);
34
+ const shouldTransformableDecl =
35
+ opts.shouldTransformableDecl || isTransformableDecl;
36
+
37
+ return {
38
+ Declaration(node) {
39
+ if (shouldTransformableDecl(node)) {
40
+ const parsed = valueParser(node.value);
41
+
42
+ parsed.walk((node) => {
43
+ if (node.type !== "function" || node.nodes.length !== 1) {
44
+ return;
45
+ }
46
+
47
+ const firstValue = node.nodes[0].value;
48
+
49
+ if (
50
+ !customProperties.has(firstValue) ||
51
+ customProperties.get(firstValue).length === 0
52
+ ) {
53
+ return;
54
+ }
55
+
56
+ const fallback = customProperties.get(firstValue);
57
+
58
+ node.nodes.push(
59
+ {
60
+ type: "divider",
61
+ value: ",",
62
+ },
63
+ {
64
+ type: "word",
65
+ value:
66
+ fallback.length > 1
67
+ ? fallback
68
+ .map((fallbackNode) => nodeToString(fallbackNode))
69
+ .join(" ")
70
+ : fallback,
71
+ }
72
+ );
73
+ });
74
+
75
+ node.value = parsed.toString();
76
+ }
77
+ },
78
+ };
79
+ },
80
+ };
81
+ };
82
+
83
+ module.exports.postcss = true;
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  import { PopoutWrapper } from "../PopoutWrapper/PopoutWrapper";
3
- import { ViewWidth, ViewHeight } from "../../hoc/withAdaptivity";
4
3
  import { IOS } from "../../lib/platform";
5
4
  import { ActionSheetDropdownDesktop } from "./ActionSheetDropdownDesktop";
6
5
  import { ActionSheetDropdown } from "./ActionSheetDropdown";
@@ -9,7 +8,7 @@ import { ActionSheetContext, ItemClickHandler } from "./ActionSheetContext";
9
8
  import { Caption } from "../Typography/Caption/Caption";
10
9
  import { usePlatform } from "../../hooks/usePlatform";
11
10
  import { useTimeout } from "../../hooks/useTimeout";
12
- import { useAdaptivity } from "../../hooks/useAdaptivity";
11
+ import { useAdaptivityIsDesktop } from "../../hooks/useAdaptivity";
13
12
  import { useObjectMemo } from "../../hooks/useObjectMemo";
14
13
  import { warnOnce } from "../../lib/warnOnce";
15
14
  import { SharedDropdownProps, PopupDirection, ToggleRef } from "./types";
@@ -68,10 +67,7 @@ export const ActionSheet: React.FC<ActionSheetProps> = ({
68
67
  );
69
68
  }
70
69
 
71
- const { viewWidth, viewHeight, hasMouse } = useAdaptivity();
72
- const isDesktop =
73
- viewWidth >= ViewWidth.SMALL_TABLET &&
74
- (hasMouse || viewHeight >= ViewHeight.MEDIUM);
70
+ const isDesktop = useAdaptivityIsDesktop();
75
71
 
76
72
  useScrollLock(!isDesktop);
77
73
 
@@ -30,6 +30,8 @@ export interface CalendarProps
30
30
  | "changeYearAriaLabel"
31
31
  | "onNextMonth"
32
32
  | "onPrevMonth"
33
+ | "prevMonthIcon"
34
+ | "nextMonthIcon"
33
35
  >,
34
36
  HasRootRef<HTMLDivElement> {
35
37
  value?: Date;
@@ -83,6 +85,8 @@ export const Calendar: React.FC<CalendarProps> = ({
83
85
  onHeaderChange,
84
86
  onNextMonth,
85
87
  onPrevMonth,
88
+ prevMonthIcon,
89
+ nextMonthIcon,
86
90
  ...props
87
91
  }) => {
88
92
  const {
@@ -173,6 +177,8 @@ export const Calendar: React.FC<CalendarProps> = ({
173
177
  nextMonthAriaLabel={nextMonthAriaLabel}
174
178
  changeMonthAriaLabel={changeMonthAriaLabel}
175
179
  changeYearAriaLabel={changeYearAriaLabel}
180
+ prevMonthIcon={prevMonthIcon}
181
+ nextMonthIcon={nextMonthIcon}
176
182
  />
177
183
  <CalendarDays
178
184
  viewDate={externalViewDate || viewDate}
@@ -21,6 +21,9 @@
21
21
  justify-content: center;
22
22
  align-items: center;
23
23
  padding: 3px;
24
+ }
25
+
26
+ .CalendarHeader__nav-icon--accent {
24
27
  color: var(--vkui--color_icon_accent);
25
28
  }
26
29
 
@@ -29,6 +29,8 @@ export interface CalendarHeaderProps
29
29
  nextMonthAriaLabel?: string;
30
30
  changeMonthAriaLabel?: string;
31
31
  changeYearAriaLabel?: string;
32
+ prevMonthIcon?: React.ReactNode;
33
+ nextMonthIcon?: React.ReactNode;
32
34
  onChange(viewDate: Date): void;
33
35
  /**
34
36
  * Нажатие на кнопку переключения на следующий месяц.
@@ -65,6 +67,20 @@ export const CalendarHeader: React.FC<CalendarHeaderProps> = ({
65
67
  nextMonthAriaLabel = "Следующий месяц",
66
68
  changeMonthAriaLabel = "Изменить месяц",
67
69
  changeYearAriaLabel = "Изменить год",
70
+ prevMonthIcon = (
71
+ <Icon20ChevronLeftOutline
72
+ vkuiClass="CalendarHeader__nav-icon--accent"
73
+ width={30}
74
+ height={30}
75
+ />
76
+ ),
77
+ nextMonthIcon = (
78
+ <Icon20ChevronRightOutline
79
+ vkuiClass="CalendarHeader__nav-icon--accent"
80
+ width={30}
81
+ height={30}
82
+ />
83
+ ),
68
84
  }) => {
69
85
  const locale = React.useContext(LocaleProviderContext);
70
86
  const onMonthsChange = React.useCallback(
@@ -102,7 +118,7 @@ export const CalendarHeader: React.FC<CalendarHeaderProps> = ({
102
118
  subMonths(viewDate, 1)
103
119
  )}`}
104
120
  >
105
- <Icon20ChevronLeftOutline width={30} height={30} />
121
+ {prevMonthIcon}
106
122
  </Tappable>
107
123
  )}
108
124
  <div vkuiClass="CalendarHeader__pickers">
@@ -166,7 +182,7 @@ export const CalendarHeader: React.FC<CalendarHeaderProps> = ({
166
182
  addMonths(viewDate, 1)
167
183
  )}`}
168
184
  >
169
- <Icon20ChevronRightOutline width={30} height={30} />
185
+ {nextMonthIcon}
170
186
  </Tappable>
171
187
  )}
172
188
  </div>
@@ -32,6 +32,8 @@ export interface CalendarRangeProps
32
32
  | "nextMonthAriaLabel"
33
33
  | "changeMonthAriaLabel"
34
34
  | "changeYearAriaLabel"
35
+ | "prevMonthIcon"
36
+ | "nextMonthIcon"
35
37
  >,
36
38
  HasRootRef<HTMLDivElement> {
37
39
  value?: Array<Date | null>;
@@ -70,6 +72,8 @@ export const CalendarRange: React.FC<CalendarRangeProps> = ({
70
72
  changeMonthAriaLabel,
71
73
  changeYearAriaLabel,
72
74
  changeDayAriaLabel = "Изменить день",
75
+ prevMonthIcon,
76
+ nextMonthIcon,
73
77
  ...props
74
78
  }) => {
75
79
  const {
@@ -214,6 +218,7 @@ export const CalendarRange: React.FC<CalendarRangeProps> = ({
214
218
  nextMonthAriaLabel={nextMonthAriaLabel}
215
219
  changeMonthAriaLabel={changeMonthAriaLabel}
216
220
  changeYearAriaLabel={changeYearAriaLabel}
221
+ prevMonthIcon={prevMonthIcon}
217
222
  />
218
223
  <CalendarDays
219
224
  viewDate={viewDate}
@@ -247,6 +252,7 @@ export const CalendarRange: React.FC<CalendarRangeProps> = ({
247
252
  nextMonthAriaLabel={nextMonthAriaLabel}
248
253
  changeMonthAriaLabel={changeMonthAriaLabel}
249
254
  changeYearAriaLabel={changeYearAriaLabel}
255
+ nextMonthIcon={nextMonthIcon}
250
256
  />
251
257
  <CalendarDays
252
258
  viewDate={secondViewDate}
@@ -52,5 +52,5 @@
52
52
  * FormItem
53
53
  */
54
54
  .FormItem > .Cell {
55
- margin: 0 calc(-1 * var(--formitem_padding));
55
+ margin: 0 calc(-1 * var(--vkui--size_base_padding_horizontal--regular));
56
56
  }
@@ -14,7 +14,7 @@
14
14
  .FormItem .CellButton {
15
15
  width: 100%;
16
16
  box-sizing: content-box;
17
- margin: 0 calc(-1 * var(--formitem_padding));
17
+ margin: 0 calc(-1 * var(--vkui--size_base_padding_horizontal--regular));
18
18
  }
19
19
 
20
20
  .CellButton[disabled] {
@@ -5,7 +5,7 @@
5
5
  .FormItem .Checkbox {
6
6
  width: 100%;
7
7
  box-sizing: content-box;
8
- margin: 0 calc(-1 * var(--formitem_padding));
8
+ margin: 0 calc(-1 * var(--vkui--size_base_padding_horizontal--regular));
9
9
  }
10
10
 
11
11
  .Checkbox__input {
@@ -44,6 +44,8 @@ export interface DateInputProps
44
44
  | "onHeaderChange"
45
45
  | "onNextMonth"
46
46
  | "onPrevMonth"
47
+ | "prevMonthIcon"
48
+ | "nextMonthIcon"
47
49
  >,
48
50
  HasRootRef<HTMLDivElement> {
49
51
  calendarPlacement?: Placement;
@@ -126,6 +128,8 @@ export const DateInput: React.FC<DateInputProps> = ({
126
128
  onHeaderChange,
127
129
  onNextMonth,
128
130
  onPrevMonth,
131
+ prevMonthIcon,
132
+ nextMonthIcon,
129
133
  ...props
130
134
  }) => {
131
135
  const daysRef = React.useRef<HTMLSpanElement>(null);
@@ -318,9 +322,11 @@ export const DateInput: React.FC<DateInputProps> = ({
318
322
  showNeighboringMonth={showNeighboringMonth}
319
323
  size={size}
320
324
  viewDate={viewDate}
321
- onHeaderChange={onCalendarChange}
325
+ onHeaderChange={onHeaderChange}
322
326
  onNextMonth={onNextMonth}
323
327
  onPrevMonth={onPrevMonth}
328
+ prevMonthIcon={prevMonthIcon}
329
+ nextMonthIcon={nextMonthIcon}
324
330
  />
325
331
  </Popper>
326
332
  )}
@@ -34,6 +34,8 @@ export interface DateRangeInputProps
34
34
  | "changeMonthAriaLabel"
35
35
  | "changeYearAriaLabel"
36
36
  | "changeDayAriaLabel"
37
+ | "prevMonthIcon"
38
+ | "nextMonthIcon"
37
39
  >,
38
40
  HasRootRef<HTMLDivElement> {
39
41
  calendarPlacement?: Placement;
@@ -118,6 +120,8 @@ export const DateRangeInput: React.FC<DateRangeInputProps> = ({
118
120
  changeEndYearAriaLabel = "Изменить год окончания",
119
121
  clearFieldAriaLabel = "Очистить поле",
120
122
  showCalendarAriaLabel = "Показать календарь",
123
+ prevMonthIcon,
124
+ nextMonthIcon,
121
125
  ...props
122
126
  }) => {
123
127
  const daysStartRef = React.useRef<HTMLSpanElement>(null);
@@ -342,6 +346,8 @@ export const DateRangeInput: React.FC<DateRangeInputProps> = ({
342
346
  changeMonthAriaLabel={changeMonthAriaLabel}
343
347
  changeYearAriaLabel={changeYearAriaLabel}
344
348
  changeDayAriaLabel={changeDayAriaLabel}
349
+ prevMonthIcon={prevMonthIcon}
350
+ nextMonthIcon={nextMonthIcon}
345
351
  />
346
352
  </Popper>
347
353
  )}
@@ -1,6 +1,16 @@
1
1
  .FixedLayout {
2
2
  position: fixed;
3
3
  box-sizing: border-box;
4
+ /**
5
+ * ⚠️ WARNING ⚠️
6
+ * `left: auto` решает следующие задачи:
7
+ * 1. При фиксированной ширине компонента позиционирует компонент по центру.
8
+ * 2. При использовании `SplitLayout` позиционирует компонент с права от `<SplitCol fixed />`.
9
+ *
10
+ * Подробности можно почитать здесь https://github.com/VKCOM/VKUI/pull/2472
11
+ *
12
+ * Единственное, есть проблема при срабатывании insets в landscape ориентации экрана (https://github.com/VKCOM/VKUI/issues/2422).
13
+ */
4
14
  left: auto;
5
15
  z-index: 3;
6
16
  padding-left: var(--safe-area-inset-left);
@@ -14,12 +24,10 @@
14
24
  .FixedLayout--top {
15
25
  width: 100%;
16
26
  top: 0;
17
- left: 0;
18
27
  }
19
28
 
20
29
  .FixedLayout--bottom {
21
30
  width: 100%;
22
- left: 0;
23
31
  bottom: 0;
24
32
  padding-bottom: var(--safe-area-inset-bottom);
25
33
  }
@@ -51,6 +51,7 @@
51
51
 
52
52
  /**
53
53
  * iOS
54
+ * TODO: v5 удалить
54
55
  */
55
56
  .FormItem--ios {
56
57
  --formitem_padding: 12px;
@@ -1,6 +1,6 @@
1
1
  .FormLayoutGroup--horizontal {
2
2
  display: flex;
3
- padding: 12px var(--formitem_padding);
3
+ padding: 12px var(--vkui--size_base_padding_horizontal--regular);
4
4
  }
5
5
 
6
6
  .FormLayoutGroup__removable {
@@ -11,6 +11,7 @@
11
11
 
12
12
  /**
13
13
  * iOS
14
+ * TODO: v5 удалить
14
15
  */
15
16
  .FormLayoutGroup--ios {
16
17
  --formitem_padding: 12px;
@@ -3,11 +3,7 @@ import { getClassName } from "../../helpers/getClassName";
3
3
  import { classNames } from "../../lib/classNames";
4
4
  import { withPlatform } from "../../hoc/withPlatform";
5
5
  import { HasPlatform } from "../../types";
6
- import {
7
- withAdaptivity,
8
- ViewHeight,
9
- ViewWidth,
10
- } from "../../hoc/withAdaptivity";
6
+ import { withAdaptivity } from "../../hoc/withAdaptivity";
11
7
  import ModalRootContext, {
12
8
  useModalRegistry,
13
9
  } from "../ModalRoot/ModalRootContext";
@@ -22,6 +18,7 @@ import {
22
18
  AdaptivityContextInterface,
23
19
  AdaptivityProps,
24
20
  } from "../AdaptivityProvider/AdaptivityContext";
21
+ import { useAdaptivityIsDesktop } from "../../hooks/useAdaptivity";
25
22
  import "./ModalCard.css";
26
23
 
27
24
  export interface ModalCardProps
@@ -51,9 +48,7 @@ const ModalCard: React.FC<ModalCardProps & AdaptivityContextInterface> = (
51
48
  ...restProps
52
49
  } = props;
53
50
 
54
- const isDesktop =
55
- viewWidth >= ViewWidth.SMALL_TABLET &&
56
- (hasMouse || viewHeight >= ViewHeight.MEDIUM);
51
+ const isDesktop = useAdaptivityIsDesktop();
57
52
 
58
53
  const modalContext = React.useContext(ModalRootContext);
59
54
  const { refs } = useModalRegistry(getNavId(props, warn), ModalType.CARD);
@@ -5,18 +5,15 @@ import Headline from "../Typography/Headline/Headline";
5
5
  import { classNames } from "../../lib/classNames";
6
6
  import { getClassName } from "../../helpers/getClassName";
7
7
  import { usePlatform } from "../../hooks/usePlatform";
8
- import {
9
- ViewHeight,
10
- ViewWidth,
11
- withAdaptivity,
12
- } from "../../hoc/withAdaptivity";
8
+ import { ViewWidth, withAdaptivity } from "../../hoc/withAdaptivity";
13
9
  import { HasRootRef } from "../../types";
14
10
  import { PanelHeaderButton } from "../PanelHeaderButton/PanelHeaderButton";
15
- import { ANDROID, IOS } from "../../lib/platform";
11
+ import { ANDROID, IOS, Platform } from "../../lib/platform";
16
12
  import ModalDismissButton from "../ModalDismissButton/ModalDismissButton";
17
13
  import { Icon24Dismiss } from "@vkontakte/icons";
18
14
  import { useKeyboard } from "../../hooks/useKeyboard";
19
15
  import { AdaptivityContextInterface } from "../AdaptivityProvider/AdaptivityContext";
16
+ import { useAdaptivityIsDesktop } from "../../hooks/useAdaptivity";
20
17
  import "./ModalCardBase.css";
21
18
 
22
19
  export interface ModalCardBaseProps
@@ -77,12 +74,11 @@ export const ModalCardBase = withAdaptivity<
77
74
  ...restProps
78
75
  }) => {
79
76
  const platform = usePlatform();
80
- const isDesktop =
81
- viewWidth >= ViewWidth.SMALL_TABLET &&
82
- (hasMouse || viewHeight >= ViewHeight.MEDIUM);
77
+ const isDesktop = useAdaptivityIsDesktop();
83
78
  const isSoftwareKeyboardOpened = useKeyboard().isOpened;
84
79
 
85
- const canShowCloseBtn = viewWidth >= ViewWidth.SMALL_TABLET;
80
+ const canShowCloseBtn =
81
+ viewWidth >= ViewWidth.SMALL_TABLET || platform === Platform.VKCOM;
86
82
  const canShowCloseBtnIos = platform === IOS && !canShowCloseBtn;
87
83
 
88
84
  return (
@@ -7,11 +7,7 @@ import {
7
7
  } from "../ModalRoot/ModalRootContext";
8
8
  import { usePlatform } from "../../hooks/usePlatform";
9
9
  import { useOrientationChange } from "../../hooks/useOrientationChange";
10
- import {
11
- withAdaptivity,
12
- ViewHeight,
13
- ViewWidth,
14
- } from "../../hoc/withAdaptivity";
10
+ import { withAdaptivity, ViewWidth } from "../../hoc/withAdaptivity";
15
11
  import {
16
12
  AdaptivityContextInterface,
17
13
  AdaptivityProps,
@@ -21,6 +17,8 @@ import { multiRef } from "../../lib/utils";
21
17
  import { ModalType } from "../ModalRoot/types";
22
18
  import { getNavId, NavIdProps } from "../../lib/getNavId";
23
19
  import { warnOnce } from "../../lib/warnOnce";
20
+ import { Platform } from "../../lib/platform";
21
+ import { useAdaptivityIsDesktop } from "../../hooks/useAdaptivity";
24
22
  import "./ModalPage.css";
25
23
 
26
24
  export interface ModalPageProps
@@ -91,10 +89,9 @@ const ModalPage: React.FC<ModalPageProps & AdaptivityContextInterface> = (
91
89
  updateModalHeight,
92
90
  ]);
93
91
 
94
- const isDesktop =
95
- viewWidth >= ViewWidth.SMALL_TABLET &&
96
- (hasMouse || viewHeight >= ViewHeight.MEDIUM);
97
- const canShowCloseBtn = viewWidth >= ViewWidth.SMALL_TABLET;
92
+ const isDesktop = useAdaptivityIsDesktop();
93
+ const canShowCloseBtn =
94
+ viewWidth >= ViewWidth.SMALL_TABLET || platform === Platform.VKCOM;
98
95
 
99
96
  const modalContext = React.useContext(ModalRootContext);
100
97
  const { refs } = useModalRegistry(getNavId(props, warn), ModalType.PAGE);
@@ -4,10 +4,9 @@ import { HasRef } from "../../types";
4
4
  import { VKCOM } from "../../lib/platform";
5
5
  import PanelHeader, { PanelHeaderProps } from "../PanelHeader/PanelHeader";
6
6
  import Separator from "../Separator/Separator";
7
- import { useAdaptivity } from "../../hooks/useAdaptivity";
7
+ import { useAdaptivityIsDesktop } from "../../hooks/useAdaptivity";
8
8
  import { classNames } from "../../lib/classNames";
9
9
  import { getClassName } from "../../helpers/getClassName";
10
- import { ViewHeight, ViewWidth } from "../AdaptivityProvider/AdaptivityContext";
11
10
  import "./ModalPageHeader.css";
12
11
 
13
12
  export interface ModalPageHeaderProps
@@ -22,11 +21,8 @@ const ModalPageHeader: React.FunctionComponent<ModalPageHeaderProps> = ({
22
21
  ...restProps
23
22
  }: ModalPageHeaderProps) => {
24
23
  const platform = usePlatform();
25
- const { viewWidth, viewHeight, hasMouse } = useAdaptivity();
26
24
  const hasSeparator = separator && platform === VKCOM;
27
- const isDesktop =
28
- viewWidth >= ViewWidth.SMALL_TABLET &&
29
- (hasMouse || viewHeight >= ViewHeight.MEDIUM);
25
+ const isDesktop = useAdaptivityIsDesktop();
30
26
 
31
27
  return (
32
28
  <div
@@ -1,9 +1,5 @@
1
1
  import * as React from "react";
2
- import {
3
- withAdaptivity,
4
- ViewHeight,
5
- ViewWidth,
6
- } from "../../hoc/withAdaptivity";
2
+ import { withAdaptivity } from "../../hoc/withAdaptivity";
7
3
  import { ModalRootTouch } from "./ModalRoot";
8
4
  import { ModalRootDesktop } from "./ModalRootDesktop";
9
5
  import {
@@ -11,6 +7,7 @@ import {
11
7
  AdaptivityProps,
12
8
  } from "../AdaptivityProvider/AdaptivityContext";
13
9
  import { useScrollLock } from "../AppRoot/ScrollContext";
10
+ import { useAdaptivityIsDesktop } from "../../hooks/useAdaptivity";
14
11
 
15
12
  export interface ModalRootProps extends AdaptivityProps {
16
13
  activeModal?: string | null;
@@ -39,10 +36,7 @@ export interface ModalRootProps extends AdaptivityProps {
39
36
  const ModalRootComponent: React.FC<
40
37
  ModalRootProps & AdaptivityContextInterface
41
38
  > = (props) => {
42
- const { viewWidth, viewHeight, hasMouse } = props;
43
- const isDesktop =
44
- viewWidth >= ViewWidth.SMALL_TABLET &&
45
- (hasMouse || viewHeight >= ViewHeight.MEDIUM);
39
+ const isDesktop = useAdaptivityIsDesktop();
46
40
 
47
41
  useScrollLock(!!props.activeModal);
48
42
 
@@ -39,7 +39,7 @@ class App extends Component {
39
39
  либо идентификатор предыдущей модалки, либо `null` для скрытия.
40
40
  Каждой конкретной `ModalPage` или `ModalCard` можно передать свой обработчик `onClose`, если нужно переопределить поведение.
41
41
 
42
- ```jsx { "props": { "layout": false, "adaptivity": true } }
42
+ ```jsx { "props": { "layout": false, "adaptivity": true, "webviewType": true } }
43
43
  const MODAL_PAGE_FILTERS = "filters";
44
44
  const MODAL_PAGE_COUNTRIES = "countries";
45
45
  const MODAL_PAGE_STORY_FEEDBACK = "story-feedback";
@@ -44,25 +44,29 @@ const PanelHeaderIn: React.FC<PanelHeaderProps> = ({
44
44
  children,
45
45
  left,
46
46
  right,
47
+ separator,
47
48
  }) => {
48
49
  const { webviewType } = React.useContext(ConfigProviderContext);
49
50
  const { isInsideModal } = React.useContext(ModalRootContext);
50
51
  const platform = usePlatform();
51
52
 
52
53
  return (
53
- <TooltipContainer fixed vkuiClass="PanelHeader__in">
54
- <div vkuiClass="PanelHeader__left">{left}</div>
55
- <div vkuiClass="PanelHeader__content">
56
- {platform === VKCOM ? (
57
- <Text weight="medium">{children}</Text>
58
- ) : (
59
- <span vkuiClass="PanelHeader__content-in">{children}</span>
60
- )}
61
- </div>
62
- <div vkuiClass="PanelHeader__right">
63
- {(webviewType === WebviewType.INTERNAL || isInsideModal) && right}
64
- </div>
65
- </TooltipContainer>
54
+ <React.Fragment>
55
+ <TooltipContainer fixed vkuiClass="PanelHeader__in">
56
+ <div vkuiClass="PanelHeader__left">{left}</div>
57
+ <div vkuiClass="PanelHeader__content">
58
+ {platform === VKCOM ? (
59
+ <Text weight="medium">{children}</Text>
60
+ ) : (
61
+ <span vkuiClass="PanelHeader__content-in">{children}</span>
62
+ )}
63
+ </div>
64
+ <div vkuiClass="PanelHeader__right">
65
+ {(webviewType === WebviewType.INTERNAL || isInsideModal) && right}
66
+ </div>
67
+ </TooltipContainer>
68
+ {separator && platform === VKCOM && <Separator wide />}
69
+ </React.Fragment>
66
70
  );
67
71
  };
68
72
 
@@ -120,11 +124,8 @@ const PanelHeader: React.FC<PanelHeaderProps> = (props: PanelHeaderProps) => {
120
124
  ) : (
121
125
  <PanelHeaderIn {...props} />
122
126
  )}
123
- {separator && visor && (
124
- <Separator
125
- expanded={sizeX === SizeType.REGULAR && platform !== VKCOM}
126
- wide={platform === VKCOM}
127
- />
127
+ {separator && visor && platform !== VKCOM && (
128
+ <Separator expanded={sizeX === SizeType.REGULAR} />
128
129
  )}
129
130
  </div>
130
131
  );
@@ -11,9 +11,9 @@
11
11
 
12
12
  > **Важно**
13
13
  >
14
- > Правая часть шапки будет скрыта, если в [`ConfigProvider`](#/ConfigProvider) передан `webviewType={WebviewType.VKAPPS}`.
14
+ > Правая часть шапки скрыта по умолчанию, если требуется показать её, передайте в [`ConfigProvider`](#/ConfigProvider) свойство `webviewType={WebviewType.INTERNAL}`.
15
15
 
16
- ```jsx
16
+ ```jsx { "props": { "webviewType": true } }
17
17
  class Example extends React.Component {
18
18
  constructor(props) {
19
19
  super(props);