@gravity-ui/page-constructor 2.18.0 → 2.19.0-alpha.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/build/cjs/components/Button/Button.css +3 -0
- package/build/cjs/components/Button/Button.js +4 -4
- package/build/cjs/models/constructor-items/common.d.ts +2 -3
- package/build/esm/components/Button/Button.css +3 -0
- package/build/esm/components/Button/Button.js +4 -4
- package/build/esm/models/constructor-items/common.d.ts +2 -3
- package/package.json +4 -1
- package/server/models/constructor-items/common.d.ts +2 -3
|
@@ -15,7 +15,7 @@ const b = (0, utils_1.block)('button-block');
|
|
|
15
15
|
const Button = (props) => {
|
|
16
16
|
const handleMetrika = (0, useMetrika_1.useMetrika)();
|
|
17
17
|
const { lang, tld } = (0, react_1.useContext)(localeContext_1.LocaleContext);
|
|
18
|
-
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
18
|
+
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text, width } = props, rest = tslib_1.__rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text", "width"]);
|
|
19
19
|
const defaultImgPosition = 'left';
|
|
20
20
|
const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.Button, url);
|
|
21
21
|
const onClick = (0, react_1.useCallback)((e) => {
|
|
@@ -29,8 +29,8 @@ const Button = (props) => {
|
|
|
29
29
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
30
30
|
: { url: img, position: defaultImgPosition };
|
|
31
31
|
const buttonClass = img
|
|
32
|
-
? b({ position: buttonImg.position, size, theme }, className)
|
|
33
|
-
: b({ size, theme }, className);
|
|
32
|
+
? b({ position: buttonImg.position, size, theme, width }, className)
|
|
33
|
+
: b({ size, theme, width }, className);
|
|
34
34
|
const buttonProps = Object.assign(Object.assign({}, rest), { onClick });
|
|
35
35
|
if (theme === 'app-store' || theme === 'google-play') {
|
|
36
36
|
const platform = theme === 'app-store' ? uikit_1.Platform.IOS : uikit_1.Platform.ANDROID;
|
|
@@ -43,7 +43,7 @@ const Button = (props) => {
|
|
|
43
43
|
image = undefined;
|
|
44
44
|
}
|
|
45
45
|
const buttonTheme = theme === 'scale' ? 'accent' : theme;
|
|
46
|
-
return (react_1.default.createElement(uikit_1.Button, Object.assign({ className: buttonClass, view: (0, utils_2.toCommonView)(buttonTheme), size: (0, utils_2.toCommonSize)(size), href: url ? (0, utils_1.setUrlTld)(url, tld) : undefined }, buttonProps),
|
|
46
|
+
return (react_1.default.createElement(uikit_1.Button, Object.assign({ className: buttonClass, view: (0, utils_2.toCommonView)(buttonTheme), size: (0, utils_2.toCommonSize)(size), href: url ? (0, utils_1.setUrlTld)(url, tld) : undefined, width: width }, buttonProps),
|
|
47
47
|
icon && buttonImg.position === 'left' ? icon : null,
|
|
48
48
|
react_1.default.createElement("span", { className: b('content') },
|
|
49
49
|
image && buttonImg.position === 'left' ? image : null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
@@ -131,11 +131,10 @@ export interface FileLinkProps extends ClassNameProps {
|
|
|
131
131
|
onClick?: () => void;
|
|
132
132
|
}
|
|
133
133
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
134
|
-
export interface ButtonProps extends AnalyticsEventsBase {
|
|
134
|
+
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width'> {
|
|
135
135
|
text: string;
|
|
136
136
|
url: string;
|
|
137
137
|
primary?: boolean;
|
|
138
|
-
size?: ButtonSize;
|
|
139
138
|
theme?: ButtonTheme;
|
|
140
139
|
img?: ButtonImageProps | string;
|
|
141
140
|
metrikaGoals?: MetrikaGoal;
|
|
@@ -14,7 +14,7 @@ const b = block('button-block');
|
|
|
14
14
|
const Button = (props) => {
|
|
15
15
|
const handleMetrika = useMetrika();
|
|
16
16
|
const { lang, tld } = useContext(LocaleContext);
|
|
17
|
-
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text"]);
|
|
17
|
+
const { className, metrikaGoals, pixelEvents, analyticsEvents, size = 'l', theme = 'normal', url, img, onClick: onClickOrigin, text, width } = props, rest = __rest(props, ["className", "metrikaGoals", "pixelEvents", "analyticsEvents", "size", "theme", "url", "img", "onClick", "text", "width"]);
|
|
18
18
|
const defaultImgPosition = 'left';
|
|
19
19
|
const handleAnalytics = useAnalytics(DefaultEventNames.Button, url);
|
|
20
20
|
const onClick = useCallback((e) => {
|
|
@@ -28,8 +28,8 @@ const Button = (props) => {
|
|
|
28
28
|
? { url: img.url, position: img.position || defaultImgPosition, alt: img.alt }
|
|
29
29
|
: { url: img, position: defaultImgPosition };
|
|
30
30
|
const buttonClass = img
|
|
31
|
-
? b({ position: buttonImg.position, size, theme }, className)
|
|
32
|
-
: b({ size, theme }, className);
|
|
31
|
+
? b({ position: buttonImg.position, size, theme, width }, className)
|
|
32
|
+
: b({ size, theme, width }, className);
|
|
33
33
|
const buttonProps = Object.assign(Object.assign({}, rest), { onClick });
|
|
34
34
|
if (theme === 'app-store' || theme === 'google-play') {
|
|
35
35
|
const platform = theme === 'app-store' ? Platform.IOS : Platform.ANDROID;
|
|
@@ -42,7 +42,7 @@ const Button = (props) => {
|
|
|
42
42
|
image = undefined;
|
|
43
43
|
}
|
|
44
44
|
const buttonTheme = theme === 'scale' ? 'accent' : theme;
|
|
45
|
-
return (React.createElement(CommonButton, Object.assign({ className: buttonClass, view: toCommonView(buttonTheme), size: toCommonSize(size), href: url ? setUrlTld(url, tld) : undefined }, buttonProps),
|
|
45
|
+
return (React.createElement(CommonButton, Object.assign({ className: buttonClass, view: toCommonView(buttonTheme), size: toCommonSize(size), href: url ? setUrlTld(url, tld) : undefined, width: width }, buttonProps),
|
|
46
46
|
icon && buttonImg.position === 'left' ? icon : null,
|
|
47
47
|
React.createElement("span", { className: b('content') },
|
|
48
48
|
image && buttonImg.position === 'left' ? image : null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
@@ -131,11 +131,10 @@ export interface FileLinkProps extends ClassNameProps {
|
|
|
131
131
|
onClick?: () => void;
|
|
132
132
|
}
|
|
133
133
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
134
|
-
export interface ButtonProps extends AnalyticsEventsBase {
|
|
134
|
+
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width'> {
|
|
135
135
|
text: string;
|
|
136
136
|
url: string;
|
|
137
137
|
primary?: boolean;
|
|
138
|
-
size?: ButtonSize;
|
|
139
138
|
theme?: ButtonTheme;
|
|
140
139
|
img?: ButtonImageProps | string;
|
|
141
140
|
metrikaGoals?: MetrikaGoal;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0-alpha.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -138,5 +138,8 @@
|
|
|
138
138
|
"*.{json,yaml,yml,md}": [
|
|
139
139
|
"prettier --write"
|
|
140
140
|
]
|
|
141
|
+
},
|
|
142
|
+
"publishConfig": {
|
|
143
|
+
"tag": "alpha"
|
|
141
144
|
}
|
|
142
145
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils/theme';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType } from '../common';
|
|
5
5
|
export declare enum AuthorType {
|
|
@@ -131,11 +131,10 @@ export interface FileLinkProps extends ClassNameProps {
|
|
|
131
131
|
onClick?: () => void;
|
|
132
132
|
}
|
|
133
133
|
export type ButtonTheme = ButtonView | 'github' | 'app-store' | 'google-play' | 'scale' | 'monochrome';
|
|
134
|
-
export interface ButtonProps extends AnalyticsEventsBase {
|
|
134
|
+
export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps, 'size' | 'width'> {
|
|
135
135
|
text: string;
|
|
136
136
|
url: string;
|
|
137
137
|
primary?: boolean;
|
|
138
|
-
size?: ButtonSize;
|
|
139
138
|
theme?: ButtonTheme;
|
|
140
139
|
img?: ButtonImageProps | string;
|
|
141
140
|
metrikaGoals?: MetrikaGoal;
|