Create a Tailwind CQs/MQs plugin
What does this MR do?
Create a Tailwind CQs/MQs plugin
This creates a Tailwind plugin that matches @<breakpoint utils. For
those utils, it generates media queries by default.
If Tailwind is executed with the USE_TAILWIND_CONTAINER_QUERIES flag
enabled, the plugin generates container queries instead of media
queries.
Consumers of GitLab UI can use this to generate the bundle(s) they need
depending on whether or not they are built using containers.
To build the container queries versions of the CSS bundles, build the assets with the USE_TAILWIND_CONTAINER_QUERIES flag enabled:
USE_TAILWIND_CONTAINER_QUERIES=true yarn build
What's the diff?
Here's the diff for the built index.css and tailwind.css bundles when container queries are enabled:
diff --git a/packages/gitlab-ui/dist/index.css b/packages/gitlab-ui/dist/index.css
index 42c2673c9..f10e8e157 100644
--- a/packages/gitlab-ui/dist/index.css
+++ b/packages/gitlab-ui/dist/index.css
@@ -16182,7 +16182,7 @@ body.modal-open{
margin-top:.5rem;
width:100%
}
-@media (min-width:768px){
+@container (min-width: 768px){
.gl-actions-tabs-start{
display:none
}
@@ -16195,7 +16195,7 @@ body.modal-open{
justify-content:flex-end;
margin-top:0
}
-@media (min-width:768px){
+@container (min-width: 768px){
.gl-actions-tabs-end{
display:flex
}
@@ -16203,7 +16203,7 @@ body.modal-open{
.gl-actions-tabs-end button,.gl-actions-tabs-start button{
margin-bottom:.5rem
}
-@media (min-width:768px){
+@container (min-width: 768px){
.gl-actions-tabs-end button,.gl-actions-tabs-start button{
margin-bottom:0;
margin-right:.5rem
diff --git a/packages/gitlab-ui/dist/tailwind.css b/packages/gitlab-ui/dist/tailwind.css
index e7b4d206d..5f34deeba 100644
--- a/packages/gitlab-ui/dist/tailwind.css
+++ b/packages/gitlab-ui/dist/tailwind.css
@@ -998,7 +998,7 @@
box-shadow:inset 0 0 0 2px var(--gl-focus-ring-outer-color),inset 0 0 0 3px var(--gl-focus-ring-inner-color),inset 0 0 0 1px var(--gl-focus-ring-inner-color)!important;
outline:none!important
}
-@media (min-width:576px){
+@container (min-width: 576px){
.\@sm\:gl-block{
display:block
}
@@ -1008,6 +1008,8 @@
.\@sm\:gl-gap-3{
gap:.5rem
}
+}
+@media (min-width:576px){
.sm\:\!gl-hidden{
display:none!important
}
Screenshots or screen recordings
Integrations
-
GitLab: gitlab-org/gitlab!202280 (merged) -
CustomersDot: mr_url -
Duo UI: mr_url -
Status Page: mr_url -
Docs: mr_url -
Switchboard: mr_url
Does this MR meet the acceptance criteria?
This checklist encourages the authors, reviewers, and maintainers of merge requests (MRs) to confirm changes were analyzed for conformity with the project's guidelines, security and accessibility.
Toggle the acceptance checklist
Conformity
-
The “What does this MR do?” section in the MR description is filled out, explaining the reasons for and scope of the proposed changes, per “Say why not just what”. - For example, if the MR is focused on usage guidelines, addressing accessibility challenges could be added in a separate MR.
-
Relevant label(s) are applied to the MR. -
The MR is added to a milestone. -
Added the ~"component:*"label(s) if applicable.
Components
-
GitLab UI's contributing guidelines. -
If the MR changes a component's API, integration MR(s) have been opened (see integrations above).
Documentation
-
If creating a new component page from scratch, it follows the page template structure. -
Content follows the Pajamas voice and tone guidelines, falling back on the GitLab Documentation Style Guide when needed. -
Related pages are cross-linked, where helpful. Component pages have related components and patterns defined in their Markdown front matter. -
If embedding a Figma file, it follows the Figma embed guide. -
Review requested from any GitLab designer or directly from a maintainer or trainee maintainer. -
Maintainer review follows the Pajamas UX maintainer review checklist.
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec -
Security reports checked/validated by a reviewer from the AppSec team
Accessibility
If this MR adds or modifies a component, take a few moments to review the following:
-
All actions and functionality can be done with a keyboard. -
Links, buttons, and controls have a visible focus state. -
All content is presented in text or with a text equivalent. For example, alt text for SVG, or aria-labelfor icons that have meaning or perform actions. -
Changes in a component’s state are announced by a screen reader. For example, changing aria-expanded="false"toaria-expanded="true"when an accordion is expanded. -
Color combinations have sufficient contrast.