From 016c8191e57501af37f18ff3f3e146555dc6e502 Mon Sep 17 00:00:00 2001 From: Ali Hamdi Ali Fadel Date: Fri, 22 Nov 2024 06:00:12 -0800 Subject: [PATCH] Support RTL in alert/alert_dialog/dialog/sheet components --- lib/ruby_ui/alert/alert.rb | 2 +- lib/ruby_ui/alert_dialog/alert_dialog_footer.rb | 2 +- lib/ruby_ui/alert_dialog/alert_dialog_header.rb | 2 +- lib/ruby_ui/dialog/dialog_content.rb | 2 +- lib/ruby_ui/dialog/dialog_footer.rb | 2 +- lib/ruby_ui/dialog/dialog_header.rb | 2 +- lib/ruby_ui/sheet/sheet_content.rb | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ruby_ui/alert/alert.rb b/lib/ruby_ui/alert/alert.rb index 0c7881eb..c83352d0 100644 --- a/lib/ruby_ui/alert/alert.rb +++ b/lib/ruby_ui/alert/alert.rb @@ -27,7 +27,7 @@ def colors end def default_attrs - base_classes = "backdrop-blur relative w-full ring-1 ring-inset rounded-lg px-4 py-4 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg~*]:pl-8" + base_classes = "backdrop-blur relative w-full ring-1 ring-inset rounded-lg px-4 py-4 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:start-4 [&>svg]:top-4 [&>svg~*]:ps-8" { class: [base_classes, colors] } diff --git a/lib/ruby_ui/alert_dialog/alert_dialog_footer.rb b/lib/ruby_ui/alert_dialog/alert_dialog_footer.rb index 07c0e6e1..f5481062 100644 --- a/lib/ruby_ui/alert_dialog/alert_dialog_footer.rb +++ b/lib/ruby_ui/alert_dialog/alert_dialog_footer.rb @@ -10,7 +10,7 @@ def view_template(&) def default_attrs { - class: "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2" + class: "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 rtl:space-x-reverse" } end end diff --git a/lib/ruby_ui/alert_dialog/alert_dialog_header.rb b/lib/ruby_ui/alert_dialog/alert_dialog_header.rb index 1331fa1f..0494988a 100644 --- a/lib/ruby_ui/alert_dialog/alert_dialog_header.rb +++ b/lib/ruby_ui/alert_dialog/alert_dialog_header.rb @@ -10,7 +10,7 @@ def view_template(&) def default_attrs { - class: "flex flex-col space-y-2 text-center sm:text-left" + class: "flex flex-col space-y-2 text-center sm:text-left rtl:sm:text-right" } end end diff --git a/lib/ruby_ui/dialog/dialog_content.rb b/lib/ruby_ui/dialog/dialog_content.rb index 3c9df6db..41b01d61 100644 --- a/lib/ruby_ui/dialog/dialog_content.rb +++ b/lib/ruby_ui/dialog/dialog_content.rb @@ -43,7 +43,7 @@ def default_attrs def close_button button( type: "button", - class: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", + class: "absolute end-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", data_action: "click->ruby-ui--dialog#dismiss" ) do svg( diff --git a/lib/ruby_ui/dialog/dialog_footer.rb b/lib/ruby_ui/dialog/dialog_footer.rb index 88277df0..bf2b35a2 100644 --- a/lib/ruby_ui/dialog/dialog_footer.rb +++ b/lib/ruby_ui/dialog/dialog_footer.rb @@ -10,7 +10,7 @@ def view_template(&) def default_attrs { - class: "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 gap-y-2 sm:gap-y-0" + class: "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 gap-y-2 sm:gap-y-0 rtl:space-x-reverse" } end end diff --git a/lib/ruby_ui/dialog/dialog_header.rb b/lib/ruby_ui/dialog/dialog_header.rb index cb7d9b5c..c6a12aa7 100644 --- a/lib/ruby_ui/dialog/dialog_header.rb +++ b/lib/ruby_ui/dialog/dialog_header.rb @@ -10,7 +10,7 @@ def view_template(&) def default_attrs { - class: "flex flex-col space-y-1.5 text-center sm:text-left" + class: "flex flex-col space-y-1.5 text-center sm:text-left rtl:sm:text-right" } end end diff --git a/lib/ruby_ui/sheet/sheet_content.rb b/lib/ruby_ui/sheet/sheet_content.rb index 60f733da..bf3a3115 100644 --- a/lib/ruby_ui/sheet/sheet_content.rb +++ b/lib/ruby_ui/sheet/sheet_content.rb @@ -42,7 +42,7 @@ def default_attrs def close_button button( type: "button", - class: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", + class: "absolute end-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", data_action: "click->ruby-ui--sheet-content#close" ) do svg(