@hanzo/ui 4.5.3 → 4.5.4
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/dist/mcp/enhanced-server.js +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/registry/api.js +1 -2
- package/dist/registry/index.d.ts +348 -4
- package/package.json +1 -1
- package/tsconfig.json +9 -4
- package/dist/blocks/components/accordian-block.d.ts +0 -4
- package/dist/blocks/components/accordian-block.jsx +0 -25
- package/dist/blocks/components/block-component-props.d.ts +0 -7
- package/dist/blocks/components/block-component-props.js +0 -1
- package/dist/blocks/components/bullet-cards-block.d.ts +0 -4
- package/dist/blocks/components/bullet-cards-block.jsx +0 -25
- package/dist/blocks/components/card-block/index.d.ts +0 -6
- package/dist/blocks/components/card-block/index.jsx +0 -87
- package/dist/blocks/components/card-block/link-out-button.d.ts +0 -6
- package/dist/blocks/components/card-block/link-out-button.jsx +0 -4
- package/dist/blocks/components/card-block/util.d.ts +0 -4
- package/dist/blocks/components/card-block/util.js +0 -6
- package/dist/blocks/components/carte-blanche-block/index.d.ts +0 -4
- package/dist/blocks/components/carte-blanche-block/index.jsx +0 -82
- package/dist/blocks/components/carte-blanche-block/variant-content-left.d.ts +0 -10
- package/dist/blocks/components/carte-blanche-block/variant-content-left.jsx +0 -23
- package/dist/blocks/components/content.d.ts +0 -10
- package/dist/blocks/components/content.jsx +0 -47
- package/dist/blocks/components/cta-block.d.ts +0 -12
- package/dist/blocks/components/cta-block.jsx +0 -69
- package/dist/blocks/components/enh-heading-block.d.ts +0 -7
- package/dist/blocks/components/enh-heading-block.jsx +0 -142
- package/dist/blocks/components/grid-block/grid-block-mutator.d.ts +0 -5
- package/dist/blocks/components/grid-block/grid-block-mutator.js +0 -1
- package/dist/blocks/components/grid-block/index.d.ts +0 -9
- package/dist/blocks/components/grid-block/index.jsx +0 -56
- package/dist/blocks/components/grid-block/mutator-registry.d.ts +0 -3
- package/dist/blocks/components/grid-block/mutator-registry.js +0 -5
- package/dist/blocks/components/grid-block/table-borders.mutator.d.ts +0 -3
- package/dist/blocks/components/grid-block/table-borders.mutator.js +0 -36
- package/dist/blocks/components/group-block.d.ts +0 -7
- package/dist/blocks/components/group-block.jsx +0 -61
- package/dist/blocks/components/heading-block.d.ts +0 -4
- package/dist/blocks/components/heading-block.jsx +0 -99
- package/dist/blocks/components/image-block.d.ts +0 -7
- package/dist/blocks/components/image-block.jsx +0 -69
- package/dist/blocks/components/index.d.ts +0 -14
- package/dist/blocks/components/index.js +0 -13
- package/dist/blocks/components/screenful-block/content.d.ts +0 -8
- package/dist/blocks/components/screenful-block/content.jsx +0 -71
- package/dist/blocks/components/screenful-block/index.d.ts +0 -12
- package/dist/blocks/components/screenful-block/index.jsx +0 -57
- package/dist/blocks/components/screenful-block/poster-background.d.ts +0 -7
- package/dist/blocks/components/screenful-block/poster-background.jsx +0 -14
- package/dist/blocks/components/screenful-block/video-background.d.ts +0 -8
- package/dist/blocks/components/screenful-block/video-background.jsx +0 -20
- package/dist/blocks/components/space-block.d.ts +0 -4
- package/dist/blocks/components/space-block.jsx +0 -42
- package/dist/blocks/components/video-block.d.ts +0 -9
- package/dist/blocks/components/video-block.jsx +0 -83
- package/dist/blocks/def/accordian-block.d.ts +0 -10
- package/dist/blocks/def/accordian-block.js +0 -2
- package/dist/blocks/def/block.d.ts +0 -4
- package/dist/blocks/def/block.js +0 -1
- package/dist/blocks/def/bullet-cards-block.d.ts +0 -17
- package/dist/blocks/def/bullet-cards-block.js +0 -1
- package/dist/blocks/def/card-block.d.ts +0 -17
- package/dist/blocks/def/card-block.js +0 -2
- package/dist/blocks/def/carte-blanche-block.d.ts +0 -12
- package/dist/blocks/def/carte-blanche-block.js +0 -1
- package/dist/blocks/def/cta-block.d.ts +0 -8
- package/dist/blocks/def/cta-block.js +0 -1
- package/dist/blocks/def/element-block.d.ts +0 -7
- package/dist/blocks/def/element-block.js +0 -2
- package/dist/blocks/def/enh-heading-block.d.ts +0 -22
- package/dist/blocks/def/enh-heading-block.js +0 -1
- package/dist/blocks/def/grid-block.d.ts +0 -12
- package/dist/blocks/def/grid-block.js +0 -1
- package/dist/blocks/def/group-block.d.ts +0 -7
- package/dist/blocks/def/group-block.js +0 -1
- package/dist/blocks/def/heading-block.d.ts +0 -11
- package/dist/blocks/def/heading-block.js +0 -1
- package/dist/blocks/def/image-block.d.ts +0 -26
- package/dist/blocks/def/image-block.js +0 -1
- package/dist/blocks/def/index.d.ts +0 -17
- package/dist/blocks/def/index.js +0 -2
- package/dist/blocks/def/screenful-block.d.ts +0 -41
- package/dist/blocks/def/screenful-block.js +0 -1
- package/dist/blocks/def/space-block.d.ts +0 -47
- package/dist/blocks/def/space-block.js +0 -8
- package/dist/blocks/def/video-block.d.ts +0 -5
- package/dist/blocks/def/video-block.js +0 -1
- package/dist/blocks/index.d.ts +0 -2
- package/dist/blocks/index.js +0 -2
- package/dist/primitives/accordion.d.ts +0 -10
- package/dist/primitives/accordion.jsx +0 -21
- package/dist/primitives/action-button.d.ts +0 -9
- package/dist/primitives/action-button.jsx +0 -16
- package/dist/primitives/apply-typography.d.ts +0 -7
- package/dist/primitives/apply-typography.jsx +0 -38
- package/dist/primitives/aspect-ratio.d.ts +0 -3
- package/dist/primitives/aspect-ratio.jsx +0 -4
- package/dist/primitives/avatar.d.ts +0 -6
- package/dist/primitives/avatar.jsx +0 -11
- package/dist/primitives/badge.d.ts +0 -9
- package/dist/primitives/badge.jsx +0 -18
- package/dist/primitives/breadcrumb.d.ts +0 -19
- package/dist/primitives/breadcrumb.jsx +0 -27
- package/dist/primitives/breakpoint-indicator.d.ts +0 -3
- package/dist/primitives/breakpoint-indicator.jsx +0 -14
- package/dist/primitives/button.d.ts +0 -12
- package/dist/primitives/button.jsx +0 -55
- package/dist/primitives/calendar.d.ts +0 -8
- package/dist/primitives/calendar.jsx +0 -40
- package/dist/primitives/card.d.ts +0 -8
- package/dist/primitives/card.jsx +0 -18
- package/dist/primitives/carousel.d.ts +0 -18
- package/dist/primitives/carousel.jsx +0 -106
- package/dist/primitives/checkbox.d.ts +0 -4
- package/dist/primitives/checkbox.jsx +0 -15
- package/dist/primitives/combobox.d.ts +0 -41
- package/dist/primitives/combobox.jsx +0 -77
- package/dist/primitives/command.d.ts +0 -17
- package/dist/primitives/command.jsx +0 -38
- package/dist/primitives/context-menu.d.ts +0 -27
- package/dist/primitives/context-menu.jsx +0 -57
- package/dist/primitives/dialog-video-controller.d.ts +0 -3
- package/dist/primitives/dialog-video-controller.jsx +0 -24
- package/dist/primitives/dialog.d.ts +0 -28
- package/dist/primitives/dialog.jsx +0 -37
- package/dist/primitives/drawer.d.ts +0 -29
- package/dist/primitives/drawer.jsx +0 -34
- package/dist/primitives/form.d.ts +0 -12
- package/dist/primitives/form.jsx +0 -69
- package/dist/primitives/icons/github.d.ts +0 -4
- package/dist/primitives/icons/github.jsx +0 -6
- package/dist/primitives/icons/index.d.ts +0 -4
- package/dist/primitives/icons/index.js +0 -4
- package/dist/primitives/icons/youtube-logo.d.ts +0 -4
- package/dist/primitives/icons/youtube-logo.jsx +0 -39
- package/dist/primitives/index-common.d.ts +0 -47
- package/dist/primitives/index-common.js +0 -46
- package/dist/primitives/index-next.d.ts +0 -2
- package/dist/primitives/index-next.js +0 -2
- package/dist/primitives/input-otp.d.ts +0 -7
- package/dist/primitives/input-otp.jsx +0 -24
- package/dist/primitives/input.d.ts +0 -5
- package/dist/primitives/input.jsx +0 -11
- package/dist/primitives/label.d.ts +0 -5
- package/dist/primitives/label.jsx +0 -11
- package/dist/primitives/list-adaptor.d.ts +0 -9
- package/dist/primitives/list-adaptor.js +0 -1
- package/dist/primitives/list-box.d.ts +0 -10
- package/dist/primitives/list-box.jsx +0 -14
- package/dist/primitives/loading-spinner.d.ts +0 -5
- package/dist/primitives/loading-spinner.jsx +0 -8
- package/dist/primitives/navigation-menu.d.ts +0 -12
- package/dist/primitives/navigation-menu.jsx +0 -38
- package/dist/primitives/next/image.d.ts +0 -11
- package/dist/primitives/next/image.jsx +0 -42
- package/dist/primitives/next/index.d.ts +0 -7
- package/dist/primitives/next/index.js +0 -7
- package/dist/primitives/next/inline-icon.d.ts +0 -13
- package/dist/primitives/next/inline-icon.jsx +0 -15
- package/dist/primitives/next/link-element.d.ts +0 -23
- package/dist/primitives/next/link-element.jsx +0 -56
- package/dist/primitives/next/mdx-link.d.ts +0 -3
- package/dist/primitives/next/mdx-link.jsx +0 -12
- package/dist/primitives/next/media-stack.d.ts +0 -8
- package/dist/primitives/next/media-stack.jsx +0 -28
- package/dist/primitives/next/nav-items.d.ts +0 -10
- package/dist/primitives/next/nav-items.jsx +0 -24
- package/dist/primitives/next/youtube-embed.d.ts +0 -11
- package/dist/primitives/next/youtube-embed.jsx +0 -23
- package/dist/primitives/popover.d.ts +0 -9
- package/dist/primitives/popover.jsx +0 -18
- package/dist/primitives/progress.d.ts +0 -4
- package/dist/primitives/progress.jsx +0 -9
- package/dist/primitives/radio-group.d.ts +0 -7
- package/dist/primitives/radio-group.jsx +0 -18
- package/dist/primitives/scroll-area.d.ts +0 -5
- package/dist/primitives/scroll-area.jsx +0 -19
- package/dist/primitives/select.d.ts +0 -13
- package/dist/primitives/select.jsx +0 -62
- package/dist/primitives/separator.d.ts +0 -4
- package/dist/primitives/separator.jsx +0 -7
- package/dist/primitives/sheet.d.ts +0 -30
- package/dist/primitives/sheet.jsx +0 -56
- package/dist/primitives/skeleton.d.ts +0 -4
- package/dist/primitives/skeleton.jsx +0 -3
- package/dist/primitives/slider.d.ts +0 -9
- package/dist/primitives/slider.jsx +0 -30
- package/dist/primitives/sonner.d.ts +0 -5
- package/dist/primitives/sonner.jsx +0 -16
- package/dist/primitives/step-indicator.d.ts +0 -9
- package/dist/primitives/step-indicator.jsx +0 -23
- package/dist/primitives/switch.d.ts +0 -6
- package/dist/primitives/switch.jsx +0 -14
- package/dist/primitives/table.d.ts +0 -10
- package/dist/primitives/table.jsx +0 -21
- package/dist/primitives/tabs.d.ts +0 -7
- package/dist/primitives/tabs.jsx +0 -18
- package/dist/primitives/text-area.d.ts +0 -5
- package/dist/primitives/text-area.jsx +0 -9
- package/dist/primitives/toggle-group.d.ts +0 -14
- package/dist/primitives/toggle-group.jsx +0 -28
- package/dist/primitives/toggle.d.ts +0 -14
- package/dist/primitives/toggle.jsx +0 -52
- package/dist/primitives/tooltip.d.ts +0 -11
- package/dist/primitives/tooltip.jsx +0 -18
- package/dist/primitives/video-player.d.ts +0 -6
- package/dist/primitives/video-player.jsx +0 -8
- package/dist/style/theme-provider.d.ts +0 -4
- package/dist/style/theme-provider.jsx +0 -11
- package/dist/tailwind/fontFamily.tailwind.d.ts +0 -8
- package/dist/tailwind/fontFamily.tailwind.js +0 -7
- package/dist/tailwind/fontSize.tailwind.d.ts +0 -36
- package/dist/tailwind/fontSize.tailwind.js +0 -13
- package/dist/tailwind/index.d.ts +0 -3
- package/dist/tailwind/index.js +0 -2
- package/dist/tailwind/screens.tailwind.d.ts +0 -9
- package/dist/tailwind/screens.tailwind.js +0 -8
- package/dist/tailwind/tw-font-desc.d.ts +0 -6
- package/dist/tailwind/tw-font-desc.js +0 -6
- package/dist/types/animation-def.d.ts +0 -2
- package/dist/types/animation-def.js +0 -1
- package/dist/types/breakpoints.d.ts +0 -4
- package/dist/types/breakpoints.js +0 -4
- package/dist/types/bullet-item.d.ts +0 -6
- package/dist/types/bullet-item.js +0 -2
- package/dist/types/button-def.d.ts +0 -29
- package/dist/types/button-def.js +0 -2
- package/dist/types/dimensions.d.ts +0 -5
- package/dist/types/dimensions.js +0 -1
- package/dist/types/grid-def.d.ts +0 -36
- package/dist/types/grid-def.js +0 -33
- package/dist/types/image-def.d.ts +0 -27
- package/dist/types/image-def.js +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.js +0 -2
- package/dist/types/link-def.d.ts +0 -44
- package/dist/types/link-def.js +0 -1
- package/dist/types/media-stack-def.d.ts +0 -25
- package/dist/types/media-stack-def.js +0 -1
- package/dist/types/t-shirt-size.d.ts +0 -2
- package/dist/types/t-shirt-size.js +0 -1
- package/dist/types/tshirt-dimensions.d.ts +0 -12
- package/dist/types/tshirt-dimensions.js +0 -1
- package/dist/types/video-def.d.ts +0 -9
- package/dist/types/video-def.js +0 -1
- package/dist/util/format-and-abbreviate-as-currency.d.ts +0 -11
- package/dist/util/format-and-abbreviate-as-currency.js +0 -91
- package/dist/util/format-to-max-char.d.ts +0 -5
- package/dist/util/format-to-max-char.js +0 -57
- package/dist/util/index-client.d.ts +0 -2
- package/dist/util/index-client.js +0 -3
- package/dist/util/index.d.ts +0 -17
- package/dist/util/index.js +0 -41
- package/dist/util/number-abbreviate.d.ts +0 -9
- package/dist/util/number-abbreviate.js +0 -30
- package/dist/util/specifier.d.ts +0 -7
- package/dist/util/specifier.js +0 -31
- package/dist/util/spread-to-transform.d.ts +0 -7
- package/dist/util/spread-to-transform.js +0 -18
- package/dist/util/step-animation.d.ts +0 -5
- package/dist/util/step-animation.js +0 -60
- package/dist/util/two-way-map.d.ts +0 -8
- package/dist/util/two-way-map.js +0 -16
- /package/{mcp → src/mcp}/README.md +0 -0
- /package/{mcp → src/mcp}/enhanced-server.ts +0 -0
- /package/{mcp → src/mcp}/index.ts +0 -0
- /package/{mcp → src/mcp}/package.json +0 -0
- /package/{registry → src/registry}/api.ts +0 -0
- /package/{registry → src/registry}/index.ts +0 -0
- /package/{registry → src/registry}/package.json +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Card, CardContent, CardFooter, CardHeader, } from '../../../primitives/index-common';
|
|
3
|
-
import { cn, containsToken } from '../../../util';
|
|
4
|
-
import { getSpecifierData, getPrimaryStartingWith, getDim, } from '../../../util/specifier';
|
|
5
|
-
import CTABlockComponent from '../cta-block';
|
|
6
|
-
import Content from '../content';
|
|
7
|
-
import { EnhHeadingBlockComponent } from '..';
|
|
8
|
-
import VariantContentLeft from './variant-content-left';
|
|
9
|
-
const _getClx = (specifier, section) => {
|
|
10
|
-
let result = '';
|
|
11
|
-
if (specifier === 'big-padding') {
|
|
12
|
-
switch (section) {
|
|
13
|
-
// defaults: p-4 lg:p-6 xl:p-8
|
|
14
|
-
case 'header':
|
|
15
|
-
{
|
|
16
|
-
result = 'md:p-8 lg:p-12 xl:p-16';
|
|
17
|
-
}
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (specifier === 'big-padding-content') {
|
|
22
|
-
switch (section) {
|
|
23
|
-
case 'content':
|
|
24
|
-
{
|
|
25
|
-
result = 'md:p-8 lg:p-12 xl:p-16';
|
|
26
|
-
}
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else if (specifier === 'no-inner-borders') {
|
|
31
|
-
switch (section) {
|
|
32
|
-
case 'header':
|
|
33
|
-
{
|
|
34
|
-
result = 'border-none';
|
|
35
|
-
}
|
|
36
|
-
break;
|
|
37
|
-
case 'footer':
|
|
38
|
-
{
|
|
39
|
-
result = 'border-t-0';
|
|
40
|
-
}
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
46
|
-
const CarteBlancheBlockComponent = ({ block, className = '', agent, }) => {
|
|
47
|
-
if (block.blockType !== 'carte-blanche') {
|
|
48
|
-
return <>carte blanche block required</>;
|
|
49
|
-
}
|
|
50
|
-
const b = block;
|
|
51
|
-
const specified = (s) => (containsToken(b.specifiers, s));
|
|
52
|
-
const getClx = (specifier, section) => ((specified(specifier)) ? _getClx(specifier, section) : '');
|
|
53
|
-
//const bigPadding = specified('big-padding')
|
|
54
|
-
const headingclx = [
|
|
55
|
-
getClx('big-padding', 'header'),
|
|
56
|
-
getClx('no-inner-borders', 'header'),
|
|
57
|
-
].join(' ');
|
|
58
|
-
const contentclx = [
|
|
59
|
-
getClx('big-padding-content', 'content'),
|
|
60
|
-
].join(' ');
|
|
61
|
-
const footerclx = [
|
|
62
|
-
getClx('no-inner-borders', 'footer'),
|
|
63
|
-
].join(' ');
|
|
64
|
-
const noOuterBorders = specified('no-outer-borders');
|
|
65
|
-
const contentLeft = specified('variant-content-left');
|
|
66
|
-
const mobileContentLeft = specified('variant-mobile-content-left');
|
|
67
|
-
return (<Card className={cn('flex flex-col', className, noOuterBorders ? 'border-none' : '')}>
|
|
68
|
-
{contentLeft || (mobileContentLeft && agent === 'phone') ? (<VariantContentLeft block={b} agent={agent} className={className} headingclx={headingclx} contentclx={contentclx} footerclx={footerclx}/>) : (<>
|
|
69
|
-
{(b.heading || b.topContent) && (<CardHeader className={cn('typography-img:m-0', headingclx)}>
|
|
70
|
-
{b.topContent && (<Content blocks={b.topContent} agent={agent} className=''/>)}
|
|
71
|
-
{b.heading && (<EnhHeadingBlockComponent block={b.heading} className='text-accent' agent={agent}/>)}
|
|
72
|
-
</CardHeader>)}
|
|
73
|
-
{b.content && (<CardContent className={cn('typography flex flex-col justify-center', contentclx, className)}>
|
|
74
|
-
<Content blocks={b.content} agent={agent}/>
|
|
75
|
-
</CardContent>)}
|
|
76
|
-
{b.cta && (<CardFooter className={cn('grid grid-cols-1 gap-2 md:flex md:flex-row md:justify-center', footerclx)}>
|
|
77
|
-
<CTABlockComponent block={b.cta} agent={agent}/>
|
|
78
|
-
</CardFooter>)}
|
|
79
|
-
</>)}
|
|
80
|
-
</Card>);
|
|
81
|
-
};
|
|
82
|
-
export default CarteBlancheBlockComponent;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type CarteBlancheBlock } from '../..';
|
|
2
|
-
declare const VariantContentLeft: React.FC<{
|
|
3
|
-
block: CarteBlancheBlock;
|
|
4
|
-
agent?: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
headingclx?: string;
|
|
7
|
-
contentclx?: string;
|
|
8
|
-
footerclx?: string;
|
|
9
|
-
}>;
|
|
10
|
-
export default VariantContentLeft;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { EnhHeadingBlockComponent, CTABlockComponent } from '../..';
|
|
2
|
-
import { CardContent, CardFooter, CardHeader, } from '../../../primitives/index-common';
|
|
3
|
-
import { cn } from '../../../util';
|
|
4
|
-
import Content from '../content';
|
|
5
|
-
const VariantContentLeft = ({ block, agent, className, headingclx, contentclx, footerclx, }) => {
|
|
6
|
-
return (<>
|
|
7
|
-
<div className='flex gap-2'>
|
|
8
|
-
{block.topContent && <Content blocks={block.topContent} agent={agent} className='self-center ml-6 mt-6'/>}
|
|
9
|
-
<div className='flex flex-col'>
|
|
10
|
-
{block.heading && (<CardHeader className={cn('typography-img:m-0', headingclx)}>
|
|
11
|
-
<EnhHeadingBlockComponent block={block.heading} className='text-accent' agent={agent}/>
|
|
12
|
-
</CardHeader>)}
|
|
13
|
-
{block.content && (<CardContent className={cn('typography flex flex-col justify-start', contentclx, className)}>
|
|
14
|
-
<Content blocks={block.content} agent={agent}/>
|
|
15
|
-
</CardContent>)}
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
{block.cta && (<CardFooter className={cn('grid grid-cols-1 gap-2 md:flex md:flex-row md:justify-center mx-auto', footerclx)}>
|
|
19
|
-
<CTABlockComponent block={block.cta} agent={agent}/>
|
|
20
|
-
</CardFooter>)}
|
|
21
|
-
</>);
|
|
22
|
-
};
|
|
23
|
-
export default VariantContentLeft;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, { type ComponentType } from 'react';
|
|
2
|
-
import type * as B from '../def';
|
|
3
|
-
import type BlockComponentProps from './block-component-props';
|
|
4
|
-
declare const registerBlockType: (key: string, type: ComponentType<BlockComponentProps>) => void;
|
|
5
|
-
declare const ContentComponent: React.FC<{
|
|
6
|
-
blocks: B.Block | B.Block[] | undefined;
|
|
7
|
-
className?: string;
|
|
8
|
-
agent?: string;
|
|
9
|
-
}>;
|
|
10
|
-
export { ContentComponent as default, registerBlockType };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React, {} from 'react';
|
|
2
|
-
import AccordianBlockComponent from './accordian-block';
|
|
3
|
-
import BulletCardsBlockComponent from './bullet-cards-block';
|
|
4
|
-
import CTABlockComponent from './cta-block';
|
|
5
|
-
import CardBlockComponent from './card-block';
|
|
6
|
-
import CarteBlancheBlockComponent from './carte-blanche-block';
|
|
7
|
-
import EnhHeadingBlockComponent from './enh-heading-block';
|
|
8
|
-
import HeadingBlockComponent from './heading-block';
|
|
9
|
-
import GroupBlockComponent from './group-block';
|
|
10
|
-
import GridBlockComponent from './grid-block';
|
|
11
|
-
import ImageBlockComponent from './image-block';
|
|
12
|
-
import SpaceBlockComponent from './space-block';
|
|
13
|
-
import VideoBlockComponent from './video-block';
|
|
14
|
-
const map = new Map();
|
|
15
|
-
map.set('accordian', AccordianBlockComponent);
|
|
16
|
-
map.set('bullet-cards', BulletCardsBlockComponent);
|
|
17
|
-
map.set('card', CardBlockComponent);
|
|
18
|
-
map.set('carte-blanche', CarteBlancheBlockComponent);
|
|
19
|
-
map.set('cta', CTABlockComponent);
|
|
20
|
-
map.set('heading', HeadingBlockComponent);
|
|
21
|
-
map.set('enh-heading', EnhHeadingBlockComponent);
|
|
22
|
-
map.set('space', SpaceBlockComponent);
|
|
23
|
-
map.set('image', ImageBlockComponent);
|
|
24
|
-
map.set('video', VideoBlockComponent);
|
|
25
|
-
map.set('group', GroupBlockComponent);
|
|
26
|
-
map.set('grid', GridBlockComponent);
|
|
27
|
-
const registerBlockType = (key, type) => {
|
|
28
|
-
map.set(key, type);
|
|
29
|
-
};
|
|
30
|
-
const renderBlock = (block, className, agent, keyStr) => {
|
|
31
|
-
if (block.blockType === 'element') {
|
|
32
|
-
return block.element;
|
|
33
|
-
}
|
|
34
|
-
const CompType = map.get(block.blockType);
|
|
35
|
-
if (!CompType)
|
|
36
|
-
return null;
|
|
37
|
-
return <CompType block={block} className={className} agent={agent} key={keyStr ?? ''}/>;
|
|
38
|
-
};
|
|
39
|
-
const ContentComponent = ({ blocks, className = '', agent }) => {
|
|
40
|
-
if (!blocks)
|
|
41
|
-
return null;
|
|
42
|
-
if (Array.isArray(blocks)) {
|
|
43
|
-
return (blocks.map((block, index) => (renderBlock(block, className, agent, `content-block-${block.blockType}-${index}`))));
|
|
44
|
-
}
|
|
45
|
-
return renderBlock(blocks, className, agent);
|
|
46
|
-
};
|
|
47
|
-
export { ContentComponent as default, registerBlockType };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { LinkDef, ButtonDef } from '../../types';
|
|
3
|
-
import { buttonVariants } from '../../primitives/index-next';
|
|
4
|
-
import { type VariantProps } from '../../util';
|
|
5
|
-
import type BlockComponentProps from './block-component-props';
|
|
6
|
-
declare const CtaBlockComponent: React.FC<BlockComponentProps & {
|
|
7
|
-
itemClasses?: string;
|
|
8
|
-
itemSize?: VariantProps<typeof buttonVariants>['size'];
|
|
9
|
-
renderLink?: (def: LinkDef, key: any) => JSX.Element;
|
|
10
|
-
renderButton?: (def: ButtonDef, key: any) => JSX.Element;
|
|
11
|
-
}>;
|
|
12
|
-
export default CtaBlockComponent;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { buttonVariants, ActionButton, LinkElement } from '../../primitives/index-next';
|
|
3
|
-
import { cn, containsToken } from '../../util';
|
|
4
|
-
const CtaBlockComponent = ({ block, className = '', // assigned to each item
|
|
5
|
-
itemClasses = '', itemSize, // do not provide default. this is an override to the def
|
|
6
|
-
renderLink, renderButton, agent }) => {
|
|
7
|
-
if (block.blockType !== 'cta') {
|
|
8
|
-
return <>cta block required</>;
|
|
9
|
-
}
|
|
10
|
-
const { elements, specifiers } = block;
|
|
11
|
-
let wrapperClasses = '';
|
|
12
|
-
let itemclx = '';
|
|
13
|
-
if (containsToken(specifiers, 'fill')) {
|
|
14
|
-
wrapperClasses += 'w-full ';
|
|
15
|
-
itemclx += 'grow shrink !min-w-0';
|
|
16
|
-
}
|
|
17
|
-
else if (containsToken(specifiers, 'left')) {
|
|
18
|
-
wrapperClasses += 'md:justify-start ';
|
|
19
|
-
}
|
|
20
|
-
else if (containsToken(specifiers, 'right')) {
|
|
21
|
-
wrapperClasses += 'md:justify-end ';
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
wrapperClasses += 'md:justify-center ';
|
|
25
|
-
}
|
|
26
|
-
const mobile2Columns = containsToken(specifiers, 'mobile-2-columns');
|
|
27
|
-
// normally 'default' buttons have a min width only at > lg.
|
|
28
|
-
// generally if more than one we don't want this and override it,
|
|
29
|
-
// but this specifier asks to observe the default behavior.
|
|
30
|
-
const fillEvenly = !containsToken(specifiers, 'desktop-dont-fill');
|
|
31
|
-
const mobileCenterFirstIfOdd = containsToken(specifiers, 'mobile-center-first-if-odd');
|
|
32
|
-
const mobileOddFullWidth = containsToken(specifiers, 'mobile-odd-full-width');
|
|
33
|
-
let layoutclx = undefined;
|
|
34
|
-
if (elements.length > 1) {
|
|
35
|
-
let resetMinWidth = false;
|
|
36
|
-
if (mobile2Columns) {
|
|
37
|
-
layoutclx = 'grid grid-cols-2 gap-2 self-stretch ';
|
|
38
|
-
resetMinWidth = true;
|
|
39
|
-
}
|
|
40
|
-
if (fillEvenly) {
|
|
41
|
-
layoutclx = (layoutclx ?? 'grid grid-cols-2 gap-2 self-stretch');
|
|
42
|
-
resetMinWidth = true;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
layoutclx = layoutclx ? (layoutclx + 'md:flex md:flex-row md:justify-center ') : 'flex flex-row justify-center ';
|
|
46
|
-
}
|
|
47
|
-
itemclx += resetMinWidth ? '!min-w-0 ' : '';
|
|
48
|
-
}
|
|
49
|
-
layoutclx = layoutclx ?? 'flex flex-col items-stretch gap-2 self-stretch md:flex-row sm:justify-center ';
|
|
50
|
-
const getMobileColSpanClx = (index, total) => {
|
|
51
|
-
const indexToCenter = (total % 2 === 0) ? -1 : (mobileCenterFirstIfOdd) ? 0 : total - 1;
|
|
52
|
-
const widthclx = mobileOddFullWidth ? 'w-full ' : 'w-3/5 mx-auto ';
|
|
53
|
-
return ((agent === 'phone' && mobile2Columns && (index === indexToCenter)) ? ('col-span-2 ' + widthclx) : '');
|
|
54
|
-
};
|
|
55
|
-
return (<div className={cn(layoutclx, wrapperClasses, className)}>
|
|
56
|
-
{elements.map((element, index) => {
|
|
57
|
-
const twoColClx = getMobileColSpanClx(index, elements.length);
|
|
58
|
-
if (element.title) {
|
|
59
|
-
const def = element;
|
|
60
|
-
return renderLink ? renderLink(def, index) : (<LinkElement def={def} key={index} size={itemSize} className={cn(itemclx, itemClasses, twoColClx)}/>);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const def = element;
|
|
64
|
-
return renderButton ? renderButton(def, index) : (<ActionButton def={def} key={index} size={itemSize} className={cn(itemclx, itemClasses, twoColClx)}/>);
|
|
65
|
-
}
|
|
66
|
-
})}
|
|
67
|
-
</div>);
|
|
68
|
-
};
|
|
69
|
-
export default CtaBlockComponent;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type BlockComponentProps from './block-component-props';
|
|
3
|
-
declare const EnhHeadingBlockComponent: React.FC<BlockComponentProps & {
|
|
4
|
-
applyTypography?: boolean;
|
|
5
|
-
extraSpecifiers?: string;
|
|
6
|
-
}>;
|
|
7
|
-
export default EnhHeadingBlockComponent;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import React, {} from 'react';
|
|
2
|
-
import { ApplyTypography } from '../../primitives/index-common';
|
|
3
|
-
import { cn, containsToken } from '../../util';
|
|
4
|
-
import InlineIcon from '../../primitives/next/inline-icon';
|
|
5
|
-
const DEFAULTS = {
|
|
6
|
-
preheading: {
|
|
7
|
-
tag: 'h4',
|
|
8
|
-
mb: 2
|
|
9
|
-
},
|
|
10
|
-
heading: {
|
|
11
|
-
tag: 'h1',
|
|
12
|
-
mb: 2
|
|
13
|
-
},
|
|
14
|
-
byline: {
|
|
15
|
-
tag: 'h6',
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const tagFromLevel = (level) => {
|
|
19
|
-
switch (level) {
|
|
20
|
-
case 1: {
|
|
21
|
-
return 'h1';
|
|
22
|
-
}
|
|
23
|
-
case 2: {
|
|
24
|
-
return 'h2';
|
|
25
|
-
}
|
|
26
|
-
case 3: {
|
|
27
|
-
return 'h3';
|
|
28
|
-
}
|
|
29
|
-
case 4: {
|
|
30
|
-
return 'h4';
|
|
31
|
-
}
|
|
32
|
-
case 5: {
|
|
33
|
-
return 'h5';
|
|
34
|
-
}
|
|
35
|
-
case 6: {
|
|
36
|
-
return 'h6';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return 'p';
|
|
40
|
-
};
|
|
41
|
-
// TODO Impl icon support
|
|
42
|
-
const Element = ({ asTag: Tag, text, icon, iconLeft = true, className: elClassName = '' }) => (<Tag className={elClassName}>{text}</Tag>);
|
|
43
|
-
const getPositionClx = (specified, agent) => {
|
|
44
|
-
const mobileHeadingCentered = specified('mobile-heading-centered');
|
|
45
|
-
const mobileHeadingLeft = specified('mobile-heading-left');
|
|
46
|
-
const headingCentered = specified('center');
|
|
47
|
-
const headingRight = specified('right');
|
|
48
|
-
const bylineCentered = specified('byline-center');
|
|
49
|
-
const bylineRight = specified('byline-right');
|
|
50
|
-
const mobileBylineLeft = specified('mobile-byline-left');
|
|
51
|
-
let headerclx = '';
|
|
52
|
-
let bylineclx = (bylineCentered) ?
|
|
53
|
-
'self-center !text-center' : (bylineRight ? 'self-end !text-right' : 'self-start !text-left');
|
|
54
|
-
if (agent === 'phone') {
|
|
55
|
-
if (mobileHeadingLeft) {
|
|
56
|
-
headerclx = 'self-start text-left';
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
headerclx = (mobileHeadingCentered || headingCentered) ?
|
|
60
|
-
'self-center text-center' : (headingRight ? 'self-end text-right' : 'self-start text-left');
|
|
61
|
-
}
|
|
62
|
-
if (mobileBylineLeft) {
|
|
63
|
-
bylineclx = 'self-start !text-left';
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
const largerclx = (headingCentered) ?
|
|
68
|
-
'self-center text-center' : (headingRight ? 'self-end text-right' : 'self-start text-left');
|
|
69
|
-
if (mobileHeadingCentered) {
|
|
70
|
-
headerclx = 'self-center text-center md:' + largerclx.split(' ').join(' md:');
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
headerclx = largerclx;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
preheading: headerclx,
|
|
78
|
-
heading: headerclx,
|
|
79
|
-
byline: bylineclx
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
const EnhHeadingBlockComponent = ({ block, className = '', agent, applyTypography = true, extraSpecifiers = '' }) => {
|
|
83
|
-
if (block.blockType !== 'enh-heading') {
|
|
84
|
-
return <>enhance heading block required</>;
|
|
85
|
-
}
|
|
86
|
-
const b = block;
|
|
87
|
-
const specified = (s) => (containsToken(b.specifiers + extraSpecifiers, s));
|
|
88
|
-
const preheadingHeadingFont = specified('preheading-heading-font');
|
|
89
|
-
const phFontClx = preheadingHeadingFont ? 'font-heading' : '';
|
|
90
|
-
const alignMiddleClx = specified('align-middle') ? 'my-auto' : '';
|
|
91
|
-
const positionclx = getPositionClx(specified, agent);
|
|
92
|
-
const Inner = () => {
|
|
93
|
-
const toRender = [
|
|
94
|
-
{
|
|
95
|
-
tag: (b.preheading) ?
|
|
96
|
-
(b.preheading.level !== undefined ? tagFromLevel(b.preheading.level) : DEFAULTS.preheading.tag)
|
|
97
|
-
:
|
|
98
|
-
undefined,
|
|
99
|
-
clx: (b.preheading) ?
|
|
100
|
-
(b.preheading.mb !== undefined ?
|
|
101
|
-
`mb-${b.preheading.mb}` : `mb-${DEFAULTS.preheading.mb}`) + ' ' + positionclx.preheading + ' ' + phFontClx
|
|
102
|
-
:
|
|
103
|
-
positionclx.preheading + ' ' + phFontClx,
|
|
104
|
-
text: (b.preheading) ? (b.preheading.text) : undefined,
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
tag: (b.heading.level !== undefined ? tagFromLevel(b.heading.level) : DEFAULTS.heading.tag),
|
|
108
|
-
clx: (b.heading.mb !== undefined ? `mb-${b.heading.mb}` : `mb-${DEFAULTS.heading.mb}`) + ' ' + positionclx.heading,
|
|
109
|
-
text: b.heading.text,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
tag: (b.byline) ?
|
|
113
|
-
(b.byline.level !== undefined ? tagFromLevel(b.byline.level) : DEFAULTS.byline.tag)
|
|
114
|
-
:
|
|
115
|
-
undefined,
|
|
116
|
-
clx: positionclx.byline,
|
|
117
|
-
text: (b.byline) ? (b.byline.text) : undefined,
|
|
118
|
-
},
|
|
119
|
-
];
|
|
120
|
-
let iconRendered = false;
|
|
121
|
-
return <>
|
|
122
|
-
{toRender.map(({ tag, clx, text }, index) => {
|
|
123
|
-
if (!tag)
|
|
124
|
-
return null;
|
|
125
|
-
if (b.icon && !iconRendered) {
|
|
126
|
-
iconRendered = true;
|
|
127
|
-
return (<div className={cn('flex flex-row items-center gap-2 sm:gap-4', clx)} key={`div-${index}`}>
|
|
128
|
-
<InlineIcon icon={b.icon} size={b.iconSize ?? 32} agent={agent}/>
|
|
129
|
-
<Element asTag={tag} text={text}/>
|
|
130
|
-
</div>);
|
|
131
|
-
}
|
|
132
|
-
return ((<Element asTag={tag} text={text} className={clx} key={`el-${index}`}/>));
|
|
133
|
-
})}
|
|
134
|
-
</>;
|
|
135
|
-
};
|
|
136
|
-
return applyTypography ? (<ApplyTypography className={cn('flex flex-col w-full !gap-0', className, alignMiddleClx)}>
|
|
137
|
-
<Inner />
|
|
138
|
-
</ApplyTypography>) : (<div className={cn('flex flex-col w-full gap-0', className, alignMiddleClx)}>
|
|
139
|
-
<Inner />
|
|
140
|
-
</div>);
|
|
141
|
-
};
|
|
142
|
-
export default EnhHeadingBlockComponent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import type BlockComponentProps from '../block-component-props';
|
|
3
|
-
/**
|
|
4
|
-
* A component that lays out the Blocks in 'cells' on a grid.
|
|
5
|
-
* If invoked directly, and children are supplied,
|
|
6
|
-
* block.cells is ignore and the children are rendered.
|
|
7
|
-
*/
|
|
8
|
-
declare const GridBlockComponent: React.FC<BlockComponentProps & PropsWithChildren>;
|
|
9
|
-
export default GridBlockComponent;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, {} from 'react';
|
|
2
|
-
import { cn, containsToken } from '../../../util';
|
|
3
|
-
import Content from '../content';
|
|
4
|
-
import getMutator from './mutator-registry';
|
|
5
|
-
// These must be / are safelisted in tailwind.config
|
|
6
|
-
const gridClx = (d, prefix) => ((typeof d === 'number') ?
|
|
7
|
-
`${(prefix ?? '')}grid-cols-${d} `
|
|
8
|
-
:
|
|
9
|
-
`${(prefix ?? '')}grid-cols-${d.columns} ${(prefix ?? '')}gap-${d.gap} `);
|
|
10
|
-
/**
|
|
11
|
-
* A component that lays out the Blocks in 'cells' on a grid.
|
|
12
|
-
* If invoked directly, and children are supplied,
|
|
13
|
-
* block.cells is ignore and the children are rendered.
|
|
14
|
-
*/
|
|
15
|
-
const GridBlockComponent = ({ block, className = '', agent, children }) => {
|
|
16
|
-
if (block.blockType !== 'grid') {
|
|
17
|
-
return <>grid block required</>;
|
|
18
|
-
}
|
|
19
|
-
const { cells, grid, specifiers } = block;
|
|
20
|
-
const specified = (s) => (containsToken(specifiers, s));
|
|
21
|
-
const mutator = specified('style-table-borders') ? getMutator('style-table-borders') : undefined;
|
|
22
|
-
// https://tailwindcss.com/docs/content-configuration#dynamic-class-names
|
|
23
|
-
// All variants in use MUST be in style/safelist.tailwind.js
|
|
24
|
-
let clx = 'grid ';
|
|
25
|
-
if (agent === 'phone') {
|
|
26
|
-
const d = (grid.mobile) ? grid.mobile : (grid.at.xs ? grid.at.xs : (grid.at.sm ?? 1));
|
|
27
|
-
clx += gridClx(d);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
let defaultSet = false;
|
|
31
|
-
for (const [key, value] of Object.entries(grid.at)) {
|
|
32
|
-
if (!defaultSet) {
|
|
33
|
-
// ts brain fart!
|
|
34
|
-
clx += gridClx(value);
|
|
35
|
-
defaultSet = true;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
// ts brain fart!
|
|
39
|
-
clx += gridClx(value, `${key}:`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
let getMutatorCellClx = (ignore) => ('');
|
|
44
|
-
if (mutator?.getCellClx) {
|
|
45
|
-
const colCount = (typeof grid.at.md === 'number') ? grid.at.md : grid.at.md.columns;
|
|
46
|
-
const cellCount = cells?.length;
|
|
47
|
-
if (!colCount || !cellCount) {
|
|
48
|
-
throw new Error('GridBlockComponent: using mutator, but colCount and / or cellCount is invalid!');
|
|
49
|
-
}
|
|
50
|
-
getMutatorCellClx = (cellIndex) => (mutator.getCellClx(cellIndex, cellCount, colCount));
|
|
51
|
-
}
|
|
52
|
-
return (<div className={cn('grid gap-2 md:gap-4 xl:gap-6', clx, (mutator?.gapClx ?? ''), className)}>
|
|
53
|
-
{React.Children.count(children) > 0 ? children : cells?.map((cell, index) => (<Content blocks={cell} agent={agent} key={`cell-${index}`} className={getMutatorCellClx(index)}/>))}
|
|
54
|
-
</div>);
|
|
55
|
-
};
|
|
56
|
-
export default GridBlockComponent;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const getCellClx = (cellIndex, cellCount, colCount) => {
|
|
2
|
-
const isFirstRow = () => (cellIndex < colCount);
|
|
3
|
-
const isFirstColumn = () => (cellIndex % colCount === 0);
|
|
4
|
-
const isTLCorner = () => (cellIndex === 0);
|
|
5
|
-
const isTRCorner = () => (cellIndex === colCount - 1);
|
|
6
|
-
const isBLCorner = () => (cellIndex === cellCount - colCount);
|
|
7
|
-
const isBRCorner = () => (cellIndex === cellCount - 1);
|
|
8
|
-
// all get a right and bottom border and padding,
|
|
9
|
-
// other borders are a special base
|
|
10
|
-
let clx = 'border-b md:border-r p-4 md:p-8 lg:p-12 ';
|
|
11
|
-
if (isFirstRow()) {
|
|
12
|
-
clx += 'border-t ';
|
|
13
|
-
}
|
|
14
|
-
if (isFirstColumn()) {
|
|
15
|
-
clx += 'md:border-l ';
|
|
16
|
-
}
|
|
17
|
-
// on mobile this will be the first (top) cell
|
|
18
|
-
if (isTLCorner()) {
|
|
19
|
-
clx += 'border-t md:rounded-tl-lg ';
|
|
20
|
-
}
|
|
21
|
-
else if (isTRCorner()) {
|
|
22
|
-
clx += 'md:rounded-tr-lg ';
|
|
23
|
-
}
|
|
24
|
-
else if (isBLCorner()) {
|
|
25
|
-
clx += 'md:rounded-bl-lg ';
|
|
26
|
-
}
|
|
27
|
-
else if (isBRCorner()) {
|
|
28
|
-
clx += 'md:rounded-br-lg ';
|
|
29
|
-
}
|
|
30
|
-
return clx;
|
|
31
|
-
};
|
|
32
|
-
const gapClx = 'gap-0 md:gap-0 xl:gap-0';
|
|
33
|
-
export default {
|
|
34
|
-
getCellClx,
|
|
35
|
-
gapClx
|
|
36
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Breakpoints } from '../../types';
|
|
3
|
-
import { cn } from '../../util';
|
|
4
|
-
import Content from './content';
|
|
5
|
-
// eg: 'layout-grid-2-starting-md'
|
|
6
|
-
// see comments below regarding dynamic classes and the safelist
|
|
7
|
-
const getLayoutInfo = (s) => {
|
|
8
|
-
const tokenArray = s.split(' ');
|
|
9
|
-
const layoutToken = tokenArray.find((tok) => (tok.startsWith('layout-')));
|
|
10
|
-
if (layoutToken) {
|
|
11
|
-
const subtokens = layoutToken.split('-');
|
|
12
|
-
const layout = subtokens[1];
|
|
13
|
-
let spec = {};
|
|
14
|
-
switch (layout) {
|
|
15
|
-
case 'grid':
|
|
16
|
-
{
|
|
17
|
-
const columns = parseInt(subtokens[2], 10);
|
|
18
|
-
const starting = subtokens[4];
|
|
19
|
-
if (Number.isNaN(columns) || columns < 2 || columns > 6 || !Breakpoints.includes(starting)) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
spec = {
|
|
23
|
-
columns,
|
|
24
|
-
starting
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
break;
|
|
28
|
-
// no other types supported yet
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
layout,
|
|
32
|
-
spec
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
};
|
|
37
|
-
const GroupBlockComponent = ({ block, className = '' }) => {
|
|
38
|
-
if (block.blockType !== 'group') {
|
|
39
|
-
return <>group block required</>;
|
|
40
|
-
}
|
|
41
|
-
const group = block;
|
|
42
|
-
// only one supported so fat
|
|
43
|
-
if (group.specifiers?.includes('layout')) {
|
|
44
|
-
const layoutSpec = getLayoutInfo(group.specifiers);
|
|
45
|
-
if (!layoutSpec) {
|
|
46
|
-
return <>invalid or missing layout specifier in group block!</>;
|
|
47
|
-
}
|
|
48
|
-
if (layoutSpec.layout === 'grid') {
|
|
49
|
-
const { elements } = group;
|
|
50
|
-
const { spec: { starting, columns } } = layoutSpec;
|
|
51
|
-
// https://tailwindcss.com/docs/content-configuration#dynamic-class-names
|
|
52
|
-
// All variants in use MUST be in style/safelist.tailwind.js
|
|
53
|
-
const clazzName = cn('grid xs:grid-cols-1 gap-2 sm:gap-3', `${starting}:grid-cols-${columns} `, className);
|
|
54
|
-
return (<div className={clazzName}>
|
|
55
|
-
<Content blocks={elements}/>
|
|
56
|
-
</div>);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return null;
|
|
60
|
-
};
|
|
61
|
-
export default GroupBlockComponent;
|