diff --git a/resources/public/output.css b/resources/public/output.css index 15e78cd2..c83024f1 100644 --- a/resources/public/output.css +++ b/resources/public/output.css @@ -1151,6 +1151,10 @@ input:checked + .toggle-bg { margin: 1rem; } +.m-1 { + margin: 0.25rem; +} + .mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; @@ -1176,29 +1180,6 @@ input:checked + .toggle-bg { margin-bottom: 1rem; } -.mx-8 { - margin-left: 2rem; - margin-right: 2rem; -} - -.my-8 { - margin-top: 2rem; - margin-bottom: 2rem; -} - -.my-64 { - margin-top: 16rem; - margin-bottom: 16rem; -} - -.\!mt-0 { - margin-top: 0px !important; -} - -.\!mt-1 { - margin-top: 0.25rem !important; -} - .-mb-1 { margin-bottom: -0.25rem; } @@ -1279,16 +1260,24 @@ input:checked + .toggle-bg { margin-top: 1.25rem; } -.\!mt-64 { - margin-top: 16rem !important; +.\!mt-0 { + margin-top: 0px !important; } -.\!mt-32 { - margin-top: 8rem !important; +.\!mt-3 { + margin-top: 0.75rem !important; } -.mr-5 { - margin-right: 1.25rem; +.mt-3 { + margin-top: 0.75rem; +} + +.\!mt-1 { + margin-top: 0.25rem !important; +} + +.ml-64 { + margin-left: 16rem; } .block { @@ -1375,19 +1364,6 @@ input:checked + .toggle-bg { height: 100vh; } -.h-auto { - height: auto; -} - -.h-min { - height: -moz-min-content; - height: min-content; -} - -.h-64 { - height: 16rem; -} - .max-h-96 { max-height: 24rem; } @@ -1396,10 +1372,6 @@ input:checked + .toggle-bg { max-height: 100%; } -.max-h-screen { - max-height: 100vh; -} - .w-1\/2 { width: 50%; } @@ -1456,14 +1428,14 @@ input:checked + .toggle-bg { width: 24rem; } -.w-auto { - width: auto; -} - .w-full { width: 100%; } +.w-auto { + width: auto; +} + .w-max { width: -moz-max-content; width: max-content; @@ -1521,10 +1493,6 @@ input:checked + .toggle-bg { flex-grow: 1; } -.grow-0 { - flex-grow: 0; -} - .basis-1\/4 { flex-basis: 25%; } @@ -1574,16 +1542,6 @@ input:checked + .toggle-bg { transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)) !important; } -.translate-y-0 { - --tw-translate-y: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.translate-y-4 { - --tw-translate-y: 1rem; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - .rotate-180 { --tw-rotate: 180deg; transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); @@ -1683,10 +1641,6 @@ input:checked + .toggle-bg { place-items: center; } -.content-center { - align-content: center; -} - .items-start { align-items: flex-start; } @@ -1723,10 +1677,6 @@ input:checked + .toggle-bg { justify-content: space-between; } -.justify-items-center { - justify-items: center; -} - .justify-items-stretch { justify-items: stretch; } @@ -1823,6 +1773,26 @@ input:checked + .toggle-bg { border-color: rgb(243 244 246 / var(--tw-divide-opacity)); } +.place-self-start { + place-self: start; +} + +.place-self-end { + place-self: end; +} + +.self-start { + align-self: flex-start; +} + +.self-center { + align-self: center; +} + +.justify-self-start { + justify-self: start; +} + .justify-self-end { justify-self: end; } @@ -2124,11 +2094,6 @@ input:checked + .toggle-bg { background-color: rgb(253 246 178 / var(--tw-bg-opacity)); } -.bg-black { - --tw-bg-opacity: 1; - background-color: rgb(0 0 0 / var(--tw-bg-opacity)); -} - .bg-opacity-50 { --tw-bg-opacity: 0.5; } @@ -2137,18 +2102,14 @@ input:checked + .toggle-bg { --tw-bg-opacity: 0 !important; } -.\!bg-opacity-50 { - --tw-bg-opacity: 0.5 !important; -} - -.bg-opacity-40 { - --tw-bg-opacity: 0.4; -} - .\!bg-opacity-100 { --tw-bg-opacity: 1 !important; } +.\!bg-opacity-50 { + --tw-bg-opacity: 0.5 !important; +} + .p-1 { padding: 0.25rem; } @@ -2237,16 +2198,6 @@ input:checked + .toggle-bg { padding-bottom: 1.25rem; } -.px-7 { - padding-left: 1.75rem; - padding-right: 1.75rem; -} - -.py-6 { - padding-top: 1.5rem; - padding-bottom: 1.5rem; -} - .pb-2 { padding-bottom: 0.5rem; } @@ -2479,10 +2430,6 @@ input:checked + .toggle-bg { text-decoration-line: underline; } -.\!opacity-0 { - opacity: 0 !important; -} - .opacity-0 { opacity: 0; } @@ -2491,8 +2438,8 @@ input:checked + .toggle-bg { opacity: 1; } -.\!opacity-50 { - opacity: 0.5 !important; +.\!opacity-0 { + opacity: 0 !important; } .\!opacity-100 { @@ -2576,10 +2523,6 @@ input:checked + .toggle-bg { transition-duration: 100ms; } -.duration-200 { - transition-duration: 200ms; -} - .duration-300 { transition-duration: 300ms; } @@ -2592,12 +2535,8 @@ input:checked + .toggle-bg { transition-duration: 75ms; } -.duration-1000 { - transition-duration: 1000ms; -} - -.ease-\[cubic-bezier\(\.3\2c 2\.3\2c \.6\2c 1\)\] { - transition-timing-function: cubic-bezier(.3,2.3,.6,1); +.duration-200 { + transition-duration: 200ms; } .ease-in-out { @@ -2608,8 +2547,8 @@ input:checked + .toggle-bg { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); } -.ease-in { - transition-timing-function: cubic-bezier(0.4, 0, 1, 1); +.ease-\[cubic-bezier\(\.3\2c 2\.3\2c \.6\2c 1\)\] { + transition-timing-function: cubic-bezier(.3,2.3,.6,1); } .htmx-added .fade-in { @@ -3040,11 +2979,6 @@ input:checked + .toggle-bg { background-color: rgb(73 109 28 / var(--tw-bg-opacity)); } -.hover\:bg-neutral-100:hover { - --tw-bg-opacity: 1; - background-color: rgb(245 245 245 / var(--tw-bg-opacity)); -} - .hover\:bg-primary-100:hover { --tw-bg-opacity: 1; background-color: rgb(228 240 213 / var(--tw-bg-opacity)); @@ -3060,9 +2994,9 @@ input:checked + .toggle-bg { background-color: rgb(255 255 255 / var(--tw-bg-opacity)); } -.hover\:bg-gray-50:hover { +.hover\:bg-neutral-100:hover { --tw-bg-opacity: 1; - background-color: rgb(249 250 251 / var(--tw-bg-opacity)); + background-color: rgb(245 245 245 / var(--tw-bg-opacity)); } .hover\:text-blue-600:hover { @@ -3612,39 +3546,14 @@ input:checked + .toggle-bg { max-height: 80vh; } - .sm\:max-w-lg { - max-width: 32rem; - } - - .sm\:max-w-xl { - max-width: 36rem; - } - - .sm\:max-w-2xl { - max-width: 42rem; + .sm\:max-h-\[90vh\] { + max-height: 90vh; } .sm\:max-w-4xl { max-width: 56rem; } - .sm\:translate-y-0 { - --tw-translate-y: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); - } - - .sm\:scale-100 { - --tw-scale-x: 1; - --tw-scale-y: 1; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); - } - - .sm\:scale-95 { - --tw-scale-x: .95; - --tw-scale-y: .95; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); - } - .sm\:rounded-lg { border-radius: 0.5rem; } @@ -3770,6 +3679,11 @@ input:checked + .toggle-bg { } } +.\[\&\.active\]\:bg-red-500.active { + --tw-bg-opacity: 1; + background-color: rgb(255 3 3 / var(--tw-bg-opacity)); +} + .\[\&\.active\]\:bg-primary-500.active { --tw-bg-opacity: 1; background-color: rgb(121 181 46 / var(--tw-bg-opacity)); diff --git a/src/clj/auto_ap/ssr/admin/transaction_rules.clj b/src/clj/auto_ap/ssr/admin/transaction_rules.clj index dbb4d10b..2e5d8353 100644 --- a/src/clj/auto_ap/ssr/admin/transaction_rules.clj +++ b/src/clj/auto_ap/ssr/admin/transaction_rules.clj @@ -424,7 +424,7 @@ [:fieldset {:class "hx-disable" :hx-disinherit "hx-target"} (fc/start-form entity form-errors - [:div.space-y-2 + [:div.space-y-1 (when-let [id (:db/id entity)] (com/hidden {:name "db/id" :value id})) @@ -551,8 +551,9 @@ :name (fc/field-name) :orientation :horizontal}))) - [:div#form-errors [:span.error-content - (com/errors {:errors (:errors fc/*form-errors*)})]] + [:div#form-errors (when (:errors fc/*form-errors*) + [:span.error-content + (com/errors {:errors (:errors fc/*form-errors*)})])] (com/button {:color :primary :form "edit-form" :type "submit" :class "w-32"} "Save")])]] [:div]))) @@ -611,7 +612,7 @@ (html-response (dialog* :entity entity :form-params {:hx-put (str (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-edit-save))}) - :headers {"hx-trigger" "modalopen"}))) + :headers {"hx-trigger-after-settle" "modalopen"}))) (defn transaction-rule-error [request] (let [entity (some-> request :last-form)] @@ -631,7 +632,7 @@ :form-errors {} :form-params {:hx-post (str (bidi/path-for ssr-routes/only-routes :admin-transaction-rule-edit-save))}) - :headers {"hx-trigger" "modalopen"})) + :headers {"hx-trigger-after-settle" "modalopen"})) (def transaction-rule-schema (mc/schema [:map diff --git a/src/clj/auto_ap/ssr/components/inputs.clj b/src/clj/auto_ap/ssr/components/inputs.clj index 6057270f..af06787d 100644 --- a/src/clj/auto_ap/ssr/components/inputs.clj +++ b/src/clj/auto_ap/ssr/components/inputs.clj @@ -81,12 +81,14 @@ c.clearChoices(); :elements (if (:value params) [{:value ((:value-fn params first) (:value params)) :label ((:content-fn params second) (:value params))}] [])})} - [:a {:class (-> (hh/add-class (or (:class params) "") default-input-classes) - (hh/add-class "cursor-pointer")) - "@click.prevent.stop" "open = !open;" + [:a {:class (-> (hh/add-class (or (:class params) "") default-input-classes) + (hh/add-class "cursor-pointer")) + "@click.prevent" "open = !open;" "@keydown.enter.prevent.stop" "open = !open;" - :tabindex 0 - :x-init (:x-init params)} + "@keydown.down.prevent.stop" "open = true;" + "@keydown.backspace" "value = {value: '', label: '' }" + :tabindex 0 + :x-init (:x-init params)} [:input (-> params (dissoc :class) (dissoc :value-fn) @@ -94,42 +96,43 @@ c.clearChoices(); (dissoc :placeholder) (assoc - "x-ref" "hidden" - :type "hidden" - ":value" "value.value" - :x-init (hiccup/raw (str "$watch('value', v => $dispatch('change')); "))))] + "x-ref" "hidden" + :type "hidden" + ":value" "value.value" + :x-init (hiccup/raw (str "$watch('value', v => $dispatch('change')); "))))] [:div.flex.w-full.justify-items-stretch [:span.flex-grow.text-left {"x-text" "value.label"}] - [:div {:class "w-5 h-5 inline ml-1 justify-self-end"} + [:div {:class "w-3 h-3 m-1 inline ml-1 justify-self-end text-gray-500 self-center"} svg/drop-down]]] - [:ul.dropdown-contents {:class "absolute bg-gray-50 dark:bg-gray-600 rounded-lg shadow-lg py-1 w-max z-10 mt-1" - "@keydown.escape.window" "open = false" - "x-transition:enter" "ease-[cubic-bezier(.3,2.3,.6,1)] duration-200" + + [:ul.dropdown-contents {:class "absolute bg-gray-50 dark:bg-gray-600 rounded-lg shadow-lg py-1 w-max z-10 mt-1" + "@keydown.escape" "open = false; value = {value: '', label: '' }" + "x-transition:enter" "ease-[cubic-bezier(.3,2.3,.6,1)] duration-200" "x-transition:enter-start" "!opacity-0 !mt-0" - "x-transition:enter-end" "!opacity-1 !mt-1" - "x-transition:leave" "ease-out duration-200" + "x-transition:enter-end" "!opacity-1 !mt-1" + "x-transition:leave" "ease-out duration-200" "x-transition:leave-start" "!opacity-1 !mt-1" - "x-transition:leave-end" "!opacity-0 !mt-0" - "x-show " "open" - "x-trap" "open" - "@click.outside" "open=false; console.log('is this ihid')"} - [:input {:type "text" :class (hh/add-class (or (:class params) "") default-input-classes) - "x-model" "search" - "placeholder" (:placeholder params) - "@keydown.down.prevent" "active ++; active = active >= elements.length - 1 ? elements.length - 1 : active" - "@keydown.up.prevent" "active --; active = active < 0 ? 0 : active" + "x-transition:leave-end" "!opacity-0 !mt-0" + "x-show " "open" + "x-trap" "open" + "@click.outside" "open=false; console.log('is this ihid')"} + [:input {:type "text" :class (hh/add-class (or (:class params) "") default-input-classes) + "x-model" "search" + "placeholder" (:placeholder params) + "@keydown.down.prevent" "active ++; active = active >= elements.length - 1 ? elements.length - 1 : active" + "@keydown.up.prevent" "active --; active = active < 0 ? 0 : active" "@keydown.enter.prevent" "open = false; value = elements.length > 0 ? $data.elements[active] : {'value': '', label: ''}; console.log('are we here')" - "x-init" "$watch('search', s => { if($el.value.length > 2) {fetch(baseUrl + s).then(data=>data.json()).then(data => {elements = data; active=-1}) }})"}] + "x-init" "$watch('search', s => { if($el.value.length > 2) {fetch(baseUrl + s).then(data=>data.json()).then(data => {elements = data; active=-1}) }})"}] [:div.dropdown-options [:template {:x-for "(element, index) in elements"} - [:li [:a {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-300 [&.active]:dark:bg-primary-700 text-gray-800 dark:text-gray-100" - :href "#" - ":class" "active == index ? 'active' : ''" - "@mouseover" "active = index" - "@mouseout" "active = -1" + [:li [:a {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-300 [&.active]:dark:bg-primary-700 text-gray-800 dark:text-gray-100" + :href "#" + ":class" "active == index ? 'active' : ''" + "@mouseover" "active = index" + "@mouseout" "active = -1" "@click.prevent" "value = element; open=false; " - "x-html" "element.label"}]]] + "x-html" "element.label"}]]] [:template {:x-if "elements.length == 0"} [:li {:class "px-4 py-2 flex gap-2 items-center outline-0 focus:bg-neutral-100 hover:bg-neutral-100 whitespace-nowrap [&.active]:bg-primary-500 text-gray-800 dark:text-gray-100 text-xs "} "No results found"]]]]]) diff --git a/src/clj/auto_ap/ssr/ui.clj b/src/clj/auto_ap/ssr/ui.clj index 7527004e..a32ba532 100644 --- a/src/clj/auto_ap/ssr/ui.clj +++ b/src/clj/auto_ap/ssr/ui.clj @@ -78,8 +78,9 @@ input[type=number] { "x-transition:leave-end" "!bg-opacity-0"} [:div.flex.place-items-center.place-content-center.w-full.h-full.p-12 - [:div {:class (str "w-full sm:max-w-4xl sm:rounded-lg overflow-scroll max-h-full sm:max-h-[80vh]") + [:div {:class (str "w-full sm:max-w-4xl sm:rounded-lg overflow-scroll max-h-full sm:max-h-[90vh]") "@click.outside" "open=false" + "x-trap.inert.noscroll" "open" "x-trap.inert" "open" "x-show" "open" "x-transition:enter" "ease-out duration-300"