@vkontakte/vkui 4.27.1 → 4.27.2
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 +47 -27
- package/.cache/ts/src/components/ConfigProvider/ConfigProviderContext.d.ts +0 -7
- package/.cache/ts/src/components/Typography/Subhead/Subhead.d.ts +4 -1
- package/.cache/ts/src/tokenized/index.d.ts +4 -0
- package/CSS_GUIDE.md +145 -0
- package/dist/cjs/components/ActionSheetItem/ActionSheetItem.js +0 -1
- package/dist/cjs/components/ActionSheetItem/ActionSheetItem.js.map +1 -1
- package/dist/cjs/components/Banner/Banner.js +1 -3
- package/dist/cjs/components/Banner/Banner.js.map +1 -1
- package/dist/cjs/components/Button/Button.js +3 -3
- package/dist/cjs/components/Button/Button.js.map +1 -1
- package/dist/cjs/components/ConfigProvider/ConfigProvider.js +33 -20
- package/dist/cjs/components/ConfigProvider/ConfigProvider.js.map +1 -1
- package/dist/cjs/components/ConfigProvider/ConfigProviderContext.d.ts +0 -7
- package/dist/cjs/components/ConfigProvider/ConfigProviderContext.js +3 -5
- package/dist/cjs/components/ConfigProvider/ConfigProviderContext.js.map +1 -1
- package/dist/cjs/components/FormItem/FormItem.js +0 -1
- package/dist/cjs/components/FormItem/FormItem.js.map +1 -1
- package/dist/cjs/components/Header/Header.js +2 -6
- package/dist/cjs/components/Header/Header.js.map +1 -1
- package/dist/cjs/components/HorizontalCell/HorizontalCell.js +1 -3
- package/dist/cjs/components/HorizontalCell/HorizontalCell.js.map +1 -1
- package/dist/cjs/components/InfoRow/InfoRow.js +1 -2
- package/dist/cjs/components/InfoRow/InfoRow.js.map +1 -1
- package/dist/cjs/components/Removable/Removable.js +8 -4
- package/dist/cjs/components/Removable/Removable.js.map +1 -1
- package/dist/cjs/components/RichCell/RichCell.js +0 -1
- package/dist/cjs/components/RichCell/RichCell.js.map +1 -1
- package/dist/cjs/components/SimpleCell/SimpleCell.js +0 -1
- package/dist/cjs/components/SimpleCell/SimpleCell.js.map +1 -1
- package/dist/cjs/components/SubnavigationButton/SubnavigationButton.js +1 -3
- package/dist/cjs/components/SubnavigationButton/SubnavigationButton.js.map +1 -1
- package/dist/cjs/components/TextTooltip/TextTooltip.js +1 -2
- package/dist/cjs/components/TextTooltip/TextTooltip.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +1 -2
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/Typography/Subhead/Subhead.d.ts +4 -1
- package/dist/cjs/components/Typography/Subhead/Subhead.js +15 -8
- package/dist/cjs/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/cjs/components/Typography/Title/Title.js +1 -1
- package/dist/cjs/components/Typography/Title/Title.js.map +1 -1
- package/dist/cjs/components/UsersStack/UsersStack.js +0 -1
- package/dist/cjs/components/UsersStack/UsersStack.js.map +1 -1
- package/dist/cjs/tokenized/index.d.ts +4 -0
- package/dist/cjs/tokenized/index.js +16 -0
- package/dist/cjs/tokenized/index.js.map +1 -1
- package/dist/components/ActionSheetItem/ActionSheetItem.js +0 -1
- package/dist/components/ActionSheetItem/ActionSheetItem.js.map +1 -1
- package/dist/components/Banner/Banner.js +1 -3
- package/dist/components/Banner/Banner.js.map +1 -1
- package/dist/components/Button/Button.js +3 -3
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/ConfigProvider/ConfigProvider.js +30 -19
- package/dist/components/ConfigProvider/ConfigProvider.js.map +1 -1
- package/dist/components/ConfigProvider/ConfigProviderContext.d.ts +0 -7
- package/dist/components/ConfigProvider/ConfigProviderContext.js +2 -3
- package/dist/components/ConfigProvider/ConfigProviderContext.js.map +1 -1
- package/dist/components/FormItem/FormItem.js +0 -1
- package/dist/components/FormItem/FormItem.js.map +1 -1
- package/dist/components/Header/Header.js +2 -6
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/HorizontalCell/HorizontalCell.js +1 -3
- package/dist/components/HorizontalCell/HorizontalCell.js.map +1 -1
- package/dist/components/InfoRow/InfoRow.js +1 -2
- package/dist/components/InfoRow/InfoRow.js.map +1 -1
- package/dist/components/Removable/Removable.js +8 -4
- package/dist/components/Removable/Removable.js.map +1 -1
- package/dist/components/RichCell/RichCell.js +0 -1
- package/dist/components/RichCell/RichCell.js.map +1 -1
- package/dist/components/SimpleCell/SimpleCell.js +0 -1
- package/dist/components/SimpleCell/SimpleCell.js.map +1 -1
- package/dist/components/SubnavigationButton/SubnavigationButton.js +1 -3
- package/dist/components/SubnavigationButton/SubnavigationButton.js.map +1 -1
- package/dist/components/TextTooltip/TextTooltip.js +1 -2
- package/dist/components/TextTooltip/TextTooltip.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Typography/Subhead/Subhead.d.ts +4 -1
- package/dist/components/Typography/Subhead/Subhead.js +13 -7
- package/dist/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/components/Typography/Title/Title.js +1 -1
- package/dist/components/Typography/Title/Title.js.map +1 -1
- package/dist/components/UsersStack/UsersStack.js +0 -1
- package/dist/components/UsersStack/UsersStack.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/ActionSheetItem/ActionSheetItem.js +0 -1
- package/dist/cssm/components/ActionSheetItem/ActionSheetItem.js.map +1 -1
- package/dist/cssm/components/Banner/Banner.js +1 -3
- package/dist/cssm/components/Banner/Banner.js.map +1 -1
- package/dist/cssm/components/Button/Button.js +3 -3
- package/dist/cssm/components/Button/Button.js.map +1 -1
- package/dist/cssm/components/ConfigProvider/ConfigProvider.js +30 -19
- package/dist/cssm/components/ConfigProvider/ConfigProvider.js.map +1 -1
- package/dist/cssm/components/ConfigProvider/ConfigProviderContext.d.ts +0 -7
- package/dist/cssm/components/ConfigProvider/ConfigProviderContext.js +2 -3
- package/dist/cssm/components/ConfigProvider/ConfigProviderContext.js.map +1 -1
- package/dist/cssm/components/FormItem/FormItem.js +0 -1
- package/dist/cssm/components/FormItem/FormItem.js.map +1 -1
- package/dist/cssm/components/Header/Header.js +2 -6
- package/dist/cssm/components/Header/Header.js.map +1 -1
- package/dist/cssm/components/HorizontalCell/HorizontalCell.js +1 -3
- package/dist/cssm/components/HorizontalCell/HorizontalCell.js.map +1 -1
- package/dist/cssm/components/InfoRow/InfoRow.js +1 -2
- package/dist/cssm/components/InfoRow/InfoRow.js.map +1 -1
- package/dist/cssm/components/Removable/Removable.js +8 -4
- package/dist/cssm/components/Removable/Removable.js.map +1 -1
- package/dist/cssm/components/RichCell/RichCell.js +0 -1
- package/dist/cssm/components/RichCell/RichCell.js.map +1 -1
- package/dist/cssm/components/SimpleCell/SimpleCell.js +0 -1
- package/dist/cssm/components/SimpleCell/SimpleCell.js.map +1 -1
- package/dist/cssm/components/SubnavigationButton/SubnavigationButton.js +1 -3
- package/dist/cssm/components/SubnavigationButton/SubnavigationButton.js.map +1 -1
- package/dist/cssm/components/TextTooltip/TextTooltip.js +1 -2
- package/dist/cssm/components/TextTooltip/TextTooltip.js.map +1 -1
- package/dist/cssm/components/Tooltip/Tooltip.js +1 -2
- package/dist/cssm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cssm/components/Typography/Subhead/Subhead.css +1 -1
- package/dist/cssm/components/Typography/Subhead/Subhead.d.ts +4 -1
- package/dist/cssm/components/Typography/Subhead/Subhead.js +13 -7
- package/dist/cssm/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/cssm/components/Typography/Title/Title.js +1 -1
- package/dist/cssm/components/Typography/Title/Title.js.map +1 -1
- package/dist/cssm/components/UsersStack/UsersStack.js +0 -1
- package/dist/cssm/components/UsersStack/UsersStack.js.map +1 -1
- package/dist/cssm/styles/components.css +1 -1
- package/dist/cssm/tokenized/index.d.ts +4 -0
- package/dist/cssm/tokenized/index.js +2 -0
- package/dist/cssm/tokenized/index.js.map +1 -1
- package/dist/tokenized/index.d.ts +4 -0
- package/dist/tokenized/index.js +2 -0
- package/dist/tokenized/index.js.map +1 -1
- package/dist/vkui.css +1 -1
- package/dist/vkui.css.map +1 -1
- package/package.json +1 -1
- package/src/components/ActionSheetItem/ActionSheetItem.tsx +1 -3
- package/src/components/Banner/Banner.tsx +1 -1
- package/src/components/Button/Button.tsx +3 -6
- package/src/components/ConfigProvider/ConfigProvider.tsx +25 -15
- package/src/components/ConfigProvider/ConfigProviderContext.tsx +9 -13
- package/src/components/FormItem/FormItem.tsx +1 -5
- package/src/components/Header/Header.tsx +2 -2
- package/src/components/HorizontalCell/HorizontalCell.tsx +1 -3
- package/src/components/InfoRow/InfoRow.tsx +1 -1
- package/src/components/Removable/Removable.tsx +9 -7
- package/src/components/RichCell/RichCell.tsx +1 -5
- package/src/components/SimpleCell/SimpleCell.tsx +1 -5
- package/src/components/SubnavigationButton/SubnavigationButton.tsx +1 -1
- package/src/components/TextTooltip/TextTooltip.tsx +2 -6
- package/src/components/Tooltip/Tooltip.tsx +2 -6
- package/src/components/Typography/Subhead/Readme.md +18 -24
- package/src/components/Typography/Subhead/Subhead.css +22 -7
- package/src/components/Typography/Subhead/Subhead.tsx +23 -7
- package/src/components/Typography/Title/Title.tsx +1 -1
- package/src/components/UsersStack/Readme.md +1 -1
- package/src/components/UsersStack/UsersStack.tsx +1 -1
- package/src/tokenized/index.ts +6 -0
package/package.json
CHANGED
|
@@ -158,9 +158,7 @@ const ActionSheetItemComponent: React.FC<ActionSheetItemProps> = ({
|
|
|
158
158
|
{subtitle}
|
|
159
159
|
</Caption>
|
|
160
160
|
) : (
|
|
161
|
-
<Subhead
|
|
162
|
-
{subtitle}
|
|
163
|
-
</Subhead>
|
|
161
|
+
<Subhead vkuiClass="ActionSheetItem__subtitle">{subtitle}</Subhead>
|
|
164
162
|
))}
|
|
165
163
|
</div>
|
|
166
164
|
{selectable && (
|
|
@@ -69,10 +69,7 @@ const ButtonTypography: React.FC<ButtonTypographyProps> = (
|
|
|
69
69
|
case "m":
|
|
70
70
|
if (isCompact) {
|
|
71
71
|
return (
|
|
72
|
-
<Subhead
|
|
73
|
-
weight={platform === VKCOM ? "regular" : "medium"}
|
|
74
|
-
{...restProps}
|
|
75
|
-
/>
|
|
72
|
+
<Subhead weight={platform === VKCOM ? "3" : "2"} {...restProps} />
|
|
76
73
|
);
|
|
77
74
|
}
|
|
78
75
|
|
|
@@ -80,7 +77,7 @@ const ButtonTypography: React.FC<ButtonTypographyProps> = (
|
|
|
80
77
|
case "s":
|
|
81
78
|
default:
|
|
82
79
|
if (platform === IOS) {
|
|
83
|
-
return <Subhead weight="
|
|
80
|
+
return <Subhead weight="2" {...restProps} />;
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
if (platform === VKCOM) {
|
|
@@ -91,7 +88,7 @@ const ButtonTypography: React.FC<ButtonTypographyProps> = (
|
|
|
91
88
|
return <Caption level="1" weight="medium" {...restProps} />;
|
|
92
89
|
}
|
|
93
90
|
|
|
94
|
-
return <Subhead weight="
|
|
91
|
+
return <Subhead weight="2" {...restProps} />;
|
|
95
92
|
}
|
|
96
93
|
};
|
|
97
94
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { AppearanceType } from "@vkontakte/vk-bridge";
|
|
2
|
+
import vkBridge, { AppearanceType } from "@vkontakte/vk-bridge";
|
|
3
3
|
import { canUseDOM, useDOM } from "../../lib/dom";
|
|
4
4
|
import {
|
|
5
5
|
ConfigProviderContext,
|
|
6
6
|
ConfigProviderContextInterface,
|
|
7
|
-
|
|
7
|
+
WebviewType,
|
|
8
8
|
} from "./ConfigProviderContext";
|
|
9
9
|
import { useIsomorphicLayoutEffect } from "../../lib/useIsomorphicLayoutEffect";
|
|
10
10
|
import { useObjectMemo } from "../../hooks/useObjectMemo";
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
AppearanceProvider,
|
|
20
20
|
generateVKUITokensClassName,
|
|
21
21
|
} from "../AppearanceProvider/AppearanceProvider";
|
|
22
|
+
import { platform as resolvePlatform } from "../../lib/platform";
|
|
22
23
|
|
|
23
24
|
export interface ConfigProviderProps
|
|
24
25
|
extends Partial<ConfigProviderContextInterface> {
|
|
@@ -64,20 +65,24 @@ const deriveAppearance = (scheme: Scheme | undefined): AppearanceType =>
|
|
|
64
65
|
|
|
65
66
|
const ConfigProvider: React.FC<ConfigProviderProps> = ({
|
|
66
67
|
children,
|
|
67
|
-
|
|
68
|
+
webviewType = WebviewType.VKAPPS,
|
|
69
|
+
isWebView = vkBridge.isWebView(),
|
|
70
|
+
transitionMotionEnabled = true,
|
|
71
|
+
platform = resolvePlatform(),
|
|
72
|
+
hasNewTokens = false,
|
|
73
|
+
appearance,
|
|
74
|
+
scheme,
|
|
68
75
|
}) => {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
platform: platform,
|
|
74
|
-
appearance: appearance,
|
|
76
|
+
const normalizedScheme = normalizeScheme({
|
|
77
|
+
scheme,
|
|
78
|
+
platform,
|
|
79
|
+
appearance,
|
|
75
80
|
});
|
|
76
81
|
const { document } = useDOM();
|
|
77
82
|
const target = document?.body;
|
|
78
83
|
|
|
79
84
|
useIsomorphicLayoutEffect(() => {
|
|
80
|
-
if (
|
|
85
|
+
if (normalizedScheme === "inherit") {
|
|
81
86
|
return noop;
|
|
82
87
|
}
|
|
83
88
|
if (
|
|
@@ -88,11 +93,11 @@ const ConfigProvider: React.FC<ConfigProviderProps> = ({
|
|
|
88
93
|
'<body scheme> was set before VKUI mount - did you forget scheme="inherit"?'
|
|
89
94
|
);
|
|
90
95
|
}
|
|
91
|
-
target?.setAttribute("scheme",
|
|
96
|
+
target?.setAttribute("scheme", normalizedScheme);
|
|
92
97
|
return () => target?.removeAttribute("scheme");
|
|
93
|
-
}, [
|
|
98
|
+
}, [normalizedScheme]);
|
|
94
99
|
|
|
95
|
-
const realScheme = useSchemeDetector(target,
|
|
100
|
+
const realScheme = useSchemeDetector(target, normalizedScheme);
|
|
96
101
|
const derivedAppearance = deriveAppearance(realScheme);
|
|
97
102
|
|
|
98
103
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -109,8 +114,13 @@ const ConfigProvider: React.FC<ConfigProviderProps> = ({
|
|
|
109
114
|
}, [platform, derivedAppearance]);
|
|
110
115
|
|
|
111
116
|
const configContext = useObjectMemo({
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
webviewType,
|
|
118
|
+
isWebView,
|
|
119
|
+
transitionMotionEnabled,
|
|
120
|
+
hasNewTokens,
|
|
121
|
+
platform,
|
|
122
|
+
scheme,
|
|
123
|
+
appearance: appearance || derivedAppearance,
|
|
114
124
|
});
|
|
115
125
|
|
|
116
126
|
return (
|
|
@@ -36,17 +36,13 @@ export interface ConfigProviderContextInterface {
|
|
|
36
36
|
hasNewTokens: boolean;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export const defaultConfigProviderProps = {
|
|
40
|
-
webviewType: WebviewType.VKAPPS,
|
|
41
|
-
isWebView: vkBridge.isWebView(),
|
|
42
|
-
transitionMotionEnabled: true,
|
|
43
|
-
platform: platform(),
|
|
44
|
-
hasNewTokens: false,
|
|
45
|
-
// appearance is auto-detected by default
|
|
46
|
-
// appearance: Appearance.LIGHT,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
39
|
export const ConfigProviderContext =
|
|
50
|
-
React.createContext<ConfigProviderContextInterface>(
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
React.createContext<ConfigProviderContextInterface>({
|
|
41
|
+
webviewType: WebviewType.VKAPPS,
|
|
42
|
+
isWebView: vkBridge.isWebView(),
|
|
43
|
+
transitionMotionEnabled: true,
|
|
44
|
+
platform: platform(),
|
|
45
|
+
hasNewTokens: false,
|
|
46
|
+
// appearance is auto-detected by default
|
|
47
|
+
// appearance: Appearance.LIGHT,
|
|
48
|
+
});
|
|
@@ -43,11 +43,7 @@ export const FormItem: React.FC<FormItemProps> = ({
|
|
|
43
43
|
|
|
44
44
|
const wrappedChildren = (
|
|
45
45
|
<React.Fragment>
|
|
46
|
-
{hasReactNode(top) &&
|
|
47
|
-
<Subhead weight="regular" vkuiClass="FormItem__top">
|
|
48
|
-
{top}
|
|
49
|
-
</Subhead>
|
|
50
|
-
)}
|
|
46
|
+
{hasReactNode(top) && <Subhead vkuiClass="FormItem__top">{top}</Subhead>}
|
|
51
47
|
{children}
|
|
52
48
|
{hasReactNode(bottom) && (
|
|
53
49
|
<Caption level="1" weight="regular" vkuiClass="FormItem__bottom">
|
|
@@ -75,7 +75,7 @@ const HeaderAside: React.FC<HeaderAsideProps> = ({
|
|
|
75
75
|
...restProps
|
|
76
76
|
}) => {
|
|
77
77
|
return platform === Platform.VKCOM ? (
|
|
78
|
-
<Subhead
|
|
78
|
+
<Subhead {...restProps} />
|
|
79
79
|
) : (
|
|
80
80
|
<Text weight="regular" {...restProps} />
|
|
81
81
|
);
|
|
@@ -89,7 +89,7 @@ const HeaderSubtitle: React.FC<HeaderSubtitleProps> = ({
|
|
|
89
89
|
...restProps
|
|
90
90
|
}) => {
|
|
91
91
|
return mode === "secondary" ? (
|
|
92
|
-
<Subhead
|
|
92
|
+
<Subhead {...restProps} />
|
|
93
93
|
) : (
|
|
94
94
|
<Caption weight="regular" level="1" {...restProps} />
|
|
95
95
|
);
|
|
@@ -24,7 +24,7 @@ const InfoRow: React.FunctionComponent<InfoRowProps> = ({
|
|
|
24
24
|
weight="regular"
|
|
25
25
|
>
|
|
26
26
|
{hasReactNode(header) && (
|
|
27
|
-
<Subhead Component="span" vkuiClass="InfoRow__header"
|
|
27
|
+
<Subhead Component="span" vkuiClass="InfoRow__header">
|
|
28
28
|
{header}
|
|
29
29
|
</Subhead>
|
|
30
30
|
)}
|
|
@@ -25,14 +25,12 @@ export interface RemovableProps {
|
|
|
25
25
|
onRemove?: (e: React.MouseEvent, rootEl?: HTMLElement) => void;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
interface RemovableIosOwnProps
|
|
29
|
-
extends Pick<RemovableProps, "removePlaceholder"> {
|
|
30
|
-
onRemoveClick?: (e: React.MouseEvent, rootEl?: HTMLElement) => void;
|
|
28
|
+
interface RemovableIosOwnProps extends RemovableProps {
|
|
31
29
|
removePlaceholderString?: string;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
const RemovableIos: React.FC<RemovableIosOwnProps> = ({
|
|
35
|
-
|
|
33
|
+
onRemove,
|
|
36
34
|
removePlaceholder,
|
|
37
35
|
removePlaceholderString,
|
|
38
36
|
children,
|
|
@@ -40,6 +38,7 @@ const RemovableIos: React.FC<RemovableIosOwnProps> = ({
|
|
|
40
38
|
const { window } = useDOM();
|
|
41
39
|
|
|
42
40
|
const removeButtonRef = React.useRef<HTMLElement>(null);
|
|
41
|
+
const disabledRef = React.useRef(true);
|
|
43
42
|
const [removeOffset, updateRemoveOffset] = React.useState(0);
|
|
44
43
|
|
|
45
44
|
useGlobalEventListener(
|
|
@@ -56,6 +55,8 @@ const RemovableIos: React.FC<RemovableIosOwnProps> = ({
|
|
|
56
55
|
const onRemoveTransitionEnd = () => {
|
|
57
56
|
if (removeOffset > 0) {
|
|
58
57
|
removeButtonRef?.current?.focus();
|
|
58
|
+
} else {
|
|
59
|
+
disabledRef.current = true;
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
62
|
|
|
@@ -65,6 +66,7 @@ const RemovableIos: React.FC<RemovableIosOwnProps> = ({
|
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
const { offsetWidth } = removeButtonRef.current;
|
|
69
|
+
disabledRef.current = false;
|
|
68
70
|
updateRemoveOffset(offsetWidth);
|
|
69
71
|
};
|
|
70
72
|
|
|
@@ -92,10 +94,10 @@ const RemovableIos: React.FC<RemovableIosOwnProps> = ({
|
|
|
92
94
|
Component="button"
|
|
93
95
|
hasActive={false}
|
|
94
96
|
hasHover={false}
|
|
95
|
-
disabled={
|
|
97
|
+
disabled={disabledRef.current}
|
|
96
98
|
getRootRef={removeButtonRef}
|
|
97
99
|
vkuiClass="Removable__remove"
|
|
98
|
-
onClick={
|
|
100
|
+
onClick={onRemove}
|
|
99
101
|
>
|
|
100
102
|
<span vkuiClass="Removable__remove-in">{removePlaceholder}</span>
|
|
101
103
|
</Tappable>
|
|
@@ -162,7 +164,7 @@ export const Removable: React.FC<RemovableOwnProps> = ({
|
|
|
162
164
|
|
|
163
165
|
{platform === IOS && (
|
|
164
166
|
<RemovableIos
|
|
165
|
-
|
|
167
|
+
onRemove={onRemoveClick}
|
|
166
168
|
removePlaceholder={removePlaceholder}
|
|
167
169
|
removePlaceholderString={removePlaceholderString}
|
|
168
170
|
>
|
|
@@ -82,11 +82,7 @@ const RichCell: React.FC<RichCellProps> = ({
|
|
|
82
82
|
</Text>
|
|
83
83
|
)}
|
|
84
84
|
{hasReactNode(caption) && (
|
|
85
|
-
<Subhead
|
|
86
|
-
Component="span"
|
|
87
|
-
weight="regular"
|
|
88
|
-
vkuiClass="RichCell__caption"
|
|
89
|
-
>
|
|
85
|
+
<Subhead Component="span" vkuiClass="RichCell__caption">
|
|
90
86
|
{caption}
|
|
91
87
|
</Subhead>
|
|
92
88
|
)}
|
|
@@ -105,11 +105,7 @@ const SimpleCell: React.FC<SimpleCellProps> = ({
|
|
|
105
105
|
)}
|
|
106
106
|
</div>
|
|
107
107
|
{description && (
|
|
108
|
-
<Subhead
|
|
109
|
-
Component="span"
|
|
110
|
-
weight="regular"
|
|
111
|
-
vkuiClass="SimpleCell__description"
|
|
112
|
-
>
|
|
108
|
+
<Subhead Component="span" vkuiClass="SimpleCell__description">
|
|
113
109
|
{description}
|
|
114
110
|
</Subhead>
|
|
115
111
|
)}
|
|
@@ -36,7 +36,7 @@ const SubnavigationButtonTypography: React.FC<SubnavButtonTypographyProps> = ({
|
|
|
36
36
|
...restProps
|
|
37
37
|
}: SubnavButtonTypographyProps) => {
|
|
38
38
|
if (textLevel === 1) {
|
|
39
|
-
return <Subhead
|
|
39
|
+
return <Subhead {...restProps} />;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
return (
|
|
@@ -37,18 +37,14 @@ export const TextTooltip: React.FC<TextTooltipProps> = ({
|
|
|
37
37
|
{hasReactNode(header) && (
|
|
38
38
|
<Subhead
|
|
39
39
|
Component="span"
|
|
40
|
-
weight="
|
|
40
|
+
weight="2"
|
|
41
41
|
vkuiClass="TextTooltip__header"
|
|
42
42
|
>
|
|
43
43
|
{header}
|
|
44
44
|
</Subhead>
|
|
45
45
|
)}
|
|
46
46
|
{hasReactNode(text) && (
|
|
47
|
-
<Subhead
|
|
48
|
-
Component="span"
|
|
49
|
-
weight="regular"
|
|
50
|
-
vkuiClass="TextTooltip__text"
|
|
51
|
-
>
|
|
47
|
+
<Subhead Component="span" vkuiClass="TextTooltip__text">
|
|
52
48
|
{text}
|
|
53
49
|
</Subhead>
|
|
54
50
|
)}
|
|
@@ -58,15 +58,11 @@ const SimpleTooltip = React.forwardRef<HTMLDivElement, SimpleTooltipProps>(
|
|
|
58
58
|
/>
|
|
59
59
|
<div vkuiClass="Tooltip__content">
|
|
60
60
|
{header && (
|
|
61
|
-
<Subhead weight="
|
|
61
|
+
<Subhead weight="1" vkuiClass="Tooltip__title">
|
|
62
62
|
{header}
|
|
63
63
|
</Subhead>
|
|
64
64
|
)}
|
|
65
|
-
{text &&
|
|
66
|
-
<Subhead weight="regular" vkuiClass="Tooltip__text">
|
|
67
|
-
{text}
|
|
68
|
-
</Subhead>
|
|
69
|
-
)}
|
|
65
|
+
{text && <Subhead vkuiClass="Tooltip__text">{text}</Subhead>}
|
|
70
66
|
</div>
|
|
71
67
|
</div>
|
|
72
68
|
</div>
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
```jsx { "props": { "layout": false, "iframe": false } }
|
|
2
|
+
<div style={{ padding: 20 }}>
|
|
3
|
+
<Subhead>Subhead</Subhead>
|
|
4
|
+
</div>
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## Кастомизация
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
Есть возможность переопределить жирность.
|
|
4
10
|
|
|
5
|
-
```jsx
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Subhead medium
|
|
16
|
-
</Subhead>
|
|
17
|
-
<Subhead weight="semibold" style={{ marginBottom: 16 }}>
|
|
18
|
-
Subhead semibold
|
|
19
|
-
</Subhead>
|
|
20
|
-
<Subhead weight="bold" style={{ marginBottom: 16 }}>
|
|
21
|
-
Subhead bold
|
|
22
|
-
</Subhead>
|
|
23
|
-
</Div>
|
|
24
|
-
</Group>
|
|
25
|
-
</Panel>
|
|
26
|
-
</View>
|
|
11
|
+
```jsx { "props": { "layout": false, "iframe": false } }
|
|
12
|
+
<div style={{ padding: 20 }}>
|
|
13
|
+
<Subhead weight="1" style={{ marginBottom: 16 }}>
|
|
14
|
+
Subhead weight 1
|
|
15
|
+
</Subhead>
|
|
16
|
+
<Subhead weight="2" style={{ marginBottom: 16 }}>
|
|
17
|
+
Subhead weight 2
|
|
18
|
+
</Subhead>
|
|
19
|
+
<Subhead weight="3">Subhead weight 3</Subhead>
|
|
20
|
+
</div>
|
|
27
21
|
```
|
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
.Subhead {
|
|
2
2
|
margin: 0;
|
|
3
|
-
font-size:
|
|
4
|
-
line-height:
|
|
3
|
+
font-size: var(--vkui--font_subhead--font_size--regular);
|
|
4
|
+
line-height: var(--vkui--font_subhead--line_height--regular);
|
|
5
|
+
font-weight: var(--vkui--font_subhead--font_weight--regular);
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
.Subhead--sizeY-compact {
|
|
9
|
+
font-size: var(--vkui--font_subhead--font_size--compact);
|
|
10
|
+
line-height: var(--vkui--font_subhead--line_height--compact);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* TODO Удалить перед релизом 5.0.0 */
|
|
7
14
|
.Subhead--w-regular {
|
|
8
15
|
font-weight: 400;
|
|
9
16
|
}
|
|
10
17
|
|
|
18
|
+
/* TODO Удалить перед релизом 5.0.0 */
|
|
11
19
|
.Subhead--w-medium {
|
|
12
20
|
font-weight: 500;
|
|
13
21
|
}
|
|
14
22
|
|
|
23
|
+
/* TODO Удалить перед релизом 5.0.0 */
|
|
15
24
|
.Subhead--w-semibold {
|
|
16
25
|
font-weight: 600;
|
|
17
26
|
}
|
|
18
27
|
|
|
28
|
+
/* TODO Удалить перед релизом 5.0.0 */
|
|
19
29
|
.Subhead--w-bold {
|
|
20
30
|
font-weight: 700;
|
|
21
31
|
}
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
.Subhead--w-1 {
|
|
34
|
+
font-weight: var(--vkui--font_weight_accent1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.Subhead--w-2 {
|
|
38
|
+
font-weight: var(--vkui--font_weight_accent2);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.Subhead--w-3 {
|
|
42
|
+
font-weight: var(--vkui--font_weight_accent3);
|
|
28
43
|
}
|
|
@@ -1,29 +1,45 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { HasComponent } from "../../../types";
|
|
3
|
-
import { usePlatform } from "../../../hooks/usePlatform";
|
|
4
3
|
import { classNames } from "../../../lib/classNames";
|
|
5
|
-
import {
|
|
4
|
+
import { warnOnce } from "../../../lib/warnOnce";
|
|
5
|
+
import { useAdaptivity } from "../../../hooks/useAdaptivity";
|
|
6
6
|
import "./Subhead.css";
|
|
7
7
|
|
|
8
8
|
export interface SubheadProps
|
|
9
9
|
extends React.AllHTMLAttributes<HTMLElement>,
|
|
10
10
|
HasComponent {
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Начертания "regular", "medium", "semibold" и "bold" устарели и будут удалены в 5.0.0.
|
|
13
|
+
*/
|
|
14
|
+
weight?: "regular" | "medium" | "semibold" | "bold" | "1" | "2" | "3";
|
|
12
15
|
}
|
|
13
16
|
|
|
17
|
+
const warn = warnOnce("Subhead");
|
|
18
|
+
|
|
14
19
|
const Subhead: React.FC<SubheadProps> = ({
|
|
15
20
|
children,
|
|
16
|
-
weight
|
|
17
|
-
Component = "
|
|
21
|
+
weight,
|
|
22
|
+
Component = "h5",
|
|
18
23
|
...restProps
|
|
19
24
|
}: SubheadProps) => {
|
|
20
|
-
const
|
|
25
|
+
const { sizeY } = useAdaptivity();
|
|
26
|
+
|
|
27
|
+
if (process.env.NODE_ENV === "development") {
|
|
28
|
+
if (
|
|
29
|
+
weight &&
|
|
30
|
+
["heavy", "bold", "semibold", "medium", "regular"].includes(weight)
|
|
31
|
+
)
|
|
32
|
+
warn(
|
|
33
|
+
`Начертание weight="${weight}" устарело и будет удалено в 5.0.0. Используйте значения "1", "2" и "3"`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
21
36
|
|
|
22
37
|
return (
|
|
23
38
|
<Component
|
|
24
39
|
{...restProps}
|
|
25
40
|
vkuiClass={classNames(
|
|
26
|
-
|
|
41
|
+
"Subhead",
|
|
42
|
+
`Subhead--sizeY-${sizeY}`,
|
|
27
43
|
`Subhead--w-${weight}`
|
|
28
44
|
)}
|
|
29
45
|
>
|
|
@@ -41,7 +41,7 @@ const Title: React.FC<TitleProps> = ({
|
|
|
41
41
|
["heavy", "bold", "semibold", "medium", "regular"].includes(weight)
|
|
42
42
|
)
|
|
43
43
|
warn(
|
|
44
|
-
`Начертание "${weight}" устарело и будет удалено в 5.0.0. Используйте значения "1", "2" и "3"`
|
|
44
|
+
`Начертание weight="${weight}" устарело и будет удалено в 5.0.0. Используйте значения "1", "2" и "3"`
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -84,7 +84,7 @@ const UsersStack: React.FC<UsersStackProps> = (props: UsersStackProps) => {
|
|
|
84
84
|
)}
|
|
85
85
|
</div>
|
|
86
86
|
{hasReactNode(children) && (
|
|
87
|
-
<Subhead Component="span"
|
|
87
|
+
<Subhead Component="span" vkuiClass="UsersStack__text">
|
|
88
88
|
{children}
|
|
89
89
|
</Subhead>
|
|
90
90
|
)}
|
package/src/tokenized/index.ts
CHANGED
|
@@ -16,3 +16,9 @@ export type {
|
|
|
16
16
|
SegmentedControlOptionInterface,
|
|
17
17
|
SegmentedControlValue,
|
|
18
18
|
} from "../components/SegmentedControl/SegmentedControl";
|
|
19
|
+
|
|
20
|
+
export { default as Title } from "../components/Typography/Title/Title";
|
|
21
|
+
export type { TitleProps } from "../components/Typography/Title/Title";
|
|
22
|
+
|
|
23
|
+
export { default as Subhead } from "../components/Typography/Subhead/Subhead";
|
|
24
|
+
export type { SubheadProps } from "../components/Typography/Subhead/Subhead";
|