@gravity-ui/page-constructor 7.21.1 → 7.22.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/blocks/ContentLayout/schema.d.ts +11 -0
- package/build/cjs/blocks/FoldableList/schema.d.ts +11 -0
- package/build/cjs/blocks/Form/Form.css +5 -2
- package/build/cjs/blocks/Form/Form.js +12 -9
- package/build/cjs/blocks/Form/Form.js.map +1 -1
- package/build/cjs/blocks/Form/schema.d.ts +12 -4
- package/build/cjs/blocks/Form/schema.js +1 -4
- package/build/cjs/blocks/Form/schema.js.map +1 -1
- package/build/cjs/blocks/Form/utils.d.ts +3 -0
- package/build/cjs/blocks/Form/utils.js +20 -0
- package/build/cjs/blocks/Form/utils.js.map +1 -0
- package/build/cjs/blocks/Info/schema.d.ts +22 -0
- package/build/cjs/blocks/Map/schema.d.ts +11 -0
- package/build/cjs/blocks/Media/schema.d.ts +22 -0
- package/build/cjs/blocks/Questions/schema.d.ts +11 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +11 -0
- package/build/cjs/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts} +3 -3
- package/build/cjs/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js} +3 -3
- package/build/cjs/components/ContentIcon/ContentIcon.js.map +1 -0
- package/build/cjs/components/ContentLabels/ContentLabels.css +53 -0
- package/build/cjs/components/ContentLabels/ContentLabels.d.ts +3 -0
- package/build/cjs/components/ContentLabels/ContentLabels.js +16 -0
- package/build/cjs/components/ContentLabels/ContentLabels.js.map +1 -0
- package/build/cjs/components/ContentList/ContentList.js +2 -2
- package/build/cjs/components/ContentList/ContentList.js.map +1 -1
- package/build/cjs/context/windowWidthContext/{BreakpointContext.js → WindowWidthContext.js} +2 -7
- package/build/cjs/context/windowWidthContext/WindowWidthContext.js.map +1 -0
- package/build/cjs/context/windowWidthContext/index.d.ts +1 -1
- package/build/cjs/context/windowWidthContext/index.js +1 -1
- package/build/cjs/context/windowWidthContext/index.js.map +1 -1
- package/build/cjs/hooks/useDeviceValue.d.ts +2 -0
- package/build/cjs/hooks/useDeviceValue.js +33 -0
- package/build/cjs/hooks/useDeviceValue.js.map +1 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +25 -9
- package/build/cjs/models/constructor-items/blocks.js.map +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -5
- package/build/cjs/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/cjs/schema/constants.d.ts +33 -0
- package/build/cjs/schema/validators/common.d.ts +12 -1
- package/build/cjs/schema/validators/common.js +21 -0
- package/build/cjs/schema/validators/common.js.map +1 -1
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +11 -0
- package/build/cjs/sub-blocks/BasicCard/schema.d.ts +11 -0
- package/build/cjs/sub-blocks/Content/Content.css +16 -0
- package/build/cjs/sub-blocks/Content/Content.js +12 -3
- package/build/cjs/sub-blocks/Content/Content.js.map +1 -1
- package/build/cjs/sub-blocks/Content/schema.d.ts +103 -1
- package/build/cjs/sub-blocks/Content/schema.js +22 -2
- package/build/cjs/sub-blocks/Content/schema.js.map +1 -1
- package/build/cjs/sub-blocks/ImageCard/schema.d.ts +11 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +11 -0
- package/build/cjs/utils/breakpoint.d.ts +7 -0
- package/build/cjs/utils/breakpoint.js +12 -0
- package/build/cjs/utils/breakpoint.js.map +1 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +1 -0
- package/build/cjs/utils/index.js.map +1 -1
- package/build/esm/blocks/ContentLayout/schema.d.ts +11 -0
- package/build/esm/blocks/FoldableList/schema.d.ts +11 -0
- package/build/esm/blocks/Form/Form.css +5 -2
- package/build/esm/blocks/Form/Form.js +12 -9
- package/build/esm/blocks/Form/Form.js.map +1 -1
- package/build/esm/blocks/Form/schema.d.ts +12 -4
- package/build/esm/blocks/Form/schema.js +1 -4
- package/build/esm/blocks/Form/schema.js.map +1 -1
- package/build/esm/blocks/Form/utils.d.ts +3 -0
- package/build/esm/blocks/Form/utils.js +16 -0
- package/build/esm/blocks/Form/utils.js.map +1 -0
- package/build/esm/blocks/Info/schema.d.ts +22 -0
- package/build/esm/blocks/Map/schema.d.ts +11 -0
- package/build/esm/blocks/Media/schema.d.ts +22 -0
- package/build/esm/blocks/Questions/schema.d.ts +11 -0
- package/build/esm/blocks/Tabs/schema.d.ts +11 -0
- package/build/esm/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts} +3 -3
- package/build/esm/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js} +3 -3
- package/build/esm/components/ContentIcon/ContentIcon.js.map +1 -0
- package/build/esm/components/ContentLabels/ContentLabels.css +53 -0
- package/build/esm/components/ContentLabels/ContentLabels.d.ts +4 -0
- package/build/esm/components/ContentLabels/ContentLabels.js +14 -0
- package/build/esm/components/ContentLabels/ContentLabels.js.map +1 -0
- package/build/esm/components/ContentList/ContentList.js +2 -2
- package/build/esm/components/ContentList/ContentList.js.map +1 -1
- package/build/esm/context/windowWidthContext/{BreakpointContext.js → WindowWidthContext.js} +2 -7
- package/build/esm/context/windowWidthContext/WindowWidthContext.js.map +1 -0
- package/build/esm/context/windowWidthContext/index.d.ts +1 -1
- package/build/esm/context/windowWidthContext/index.js +1 -1
- package/build/esm/context/windowWidthContext/index.js.map +1 -1
- package/build/esm/hooks/useDeviceValue.d.ts +2 -0
- package/build/esm/hooks/useDeviceValue.js +29 -0
- package/build/esm/hooks/useDeviceValue.js.map +1 -0
- package/build/esm/models/constructor-items/blocks.d.ts +25 -9
- package/build/esm/models/constructor-items/blocks.js.map +1 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -5
- package/build/esm/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/esm/schema/constants.d.ts +33 -0
- package/build/esm/schema/validators/common.d.ts +12 -1
- package/build/esm/schema/validators/common.js +21 -1
- package/build/esm/schema/validators/common.js.map +1 -1
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +11 -0
- package/build/esm/sub-blocks/BasicCard/schema.d.ts +11 -0
- package/build/esm/sub-blocks/Content/Content.css +16 -0
- package/build/esm/sub-blocks/Content/Content.js +11 -3
- package/build/esm/sub-blocks/Content/Content.js.map +1 -1
- package/build/esm/sub-blocks/Content/schema.d.ts +103 -1
- package/build/esm/sub-blocks/Content/schema.js +21 -1
- package/build/esm/sub-blocks/Content/schema.js.map +1 -1
- package/build/esm/sub-blocks/ImageCard/schema.d.ts +11 -0
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +11 -0
- package/build/esm/utils/breakpoint.d.ts +7 -0
- package/build/esm/utils/breakpoint.js +9 -0
- package/build/esm/utils/breakpoint.js.map +1 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/build/esm/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +25 -9
- package/server/models/constructor-items/sub-blocks.d.ts +5 -5
- package/server/utils/breakpoint.d.ts +7 -0
- package/server/utils/breakpoint.js +11 -0
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +1 -0
- package/build/cjs/components/ContentList/ContentListItemIcon.js.map +0 -1
- package/build/cjs/context/windowWidthContext/BreakpointContext.js.map +0 -1
- package/build/esm/components/ContentList/ContentListItemIcon.js.map +0 -1
- package/build/esm/context/windowWidthContext/BreakpointContext.js.map +0 -1
- /package/build/cjs/context/windowWidthContext/{BreakpointContext.d.ts → WindowWidthContext.d.ts} +0 -0
- /package/build/esm/context/windowWidthContext/{BreakpointContext.d.ts → WindowWidthContext.d.ts} +0 -0
|
@@ -164,6 +164,17 @@ export declare const FormBlock: {
|
|
|
164
164
|
};
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
|
+
labels: {
|
|
168
|
+
type: string;
|
|
169
|
+
items: {
|
|
170
|
+
type: string;
|
|
171
|
+
properties: {
|
|
172
|
+
when: {
|
|
173
|
+
type: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
};
|
|
167
178
|
controlPosition: {
|
|
168
179
|
type: string;
|
|
169
180
|
enum: string[];
|
|
@@ -173,7 +184,7 @@ export declare const FormBlock: {
|
|
|
173
184
|
direction: {
|
|
174
185
|
enum: string[];
|
|
175
186
|
};
|
|
176
|
-
|
|
187
|
+
background: {
|
|
177
188
|
oneOf: ({
|
|
178
189
|
type: string;
|
|
179
190
|
properties: {
|
|
@@ -200,9 +211,6 @@ export declare const FormBlock: {
|
|
|
200
211
|
pattern?: undefined;
|
|
201
212
|
})[];
|
|
202
213
|
};
|
|
203
|
-
backgroundColor: {
|
|
204
|
-
type: string;
|
|
205
|
-
};
|
|
206
214
|
anchor: {
|
|
207
215
|
type: string;
|
|
208
216
|
additionalProperties: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/Form/schema.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,uBAAoB;AAE/B,OAAO,EAAC,UAAU,EAAC,yCAAsC;AACzD,OAAO,EAAC,eAAe,EAAC,8CAA2C;AACnE,OAAO,EAAC,cAAc,EAAE,SAAS,EAAC,0CAAuC;AACzE,OAAO,EAAC,WAAW,EAAC,2CAAwC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,+CAA4C;AAErE,MAAM,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,YAAY,EAAE;QACV,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,UAAU,EAAE;YACR,GAAG,cAAc;YACjB,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;aACjB;YACD,QAAQ,EAAE;gBACN,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,QAAQ;wBACpB,UAAU,EAAE;4BACR,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC;yBACrC;qBACJ;oBACD;wBACI,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,SAAS;wBACrB,UAAU,EAAE;4BACR,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC;yBACvC;qBACJ;iBACJ;aACJ;YACD,WAAW,EAAE;gBACT,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE,qBAAqB;aACpC;YACD,SAAS,EAAE;gBACP,IAAI,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,CAAC;aACnD;YACD,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/Form/schema.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,uBAAoB;AAE/B,OAAO,EAAC,UAAU,EAAC,yCAAsC;AACzD,OAAO,EAAC,eAAe,EAAC,8CAA2C;AACnE,OAAO,EAAC,cAAc,EAAE,SAAS,EAAC,0CAAuC;AACzE,OAAO,EAAC,WAAW,EAAC,2CAAwC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,+CAA4C;AAErE,MAAM,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,YAAY,EAAE;QACV,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,UAAU,EAAE;YACR,GAAG,cAAc;YACjB,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;aACjB;YACD,QAAQ,EAAE;gBACN,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,QAAQ;wBACpB,UAAU,EAAE;4BACR,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC;yBACrC;qBACJ;oBACD;wBACI,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,SAAS;wBACrB,UAAU,EAAE;4BACR,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC;yBACvC;qBACJ;iBACJ;aACJ;YACD,WAAW,EAAE;gBACT,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE,qBAAqB;aACpC;YACD,SAAS,EAAE;gBACP,IAAI,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,CAAC;aACnD;YACD,UAAU,EAAE,UAAU;SACzB;KACJ;CACJ,CAAC","sourcesContent":["import omit from 'lodash/omit';\n\nimport {ImageProps} from '../../components/Image/schema';\nimport {YandexFormProps} from '../../components/YandexForm/schema';\nimport {BlockBaseProps, withTheme} from '../../schema/validators/common';\nimport {ContentBase} from '../../sub-blocks/Content/schema';\nimport {HubspotFormProps} from '../../sub-blocks/HubspotForm/schema';\n\nconst FormBlockContentProps = omit(ContentBase, ['size', 'centered', 'colSizes']);\n\nexport const FormBlock = {\n 'form-block': {\n additionalProperties: false,\n required: ['formData'],\n properties: {\n ...BlockBaseProps,\n title: {\n type: 'string',\n },\n formData: {\n oneOf: [\n {\n type: 'object',\n optionName: 'yandex',\n properties: {\n yandex: withTheme(YandexFormProps),\n },\n },\n {\n type: 'object',\n optionName: 'hubspot',\n properties: {\n hubspot: withTheme(HubspotFormProps),\n },\n },\n ],\n },\n textContent: {\n additionalProperties: false,\n properties: FormBlockContentProps,\n },\n direction: {\n enum: ['content-form', 'form-content', 'center'],\n },\n background: ImageProps,\n },\n },\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const BACKGROUND_STYLE_PROPS: readonly ["background", "backgroundAttachment", "backgroundBlendMode", "backgroundClip", "backgroundColor", "backgroundImage", "backgroundOrigin", "backgroundPositionX", "backgroundPositionY", "backgroundRepeat", "backgroundSize", "backgroundPosition"];
|
|
3
|
+
export declare const hasBackgroundCSS: (style: React.CSSProperties) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const BACKGROUND_STYLE_PROPS = [
|
|
2
|
+
'background',
|
|
3
|
+
'backgroundAttachment',
|
|
4
|
+
'backgroundBlendMode',
|
|
5
|
+
'backgroundClip',
|
|
6
|
+
'backgroundColor',
|
|
7
|
+
'backgroundImage',
|
|
8
|
+
'backgroundOrigin',
|
|
9
|
+
'backgroundPositionX',
|
|
10
|
+
'backgroundPositionY',
|
|
11
|
+
'backgroundRepeat',
|
|
12
|
+
'backgroundSize',
|
|
13
|
+
'backgroundPosition',
|
|
14
|
+
];
|
|
15
|
+
export const hasBackgroundCSS = (style) => BACKGROUND_STYLE_PROPS.some((backgroundStyleProp) => backgroundStyleProp in style);
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"../../../../src","sources":["blocks/Form/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,YAAY;IACZ,sBAAsB;IACtB,qBAAqB;IACrB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,oBAAoB;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA0B,EAAE,EAAE,CAC3D,sBAAsB,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,mBAAmB,IAAI,KAAK,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nexport const BACKGROUND_STYLE_PROPS = [\n 'background',\n 'backgroundAttachment',\n 'backgroundBlendMode',\n 'backgroundClip',\n 'backgroundColor',\n 'backgroundImage',\n 'backgroundOrigin',\n 'backgroundPositionX',\n 'backgroundPositionY',\n 'backgroundRepeat',\n 'backgroundSize',\n 'backgroundPosition',\n] as const;\n\nexport const hasBackgroundCSS = (style: React.CSSProperties) =>\n BACKGROUND_STYLE_PROPS.some((backgroundStyleProp) => backgroundStyleProp in style);\n"]}
|
|
@@ -135,6 +135,17 @@ export declare const InfoBlock: {
|
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
|
+
labels: {
|
|
139
|
+
type: string;
|
|
140
|
+
items: {
|
|
141
|
+
type: string;
|
|
142
|
+
properties: {
|
|
143
|
+
when: {
|
|
144
|
+
type: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
138
149
|
controlPosition: {
|
|
139
150
|
type: string;
|
|
140
151
|
enum: string[];
|
|
@@ -226,6 +237,17 @@ export declare const InfoBlock: {
|
|
|
226
237
|
};
|
|
227
238
|
};
|
|
228
239
|
};
|
|
240
|
+
labels: {
|
|
241
|
+
type: string;
|
|
242
|
+
items: {
|
|
243
|
+
type: string;
|
|
244
|
+
properties: {
|
|
245
|
+
when: {
|
|
246
|
+
type: string;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
};
|
|
229
251
|
controlPosition: {
|
|
230
252
|
type: string;
|
|
231
253
|
enum: string[];
|
|
@@ -421,6 +421,17 @@ export declare const MapBlock: {
|
|
|
421
421
|
type: string;
|
|
422
422
|
enum: string[];
|
|
423
423
|
};
|
|
424
|
+
labels: {
|
|
425
|
+
type: string;
|
|
426
|
+
items: {
|
|
427
|
+
type: string;
|
|
428
|
+
properties: {
|
|
429
|
+
when: {
|
|
430
|
+
type: string;
|
|
431
|
+
};
|
|
432
|
+
};
|
|
433
|
+
};
|
|
434
|
+
};
|
|
424
435
|
additionalInfo: {
|
|
425
436
|
type: string;
|
|
426
437
|
contentType: string;
|
|
@@ -537,6 +537,17 @@ export declare const MediaBlockBaseProps: {
|
|
|
537
537
|
type: string;
|
|
538
538
|
enum: string[];
|
|
539
539
|
};
|
|
540
|
+
labels: {
|
|
541
|
+
type: string;
|
|
542
|
+
items: {
|
|
543
|
+
type: string;
|
|
544
|
+
properties: {
|
|
545
|
+
when: {
|
|
546
|
+
type: string;
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
};
|
|
540
551
|
additionalInfo: {
|
|
541
552
|
type: string;
|
|
542
553
|
contentType: string;
|
|
@@ -1178,6 +1189,17 @@ export declare const MediaBlock: {
|
|
|
1178
1189
|
type: string;
|
|
1179
1190
|
enum: string[];
|
|
1180
1191
|
};
|
|
1192
|
+
labels: {
|
|
1193
|
+
type: string;
|
|
1194
|
+
items: {
|
|
1195
|
+
type: string;
|
|
1196
|
+
properties: {
|
|
1197
|
+
when: {
|
|
1198
|
+
type: string;
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1201
|
+
};
|
|
1202
|
+
};
|
|
1181
1203
|
additionalInfo: {
|
|
1182
1204
|
type: string;
|
|
1183
1205
|
contentType: string;
|
|
@@ -51,6 +51,17 @@ export declare const QuestionsBlock: {
|
|
|
51
51
|
contentType: string;
|
|
52
52
|
inputType: string;
|
|
53
53
|
};
|
|
54
|
+
labels: {
|
|
55
|
+
type: string;
|
|
56
|
+
items: {
|
|
57
|
+
type: string;
|
|
58
|
+
properties: {
|
|
59
|
+
when: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
54
65
|
additionalInfo: {
|
|
55
66
|
type: string;
|
|
56
67
|
contentType: string;
|
|
@@ -571,6 +571,17 @@ export declare const tabsItem: {
|
|
|
571
571
|
};
|
|
572
572
|
};
|
|
573
573
|
} | undefined;
|
|
574
|
+
labels?: {
|
|
575
|
+
type: string;
|
|
576
|
+
items: {
|
|
577
|
+
type: string;
|
|
578
|
+
properties: {
|
|
579
|
+
when: {
|
|
580
|
+
type: string;
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
} | undefined;
|
|
574
585
|
controlPosition?: {
|
|
575
586
|
type: string;
|
|
576
587
|
enum: string[];
|
package/build/esm/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ClassNameProps, GravityIconProps, ImageProps, QAProps, SVGIcon } from "../../models/index.js";
|
|
2
2
|
import { ThemeSupporting } from "../../utils/index.js";
|
|
3
|
-
interface
|
|
3
|
+
interface ContentIconProps extends QAProps, ClassNameProps {
|
|
4
4
|
icon?: ThemeSupporting<ImageProps | SVGIcon>;
|
|
5
5
|
gravityIcon?: ThemeSupporting<GravityIconProps>;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const ContentIcon: ({ icon, className, qa, gravityIcon }: ContentIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default ContentIcon;
|
package/build/esm/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js}
RENAMED
|
@@ -5,7 +5,7 @@ import Icon from "../Icon/Icon.js";
|
|
|
5
5
|
function isIconSvg(icon) {
|
|
6
6
|
return typeof icon === 'function';
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const ContentIcon = ({ icon, className, qa, gravityIcon }) => {
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
const iconThemed = getThemedValue(icon, theme);
|
|
11
11
|
const gravityIconThemed = getThemedValue(gravityIcon, theme);
|
|
@@ -15,5 +15,5 @@ const ContentListItemIcon = ({ icon, className, qa, gravityIcon }) => {
|
|
|
15
15
|
}
|
|
16
16
|
return _jsx(Icon, { icon: iconThemed, gravityIcon: gravityIconThemed, className: className, qa: qa });
|
|
17
17
|
};
|
|
18
|
-
export default
|
|
19
|
-
//# sourceMappingURL=
|
|
18
|
+
export default ContentIcon;
|
|
19
|
+
//# sourceMappingURL=ContentIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentIcon.js","sourceRoot":"../../../../src","sources":["components/ContentIcon/ContentIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAE7C,OAAO,EAAkB,cAAc,EAAC,6BAAoB;AAC5D,OAAO,IAAI,wBAAqB;AAOhC,SAAS,SAAS,CAAC,IAA0B;IACzC,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC;AACtC,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAmB,EAAE,EAAE;IACzE,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/C,MAAM,iBAAiB,GAAG,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAE7D,IAAI,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,aAAa,GAAG,UAAU,CAAC;QACjC,OAAO,CACH,wBACI,KAAC,aAAa,IAAC,SAAS,EAAE,SAAS,GAAI,GACrC,CACT,CAAC;IACN,CAAC;IAED,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,GAAI,CAAC;AACpG,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {useTheme} from '../../context/theme';\nimport {ClassNameProps, GravityIconProps, ImageProps, QAProps, SVGIcon} from '../../models';\nimport {ThemeSupporting, getThemedValue} from '../../utils';\nimport Icon from '../Icon/Icon';\n\ninterface ContentIconProps extends QAProps, ClassNameProps {\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nfunction isIconSvg(icon: ImageProps | SVGIcon): icon is SVGIcon {\n return typeof icon === 'function';\n}\n\nconst ContentIcon = ({icon, className, qa, gravityIcon}: ContentIconProps) => {\n const theme = useTheme();\n const iconThemed = getThemedValue(icon, theme);\n const gravityIconThemed = getThemedValue(gravityIcon, theme);\n\n if (iconThemed && isIconSvg(iconThemed)) {\n const IconComponent = iconThemed;\n return (\n <div>\n <IconComponent className={className} />\n </div>\n );\n }\n\n return <Icon icon={iconThemed} gravityIcon={gravityIconThemed} className={className} qa={qa} />;\n};\n\nexport default ContentIcon;\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-content-labels {
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
}
|
|
8
|
+
.pc-content-labels__label {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
flex-wrap: nowrap;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
padding: 5px 11px;
|
|
14
|
+
background-color: var(--g-color-base-generic);
|
|
15
|
+
border-radius: 6px;
|
|
16
|
+
}
|
|
17
|
+
.pc-content-labels__label, .pc-content-labels__label-text {
|
|
18
|
+
color: var(--g-color-text-primary);
|
|
19
|
+
}
|
|
20
|
+
.pc-content-labels__label > .pc-icon, .pc-content-labels__label > picture {
|
|
21
|
+
display: flex;
|
|
22
|
+
}
|
|
23
|
+
.pc-content-labels__label-icon {
|
|
24
|
+
width: 16px;
|
|
25
|
+
height: 16px;
|
|
26
|
+
margin-inline-end: 6px;
|
|
27
|
+
}
|
|
28
|
+
.pc-content-labels__label_theme_light {
|
|
29
|
+
background-color: var(--g-color-private-black-50);
|
|
30
|
+
}
|
|
31
|
+
.pc-content-labels__label_theme_light,
|
|
32
|
+
.pc-content-labels__label_theme_light .pc-content-labels__label-text {
|
|
33
|
+
color: var(--g-color-text-dark-primary);
|
|
34
|
+
}
|
|
35
|
+
.pc-content-labels__label_theme_dark {
|
|
36
|
+
background-color: var(--g-color-private-white-100);
|
|
37
|
+
}
|
|
38
|
+
.pc-content-labels__label_theme_dark,
|
|
39
|
+
.pc-content-labels__label_theme_dark .pc-content-labels__label-text {
|
|
40
|
+
color: var(--g-color-text-light-primary);
|
|
41
|
+
}
|
|
42
|
+
.pc-content-labels_size_l .pc-content-labels__label, .pc-content-labels_size_m .pc-content-labels__label {
|
|
43
|
+
font-family: var(--g-text-body-font-family);
|
|
44
|
+
font-weight: var(--g-text-body-font-weight);
|
|
45
|
+
font-size: var(--g-text-body-3-font-size);
|
|
46
|
+
line-height: var(--g-text-body-3-line-height);
|
|
47
|
+
}
|
|
48
|
+
.pc-content-labels_size_s .pc-content-labels__label {
|
|
49
|
+
font-family: var(--g-text-body-font-family);
|
|
50
|
+
font-weight: var(--g-text-body-font-weight);
|
|
51
|
+
font-size: var(--g-text-body-2-font-size);
|
|
52
|
+
line-height: var(--g-text-body-2-line-height);
|
|
53
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ClassNameProps, ContentLabelsProps, QAProps } from "../../models/index.js";
|
|
2
|
+
import './ContentLabels.css';
|
|
3
|
+
declare const ContentLabels: ({ className, labels, theme, size, qa, }: ContentLabelsProps & ClassNameProps & QAProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default ContentLabels;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block, getQaAttrubutes } from "../../utils/index.js";
|
|
3
|
+
import ContentIcon from "../ContentIcon/ContentIcon.js";
|
|
4
|
+
import './ContentLabels.css';
|
|
5
|
+
const b = block('content-labels');
|
|
6
|
+
const ContentLabels = ({ className, labels, theme, size = 'l', qa, }) => {
|
|
7
|
+
const qaAttributes = getQaAttrubutes(qa, ['icon', 'text']);
|
|
8
|
+
return (_jsx("div", { className: b({ size }, className), children: labels.map((label) => {
|
|
9
|
+
const { text, icon, gravityIcon } = label;
|
|
10
|
+
return (_jsxs("div", { className: b('label', { theme }), children: [_jsx(ContentIcon, { className: b('label-icon'), icon: icon, gravityIcon: gravityIcon, qa: qaAttributes.icon }), _jsx("span", { className: b('label-text'), "data-qa": qaAttributes.text, children: text })] }, text));
|
|
11
|
+
}) }));
|
|
12
|
+
};
|
|
13
|
+
export default ContentLabels;
|
|
14
|
+
//# sourceMappingURL=ContentLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentLabels.js","sourceRoot":"../../../../src","sources":["components/ContentLabels/ContentLabels.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,6BAAoB;AACnD,OAAO,WAAW,sCAAmC;AAErD,OAAO,qBAAqB,CAAC;AAE7B,MAAM,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAElC,MAAM,aAAa,GAAG,CAAC,EACnB,SAAS,EACT,MAAM,EACN,KAAK,EACL,IAAI,GAAG,GAAG,EACV,EAAE,GAC0C,EAAE,EAAE;IAChD,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAE3D,OAAO,CACH,cAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAC,EAAE,SAAS,CAAC,YAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAClB,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAC,GAAG,KAAK,CAAC;YAExC,OAAO,CACH,eAAgB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,KAAK,EAAC,CAAC,aAC1C,KAAC,WAAW,IACR,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,EAC1B,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,YAAY,CAAC,IAAI,GACvB,EACF,eAAM,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,aAAW,YAAY,CAAC,IAAI,YACvD,IAAI,GACF,KATD,IAAI,CAUR,CACT,CAAC;QACN,CAAC,CAAC,GACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {ClassNameProps, ContentLabelsProps, QAProps} from '../../models';\nimport {block, getQaAttrubutes} from '../../utils';\nimport ContentIcon from '../ContentIcon/ContentIcon';\n\nimport './ContentLabels.scss';\n\nconst b = block('content-labels');\n\nconst ContentLabels = ({\n className,\n labels,\n theme,\n size = 'l',\n qa,\n}: ContentLabelsProps & ClassNameProps & QAProps) => {\n const qaAttributes = getQaAttrubutes(qa, ['icon', 'text']);\n\n return (\n <div className={b({size}, className)}>\n {labels.map((label) => {\n const {text, icon, gravityIcon} = label;\n\n return (\n <div key={text} className={b('label', {theme})}>\n <ContentIcon\n className={b('label-icon')}\n icon={icon}\n gravityIcon={gravityIcon}\n qa={qaAttributes.icon}\n />\n <span className={b('label-text')} data-qa={qaAttributes.text}>\n {text}\n </span>\n </div>\n );\n })}\n </div>\n );\n};\n\nexport default ContentLabels;\n"]}
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { block } from "../../utils/index.js";
|
|
5
5
|
import { getQaAttrubutes } from "../../utils/blocks.js";
|
|
6
|
+
import ContentIcon from "../ContentIcon/ContentIcon.js";
|
|
6
7
|
import YFMWrapper from "../YFMWrapper/YFMWrapper.js";
|
|
7
|
-
import ItemIcon from "./ContentListItemIcon.js";
|
|
8
8
|
import './ContentList.css';
|
|
9
9
|
const b = block('content-list');
|
|
10
10
|
function getHeadingLevel(size) {
|
|
@@ -20,7 +20,7 @@ const ContentList = ({ list, size = 'l', qa, theme }) => {
|
|
|
20
20
|
const qaAttributes = getQaAttrubutes(qa, ['image', 'title', 'text']);
|
|
21
21
|
return (_jsx("div", { className: b({ size, theme }), "data-qa": qa, children: list?.map((item) => {
|
|
22
22
|
const { icon, title, text, gravityIcon } = item;
|
|
23
|
-
return (_jsxs("div", { className: b('item', { 'without-title': !title }), children: [_jsx(
|
|
23
|
+
return (_jsxs("div", { className: b('item', { 'without-title': !title }), children: [_jsx(ContentIcon, { icon: icon, className: b('icon'), qa: qaAttributes.image, gravityIcon: gravityIcon }), _jsxs("div", { children: [title &&
|
|
24
24
|
React.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, _jsx(YFMWrapper, { content: title, modifiers: { constructor: true } })), text && (_jsx(YFMWrapper, { contentClassName: b('text', { 'without-title': !title }), content: text, modifiers: { constructor: true }, qa: qaAttributes.text }))] })] }, uuidv4()));
|
|
25
25
|
}) }));
|
|
26
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentList.js","sourceRoot":"../../../../src","sources":["components/ContentList/ContentList.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,EAAC,eAAe,EAAC,8BAA2B;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"ContentList.js","sourceRoot":"../../../../src","sources":["components/ContentList/ContentList.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,EAAC,eAAe,EAAC,8BAA2B;AACnD,OAAO,WAAW,sCAAmC;AACrD,OAAO,UAAU,oCAAiC;AAElD,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAEhC,SAAS,eAAe,CAAC,IAAiB;IACtC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC;QACT;YACI,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,EAAC,IAAI,EAAE,IAAI,GAAG,GAAG,EAAE,EAAE,EAAE,KAAK,EAA6B,EAAE,EAAE;IAC9E,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAErE,OAAO,CACH,cAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,aAAW,EAAE,YACxC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC;YAC9C,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,eAAe,EAAE,CAAC,KAAK,EAAC,CAAC,aAChD,KAAC,WAAW,IACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EACpB,EAAE,EAAE,YAAY,CAAC,KAAK,EACtB,WAAW,EAAE,WAAW,GAC1B,EACF,0BACK,KAAK;gCACF,KAAK,CAAC,aAAa,CACf,eAAe,CAAC,IAAI,CAAC,EACrB,EAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,KAAK,EAAC,EACtD,KAAC,UAAU,IAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAC,WAAW,EAAE,IAAI,EAAC,GAAI,CACjE,EACJ,IAAI,IAAI,CACL,KAAC,UAAU,IACP,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,eAAe,EAAE,CAAC,KAAK,EAAC,CAAC,EACtD,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,EAAC,WAAW,EAAE,IAAI,EAAC,EAC9B,EAAE,EAAE,YAAY,CAAC,IAAI,GACvB,CACL,IACC,KAtBiD,MAAM,EAAE,CAuB7D,CACT,CAAC;QACN,CAAC,CAAC,GACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {v4 as uuidv4} from 'uuid';\n\nimport {ContentListProps, ContentSize} from '../../models';\nimport {QAProps} from '../../models/common';\nimport {block} from '../../utils';\nimport {getQaAttrubutes} from '../../utils/blocks';\nimport ContentIcon from '../ContentIcon/ContentIcon';\nimport YFMWrapper from '../YFMWrapper/YFMWrapper';\n\nimport './ContentList.scss';\n\nconst b = block('content-list');\n\nfunction getHeadingLevel(size: ContentSize) {\n switch (size) {\n case 's':\n return 'h4';\n case 'l':\n default:\n return 'h3';\n }\n}\n\nconst ContentList = ({list, size = 'l', qa, theme}: ContentListProps & QAProps) => {\n const qaAttributes = getQaAttrubutes(qa, ['image', 'title', 'text']);\n\n return (\n <div className={b({size, theme})} data-qa={qa}>\n {list?.map((item) => {\n const {icon, title, text, gravityIcon} = item;\n return (\n <div className={b('item', {'without-title': !title})} key={uuidv4()}>\n <ContentIcon\n icon={icon}\n className={b('icon')}\n qa={qaAttributes.image}\n gravityIcon={gravityIcon}\n />\n <div>\n {title &&\n React.createElement(\n getHeadingLevel(size),\n {className: b('title'), 'data-qa': qaAttributes.title},\n <YFMWrapper content={title} modifiers={{constructor: true}} />,\n )}\n {text && (\n <YFMWrapper\n contentClassName={b('text', {'without-title': !title})}\n content={text}\n modifiers={{constructor: true}}\n qa={qaAttributes.text}\n />\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n};\n\nexport default ContentList;\n"]}
|
|
@@ -2,17 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import throttle from "lodash/throttle.js";
|
|
4
4
|
import { BREAKPOINTS } from "../../constants.js";
|
|
5
|
-
import { SSRContext } from "../ssrContext/index.js";
|
|
6
5
|
const DEFAULT_WIDTH = BREAKPOINTS.xl;
|
|
7
6
|
const UPDATE_FREQUENCY_MS = 100;
|
|
8
7
|
export const WindowWidthContext = React.createContext(DEFAULT_WIDTH);
|
|
9
8
|
export const WindowWidthProvider = ({ children }) => {
|
|
10
|
-
const { isServer } = React.useContext(SSRContext);
|
|
11
9
|
const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);
|
|
12
10
|
React.useEffect(() => {
|
|
13
|
-
if (isServer) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
11
|
const handleResize = throttle(() => {
|
|
17
12
|
setWindowWidth(window.innerWidth);
|
|
18
13
|
}, UPDATE_FREQUENCY_MS, { leading: true });
|
|
@@ -20,8 +15,8 @@ export const WindowWidthProvider = ({ children }) => {
|
|
|
20
15
|
window.addEventListener('resize', handleResize, { passive: true });
|
|
21
16
|
// eslint-disable-next-line consistent-return
|
|
22
17
|
return () => window.removeEventListener('resize', handleResize);
|
|
23
|
-
}, [
|
|
18
|
+
}, []);
|
|
24
19
|
return (_jsx(WindowWidthContext.Provider, { value: windowWidth, children: children }));
|
|
25
20
|
};
|
|
26
21
|
export const useWindowWidth = () => React.useContext(WindowWidthContext);
|
|
27
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=WindowWidthContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowWidthContext.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/WindowWidthContext.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,QAAQ,2BAAwB;AAEvC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,MAAM,aAAa,GAAG,WAAW,CAAC,EAAE,CAAC;AACrC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAS,aAAa,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAC,QAAQ,EAA0B,EAAE,EAAE;IACvE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,MAAM,YAAY,GAAG,QAAQ,CACzB,GAAG,EAAE;YACD,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACtC,CAAC,EACD,mBAAmB,EACnB,EAAC,OAAO,EAAE,IAAI,EAAC,CAClB,CAAC;QAEF,YAAY,EAAE,CAAC;QAEf,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAEjE,6CAA6C;QAC7C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACH,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAAG,QAAQ,GAA+B,CAC5F,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport throttle from 'lodash/throttle';\n\nimport {BREAKPOINTS} from '../../constants';\n\nconst DEFAULT_WIDTH = BREAKPOINTS.xl;\nconst UPDATE_FREQUENCY_MS = 100;\n\nexport const WindowWidthContext = React.createContext<number>(DEFAULT_WIDTH);\n\nexport const WindowWidthProvider = ({children}: React.PropsWithChildren) => {\n const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);\n\n React.useEffect(() => {\n const handleResize = throttle(\n () => {\n setWindowWidth(window.innerWidth);\n },\n UPDATE_FREQUENCY_MS,\n {leading: true},\n );\n\n handleResize();\n\n window.addEventListener('resize', handleResize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => window.removeEventListener('resize', handleResize);\n }, []);\n\n return (\n <WindowWidthContext.Provider value={windowWidth}>{children}</WindowWidthContext.Provider>\n );\n};\n\nexport const useWindowWidth = () => React.useContext(WindowWidthContext);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./WindowWidthContext.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./WindowWidthContext.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/index.ts"],"names":[],"mappings":"AAAA,wCAAqC","sourcesContent":["export * from './WindowWidthContext';\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { BREAKPOINTS } from "../constants.js";
|
|
3
|
+
import { useWindowWidth } from "../context/windowWidthContext/index.js";
|
|
4
|
+
import { Device } from "../models/index.js";
|
|
5
|
+
import { isDeviceValue } from "../utils/index.js";
|
|
6
|
+
const getDeviceBreakpoints = (inclusive) => {
|
|
7
|
+
const shift = inclusive ? 0 : -1;
|
|
8
|
+
return [BREAKPOINTS.md + shift, BREAKPOINTS.sm + shift];
|
|
9
|
+
};
|
|
10
|
+
export function useDeviceValue(value, inclusive) {
|
|
11
|
+
const windowWidth = useWindowWidth();
|
|
12
|
+
const [tablet, mobile] = React.useMemo(() => getDeviceBreakpoints(inclusive), [inclusive]);
|
|
13
|
+
const isMobile = windowWidth <= mobile;
|
|
14
|
+
const isTablet = windowWidth <= tablet;
|
|
15
|
+
return React.useMemo(() => {
|
|
16
|
+
if (!isDeviceValue(value)) {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
switch (true) {
|
|
20
|
+
case isMobile:
|
|
21
|
+
return value[Device.Mobile];
|
|
22
|
+
case isTablet:
|
|
23
|
+
return value[Device.Tablet] ?? value[Device.Mobile];
|
|
24
|
+
default:
|
|
25
|
+
return value[Device.Desktop];
|
|
26
|
+
}
|
|
27
|
+
}, [isMobile, isTablet, value]);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=useDeviceValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeviceValue.js","sourceRoot":"../../../src","sources":["hooks/useDeviceValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,WAAW,EAAC,wBAAqB;AACzC,OAAO,EAAC,cAAc,EAAC,+CAAsC;AAC7D,OAAO,EAAC,MAAM,EAAC,2BAAkB;AACjC,OAAO,EAAmB,aAAa,EAAC,0BAAiB;AAEzD,MAAM,oBAAoB,GAAG,CAAC,SAAmB,EAAoC,EAAE;IACnF,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjC,OAAO,CAAC,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,WAAW,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,MAAM,UAAU,cAAc,CAAI,KAA0B,EAAE,SAAmB;IAC7E,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAE3F,MAAM,QAAQ,GAAG,WAAW,IAAI,MAAM,CAAC;IACvC,MAAM,QAAQ,GAAG,WAAW,IAAI,MAAM,CAAC;IAEvC,OAAO,KAAK,CAAC,OAAO,CAAI,GAAG,EAAE;QACzB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,QAAQ,IAAI,EAAE,CAAC;YACX,KAAK,QAAQ;gBACT,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,KAAK,QAAQ;gBACT,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACxD;gBACI,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACrC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BREAKPOINTS} from '../constants';\nimport {useWindowWidth} from '../context/windowWidthContext';\nimport {Device} from '../models';\nimport {DeviceSupporting, isDeviceValue} from '../utils';\n\nconst getDeviceBreakpoints = (inclusive?: boolean): [tablet: number, mobile: number] => {\n const shift = inclusive ? 0 : -1;\n\n return [BREAKPOINTS.md + shift, BREAKPOINTS.sm + shift];\n};\n\nexport function useDeviceValue<T>(value: DeviceSupporting<T>, inclusive?: boolean): T {\n const windowWidth = useWindowWidth();\n\n const [tablet, mobile] = React.useMemo(() => getDeviceBreakpoints(inclusive), [inclusive]);\n\n const isMobile = windowWidth <= mobile;\n const isTablet = windowWidth <= tablet;\n\n return React.useMemo<T>(() => {\n if (!isDeviceValue(value)) {\n return value;\n }\n\n switch (true) {\n case isMobile:\n return value[Device.Mobile];\n case isTablet:\n return value[Device.Tablet] ?? value[Device.Mobile];\n default:\n return value[Device.Desktop];\n }\n }, [isMobile, isTablet, value]);\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ButtonSize } from '@gravity-ui/uikit';
|
|
3
3
|
import { GridColumnSize, GridColumnSizesType, IndentValue } from "../../grid/types.js";
|
|
4
4
|
import { ThemeSupporting } from "../../utils/index.js";
|
|
5
|
+
import { DeviceSupporting } from "../../utils/breakpoint.js";
|
|
5
6
|
import { AnalyticsEventsBase } from "../common.js";
|
|
6
7
|
import { AnchorProps, Animatable, BackgroundImageProps, ButtonProps, CardBorder, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, GravityIconProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, ImageProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, MediaView, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleItemBaseProps, TitleItemProps, WithBorder, YandexFormProps } from "./common.js";
|
|
7
8
|
import { BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels } from "./sub-blocks.js";
|
|
@@ -143,7 +144,7 @@ export interface HeaderBlockProps {
|
|
|
143
144
|
status?: JSX.Element;
|
|
144
145
|
renderTitle?: (title: string) => React.ReactNode;
|
|
145
146
|
}
|
|
146
|
-
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {
|
|
147
|
+
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title' | 'labels'> {
|
|
147
148
|
title: string;
|
|
148
149
|
label?: string;
|
|
149
150
|
icon?: ThemedImage;
|
|
@@ -174,7 +175,7 @@ export interface QuestionItem {
|
|
|
174
175
|
listStyle?: 'dash' | 'disk';
|
|
175
176
|
link?: LinkProps;
|
|
176
177
|
}
|
|
177
|
-
export interface QuestionsProps extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
178
|
+
export interface QuestionsProps extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'labels'> {
|
|
178
179
|
items: QuestionItem[];
|
|
179
180
|
}
|
|
180
181
|
export interface QuestionBlockItemProps extends QuestionItem {
|
|
@@ -187,7 +188,7 @@ export interface FoldableListItem {
|
|
|
187
188
|
listStyle?: 'dash' | 'disk';
|
|
188
189
|
link?: LinkProps;
|
|
189
190
|
}
|
|
190
|
-
export interface FoldableListProps extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {
|
|
191
|
+
export interface FoldableListProps extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme' | 'labels'> {
|
|
191
192
|
items: FoldableListItem[];
|
|
192
193
|
}
|
|
193
194
|
export interface FoldableListBlockItemProps extends FoldableListItem {
|
|
@@ -208,7 +209,7 @@ export interface MediaBaseBlockProps extends Animatable, MediaContentProps {
|
|
|
208
209
|
mediaOnly?: boolean;
|
|
209
210
|
mediaOnlyColSizes?: GridColumnSizesType;
|
|
210
211
|
}
|
|
211
|
-
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {
|
|
212
|
+
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered' | 'labels'> {
|
|
212
213
|
description?: string;
|
|
213
214
|
/** @deprecated Use array of buttons from ContentBlockProps instead**/
|
|
214
215
|
button?: ButtonProps;
|
|
@@ -230,8 +231,8 @@ export interface InfoBlockProps {
|
|
|
230
231
|
sectionsTitle?: string;
|
|
231
232
|
/** @deprecated **/
|
|
232
233
|
links?: Pick<LinkProps, 'text' | 'url'>[];
|
|
233
|
-
leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;
|
|
234
|
-
rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;
|
|
234
|
+
leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size' | 'labels'>;
|
|
235
|
+
rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size' | 'labels'>;
|
|
235
236
|
}
|
|
236
237
|
export interface TableProps {
|
|
237
238
|
content: string[][];
|
|
@@ -248,7 +249,7 @@ export interface TableBlockProps {
|
|
|
248
249
|
title: string;
|
|
249
250
|
table: TableProps;
|
|
250
251
|
}
|
|
251
|
-
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>, WithBorder {
|
|
252
|
+
export interface TabsBlockItem extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme' | 'labels'>, WithBorder {
|
|
252
253
|
tabName: string;
|
|
253
254
|
/**
|
|
254
255
|
* @deprecated Use array links from ContentBlockProps instead
|
|
@@ -314,7 +315,7 @@ interface ContentLayoutBlockParams {
|
|
|
314
315
|
textWidth?: ContentTextSize;
|
|
315
316
|
}
|
|
316
317
|
export interface ContentLayoutBlockProps extends ContentLayoutBlockParams {
|
|
317
|
-
textContent: ContentBlockProps
|
|
318
|
+
textContent: Omit<ContentBlockProps, 'labels'>;
|
|
318
319
|
fileContent?: FileLinkProps[];
|
|
319
320
|
}
|
|
320
321
|
export type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;
|
|
@@ -329,6 +330,16 @@ export interface ContentListProps {
|
|
|
329
330
|
size: ContentSize;
|
|
330
331
|
theme?: ContentTheme;
|
|
331
332
|
}
|
|
333
|
+
export interface ContentLabelProps {
|
|
334
|
+
text: string;
|
|
335
|
+
icon?: ThemeSupporting<ImageProps | SVGIcon>;
|
|
336
|
+
gravityIcon?: ThemeSupporting<GravityIconProps>;
|
|
337
|
+
}
|
|
338
|
+
export interface ContentLabelsProps {
|
|
339
|
+
labels: ContentLabelProps[];
|
|
340
|
+
size?: ContentSize;
|
|
341
|
+
theme?: ContentTheme;
|
|
342
|
+
}
|
|
332
343
|
export interface ContentBlockProps {
|
|
333
344
|
title?: TitleItemBaseProps | string;
|
|
334
345
|
titleId?: string;
|
|
@@ -342,6 +353,7 @@ export interface ContentBlockProps {
|
|
|
342
353
|
centered?: boolean;
|
|
343
354
|
theme?: ContentTheme;
|
|
344
355
|
list?: ContentItemProps[];
|
|
356
|
+
labels?: ContentLabelProps[];
|
|
345
357
|
controlPosition?: 'default' | 'bottom';
|
|
346
358
|
}
|
|
347
359
|
export declare enum PCShareSocialNetwork {
|
|
@@ -371,12 +383,16 @@ export interface FormBlockHubspotData {
|
|
|
371
383
|
hubspot: ThemeSupporting<HubspotFormProps>;
|
|
372
384
|
}
|
|
373
385
|
export type FormBlockData = FormBlockYandexData | FormBlockHubspotData;
|
|
386
|
+
export interface FormBlockBackgroundProps extends Omit<BackgroundImageProps, 'style'> {
|
|
387
|
+
style?: DeviceSupporting<React.CSSProperties>;
|
|
388
|
+
}
|
|
374
389
|
export interface FormBlockProps {
|
|
375
390
|
formData: FormBlockData;
|
|
376
391
|
title?: string;
|
|
377
392
|
textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;
|
|
378
393
|
direction?: FormBlockDirection;
|
|
379
|
-
background?: ThemeSupporting<
|
|
394
|
+
background?: ThemeSupporting<FormBlockBackgroundProps>;
|
|
395
|
+
customFormNode?: React.ReactNode;
|
|
380
396
|
}
|
|
381
397
|
export type HeaderBlockModel = {
|
|
382
398
|
type: BlockType.HeaderBlock;
|