lostcoords-ui 0.12.2 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +87 -21
  3. data/app/assets/tailwind/lostcoords/ui/components/menu.css +0 -1
  4. data/app/assets/tailwind/lostcoords/ui/dialog.css +7 -0
  5. data/app/assets/tailwind/lostcoords/ui/emoji-picker.css +0 -18
  6. data/app/assets/tailwind/lostcoords/ui/popover.css +10 -0
  7. data/app/assets/tailwind/lostcoords/ui/sheet.css +13 -55
  8. data/app/helpers/lostcoords/ui/card_helper.rb +1 -1
  9. data/app/helpers/lostcoords/ui/dialog_helper.rb +6 -6
  10. data/app/helpers/lostcoords/ui/list_group_helper.rb +24 -24
  11. data/app/helpers/lostcoords/ui/menu_helper.rb +31 -24
  12. data/app/helpers/lostcoords/ui/primitives_helper.rb +8 -15
  13. data/app/helpers/lostcoords/ui/sheet_helper.rb +17 -17
  14. data/app/helpers/lostcoords/ui/tailwind_helper.rb +8 -2
  15. data/app/javascript/lostcoords/ui/controllers/lc_hovercard_controller.js +3 -2
  16. data/app/javascript/lostcoords/ui/controllers/lc_menu_controller.js +14 -9
  17. data/app/javascript/lostcoords/ui/controllers/lc_search_controller.js +1 -1
  18. data/app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js +3 -71
  19. data/app/javascript/lostcoords/ui/controllers/lc_tooltip_controller.js +3 -5
  20. data/app/javascript/lostcoords/ui/helpers/catalog_picker.js +1 -1
  21. data/app/javascript/lostcoords/ui/helpers/floating_panel.js +16 -14
  22. data/app/views/lostcoords/ui/components/_emoji_picker.html.erb +0 -2
  23. data/app/views/lostcoords/ui/components/_lc_confirm_sheet.html.erb +2 -2
  24. data/app/views/lostcoords/ui/components/_lc_dialog.html.erb +9 -6
  25. data/lib/lostcoords/ui/parts.rb +9 -0
  26. data/lib/lostcoords/ui/version.rb +1 -1
  27. metadata +1 -2
  28. data/app/views/lostcoords/ui/components/_lc_floating_panel.html.erb +0 -13
@@ -86,14 +86,23 @@ module Lostcoords::Ui
86
86
  end
87
87
 
88
88
  # Rows that stay put while the sheet's content scrolls under them, painted with the sheet's surface.
89
+ # On phones the header is the sheet's title bar: the ✕ at its start and the title centred.
89
90
  # The footer sits last in an inset-padded scroller and bleeds to its edges, clearing the home indicator.
90
91
  class Sheet < Base
91
92
  SURFACE = "sticky z-sticky bg-(--lc-sheet-bg,var(--popover))"
92
93
 
94
+ # Every phone sheet closes from a 44px ✕ at its header's start.
95
+ CLOSE = "max-sm:absolute max-sm:start-3 max-sm:top-1.5 max-sm:size-11 max-sm:bg-muted max-sm:[&_svg]:size-5"
96
+
93
97
  def header(**attributes, &block)
94
98
  part(:header, "sheet-header", "#{SURFACE} top-0 flex min-h-14 shrink-0 items-center", attributes, &block)
95
99
  end
96
100
 
101
+ # Goes in the header. From sm up it is a plain icon button, placed by the caller.
102
+ def close(label, **attributes)
103
+ view.lc_icon_button(label, **slot("sheet-close", attributes, class: CLOSE)) { view.lc_icon("x-mark", options: { aria: { hidden: true } }) }
104
+ end
105
+
97
106
  def footer(**attributes, &block)
98
107
  part(:footer, "sheet-footer", "#{SURFACE} bottom-0 -mx-inset flex flex-wrap items-center justify-end gap-related " \
99
108
  "px-inset pt-3 pb-[max(env(safe-area-inset-bottom),--spacing(3))]", attributes, &block)
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.12.2"
3
+ VERSION = "0.14.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lostcoords-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates
@@ -205,7 +205,6 @@ files:
205
205
  - app/views/lostcoords/ui/components/_lc_collapsible.html.erb
206
206
  - app/views/lostcoords/ui/components/_lc_confirm_sheet.html.erb
207
207
  - app/views/lostcoords/ui/components/_lc_dialog.html.erb
208
- - app/views/lostcoords/ui/components/_lc_floating_panel.html.erb
209
208
  - app/views/lostcoords/ui/components/_lc_search.html.erb
210
209
  - config/emoji_search_aliases.yml
211
210
  - config/emoji_search_names.yml
@@ -1,13 +0,0 @@
1
- <%# locals: (id:, title:, wrapper:, trigger:, attributes:, content:) %>
2
- <% panel = tag.div(**attributes) do %>
3
- <% if title %><h2 id="<%= id %>-title" class="<%= lc_heading_class(size: :subheading) %>"><%= title %></h2><% end %>
4
- <%= content %>
5
- <% end %>
6
- <% if wrapper %>
7
- <%= tag.div(**wrapper) do %>
8
- <%= trigger %>
9
- <%= panel %>
10
- <% end %>
11
- <% else %>
12
- <%= panel %>
13
- <% end %>