@doyourjob/gravity-ui-page-constructor-addons 2.1.21 → 2.1.23
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/HeaderStripe/CloseIcon.d.ts +2 -0
- package/build/cjs/components/HeaderStripe/CloseIcon.js +9 -0
- package/build/cjs/components/HeaderStripe/HeaderStripe.css +26 -6
- package/build/cjs/components/HeaderStripe/HeaderStripe.d.ts +4 -1
- package/build/cjs/components/HeaderStripe/HeaderStripe.js +23 -4
- package/build/esm/components/HeaderStripe/CloseIcon.d.ts +2 -0
- package/build/esm/components/HeaderStripe/CloseIcon.js +4 -0
- package/build/esm/components/HeaderStripe/HeaderStripe.css +26 -6
- package/build/esm/components/HeaderStripe/HeaderStripe.d.ts +4 -1
- package/build/esm/components/HeaderStripe/HeaderStripe.js +23 -4
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloseIcon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const CloseIcon = (props) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true" }, props),
|
|
7
|
+
react_1.default.createElement("path", { d: "M15.5838 14.9948L14.9948 15.5838L0 0.589046L0.589046 0L15.5838 14.9948Z", fill: "currentColor" }),
|
|
8
|
+
react_1.default.createElement("path", { d: "M0.000647411 14.9948L0.589693 15.5838L15.5845 0.589046L14.9954 0L0.000647411 14.9948Z", fill: "currentColor" })));
|
|
9
|
+
exports.CloseIcon = CloseIcon;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
3
|
.pc-addons-header-stripe__root {
|
|
4
|
+
--local-hs-height-desktop: 56px;
|
|
5
|
+
--local-hs-height-mobile: 36px;
|
|
4
6
|
z-index: calc(var(--pc-addons-navigation-popup-z-index) + 1);
|
|
5
7
|
width: 100%;
|
|
6
8
|
color: var(--g-color-text-brand-contrast);
|
|
@@ -32,12 +34,30 @@ unpredictable css rules order in build */
|
|
|
32
34
|
animation: constrict-desktop 0.5s ease forwards;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
37
|
+
.pc-addons-header-stripe__root_new-design {
|
|
38
|
+
--local-hs-height-mobile: 28px;
|
|
39
|
+
background-color: transparent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.pc-addons-header-stripe__root_new-design .pc-addons-header-stripe__content {
|
|
43
|
+
border-radius: 12px;
|
|
44
|
+
background: transparent;
|
|
45
|
+
color: inherit;
|
|
46
|
+
transition: background 0.3s ease, color 0.3s ease;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pc-addons-header-stripe__root_new-design .pc-addons-header-stripe__close {
|
|
50
|
+
width: auto;
|
|
51
|
+
padding: 0 12px;
|
|
52
|
+
color: #737373;
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
.pc-addons-header-stripe__content {
|
|
36
56
|
position: relative;
|
|
37
57
|
display: flex;
|
|
38
58
|
overflow: hidden;
|
|
39
59
|
align-items: center;
|
|
40
|
-
height:
|
|
60
|
+
height: var(--local-hs-height-desktop);
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
.pc-addons-header-stripe__content_with-close {
|
|
@@ -51,7 +71,7 @@ unpredictable css rules order in build */
|
|
|
51
71
|
|
|
52
72
|
@media (min-width: 769px) {
|
|
53
73
|
.pc-addons-header-stripe__content {
|
|
54
|
-
height:
|
|
74
|
+
height: var(--local-hs-height-mobile);
|
|
55
75
|
}
|
|
56
76
|
}
|
|
57
77
|
.pc-addons-header-stripe__item {
|
|
@@ -132,12 +152,12 @@ unpredictable css rules order in build */
|
|
|
132
152
|
max-height: 0;
|
|
133
153
|
}
|
|
134
154
|
to {
|
|
135
|
-
max-height:
|
|
155
|
+
max-height: var(--local-hs-height-desktop);
|
|
136
156
|
}
|
|
137
157
|
}
|
|
138
158
|
@keyframes constrict-mobile {
|
|
139
159
|
from {
|
|
140
|
-
max-height:
|
|
160
|
+
max-height: var(--local-hs-height-desktop);
|
|
141
161
|
}
|
|
142
162
|
to {
|
|
143
163
|
max-height: 0;
|
|
@@ -148,12 +168,12 @@ unpredictable css rules order in build */
|
|
|
148
168
|
max-height: 0;
|
|
149
169
|
}
|
|
150
170
|
to {
|
|
151
|
-
max-height:
|
|
171
|
+
max-height: var(--local-hs-height-mobile);
|
|
152
172
|
}
|
|
153
173
|
}
|
|
154
174
|
@keyframes constrict-desktop {
|
|
155
175
|
from {
|
|
156
|
-
max-height:
|
|
176
|
+
max-height: var(--local-hs-height-mobile);
|
|
157
177
|
}
|
|
158
178
|
to {
|
|
159
179
|
max-height: 0;
|
|
@@ -4,6 +4,8 @@ type HeaderStripeItemType = {
|
|
|
4
4
|
link?: string;
|
|
5
5
|
target?: string;
|
|
6
6
|
onlyDesktop?: boolean;
|
|
7
|
+
background?: string;
|
|
8
|
+
textColor?: string;
|
|
7
9
|
} | string;
|
|
8
10
|
export type HeaderStripeProps = {
|
|
9
11
|
duration?: number;
|
|
@@ -15,6 +17,7 @@ export type HeaderStripeProps = {
|
|
|
15
17
|
isAbsolute?: boolean;
|
|
16
18
|
canClose?: boolean;
|
|
17
19
|
onClose?: () => void;
|
|
20
|
+
newDesign?: boolean;
|
|
18
21
|
};
|
|
19
|
-
export declare const HeaderStripe: ({ duration, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, }: HeaderStripeProps) => React.JSX.Element;
|
|
22
|
+
export declare const HeaderStripe: ({ duration, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, newDesign, }: HeaderStripeProps) => React.JSX.Element;
|
|
20
23
|
export {};
|
|
@@ -7,6 +7,7 @@ const gravity_ui_page_constructor_1 = require("@doyourjob/gravity-ui-page-constr
|
|
|
7
7
|
const icons_1 = require("@gravity-ui/icons");
|
|
8
8
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
9
9
|
const cn_1 = require("../../utils/cn");
|
|
10
|
+
const CloseIcon_1 = require("./CloseIcon");
|
|
10
11
|
const i18n_1 = tslib_1.__importDefault(require("./i18n"));
|
|
11
12
|
const b = (0, cn_1.block)('header-stripe');
|
|
12
13
|
const renderItemContent = (item) => {
|
|
@@ -20,7 +21,7 @@ const renderItemContent = (item) => {
|
|
|
20
21
|
return item.text;
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
|
-
const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, }) => {
|
|
24
|
+
const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, newDesign, }) => {
|
|
24
25
|
const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
|
|
25
26
|
const [isClosing, setIsClosing] = (0, react_1.useState)(false);
|
|
26
27
|
const isMobile = (0, uikit_1.useMobile)();
|
|
@@ -59,10 +60,28 @@ const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroun
|
|
|
59
60
|
}
|
|
60
61
|
return properties;
|
|
61
62
|
}, [textColor, background, backgroundImage]);
|
|
62
|
-
|
|
63
|
+
const contentStyle = (0, react_1.useMemo)(() => {
|
|
64
|
+
if (!newDesign) {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
const item = filteredItems[activeIndex];
|
|
68
|
+
const properties = {};
|
|
69
|
+
if (typeof item === 'object' && item.background) {
|
|
70
|
+
properties.background = item.background;
|
|
71
|
+
}
|
|
72
|
+
if (typeof item === 'object' && item.textColor) {
|
|
73
|
+
properties.color = item.textColor;
|
|
74
|
+
}
|
|
75
|
+
return properties;
|
|
76
|
+
}, [newDesign, filteredItems, activeIndex]);
|
|
77
|
+
return (react_1.default.createElement("div", { className: b('root', {
|
|
78
|
+
'only-desktop': onlyDesktop,
|
|
79
|
+
closing: isClosing,
|
|
80
|
+
'new-design': newDesign,
|
|
81
|
+
}), style: rootStyle },
|
|
63
82
|
react_1.default.createElement(gravity_ui_page_constructor_1.Grid, null,
|
|
64
83
|
react_1.default.createElement(gravity_ui_page_constructor_1.Col, null,
|
|
65
|
-
react_1.default.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }) },
|
|
84
|
+
react_1.default.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }), style: contentStyle },
|
|
66
85
|
filteredItems.map((item, index) => {
|
|
67
86
|
const isActive = index === activeIndex;
|
|
68
87
|
const isPrev = filteredItems.length > 1 &&
|
|
@@ -77,6 +96,6 @@ const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroun
|
|
|
77
96
|
react_1.default.createElement("div", { className: b('item-content') }, renderItemContent(item))));
|
|
78
97
|
}),
|
|
79
98
|
canClose && (react_1.default.createElement("button", { "aria-label": (0, i18n_1.default)('close'), className: b('close'), onClick: handleClose },
|
|
80
|
-
react_1.default.createElement(uikit_1.Icon, { data: icons_1.Xmark, className: b('close-icon'), size: 16 }))))))));
|
|
99
|
+
react_1.default.createElement(uikit_1.Icon, { data: newDesign ? CloseIcon_1.CloseIcon : icons_1.Xmark, className: b('close-icon'), size: 16 }))))))));
|
|
81
100
|
};
|
|
82
101
|
exports.HeaderStripe = HeaderStripe;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export const CloseIcon = (props) => (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true" }, props),
|
|
3
|
+
React.createElement("path", { d: "M15.5838 14.9948L14.9948 15.5838L0 0.589046L0.589046 0L15.5838 14.9948Z", fill: "currentColor" }),
|
|
4
|
+
React.createElement("path", { d: "M0.000647411 14.9948L0.589693 15.5838L15.5845 0.589046L14.9954 0L0.000647411 14.9948Z", fill: "currentColor" })));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* use this for style redefinitions to awoid problems with
|
|
2
2
|
unpredictable css rules order in build */
|
|
3
3
|
.pc-addons-header-stripe__root {
|
|
4
|
+
--local-hs-height-desktop: 56px;
|
|
5
|
+
--local-hs-height-mobile: 36px;
|
|
4
6
|
z-index: calc(var(--pc-addons-navigation-popup-z-index) + 1);
|
|
5
7
|
width: 100%;
|
|
6
8
|
color: var(--g-color-text-brand-contrast);
|
|
@@ -32,12 +34,30 @@ unpredictable css rules order in build */
|
|
|
32
34
|
animation: constrict-desktop 0.5s ease forwards;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
37
|
+
.pc-addons-header-stripe__root_new-design {
|
|
38
|
+
--local-hs-height-mobile: 28px;
|
|
39
|
+
background-color: transparent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.pc-addons-header-stripe__root_new-design .pc-addons-header-stripe__content {
|
|
43
|
+
border-radius: 12px;
|
|
44
|
+
background: transparent;
|
|
45
|
+
color: inherit;
|
|
46
|
+
transition: background 0.3s ease, color 0.3s ease;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pc-addons-header-stripe__root_new-design .pc-addons-header-stripe__close {
|
|
50
|
+
width: auto;
|
|
51
|
+
padding: 0 12px;
|
|
52
|
+
color: #737373;
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
.pc-addons-header-stripe__content {
|
|
36
56
|
position: relative;
|
|
37
57
|
display: flex;
|
|
38
58
|
overflow: hidden;
|
|
39
59
|
align-items: center;
|
|
40
|
-
height:
|
|
60
|
+
height: var(--local-hs-height-desktop);
|
|
41
61
|
}
|
|
42
62
|
|
|
43
63
|
.pc-addons-header-stripe__content_with-close {
|
|
@@ -51,7 +71,7 @@ unpredictable css rules order in build */
|
|
|
51
71
|
|
|
52
72
|
@media (min-width: 769px) {
|
|
53
73
|
.pc-addons-header-stripe__content {
|
|
54
|
-
height:
|
|
74
|
+
height: var(--local-hs-height-mobile);
|
|
55
75
|
}
|
|
56
76
|
}
|
|
57
77
|
.pc-addons-header-stripe__item {
|
|
@@ -132,12 +152,12 @@ unpredictable css rules order in build */
|
|
|
132
152
|
max-height: 0;
|
|
133
153
|
}
|
|
134
154
|
to {
|
|
135
|
-
max-height:
|
|
155
|
+
max-height: var(--local-hs-height-desktop);
|
|
136
156
|
}
|
|
137
157
|
}
|
|
138
158
|
@keyframes constrict-mobile {
|
|
139
159
|
from {
|
|
140
|
-
max-height:
|
|
160
|
+
max-height: var(--local-hs-height-desktop);
|
|
141
161
|
}
|
|
142
162
|
to {
|
|
143
163
|
max-height: 0;
|
|
@@ -148,12 +168,12 @@ unpredictable css rules order in build */
|
|
|
148
168
|
max-height: 0;
|
|
149
169
|
}
|
|
150
170
|
to {
|
|
151
|
-
max-height:
|
|
171
|
+
max-height: var(--local-hs-height-mobile);
|
|
152
172
|
}
|
|
153
173
|
}
|
|
154
174
|
@keyframes constrict-desktop {
|
|
155
175
|
from {
|
|
156
|
-
max-height:
|
|
176
|
+
max-height: var(--local-hs-height-mobile);
|
|
157
177
|
}
|
|
158
178
|
to {
|
|
159
179
|
max-height: 0;
|
|
@@ -5,6 +5,8 @@ type HeaderStripeItemType = {
|
|
|
5
5
|
link?: string;
|
|
6
6
|
target?: string;
|
|
7
7
|
onlyDesktop?: boolean;
|
|
8
|
+
background?: string;
|
|
9
|
+
textColor?: string;
|
|
8
10
|
} | string;
|
|
9
11
|
export type HeaderStripeProps = {
|
|
10
12
|
duration?: number;
|
|
@@ -16,6 +18,7 @@ export type HeaderStripeProps = {
|
|
|
16
18
|
isAbsolute?: boolean;
|
|
17
19
|
canClose?: boolean;
|
|
18
20
|
onClose?: () => void;
|
|
21
|
+
newDesign?: boolean;
|
|
19
22
|
};
|
|
20
|
-
export declare const HeaderStripe: ({ duration, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, }: HeaderStripeProps) => React.JSX.Element;
|
|
23
|
+
export declare const HeaderStripe: ({ duration, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, newDesign, }: HeaderStripeProps) => React.JSX.Element;
|
|
21
24
|
export {};
|
|
@@ -3,6 +3,7 @@ import { Col, Grid } from '@doyourjob/gravity-ui-page-constructor';
|
|
|
3
3
|
import { Xmark } from '@gravity-ui/icons';
|
|
4
4
|
import { Icon, useMobile } from '@gravity-ui/uikit';
|
|
5
5
|
import { block } from '../../utils/cn';
|
|
6
|
+
import { CloseIcon } from './CloseIcon';
|
|
6
7
|
import i18n from './i18n';
|
|
7
8
|
import './HeaderStripe.css';
|
|
8
9
|
const b = block('header-stripe');
|
|
@@ -17,7 +18,7 @@ const renderItemContent = (item) => {
|
|
|
17
18
|
return item.text;
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
|
-
export const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, }) => {
|
|
21
|
+
export const HeaderStripe = ({ duration = 8000, items, textColor, background, backgroundImage, onlyDesktop, canClose, onClose, newDesign, }) => {
|
|
21
22
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
22
23
|
const [isClosing, setIsClosing] = useState(false);
|
|
23
24
|
const isMobile = useMobile();
|
|
@@ -56,10 +57,28 @@ export const HeaderStripe = ({ duration = 8000, items, textColor, background, ba
|
|
|
56
57
|
}
|
|
57
58
|
return properties;
|
|
58
59
|
}, [textColor, background, backgroundImage]);
|
|
59
|
-
|
|
60
|
+
const contentStyle = useMemo(() => {
|
|
61
|
+
if (!newDesign) {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
const item = filteredItems[activeIndex];
|
|
65
|
+
const properties = {};
|
|
66
|
+
if (typeof item === 'object' && item.background) {
|
|
67
|
+
properties.background = item.background;
|
|
68
|
+
}
|
|
69
|
+
if (typeof item === 'object' && item.textColor) {
|
|
70
|
+
properties.color = item.textColor;
|
|
71
|
+
}
|
|
72
|
+
return properties;
|
|
73
|
+
}, [newDesign, filteredItems, activeIndex]);
|
|
74
|
+
return (React.createElement("div", { className: b('root', {
|
|
75
|
+
'only-desktop': onlyDesktop,
|
|
76
|
+
closing: isClosing,
|
|
77
|
+
'new-design': newDesign,
|
|
78
|
+
}), style: rootStyle },
|
|
60
79
|
React.createElement(Grid, null,
|
|
61
80
|
React.createElement(Col, null,
|
|
62
|
-
React.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }) },
|
|
81
|
+
React.createElement("div", { className: b('content', { 'with-close': Boolean(onClose) }), style: contentStyle },
|
|
63
82
|
filteredItems.map((item, index) => {
|
|
64
83
|
const isActive = index === activeIndex;
|
|
65
84
|
const isPrev = filteredItems.length > 1 &&
|
|
@@ -74,5 +93,5 @@ export const HeaderStripe = ({ duration = 8000, items, textColor, background, ba
|
|
|
74
93
|
React.createElement("div", { className: b('item-content') }, renderItemContent(item))));
|
|
75
94
|
}),
|
|
76
95
|
canClose && (React.createElement("button", { "aria-label": i18n('close'), className: b('close'), onClick: handleClose },
|
|
77
|
-
React.createElement(Icon, { data: Xmark, className: b('close-icon'), size: 16 }))))))));
|
|
96
|
+
React.createElement(Icon, { data: newDesign ? CloseIcon : Xmark, className: b('close-icon'), size: 16 }))))))));
|
|
78
97
|
};
|