Skip to content

Commit 1a2d0b3

Browse files
committed
feat(plugins/magento/cms-ai-daff-components): add all compatible @daffodil/design components
1 parent ab334b3 commit 1a2d0b3

File tree

11 files changed

+517
-1
lines changed

11 files changed

+517
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Graycore, LLC. All rights reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Graycore\CmsAiDaffComponents\Components\Accordion;
10+
11+
use Graycore\CmsAiBuilder\Api\ComponentInterface;
12+
13+
class DaffAccordionComponent implements ComponentInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function getSchema(): array
19+
{
20+
return [
21+
'type' => 'object',
22+
'description' => 'A container for grouping accordion items that can be expanded and collapsed.',
23+
'properties' => [
24+
'type' => ['type' => 'string', 'const' => 'componentSchema'],
25+
'name' => ['type' => 'string', 'const' => 'DaffAccordionComponent'],
26+
'children' => [
27+
'type' => 'array',
28+
'items' => ['$ref' => '#/$defs/DaffAccordionItemComponentSchema']
29+
]
30+
],
31+
'required' => ['type', 'name', 'children'],
32+
'additionalProperties' => false
33+
];
34+
}
35+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Graycore, LLC. All rights reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Graycore\CmsAiDaffComponents\Components\Accordion;
10+
11+
use Graycore\CmsAiBuilder\Api\ComponentInterface;
12+
13+
class DaffAccordionItemComponent implements ComponentInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function getSchema(): array
19+
{
20+
return [
21+
'type' => 'object',
22+
'description' => 'An individual accordion item with a title and collapsible content.',
23+
'properties' => [
24+
'type' => ['type' => 'string', 'const' => 'componentSchema'],
25+
'name' => ['type' => 'string', 'const' => 'DaffAccordionItemComponent'],
26+
'inputs' => [
27+
'type' => 'object',
28+
'properties' => [
29+
'initiallyExpanded' => [
30+
'type' => 'boolean',
31+
'description' => 'Whether the accordion item is initially expanded'
32+
],
33+
'disabled' => [
34+
'type' => 'boolean',
35+
'description' => 'Whether the accordion item is disabled'
36+
]
37+
],
38+
'required' => ['initiallyExpanded', 'disabled'],
39+
'additionalProperties' => false
40+
],
41+
'children' => [
42+
'type' => 'array',
43+
'items' => ['$ref' => '#/$defs/DaffContentSchema']
44+
]
45+
],
46+
'required' => ['type', 'name', 'children', 'inputs'],
47+
'additionalProperties' => false
48+
];
49+
}
50+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Graycore, LLC. All rights reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Graycore\CmsAiDaffComponents\Components;
10+
11+
use Graycore\CmsAiBuilder\Api\ComponentInterface;
12+
13+
class DaffCalloutComponent implements ComponentInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function getSchema(): array
19+
{
20+
return [
21+
'type' => 'object',
22+
'description' => 'A versatile pre-styled container used to highlight key pieces of content in a visually distinct way.',
23+
'properties' => [
24+
'type' => ['type' => 'string', 'const' => 'componentSchema'],
25+
'name' => ['type' => 'string', 'const' => 'DaffCalloutComponent'],
26+
'inputs' => [
27+
'type' => 'object',
28+
'properties' => [
29+
'textAlignment' => [
30+
'type' => 'string',
31+
'enum' => ['left', 'center', 'right'],
32+
'description' => 'Text alignment for callout content'
33+
],
34+
'compact' => [
35+
'type' => 'boolean',
36+
'description' => 'Reduces padding for tighter spacing'
37+
],
38+
'color' => [
39+
'type' => 'string',
40+
'enum' => ['primary', 'secondary', 'tertiary', 'light', 'dark', 'theme', 'theme-contrast'],
41+
'description' => 'Background color palette'
42+
],
43+
],
44+
'required' => ['textAlignment', 'compact', 'color'],
45+
'additionalProperties' => false
46+
],
47+
'children' => [
48+
'type' => 'array',
49+
'items' => ['$ref' => '#/$defs/DaffContentSchema']
50+
]
51+
],
52+
'required' => ['type', 'name', 'children', 'inputs'],
53+
'additionalProperties' => false
54+
];
55+
}
56+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Graycore, LLC. All rights reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Graycore\CmsAiDaffComponents\Components;
10+
11+
use Graycore\CmsAiBuilder\Api\ComponentInterface;
12+
13+
class DaffCardComponent implements ComponentInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function getSchema(): array
19+
{
20+
return [
21+
'type' => 'object',
22+
'description' => 'A basic card variant with a filled background for displaying grouped content.',
23+
'properties' => [
24+
'type' => ['type' => 'string', 'const' => 'componentSchema'],
25+
'name' => ['type' => 'string', 'const' => 'DaffCardComponent'],
26+
'inputs' => [
27+
'type' => 'object',
28+
'properties' => [
29+
'color' => [
30+
'type' => 'string',
31+
'enum' => ['primary', 'secondary', 'tertiary', 'light', 'dark', 'theme', 'theme-contrast'],
32+
'description' => 'Card color palette'
33+
],
34+
'orientation' => [
35+
'type' => 'string',
36+
'enum' => ['vertical', 'horizontal'],
37+
'description' => 'Card layout orientation'
38+
],
39+
'elevated' => [
40+
'type' => 'boolean',
41+
'description' => 'Whether the card displays a shadow'
42+
]
43+
],
44+
'required' => ['color', 'orientation', 'elevated'],
45+
'additionalProperties' => false
46+
],
47+
'children' => [
48+
'type' => 'array',
49+
'items' => ['$ref' => '#/$defs/DaffContentSchema']
50+
]
51+
],
52+
'required' => ['type', 'name', 'children', 'inputs'],
53+
'additionalProperties' => false
54+
];
55+
}
56+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Graycore, LLC. All rights reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Graycore\CmsAiDaffComponents\Components;
10+
11+
use Graycore\CmsAiBuilder\Api\ComponentInterface;
12+
13+
class DaffContainerComponent implements ComponentInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function getSchema(): array
19+
{
20+
return [
21+
'type' => 'object',
22+
'description' => 'A layout container that constrains content width and provides consistent spacing.',
23+
'properties' => [
24+
'type' => ['type' => 'string', 'const' => 'componentSchema'],
25+
'name' => ['type' => 'string', 'const' => 'DaffContainerComponent'],
26+
'inputs' => [
27+
'type' => 'object',
28+
'properties' => [
29+
'size' => [
30+
'type' => 'string',
31+
'enum' => ['xs', 'sm', 'md', 'lg', 'xl'],
32+
'description' => 'Container max-width size'
33+
]
34+
],
35+
'additionalProperties' => false,
36+
'required' => ['size'],
37+
],
38+
'children' => [
39+
'type' => 'array',
40+
'items' => ['$ref' => '#/$defs/DaffContentSchema']
41+
]
42+
],
43+
'required' => ['type', 'name', 'children', 'inputs'],
44+
'additionalProperties' => false
45+
];
46+
}
47+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Graycore, LLC. All rights reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Graycore\CmsAiDaffComponents\Components;
10+
11+
use Graycore\CmsAiBuilder\Api\ComponentInterface;
12+
13+
class DaffImageComponent implements ComponentInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function getSchema(): array
19+
{
20+
return [
21+
'type' => 'object',
22+
'description' => 'An optimized image component with built-in lazy loading and aspect ratio handling.',
23+
'properties' => [
24+
'type' => ['type' => 'string', 'const' => 'componentSchema'],
25+
'name' => ['type' => 'string', 'const' => 'DaffImageComponent'],
26+
'inputs' => [
27+
'type' => 'object',
28+
'properties' => [
29+
'src' => [
30+
'type' => 'string',
31+
'description' => 'The URL of the image'
32+
],
33+
'alt' => [
34+
'type' => 'string',
35+
'description' => 'The alternate text for the image'
36+
],
37+
'width' => [
38+
'type' => 'number',
39+
'description' => 'The width of the image in pixels'
40+
],
41+
'height' => [
42+
'type' => 'number',
43+
'description' => 'The height of the image in pixels'
44+
],
45+
'skeleton' => [
46+
'type' => 'boolean',
47+
'description' => 'Whether to show a skeleton loading state'
48+
],
49+
'priority' => [
50+
'type' => 'boolean',
51+
'description' => 'Whether the image should be loaded eagerly (priority images)'
52+
]
53+
],
54+
'required' => ['src', 'alt', 'width', 'height', 'skeleton', 'priority'],
55+
'additionalProperties' => false
56+
]
57+
],
58+
'required' => ['type', 'name', 'inputs'],
59+
'additionalProperties' => false
60+
];
61+
}
62+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
/**
4+
* Copyright © Graycore, LLC. All rights reserved.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Graycore\CmsAiDaffComponents\Components;
10+
11+
use Graycore\CmsAiBuilder\Api\ComponentInterface;
12+
13+
class DaffTagComponent implements ComponentInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function getSchema(): array
19+
{
20+
return [
21+
'type' => 'object',
22+
'description' => 'A tag component for labeling, categorizing, or filtering content.',
23+
'properties' => [
24+
'type' => ['type' => 'string', 'const' => 'componentSchema'],
25+
'name' => ['type' => 'string', 'const' => 'DaffTagComponent'],
26+
'inputs' => [
27+
'type' => 'object',
28+
'properties' => [
29+
'color' => [
30+
'type' => 'string',
31+
'enum' => ['primary', 'secondary', 'tertiary', 'light', 'dark', 'theme', 'theme-contrast'],
32+
'description' => 'Tag color palette'
33+
],
34+
'size' => [
35+
'type' => 'string',
36+
'enum' => ['sm', 'md', 'lg'],
37+
'description' => 'Tag size'
38+
],
39+
'status' => [
40+
'type' => 'string',
41+
'enum' => ['warn', 'danger', 'success'],
42+
'description' => 'Tag status indicator'
43+
],
44+
'disabled' => [
45+
'type' => 'boolean',
46+
'description' => 'Whether the tag is disabled'
47+
],
48+
'dismissible' => [
49+
'type' => 'boolean',
50+
'description' => 'Whether the tag can be dismissed by the user'
51+
]
52+
],
53+
'required' => ['color', 'size', 'status', 'disabled', 'dismissible'],
54+
'additionalProperties' => false
55+
],
56+
'children' => [
57+
'type' => 'array',
58+
'items' => ['$ref' => '#/$defs/DaffContentSchema']
59+
]
60+
],
61+
'required' => ['type', 'name', 'children', 'inputs'],
62+
'additionalProperties' => false
63+
];
64+
}
65+
}

0 commit comments

Comments
 (0)