From dee28f1ee526705cbf2c3452b89312ea0a46636c Mon Sep 17 00:00:00 2001 From: Ronan Berder Date: Sun, 27 Apr 2025 23:19:52 +0800 Subject: [PATCH] Working on docs and polishing macros --- dist/basecoat.css | 31 ++- dist/basecoat.tailwind.css | 2 +- docs/_includes/components/dialog-script.njk | 55 ++++++ docs/_includes/components/dialog.njk | 87 +++----- .../components/dropdown-menu-script.njk | 98 +++++++++ docs/_includes/components/dropdown-menu.njk | 107 +--------- docs/_includes/components/popover-script.njk | 33 ++++ docs/_includes/components/popover.njk | 36 +--- docs/_includes/components/select-script.njk | 158 +++++++++++++++ docs/_includes/components/select.njk | 186 ++---------------- docs/_includes/components/tabs-script.njk | 71 +++++++ docs/_includes/components/tabs.njk | 75 +------ docs/_includes/components/toast-script.njk | 52 +++++ docs/_includes/components/toast.njk | 55 +----- docs/_includes/layouts/base.njk | 11 +- docs/_includes/layouts/component.njk | 2 +- docs/_includes/layouts/page.njk | 39 ++++ docs/_includes/macros/code_preview.njk | 2 +- .../partials/kitchen-sink/dialog.njk | 2 +- .../partials/kitchen-sink/select.njk | 3 +- docs/components/accordion.njk | 6 +- docs/components/alert-dialog.njk | 43 ++-- docs/components/alert.njk | 5 +- docs/components/avatar.njk | 6 +- docs/components/badge.njk | 2 +- docs/components/breadcrumb.njk | 19 +- docs/components/button.njk | 4 +- docs/components/card.njk | 3 +- docs/components/checkbox.njk | 7 +- docs/components/combobox.njk | 75 +++++-- docs/components/popover.njk | 8 +- docs/components/select.njk | 32 ++- docs/installation.njk | 11 ++ 33 files changed, 765 insertions(+), 561 deletions(-) create mode 100644 docs/_includes/components/dialog-script.njk create mode 100644 docs/_includes/components/dropdown-menu-script.njk create mode 100644 docs/_includes/components/popover-script.njk create mode 100644 docs/_includes/components/select-script.njk create mode 100644 docs/_includes/components/tabs-script.njk create mode 100644 docs/_includes/components/toast-script.njk create mode 100644 docs/_includes/layouts/page.njk create mode 100644 docs/installation.njk diff --git a/dist/basecoat.css b/dist/basecoat.css index c06fe96..2197ee9 100644 --- a/dist/basecoat.css +++ b/dist/basecoat.css @@ -336,9 +336,6 @@ .mx-auto { margin-inline: auto; } - .my-4 { - margin-block: calc(var(--spacing) * 4); - } .my-6 { margin-block: calc(var(--spacing) * 6); } @@ -1381,6 +1378,32 @@ } } } + .\[\&_a\:not\(\[class\]\)\]\:text-muted-foreground { + & a:not([class]) { + color: var(--color-muted-foreground); + } + } + .\[\&_a\:not\(\[class\]\)\]\:no-underline { + & a:not([class]) { + text-decoration-line: none; + } + } + .\[\&_a\:not\(\[class\]\)\]\:transition-colors { + & a:not([class]) { + transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to; + transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)); + transition-duration: var(--tw-duration, var(--default-transition-duration)); + } + } + .\[\&_a\:not\(\[class\]\)\]\:hover\:text-foreground { + & a:not([class]) { + &:hover { + @media (hover: hover) { + color: var(--color-foreground); + } + } + } + } .\[\&_img\]\:size-8 { & img { width: calc(var(--spacing) * 8); @@ -2848,6 +2871,8 @@ display: flex; height: calc(var(--spacing) * 10); width: 100%; + min-width: calc(var(--spacing) * 0); + flex: 1; border-radius: var(--radius-md); background-color: transparent; padding-block: calc(var(--spacing) * 3); diff --git a/dist/basecoat.tailwind.css b/dist/basecoat.tailwind.css index 862d479..f79a2db 100644 --- a/dist/basecoat.tailwind.css +++ b/dist/basecoat.tailwind.css @@ -660,7 +660,7 @@ @apply size-4 shrink-0 opacity-50; } input[role='combobox'] { - @apply placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50; + @apply placeholder:text-muted-foreground flex h-10 flex-1 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 min-w-0; } } [role='listbox']:not(:has([data-value]:not([aria-hidden='true'])))::before { diff --git a/docs/_includes/components/dialog-script.njk b/docs/_includes/components/dialog-script.njk new file mode 100644 index 0000000..2c76bdd --- /dev/null +++ b/docs/_includes/components/dialog-script.njk @@ -0,0 +1,55 @@ + \ No newline at end of file diff --git a/docs/_includes/components/dialog.njk b/docs/_includes/components/dialog.njk index 0a883c7..21ce3c9 100644 --- a/docs/_includes/components/dialog.njk +++ b/docs/_includes/components/dialog.njk @@ -1,3 +1,24 @@ +{# + Renders a dialog component with optional trigger, header, body, and footer. + + @param id {string} - Unique identifier for the dialog component. + @param trigger {string} [optional] - Text or HTML for the button that triggers the dialog. + @param title {string} [optional] - Title text displayed in the dialog header. + @param description {string} [optional] - Description text displayed below the title. + @param footer {string} [optional] - HTML content for the dialog footer. + @param main_attrs {object} [optional] - Additional HTML attributes for the main container div. + @param trigger_attrs {object} [optional] - Additional HTML attributes for the trigger button. + @param content_attrs {object} [optional] - Additional HTML attributes for the dialog content article. + @param content_header_attrs {object} [optional] - Additional HTML attributes for the dialog header. + @param content_body_attrs {object} [optional] - Additional HTML attributes for the dialog body section. + @param content_footer_attrs {object} [optional] - Additional HTML attributes for the dialog footer. + @param open {boolean} [optional] [default=false] - Whether the dialog should be open initially. + @param close_button {boolean} [optional] [default=true] - Whether to include a close button. + @param close_on_overlay_click {boolean} [optional] [default=true] - Whether clicking the overlay closes the dialog. + @param include_html {boolean} [optional] [default=true] - Whether to render the HTML structure. + @param include_script {boolean} [optional] [default=true] - Whether to include the Alpine.js component script. + @param register_on {array} [optional] [default=["alpine:init"]] - Alpine.js events to register the component on. +#} {% macro dialog( id, trigger=None, @@ -14,72 +35,11 @@ close_button=true, close_on_overlay_click=true, include_html=true, - include_script=true, + include_script=false, register_on=["alpine:init"] ) %} {% if include_script %} - + {% include "components/dialog-script.njk" %} {% endif %} {% if include_html %} @@ -94,6 +54,7 @@ > {% if trigger %}