@redneckz/wildless-cms-uni-blocks 0.3.4 → 0.3.5
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +8 -8
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/Accordion/utils/isActiveHandler.js +1 -1
- package/dist/components/Accordion/utils/isActiveHandler.js.map +1 -1
- package/dist/components/Blocks.mobile.d.ts +3 -1
- package/dist/components/Blocks.mobile.js +5 -1
- package/dist/components/Blocks.mobile.js.map +1 -1
- package/dist/components/ContentPage/ContentPage.js +2 -2
- package/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/dist/components/ContentPage/isBlockInRegistry.d.ts +1 -2
- package/dist/components/ContentPage/isBlockInRegistry.js +2 -2
- package/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/dist/components/ContentPage/normalizeBlock.d.ts +1 -1
- package/dist/components/ContentPage/normalizePage.js +1 -1
- package/dist/components/ContentPage/normalizePage.js.map +1 -1
- package/dist/components/ContentPage/normalizePage.mobile.js +1 -1
- package/dist/components/ContentPage/normalizePage.mobile.js.map +1 -1
- package/dist/components/Headline/HeadlineContent.d.ts +1 -1
- package/dist/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
- package/dist/components/Placeholder/Placeholder.js +8 -3
- package/dist/components/Placeholder/Placeholder.js.map +1 -1
- package/dist/components/Placeholder/PlaceholderContent.d.ts +2 -1
- package/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/dist/components/ProductTile/ProductTileContent.d.ts +1 -1
- package/dist/components/PromoTile/PromoTileContent.d.ts +1 -1
- package/dist/components/Tile/TileContent.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui-kit/Description/Description.d.ts +4 -1
- package/dist/ui-kit/Description/Description.js.map +1 -1
- package/{lib/ui-kit/Description/DescriptionProps.d.ts → dist/ui-kit/Description/DescriptionContent.d.ts} +0 -3
- package/dist/ui-kit/Description/{DescriptionProps.js → DescriptionContent.js} +1 -1
- package/dist/ui-kit/Description/DescriptionContent.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/Accordion/utils/isActiveHandler.js +1 -1
- package/lib/components/Accordion/utils/isActiveHandler.js.map +1 -1
- package/lib/components/Blocks.mobile.d.ts +3 -1
- package/lib/components/Blocks.mobile.js +5 -1
- package/lib/components/Blocks.mobile.js.map +1 -1
- package/lib/components/ContentPage/ContentPage.js +2 -2
- package/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/lib/components/ContentPage/isBlockInRegistry.d.ts +1 -2
- package/lib/components/ContentPage/isBlockInRegistry.js +2 -2
- package/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/lib/components/ContentPage/normalizeBlock.d.ts +1 -1
- package/lib/components/ContentPage/normalizePage.js +1 -1
- package/lib/components/ContentPage/normalizePage.js.map +1 -1
- package/lib/components/ContentPage/normalizePage.mobile.js +1 -1
- package/lib/components/ContentPage/normalizePage.mobile.js.map +1 -1
- package/lib/components/Headline/HeadlineContent.d.ts +1 -1
- package/lib/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
- package/lib/components/Placeholder/Placeholder.fixture.mobile.d.ts +2 -0
- package/lib/components/Placeholder/Placeholder.js +9 -4
- package/lib/components/Placeholder/Placeholder.js.map +1 -1
- package/lib/components/Placeholder/PlaceholderContent.d.ts +2 -1
- package/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/lib/components/ProductTile/ProductTileContent.d.ts +1 -1
- package/lib/components/PromoTile/PromoTileContent.d.ts +1 -1
- package/lib/components/Tile/TileContent.d.ts +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/ui-kit/Description/Description.d.ts +4 -1
- package/lib/ui-kit/Description/Description.js.map +1 -1
- package/{mobile/dist/ui-kit/Description/DescriptionProps.d.ts → lib/ui-kit/Description/DescriptionContent.d.ts} +0 -3
- package/lib/ui-kit/Description/DescriptionContent.js +2 -0
- package/lib/ui-kit/Description/DescriptionContent.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +203 -201
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/Accordion/utils/isActiveHandler.js +1 -1
- package/mobile/dist/components/Accordion/utils/isActiveHandler.js.map +1 -1
- package/mobile/dist/components/Blocks.d.ts +3 -1
- package/mobile/dist/components/Blocks.js +5 -1
- package/mobile/dist/components/Blocks.js.map +1 -1
- package/mobile/dist/components/ContentPage/ContentPage.js +2 -2
- package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/dist/components/ContentPage/isBlockInRegistry.d.ts +1 -2
- package/mobile/dist/components/ContentPage/isBlockInRegistry.js +2 -2
- package/mobile/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/mobile/dist/components/ContentPage/normalizePage.js +1 -1
- package/mobile/dist/components/ContentPage/normalizePage.js.map +1 -1
- package/mobile/dist/components/Headline/HeadlineContent.d.ts +1 -1
- package/mobile/dist/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
- package/mobile/dist/components/Placeholder/Placeholder.d.ts +1 -1
- package/mobile/dist/components/Placeholder/Placeholder.js +8 -3
- package/mobile/dist/components/Placeholder/Placeholder.js.map +1 -1
- package/mobile/dist/components/Placeholder/PlaceholderContent.d.ts +2 -1
- package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/mobile/dist/components/ProductTile/ProductTileContent.d.ts +1 -1
- package/mobile/dist/components/PromoTile/PromoTileContent.d.ts +1 -1
- package/mobile/dist/components/Tile/TileContent.d.ts +1 -1
- package/mobile/dist/types.d.ts +1 -1
- package/mobile/dist/ui-kit/Description/Description.d.ts +4 -1
- package/mobile/dist/ui-kit/Description/Description.js.map +1 -1
- package/mobile/{lib/ui-kit/Description/DescriptionProps.d.ts → dist/ui-kit/Description/DescriptionContent.d.ts} +0 -3
- package/mobile/dist/ui-kit/Description/{DescriptionProps.js → DescriptionContent.js} +1 -1
- package/mobile/dist/ui-kit/Description/DescriptionContent.js.map +1 -0
- package/mobile/lib/components/Accordion/utils/isActiveHandler.js +1 -1
- package/mobile/lib/components/Accordion/utils/isActiveHandler.js.map +1 -1
- package/mobile/lib/components/Blocks.d.ts +3 -1
- package/mobile/lib/components/Blocks.js +5 -1
- package/mobile/lib/components/Blocks.js.map +1 -1
- package/mobile/lib/components/ContentPage/ContentPage.js +2 -2
- package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/lib/components/ContentPage/isBlockInRegistry.d.ts +1 -2
- package/mobile/lib/components/ContentPage/isBlockInRegistry.js +2 -2
- package/mobile/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
- package/mobile/lib/components/ContentPage/normalizePage.js +1 -1
- package/mobile/lib/components/ContentPage/normalizePage.js.map +1 -1
- package/mobile/lib/components/Headline/HeadlineContent.d.ts +1 -1
- package/mobile/lib/components/MobileAppTile/MobileAppTileContent.d.ts +1 -1
- package/mobile/lib/components/Placeholder/Placeholder.d.ts +1 -1
- package/mobile/lib/components/Placeholder/Placeholder.js +9 -4
- package/mobile/lib/components/Placeholder/Placeholder.js.map +1 -1
- package/mobile/lib/components/Placeholder/PlaceholderContent.d.ts +2 -1
- package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +1 -1
- package/mobile/lib/components/ProductTile/ProductTileContent.d.ts +1 -1
- package/mobile/lib/components/PromoTile/PromoTileContent.d.ts +1 -1
- package/mobile/lib/components/Tile/TileContent.d.ts +1 -1
- package/mobile/lib/types.d.ts +1 -1
- package/mobile/lib/ui-kit/Description/Description.d.ts +4 -1
- package/mobile/lib/ui-kit/Description/Description.js.map +1 -1
- package/{dist/ui-kit/Description/DescriptionProps.d.ts → mobile/lib/ui-kit/Description/DescriptionContent.d.ts} +0 -3
- package/mobile/lib/ui-kit/Description/DescriptionContent.js +2 -0
- package/mobile/lib/ui-kit/Description/DescriptionContent.js.map +1 -0
- package/mobile/src/components/Accordion/utils/isActiveHandler.ts +1 -2
- package/mobile/src/components/Blocks.ts +5 -1
- package/mobile/src/components/ContentPage/ContentPage.page.json +37 -43
- package/mobile/src/components/ContentPage/ContentPage.tsx +2 -2
- package/mobile/src/components/ContentPage/isBlockInRegistry.ts +2 -4
- package/mobile/src/components/ContentPage/normalizePage.ts +4 -1
- package/mobile/src/components/Headline/HeadlineContent.ts +1 -1
- package/mobile/src/components/MobileAppTile/MobileAppTileContent.ts +1 -1
- package/mobile/src/components/Placeholder/Placeholder.tsx +36 -14
- package/mobile/src/components/Placeholder/PlaceholderContent.ts +2 -1
- package/mobile/src/components/ProductBlock/ProductBlockContent.ts +1 -1
- package/mobile/src/components/ProductTile/ProductTileContent.ts +1 -1
- package/mobile/src/components/PromoTile/PromoTileContent.ts +1 -1
- package/mobile/src/components/Tile/TileContent.ts +1 -1
- package/mobile/src/types.ts +1 -1
- package/mobile/src/ui-kit/Description/Description.tsx +5 -1
- package/mobile/src/ui-kit/Description/{DescriptionProps.ts → DescriptionContent.ts} +0 -4
- package/package.json +1 -1
- package/src/components/Accordion/utils/isActiveHandler.ts +1 -2
- package/src/components/Blocks.mobile.ts +5 -1
- package/src/components/ContentPage/ContentPage.page.json +37 -43
- package/src/components/ContentPage/ContentPage.tsx +2 -2
- package/src/components/ContentPage/isBlockInRegistry.ts +2 -4
- package/src/components/ContentPage/normalizePage.mobile.ts +4 -1
- package/src/components/ContentPage/normalizePage.ts +1 -1
- package/src/components/Headline/HeadlineContent.ts +1 -1
- package/src/components/MobileAppTile/MobileAppTileContent.ts +1 -1
- package/src/components/Placeholder/Placeholder.fixture.mobile.tsx +9 -0
- package/src/components/Placeholder/Placeholder.tsx +35 -8
- package/src/components/Placeholder/PlaceholderContent.ts +2 -1
- package/src/components/ProductBlock/ProductBlock.fixture.mobile.tsx +6 -0
- package/src/components/ProductBlock/ProductBlockContent.ts +1 -1
- package/src/components/ProductGallery/ProductGallery.fixture.mobile.tsx +8 -0
- package/src/components/ProductTile/ProductTileContent.ts +1 -1
- package/src/components/PromoTile/PromoTileContent.ts +1 -1
- package/src/components/Tile/TileContent.ts +1 -1
- package/src/types.ts +1 -1
- package/src/ui-kit/Description/Description.tsx +5 -1
- package/src/ui-kit/Description/{DescriptionProps.ts → DescriptionContent.ts} +0 -4
- package/dist/components/Placeholder/Placeholder.mobile.d.ts +0 -6
- package/dist/components/Placeholder/Placeholder.mobile.js +0 -15
- package/dist/components/Placeholder/Placeholder.mobile.js.map +0 -1
- package/dist/ui-kit/Description/DescriptionProps.js.map +0 -1
- package/lib/components/Placeholder/Placeholder.mobile.d.ts +0 -6
- package/lib/components/Placeholder/Placeholder.mobile.js +0 -13
- package/lib/components/Placeholder/Placeholder.mobile.js.map +0 -1
- package/lib/ui-kit/Description/DescriptionProps.js +0 -2
- package/lib/ui-kit/Description/DescriptionProps.js.map +0 -1
- package/mobile/dist/ui-kit/Description/DescriptionProps.js.map +0 -1
- package/mobile/lib/ui-kit/Description/DescriptionProps.js +0 -2
- package/mobile/lib/ui-kit/Description/DescriptionProps.js.map +0 -1
- package/src/components/Placeholder/Placeholder.mobile.tsx +0 -35
|
@@ -186,62 +186,22 @@
|
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const protoSeparator = '//';
|
|
197
|
-
const endOfProto = url.indexOf(protoSeparator);
|
|
198
|
-
const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
|
|
199
|
-
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
var url = /*#__PURE__*/Object.freeze({
|
|
203
|
-
__proto__: null,
|
|
204
|
-
isURL: isURL,
|
|
205
|
-
withoutQuery: withoutQuery,
|
|
206
|
-
getOrigin: getOrigin
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
const MOBILE_URL_PATH = '/mobile';
|
|
210
|
-
const withoutMobilePath = (href) => (href || '').replace(MOBILE_URL_PATH, '');
|
|
211
|
-
|
|
212
|
-
const adjustHref = (href, router) => {
|
|
213
|
-
if (!href) {
|
|
214
|
-
return href;
|
|
215
|
-
}
|
|
216
|
-
const relativeHref = toRelativeHref(href, router) || '';
|
|
217
|
-
const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
|
|
218
|
-
return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
|
|
189
|
+
const HeadingClass = {
|
|
190
|
+
h1: 'text-m-title',
|
|
191
|
+
h2: 'text-m-title',
|
|
192
|
+
h3: 'text-m-title-md',
|
|
193
|
+
h4: 'text-m-title-xs',
|
|
194
|
+
h5: 'text-m-title-xs',
|
|
195
|
+
h6: 'text-m-title-xs',
|
|
219
196
|
};
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
197
|
+
const Heading = JSX((props) => {
|
|
198
|
+
const { className, headingType, title } = props;
|
|
199
|
+
if (!headingType) {
|
|
200
|
+
return;
|
|
223
201
|
}
|
|
224
|
-
const
|
|
225
|
-
return
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
const defaultHandlerDecorator = (handler) => handler;
|
|
229
|
-
function useLink({ router, handlerDecorator = defaultHandlerDecorator, }, link) {
|
|
230
|
-
const href = adjustHref(link.href, router);
|
|
231
|
-
return {
|
|
232
|
-
...link,
|
|
233
|
-
href,
|
|
234
|
-
ariaLabel: link.text,
|
|
235
|
-
onClick: handlerDecorator((ev) => {
|
|
236
|
-
const isLocalHref = href && !isURL(href);
|
|
237
|
-
const isLocalTarget = !link.target || link.target === '_self';
|
|
238
|
-
if (isLocalHref && isLocalTarget) {
|
|
239
|
-
ev.preventDefault();
|
|
240
|
-
router.push(href);
|
|
241
|
-
}
|
|
242
|
-
}, link),
|
|
243
|
-
};
|
|
244
|
-
}
|
|
202
|
+
const Tag = headingType;
|
|
203
|
+
return (jsx(Tag, { className: `font-sans font-medium ${HeadingClass[headingType]} ${className || ''}`, children: title }));
|
|
204
|
+
});
|
|
245
205
|
|
|
246
206
|
const projectSettings = new (class {
|
|
247
207
|
_ = {
|
|
@@ -286,144 +246,6 @@
|
|
|
286
246
|
return (jsx("img", { className: className, src: href, alt: alt, title: title, ...imgProps, "aria-hidden": "true" }));
|
|
287
247
|
});
|
|
288
248
|
|
|
289
|
-
const ButtonInner = JSX(({ text, aboveText, appendLeft, rounded, version }) => {
|
|
290
|
-
const withoutText = !text && !aboveText && Boolean(appendLeft);
|
|
291
|
-
const buttonInnerClasses = version !== 'link'
|
|
292
|
-
? `flex items-center justify-center
|
|
293
|
-
${withoutText ? 'h-12 w-12' : `px-8 gap-2 ${aboveText ? 'py-2' : 'py-3.5'}`} ${rounded ? 'rounded-full' : ''}`
|
|
294
|
-
: null;
|
|
295
|
-
return renderButtonInner({ buttonInnerClasses, appendLeft, withoutText, aboveText, text });
|
|
296
|
-
});
|
|
297
|
-
function renderButtonInner({ buttonInnerClasses, appendLeft, withoutText, aboveText, text }) {
|
|
298
|
-
return (jsxs("div", { className: buttonInnerClasses, children: [appendLeft ? appendLeft : null, withoutText ? null : (jsxs("div", { children: [jsx("div", { className: "text-m-2xs text-left", children: aboveText }), jsx("div", { className: "text-m-button font-medium text-left", children: text })] }))] }));
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const buttonStyleMap = {
|
|
302
|
-
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
303
|
-
secondary: 'text-primary-main bg-secondary-light hover:bg-secondary-hover active:bg-secondary-active',
|
|
304
|
-
link: 'text-primary-main',
|
|
305
|
-
};
|
|
306
|
-
const buttonDisabledStyleMap = {
|
|
307
|
-
primary: 'bg-secondary-dark text-secondary-text',
|
|
308
|
-
secondary: 'bg-secondary-light text-secondary-text',
|
|
309
|
-
link: '',
|
|
310
|
-
};
|
|
311
|
-
const styleButton = 'w-full text-center font-sans select-none';
|
|
312
|
-
const Button = JSX(({ className, text, aboveText, appendLeft, href, target, onClick, children, disabled, rounded, version = 'primary', ariaLabel, ...rest }) => {
|
|
313
|
-
const buttonInner = children ?? (jsx(ButtonInner, { text: text, aboveText: aboveText, appendLeft: appendLeft, rounded: rounded, version: version }));
|
|
314
|
-
if (disabled) {
|
|
315
|
-
return (jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabIndex: "-1", className: `inline-block ${styleButton} ${buttonDisabledStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, children: buttonInner }));
|
|
316
|
-
}
|
|
317
|
-
return (jsx("a", { className: `${styleButton} inline-block cursor-pointer no-underline ${buttonStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, href: href, target: target, onClick: onClick, "aria-label": ariaLabel, role: !href ? 'button' : 'link', ...rest, children: buttonInner }));
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
const ButtonSection = JSX(({ context, className = '', buttons }) => {
|
|
321
|
-
const { handlerDecorator } = context;
|
|
322
|
-
const router = context.useRouter();
|
|
323
|
-
return buttons?.length ? (jsx("div", { className: `${className}`, children: buttons.map((button, index) => renderButton(useLink({ router, handlerDecorator }, button), index)) })) : null;
|
|
324
|
-
});
|
|
325
|
-
function renderButton({ icon, ...button }, i) {
|
|
326
|
-
if (!button?.text)
|
|
327
|
-
return;
|
|
328
|
-
return icon ? (jsx(Button, { appendLeft: jsx(Icon, { name: icon, width: "24", height: "24", asSVG: true }), ...button }, String(i))) : (jsx(Button, { ...button }, String(i)));
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
const HeadingClass = {
|
|
332
|
-
h1: 'text-m-title',
|
|
333
|
-
h2: 'text-m-title',
|
|
334
|
-
h3: 'text-m-title-md',
|
|
335
|
-
h4: 'text-m-title-xs',
|
|
336
|
-
h5: 'text-m-title-xs',
|
|
337
|
-
h6: 'text-m-title-xs',
|
|
338
|
-
};
|
|
339
|
-
const Heading = JSX((props) => {
|
|
340
|
-
const { className, headingType, title } = props;
|
|
341
|
-
if (!headingType) {
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
const Tag = headingType;
|
|
345
|
-
return (jsx(Tag, { className: `font-sans font-medium ${HeadingClass[headingType]} ${className || ''}`, children: title }));
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
const BaseTile = JSX(({ className = '', title, children, buttons, image }) => {
|
|
349
|
-
return (jsxs("div", { className: `font-sans flex flex-col grow h-full items-start ${className}`, children: [title, jsxs("div", { className: `flex grow w-full justify-between`, children: [jsxs("div", { className: `flex flex-col justify-between`, children: [jsx("div", { children: children }), jsx("div", { children: buttons })] }), image] })] }));
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
const getColSpan = (className) => {
|
|
353
|
-
const colSpanPrefix = 'col-span-';
|
|
354
|
-
const colSpanStr = className.split(/\s+/).find((_) => _.startsWith(colSpanPrefix));
|
|
355
|
-
return colSpanStr ? parseInt(colSpanStr.substring(colSpanPrefix.length), 10) : 12;
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
function getTileHeadingType(className = '') {
|
|
359
|
-
const colSpan = getColSpan(className);
|
|
360
|
-
if (colSpan <= 4) {
|
|
361
|
-
return 'h4';
|
|
362
|
-
}
|
|
363
|
-
else if (colSpan <= 8) {
|
|
364
|
-
return 'h3';
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
return 'h2';
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function getTileMinHeight(className = '') {
|
|
372
|
-
const colSpan = getColSpan(className);
|
|
373
|
-
if (colSpan <= 6) {
|
|
374
|
-
return 'min-h-[300px]';
|
|
375
|
-
}
|
|
376
|
-
else if (colSpan <= 8) {
|
|
377
|
-
return 'min-h-[320px]';
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
return 'min-h-[360px]';
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function getTileRightPadding(className = '') {
|
|
385
|
-
const colSpan = getColSpan(className);
|
|
386
|
-
if (colSpan <= 6) {
|
|
387
|
-
return 'pr-9';
|
|
388
|
-
}
|
|
389
|
-
else if (colSpan <= 8) {
|
|
390
|
-
return 'pr-[4.75rem]';
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
return 'pr-[9.4rem]';
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
const CBR_EXCHANGE_RATE_URL = 'https://www.cbr-xml-daily.ru/daily_json.js';
|
|
398
|
-
const CURRENCY_CODES = ['USD', 'EUR'];
|
|
399
|
-
const CURRENCY_ICONS_MAP = {
|
|
400
|
-
USD: 'DollarIcon',
|
|
401
|
-
EUR: 'EuroIcon',
|
|
402
|
-
};
|
|
403
|
-
const buttons = [
|
|
404
|
-
{
|
|
405
|
-
text: 'Все показатели',
|
|
406
|
-
href: 'https://cbr.ru/currency_base/daily/',
|
|
407
|
-
version: 'secondary',
|
|
408
|
-
},
|
|
409
|
-
];
|
|
410
|
-
const ExchangeRateTile = JSX(({ className = '', context, title = 'Курсы обмена валют' }) => {
|
|
411
|
-
const { data } = context.useAsyncData(CBR_EXCHANGE_RATE_URL, fetchExchangeRate);
|
|
412
|
-
return (jsx("section", { className: `bg-white text-primary-text font-sans p-9 box-border ${className} ${getTileRightPadding(className)} ${getTileMinHeight(className)} `, children: jsx(BaseTile, { context: context, title: title && (jsx(Heading, { headingType: getTileHeadingType(className), title: title, className: `whitespace-pre-wrap max-w-[600px]` })), buttons: buttons?.length ? (jsx(ButtonSection, { context: context, buttons: buttons, className: "flex mt-9 gap-3" })) : null, children: jsxs("table", { children: [jsx("thead", { children: jsxs("tr", { children: [jsx(CurrencyTH, { children: "\u0412\u0430\u043B\u044E\u0442\u0430" }), jsx(CurrencyTH, { className: "pl-11", children: "\u041A\u0443\u0440\u0441" })] }) }), jsx("tbody", { children: CURRENCY_CODES.map(renderCurrencyRow(data)) })] }) }) }));
|
|
413
|
-
});
|
|
414
|
-
const CurrencyTH = JSX(({ className = '', children }) => (jsx("th", { className: `text-left font-normal text-sm text-secondary-text ${className}`, children: children })));
|
|
415
|
-
const CurrencyTD = JSX(({ className = '', children }) => (jsx("td", { className: `text-left font-normal text-base text-primary-text ${className}`, children: children })));
|
|
416
|
-
async function fetchExchangeRate() {
|
|
417
|
-
const response = await fetch(CBR_EXCHANGE_RATE_URL);
|
|
418
|
-
return await response.json();
|
|
419
|
-
}
|
|
420
|
-
const currencyNumberFormat = new Intl.NumberFormat('ru', { style: 'currency', currency: 'RUB' });
|
|
421
|
-
const formatCurrency = (value) => (value ? currencyNumberFormat.format(value) : '');
|
|
422
|
-
const renderCurrencyRow = (data) => (code) => {
|
|
423
|
-
const value = (data?.Valute || {})[code]?.Value;
|
|
424
|
-
return (jsxs("tr", { children: [jsx(CurrencyTD, { className: "pt-4", children: jsxs("div", { className: "flex items-center", children: [jsx(Icon, { name: CURRENCY_ICONS_MAP[code], width: "24", height: "24" }), jsx("span", { className: "ml-2", children: code })] }) }), jsx(CurrencyTD, { className: "pt-4 pl-11", children: formatCurrency(value) })] }, code));
|
|
425
|
-
};
|
|
426
|
-
|
|
427
249
|
const Img = JSX(({ className = '', image }) => {
|
|
428
250
|
if (!image) {
|
|
429
251
|
return null;
|
|
@@ -657,11 +479,159 @@
|
|
|
657
479
|
return image?.src ? jsx(Img, { className: "pb-3 mr-auto", image: image }) : null;
|
|
658
480
|
}
|
|
659
481
|
|
|
482
|
+
const isURL = (href) => href?.includes('//');
|
|
483
|
+
const withoutQuery = (href) => (href || '').replace(/\/?\?.*/, '');
|
|
484
|
+
const getOrigin = (href) => {
|
|
485
|
+
if (!href || !isURL(href)) {
|
|
486
|
+
return undefined;
|
|
487
|
+
}
|
|
488
|
+
const url = href;
|
|
489
|
+
const protoSeparator = '//';
|
|
490
|
+
const endOfProto = url.indexOf(protoSeparator);
|
|
491
|
+
const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
|
|
492
|
+
return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
var url = /*#__PURE__*/Object.freeze({
|
|
496
|
+
__proto__: null,
|
|
497
|
+
isURL: isURL,
|
|
498
|
+
withoutQuery: withoutQuery,
|
|
499
|
+
getOrigin: getOrigin
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
const MOBILE_URL_PATH = '/mobile';
|
|
503
|
+
const withoutMobilePath = (href) => (href || '').replace(MOBILE_URL_PATH, '');
|
|
504
|
+
|
|
505
|
+
const adjustHref = (href, router) => {
|
|
506
|
+
if (!href) {
|
|
507
|
+
return href;
|
|
508
|
+
}
|
|
509
|
+
const relativeHref = toRelativeHref(href, router) || '';
|
|
510
|
+
const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
|
|
511
|
+
return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
|
|
512
|
+
};
|
|
513
|
+
const toRelativeHref = (href, router) => {
|
|
514
|
+
if (!href) {
|
|
515
|
+
return href;
|
|
516
|
+
}
|
|
517
|
+
const origin = getOrigin(router?.href);
|
|
518
|
+
return origin ? href.replace(origin, '') || '/' : href;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
const defaultHandlerDecorator = (handler) => handler;
|
|
522
|
+
function useLink({ router, handlerDecorator = defaultHandlerDecorator, }, link) {
|
|
523
|
+
const href = adjustHref(link.href, router);
|
|
524
|
+
return {
|
|
525
|
+
...link,
|
|
526
|
+
href,
|
|
527
|
+
ariaLabel: link.text,
|
|
528
|
+
onClick: handlerDecorator((ev) => {
|
|
529
|
+
const isLocalHref = href && !isURL(href);
|
|
530
|
+
const isLocalTarget = !link.target || link.target === '_self';
|
|
531
|
+
if (isLocalHref && isLocalTarget) {
|
|
532
|
+
ev.preventDefault();
|
|
533
|
+
router.push(href);
|
|
534
|
+
}
|
|
535
|
+
}, link),
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const ButtonInner = JSX(({ text, aboveText, appendLeft, rounded, version }) => {
|
|
540
|
+
const withoutText = !text && !aboveText && Boolean(appendLeft);
|
|
541
|
+
const buttonInnerClasses = version !== 'link'
|
|
542
|
+
? `flex items-center justify-center
|
|
543
|
+
${withoutText ? 'h-12 w-12' : `px-8 gap-2 ${aboveText ? 'py-2' : 'py-3.5'}`} ${rounded ? 'rounded-full' : ''}`
|
|
544
|
+
: null;
|
|
545
|
+
return renderButtonInner({ buttonInnerClasses, appendLeft, withoutText, aboveText, text });
|
|
546
|
+
});
|
|
547
|
+
function renderButtonInner({ buttonInnerClasses, appendLeft, withoutText, aboveText, text }) {
|
|
548
|
+
return (jsxs("div", { className: buttonInnerClasses, children: [appendLeft ? appendLeft : null, withoutText ? null : (jsxs("div", { children: [jsx("div", { className: "text-m-2xs text-left", children: aboveText }), jsx("div", { className: "text-m-button font-medium text-left", children: text })] }))] }));
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
const buttonStyleMap = {
|
|
552
|
+
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
553
|
+
secondary: 'text-primary-main bg-secondary-light hover:bg-secondary-hover active:bg-secondary-active',
|
|
554
|
+
link: 'text-primary-main',
|
|
555
|
+
};
|
|
556
|
+
const buttonDisabledStyleMap = {
|
|
557
|
+
primary: 'bg-secondary-dark text-secondary-text',
|
|
558
|
+
secondary: 'bg-secondary-light text-secondary-text',
|
|
559
|
+
link: '',
|
|
560
|
+
};
|
|
561
|
+
const styleButton = 'w-full text-center font-sans select-none';
|
|
562
|
+
const Button = JSX(({ className, text, aboveText, appendLeft, href, target, onClick, children, disabled, rounded, version = 'primary', ariaLabel, ...rest }) => {
|
|
563
|
+
const buttonInner = children ?? (jsx(ButtonInner, { text: text, aboveText: aboveText, appendLeft: appendLeft, rounded: rounded, version: version }));
|
|
564
|
+
if (disabled) {
|
|
565
|
+
return (jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabIndex: "-1", className: `inline-block ${styleButton} ${buttonDisabledStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, children: buttonInner }));
|
|
566
|
+
}
|
|
567
|
+
return (jsx("a", { className: `${styleButton} inline-block cursor-pointer no-underline ${buttonStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, href: href, target: target, onClick: onClick, "aria-label": ariaLabel, role: !href ? 'button' : 'link', ...rest, children: buttonInner }));
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
const ButtonSection = JSX(({ context, className = '', buttons }) => {
|
|
571
|
+
const { handlerDecorator } = context;
|
|
572
|
+
const router = context.useRouter();
|
|
573
|
+
return buttons?.length ? (jsx("div", { className: `${className}`, children: buttons.map((button, index) => renderButton(useLink({ router, handlerDecorator }, button), index)) })) : null;
|
|
574
|
+
});
|
|
575
|
+
function renderButton({ icon, ...button }, i) {
|
|
576
|
+
if (!button?.text)
|
|
577
|
+
return;
|
|
578
|
+
return icon ? (jsx(Button, { appendLeft: jsx(Icon, { name: icon, width: "24", height: "24", asSVG: true }), ...button }, String(i))) : (jsx(Button, { ...button }, String(i)));
|
|
579
|
+
}
|
|
580
|
+
|
|
660
581
|
const Description = JSX((props) => {
|
|
661
582
|
const { className, description } = props;
|
|
662
583
|
return jsx("div", { className: `font-normal text-base ${className || ''}`, children: description });
|
|
663
584
|
});
|
|
664
585
|
|
|
586
|
+
const BaseTile = JSX(({ className = '', title, children, buttons, image }) => {
|
|
587
|
+
return (jsxs("div", { className: `font-sans flex flex-col grow h-full items-start ${className}`, children: [title, jsxs("div", { className: `flex grow w-full justify-between`, children: [jsxs("div", { className: `flex flex-col justify-between`, children: [jsx("div", { children: children }), jsx("div", { children: buttons })] }), image] })] }));
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
const getColSpan = (className) => {
|
|
591
|
+
const colSpanPrefix = 'col-span-';
|
|
592
|
+
const colSpanStr = className.split(/\s+/).find((_) => _.startsWith(colSpanPrefix));
|
|
593
|
+
return colSpanStr ? parseInt(colSpanStr.substring(colSpanPrefix.length), 10) : 12;
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
function getTileHeadingType(className = '') {
|
|
597
|
+
const colSpan = getColSpan(className);
|
|
598
|
+
if (colSpan <= 4) {
|
|
599
|
+
return 'h4';
|
|
600
|
+
}
|
|
601
|
+
else if (colSpan <= 8) {
|
|
602
|
+
return 'h3';
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
return 'h2';
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function getTileMinHeight(className = '') {
|
|
610
|
+
const colSpan = getColSpan(className);
|
|
611
|
+
if (colSpan <= 6) {
|
|
612
|
+
return 'min-h-[300px]';
|
|
613
|
+
}
|
|
614
|
+
else if (colSpan <= 8) {
|
|
615
|
+
return 'min-h-[320px]';
|
|
616
|
+
}
|
|
617
|
+
else {
|
|
618
|
+
return 'min-h-[360px]';
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function getTileRightPadding(className = '') {
|
|
623
|
+
const colSpan = getColSpan(className);
|
|
624
|
+
if (colSpan <= 6) {
|
|
625
|
+
return 'pr-9';
|
|
626
|
+
}
|
|
627
|
+
else if (colSpan <= 8) {
|
|
628
|
+
return 'pr-[4.75rem]';
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
return 'pr-[9.4rem]';
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
665
635
|
const tileStyleMap = {
|
|
666
636
|
primary: 'bg-white text-primary-text',
|
|
667
637
|
secondary: 'bg-primary-main text-white',
|
|
@@ -826,7 +796,7 @@
|
|
|
826
796
|
const [isActive, setIsActive] = context.useState(false);
|
|
827
797
|
const hasContent = blocks?.length;
|
|
828
798
|
const icon = isActive ? 'MinusIcon' : 'PlusIcon';
|
|
829
|
-
const getContentBlock = ({
|
|
799
|
+
const getContentBlock = ({ currentTarget }) => currentTarget.nextSibling;
|
|
830
800
|
const handleToggle = (e) => {
|
|
831
801
|
if (!hasContent) {
|
|
832
802
|
return;
|
|
@@ -853,6 +823,36 @@
|
|
|
853
823
|
return (jsxs("section", { className: `py-6 font-sans bg-white text-primary-text ${bordered ? 'px-4' : ''} ${className}`, children: [title ? jsx(Heading, { headingType: "h3", className: "mb-2 text-center", title: title }) : null, description ? jsx("div", { className: "mb-5 text-m-md text-center", children: description }) : null, accordionItems?.length ? (jsx("ul", { className: "list-none m-0 p-0", children: accordionItems.map((item, i) => (jsx(AccordionItem, { ...item, context: context, bordered: bordered }, `AccordionItem${i}`))) })) : null] }));
|
|
854
824
|
});
|
|
855
825
|
|
|
826
|
+
const CBR_EXCHANGE_RATE_URL = 'https://www.cbr-xml-daily.ru/daily_json.js';
|
|
827
|
+
const CURRENCY_CODES = ['USD', 'EUR'];
|
|
828
|
+
const CURRENCY_ICONS_MAP = {
|
|
829
|
+
USD: 'DollarIcon',
|
|
830
|
+
EUR: 'EuroIcon',
|
|
831
|
+
};
|
|
832
|
+
const buttons = [
|
|
833
|
+
{
|
|
834
|
+
text: 'Все показатели',
|
|
835
|
+
href: 'https://cbr.ru/currency_base/daily/',
|
|
836
|
+
version: 'secondary',
|
|
837
|
+
},
|
|
838
|
+
];
|
|
839
|
+
const ExchangeRateTile = JSX(({ className = '', context, title = 'Курсы обмена валют' }) => {
|
|
840
|
+
const { data } = context.useAsyncData(CBR_EXCHANGE_RATE_URL, fetchExchangeRate);
|
|
841
|
+
return (jsx("section", { className: `bg-white text-primary-text font-sans p-9 box-border ${className} ${getTileRightPadding(className)} ${getTileMinHeight(className)} `, children: jsx(BaseTile, { context: context, title: title && (jsx(Heading, { headingType: getTileHeadingType(className), title: title, className: `whitespace-pre-wrap max-w-[600px]` })), buttons: buttons?.length ? (jsx(ButtonSection, { context: context, buttons: buttons, className: "flex mt-9 gap-3" })) : null, children: jsxs("table", { children: [jsx("thead", { children: jsxs("tr", { children: [jsx(CurrencyTH, { children: "\u0412\u0430\u043B\u044E\u0442\u0430" }), jsx(CurrencyTH, { className: "pl-11", children: "\u041A\u0443\u0440\u0441" })] }) }), jsx("tbody", { children: CURRENCY_CODES.map(renderCurrencyRow(data)) })] }) }) }));
|
|
842
|
+
});
|
|
843
|
+
const CurrencyTH = JSX(({ className = '', children }) => (jsx("th", { className: `text-left font-normal text-sm text-secondary-text ${className}`, children: children })));
|
|
844
|
+
const CurrencyTD = JSX(({ className = '', children }) => (jsx("td", { className: `text-left font-normal text-base text-primary-text ${className}`, children: children })));
|
|
845
|
+
async function fetchExchangeRate() {
|
|
846
|
+
const response = await fetch(CBR_EXCHANGE_RATE_URL);
|
|
847
|
+
return await response.json();
|
|
848
|
+
}
|
|
849
|
+
const currencyNumberFormat = new Intl.NumberFormat('ru', { style: 'currency', currency: 'RUB' });
|
|
850
|
+
const formatCurrency = (value) => (value ? currencyNumberFormat.format(value) : '');
|
|
851
|
+
const renderCurrencyRow = (data) => (code) => {
|
|
852
|
+
const value = (data?.Valute || {})[code]?.Value;
|
|
853
|
+
return (jsxs("tr", { children: [jsx(CurrencyTD, { className: "pt-4", children: jsxs("div", { className: "flex items-center", children: [jsx(Icon, { name: CURRENCY_ICONS_MAP[code], width: "24", height: "24" }), jsx("span", { className: "ml-2", children: code })] }) }), jsx(CurrencyTD, { className: "pt-4 pl-11", children: formatCurrency(value) })] }, code));
|
|
854
|
+
};
|
|
855
|
+
|
|
856
856
|
const LOGO_PATHS = [
|
|
857
857
|
'm13.72 25.51 4.42-4.33v-2.95l-4.42 4.32v2.96Zm0-10.98 4.42-4.35V7.41l-4.42 4.31v2.8Zm0 3.63 4.42-4.33v-2.78l-4.42 4.32v2.8ZM12.46 7.44l-.6-.56V0h-.66v6.22l-.58-.57V0h-.67v5l-.59-.58V0H8.7v6.56l4.44 4.33V0h-.67v7.44Zm1.26 14.35 4.42-4.33v-2.78L13.72 19v2.8Zm-5.03-.61 4.44 4.33v-2.96l-4.44-4.32v2.95Zm8.79-16.76-.59.58V0h-.66v5.66l-.6.56V0h-.66v6.87l-.58.57V0h-.67v10.9l4.42-4.34V0h-.66v4.42Zm-8.79 5.76 4.44 4.35v-2.8L8.69 7.4v2.77Zm0 3.65 4.44 4.33v-2.8l-4.44-4.3v2.77Zm0 3.63 4.44 4.33V19l-4.44-4.31v2.78Zm26.37 2.29H24.3a2.25 2.25 0 0 0 .36-1.22 2.32 2.32 0 0 0-2.33-2.31 2.32 2.32 0 0 0-2.31 2.31c0 .5.16.96.43 1.34a.74.74 0 0 0-.33.61c0 .26.14.49.33.62a2.32 2.32 0 0 0-.43 1.34 2.31 2.31 0 0 0 2.31 2.31 2.32 2.32 0 0 0 2.33-2.31c0-.45-.13-.87-.36-1.22h8.01v.49h-.8v.68h.8v.7h-.8v1.3h.8v-.58h1.17v.58h.79v-1.3h-.79v-.7h.79v-.68h-.79v-.5h1.58a.56.56 0 0 0 .56-.56v-.34a.57.57 0 0 0-.56-.56Zm-11.53 2.7a1.2 1.2 0 0 1-2.4 0c0-.24.08-.47.2-.66l.34-.56a.97.97 0 0 1-.34-.75c0-.3.13-.56.33-.74l-.32-.56a1.13 1.13 0 0 1-.2-.66 1.2 1.2 0 0 1 2.4 0c0 .49-.56 1.65-.56 1.65v.62c-.01.01.55 1.17.55 1.66ZM4.67 18.34v2.89c0 2.75 1.2 4.53 1.9 5.21l4.58 4.5c1.28 1.25 1.5 1.66 1.79 2.37v-3.2c0-2.84-1.44-3.94-2.19-4.67-1.73-1.68-2.89-2.8-3.82-3.73a8.98 8.98 0 0 1-2.26-3.37Zm6.08 14.24c-1.73-1.7-2.89-2.8-3.82-3.73a10 10 0 0 1-2.25-2.98v2.49a7.87 7.87 0 0 0 1.89 5.24l4.58 4.47c1.28 1.25 1.5 1.85 1.79 2.55v-3.37c0-2.85-1.45-3.95-2.19-4.67Z',
|
|
858
858
|
'M19.88 5.34c-.32 0-.64 0-.96.02V6.7a18.5 18.5 0 1 1 .95 36.94A18.5 18.5 0 0 1 1.35 25.17c0-5.67 2.55-10.73 6.58-14.13V9.32A19.78 19.78 0 0 0 0 25.17C0 36.12 8.9 45 19.88 45a19.85 19.85 0 0 0 19.86-19.83c0-10.95-8.9-19.83-19.87-19.83Z',
|
|
@@ -1057,8 +1057,8 @@
|
|
|
1057
1057
|
const renderSubItem = (item, i) => (jsx(HeaderItem, { className: "mr-8 whitespace-nowrap text-sm", ...item }, String(i)));
|
|
1058
1058
|
|
|
1059
1059
|
const GOLDEN_RATIO = 1.618;
|
|
1060
|
-
const Placeholder = JSX(({ className
|
|
1061
|
-
return (jsx(
|
|
1060
|
+
const Placeholder = JSX(({ className, context, title, description = 'Блок в разработке...' }) => {
|
|
1061
|
+
return (jsx("section", { className: `bg-white text-primary-text font-sans p-9 box-border ${className} ${getTileRightPadding(className)} ${getTileMinHeight(className)} `, children: jsxs(BaseTile, { context: context, title: title ? (jsx(Heading, { headingType: getTileHeadingType(className), title: title, className: `whitespace-pre-wrap max-w-[600px]` })) : null, children: [description ? (jsx(Description, { className: "mt-4 max-w-[600px]", description: description })) : null, jsx("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() })] }) }));
|
|
1062
1062
|
});
|
|
1063
1063
|
const renderShimmer = (size = 3) => goldenSequence(100, size)
|
|
1064
1064
|
.map((_) => Math.floor(_))
|
|
@@ -1129,16 +1129,18 @@
|
|
|
1129
1129
|
};
|
|
1130
1130
|
|
|
1131
1131
|
const Blocks = {
|
|
1132
|
+
Accordion,
|
|
1132
1133
|
ExchangeRateTile,
|
|
1133
1134
|
Footer,
|
|
1134
1135
|
Header,
|
|
1135
1136
|
Headline,
|
|
1136
1137
|
LinkDocs,
|
|
1138
|
+
MobileAppTile,
|
|
1137
1139
|
Placeholder,
|
|
1138
1140
|
ProductBlock,
|
|
1139
1141
|
ProductGallery,
|
|
1140
|
-
TextBlock,
|
|
1141
1142
|
StepsBlock,
|
|
1143
|
+
TextBlock,
|
|
1142
1144
|
};
|
|
1143
1145
|
|
|
1144
1146
|
const LikeButton = JSX(({ className, onClick, ariaLabel }) => (jsx("button", { type: "button", className: `border-0 w-[36px] bg-inherit cursor-pointer ${className || ''}`, onClick: onClick, "aria-label": ariaLabel, children: renderLikeIcon() })));
|
|
@@ -1164,10 +1166,10 @@
|
|
|
1164
1166
|
});
|
|
1165
1167
|
function renderBlock({ block, blockDecorator, blocksRegistry, context }, i) {
|
|
1166
1168
|
const { type } = block;
|
|
1167
|
-
if (!(type in blocksRegistry)) {
|
|
1169
|
+
if (!(type && type in blocksRegistry)) {
|
|
1168
1170
|
console.warn(`No block with "${type}" is registered`);
|
|
1169
1171
|
}
|
|
1170
|
-
const BlockComponent = blocksRegistry[type] || Placeholder;
|
|
1172
|
+
const BlockComponent = blocksRegistry[type || 'Placeholder'] || Placeholder;
|
|
1171
1173
|
return blockDecorator({
|
|
1172
1174
|
blockClassName: style2className(block.style),
|
|
1173
1175
|
block,
|
|
@@ -1188,8 +1190,8 @@
|
|
|
1188
1190
|
: null, children] }));
|
|
1189
1191
|
});
|
|
1190
1192
|
|
|
1191
|
-
function isBlockInRegistry(
|
|
1192
|
-
return
|
|
1193
|
+
function isBlockInRegistry(blockType, registry) {
|
|
1194
|
+
return (blockType || '') in registry;
|
|
1193
1195
|
}
|
|
1194
1196
|
|
|
1195
1197
|
function normalizeBlock(block) {
|
|
@@ -1217,7 +1219,7 @@
|
|
|
1217
1219
|
}
|
|
1218
1220
|
function getMobileBlocks(blocks) {
|
|
1219
1221
|
return blocks
|
|
1220
|
-
?.filter((block) => isBlockInRegistry(block, Blocks) && !block.mobile?.hidden)
|
|
1222
|
+
?.filter((block) => isBlockInRegistry(block?.type || block?.mobile?.type, Blocks) && !block.mobile?.hidden)
|
|
1221
1223
|
.map(normalizeBlock);
|
|
1222
1224
|
}
|
|
1223
1225
|
|