diff --git a/src/Toolkit/kits/shadcn/button-group/EXAMPLES.md b/src/Toolkit/kits/shadcn/button-group/EXAMPLES.md new file mode 100644 index 00000000000..2fcb6f20992 --- /dev/null +++ b/src/Toolkit/kits/shadcn/button-group/EXAMPLES.md @@ -0,0 +1,125 @@ +# Examples + +## Default + +```twig {"preview":true,"height":"220px"} + + + + Archive + Report + + + + + Snooze + + + + + + +``` + +## Orientation + +```twig {"preview":true,"height":"200px"} + + + + + + + + +``` + +## Size + +```twig {"preview":true,"height":"420px"} +
+ + Small + Button + Group + + + + + + Default + Button + Group + + + + + + Large + Button + Group + + + + +
+``` + +## Input + +```twig {"preview":true,"height":"200px"} + + + + + + +``` + +## Nested + +```twig {"preview":true,"height":"240px"} + + + 1 + 2 + 3 + 4 + 5 + + + + + + + + + + +``` + +## Separator + +```twig {"preview":true,"height":"200px"} + + Copy + + Paste + +``` + +## Split + +```twig {"preview":true,"height":"200px"} + + Button + + + + + +``` diff --git a/src/Toolkit/kits/shadcn/button-group/manifest.json b/src/Toolkit/kits/shadcn/button-group/manifest.json new file mode 100644 index 00000000000..562ee0f7661 --- /dev/null +++ b/src/Toolkit/kits/shadcn/button-group/manifest.json @@ -0,0 +1,13 @@ +{ + "$schema": "../../../schema-kit-recipe-v1.json", + "type": "component", + "name": "Button Group", + "description": "A layout helper for grouping buttons and related controls with shared borders and separators.", + "copy-files": { + "templates/": "templates/" + }, + "dependencies": { + "composer": ["twig/extra-bundle", "twig/html-extra:^3.12.0", "tales-from-a-dev/twig-tailwind-extra:^1.0.0"], + "recipe": ["separator"] + } +} diff --git a/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup.html.twig b/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup.html.twig new file mode 100644 index 00000000000..4ff7ea3c364 --- /dev/null +++ b/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup.html.twig @@ -0,0 +1,25 @@ +{# @prop orientation 'horizontal'|'vertical' The orientation, default to `horizontal` #} +{# @block content The default block #} +{%- props orientation = 'horizontal' -%} +{%- set style = html_cva( + base: 'flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*=\'w-\'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2', + variants: { + orientation: { + horizontal: '[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none', + vertical: 'flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none', + }, + }, + default_variant: { + orientation: 'horizontal', + }, +) -%} + +
+ {%- block content %}{% endblock -%} +
diff --git a/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup/Separator.html.twig b/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup/Separator.html.twig new file mode 100644 index 00000000000..fe05d28c830 --- /dev/null +++ b/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup/Separator.html.twig @@ -0,0 +1,9 @@ +{# @prop orientation 'horizontal'|'vertical' The orientation of the separator, default to `vertical` #} +{# @block content The default block #} +{%- props orientation = 'vertical' -%} + diff --git a/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup/Text.html.twig b/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup/Text.html.twig new file mode 100644 index 00000000000..092d329ab5c --- /dev/null +++ b/src/Toolkit/kits/shadcn/button-group/templates/components/ButtonGroup/Text.html.twig @@ -0,0 +1,10 @@ +{# @prop as 'div' The HTML tag to use, default to `div` #} +{# @block content The default block #} +{%- props as = 'div' -%} +<{{ as }} + data-slot="button-group-text" + class="{{ 'bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*=\'size-\'])]:size-4 ' ~ attributes.render('class')|tailwind_merge }}" + {{ attributes }} +> + {%- block content %}{% endblock -%} + diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 1__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 1__1.html new file mode 100644 index 00000000000..e91a4f59de5 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 1__1.html @@ -0,0 +1,44 @@ + +
+ +
+ + +
+
+ + +
+
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 2__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 2__1.html new file mode 100644 index 00000000000..83a9c7b3377 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 2__1.html @@ -0,0 +1,21 @@ + +
+ + +
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 3__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 3__1.html new file mode 100644 index 00000000000..b60069863e8 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 3__1.html @@ -0,0 +1,56 @@ + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 4__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 4__1.html new file mode 100644 index 00000000000..7fa79a52f52 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 4__1.html @@ -0,0 +1,19 @@ + +
+ + + +
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 5__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 5__1.html new file mode 100644 index 00000000000..afa74c9da32 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 5__1.html @@ -0,0 +1,39 @@ + +
+
+ + + + + +
+
+ + +
+
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 6__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 6__1.html new file mode 100644 index 00000000000..b66cdd65495 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 6__1.html @@ -0,0 +1,19 @@ + +
+ +
+ + + +
\ No newline at end of file diff --git a/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 7__1.html b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 7__1.html new file mode 100644 index 00000000000..85047c9e8c6 --- /dev/null +++ b/src/Toolkit/tests/Functional/__snapshots__/ComponentsRenderingTest__testComponentRendering with data set Kit shadcn, component button-group, code 7__1.html @@ -0,0 +1,22 @@ + +
+ +
+ + + +
\ No newline at end of file