diff --git a/src/Toolkit/kits/shadcn/item/EXAMPLES.md b/src/Toolkit/kits/shadcn/item/EXAMPLES.md new file mode 100644 index 00000000000..02ba0bb64bb --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/EXAMPLES.md @@ -0,0 +1,99 @@ +# Examples + +## Default + +```twig {"preview":true} +
+ + + Default Variant + + Standard styling with subtle background and borders. + + + + + Open + + + + + + Outline Variant + + Outlined style with clear borders and transparent background. + + + + + Open + + + + + + Muted Variant + + Subdued appearance with muted colors for secondary content. + + + + + Open + + + +
+``` + +## With Icon + +```twig {"preview":true} +
+ + + + + + Security Alert + + New login detected from unknown device. + + + + + Review + + + +
+``` + +## Link + +```twig {"preview":true} +
+ + + Visit our documentation + + Learn how to get started with our components. + + + + + + + + + External resource + + Opens in a new tab with security attributes. + + + + + + +
+``` diff --git a/src/Toolkit/kits/shadcn/item/manifest.json b/src/Toolkit/kits/shadcn/item/manifest.json new file mode 100644 index 00000000000..43f9dc65fcc --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/manifest.json @@ -0,0 +1,12 @@ +{ + "$schema": "../../../schema-kit-recipe-v1.json", + "type": "component", + "name": "Item", + "description": "A versatile component that you can use to display any content.", + "copy-files": { + "templates/": "templates/" + }, + "dependencies": { + "composer": ["symfony/ux-icons", "tales-from-a-dev/twig-tailwind-extra"] + } +} diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item.html.twig new file mode 100644 index 00000000000..a9f6f8fb5ca --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item.html.twig @@ -0,0 +1,33 @@ +{# @prop variant 'default'|'outline'|'muted' The variant, default to `default` #} +{# @prop size 'default'|'sm' The size, default to `default` #} +{# @prop as 'div' The HTML tag to use, default to `div` #} +{# @block content The default block #} +{%- props variant = 'default', size = 'default', as = 'div' -%} +{%- set style = html_cva({ + base: 'group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]', + variants: { + variant: { + default: 'bg-transparent', + outline: 'border-border', + muted: 'bg-muted/50', + }, + size: { + default: 'p-4 gap-4', + sm: 'py-3 px-4 gap-2.5', + }, + }, + defaultVariants: { + variant: 'default', + size: 'default', + }, +}) -%} + +<{{ as }} + data-slot="item" + data-variant="{{ variant }}" + data-size="{{ size }}" + class="{{ style.apply({variant: variant, size: size}, attributes.render('class'))|tailwind_merge }}" + {{ attributes }} +> + {%- block content %}{% endblock -%} + diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Actions.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Actions.html.twig new file mode 100644 index 00000000000..26092ee30a4 --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Actions.html.twig @@ -0,0 +1,8 @@ +{# @block content The default block #} +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Content.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Content.html.twig new file mode 100644 index 00000000000..5f52f11b479 --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Content.html.twig @@ -0,0 +1,8 @@ +{# @block content The default block #} +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Description.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Description.html.twig new file mode 100644 index 00000000000..a03ee890311 --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Description.html.twig @@ -0,0 +1,8 @@ +{# @block content The default block #} +

+ {%- block content %}{% endblock -%} +

diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Footer.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Footer.html.twig new file mode 100644 index 00000000000..b99b36ce9dd --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Footer.html.twig @@ -0,0 +1,8 @@ +{# @block content The default block #} +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Group.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Group.html.twig new file mode 100644 index 00000000000..c6867c3e89e --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Group.html.twig @@ -0,0 +1,9 @@ +{# @block content The default block #} +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Header.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Header.html.twig new file mode 100644 index 00000000000..0f8b83be75d --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Header.html.twig @@ -0,0 +1,8 @@ +{# @block content The default block #} +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Media.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Media.html.twig new file mode 100644 index 00000000000..87198b572a3 --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Media.html.twig @@ -0,0 +1,25 @@ +{# @prop variant 'default'|'icon'|'image' The variant, default to `default` #} +{# @block content The default block #} +{%- props variant = 'default' -%} +{%- set style = html_cva({ + base: 'flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5', + variants: { + variant: { + default: 'bg-transparent', + icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4", + image: 'size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover', + }, + }, + defaultVariants: { + variant: 'default', + }, +}) -%} + +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Separator.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Separator.html.twig new file mode 100644 index 00000000000..908717ba507 --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Separator.html.twig @@ -0,0 +1,18 @@ +{# @prop orientation 'horizontal'|'vertical' The orientation, default to `horizontal` #} +{# @prop decorative bool Whether the separator is decorative, default to `true` #} +{# @block content The default block #} +{%- props orientation = 'horizontal', decorative = true -%} + + diff --git a/src/Toolkit/kits/shadcn/item/templates/components/Item/Title.html.twig b/src/Toolkit/kits/shadcn/item/templates/components/Item/Title.html.twig new file mode 100644 index 00000000000..69b2577ae85 --- /dev/null +++ b/src/Toolkit/kits/shadcn/item/templates/components/Item/Title.html.twig @@ -0,0 +1,8 @@ +{# @block content The default block #} +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 1__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 1__1.html new file mode 100644 index 00000000000..c7ce44c74c9 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 1__1.html @@ -0,0 +1,83 @@ + +
+
+
+
Default Variant
+

Standard styling with subtle background and borders. +

+
+
+ +
+
+
+
+
Outline Variant
+

Outlined style with clear borders and transparent background. +

+
+
+ +
+
+
+
+
Muted Variant
+

Subdued appearance with muted colors for secondary content. +

+
+
+ +
+
+
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 2__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 2__1.html new file mode 100644 index 00000000000..fb07e4bf6bd --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 2__1.html @@ -0,0 +1,41 @@ + +
+
+
+ +
+
+
Security Alert
+

New login detected from unknown device. +

+
+
+ +
+
+
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 3__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 3__1.html new file mode 100644 index 00000000000..1de69ec46b7 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component item, code 3__1.html @@ -0,0 +1,51 @@ + +
+
+
Visit our documentation
+

Learn how to get started with our components. +

+
+
+ +
+
+
+
External resource
+

Opens in a new tab with security attributes. +

+
+
+ +
+
+
\ No newline at end of file