lostcoords-ui 0.7.0 → 0.8.1

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 (58) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +338 -28
  3. data/app/assets/tailwind/lostcoords/ui/card.css +14 -6
  4. data/app/assets/tailwind/lostcoords/ui/collapsible.css +6 -0
  5. data/app/assets/tailwind/lostcoords/ui/components/dialog.css +2 -2
  6. data/app/assets/tailwind/lostcoords/ui/components/search.css +5 -0
  7. data/app/assets/tailwind/lostcoords/ui/components.css +1 -0
  8. data/app/assets/tailwind/lostcoords/ui/core.css +2 -2
  9. data/app/assets/tailwind/lostcoords/ui/dialog.css +17 -0
  10. data/app/assets/tailwind/lostcoords/ui/emoji-picker.css +2 -1
  11. data/app/assets/tailwind/lostcoords/ui/popover.css +6 -4
  12. data/app/assets/tailwind/lostcoords/ui/search.css +96 -0
  13. data/app/assets/tailwind/lostcoords/ui/sheet.css +41 -8
  14. data/app/assets/tailwind/lostcoords/ui/theme.css +18 -0
  15. data/app/assets/tailwind/lostcoords/ui/toast.css +34 -4
  16. data/app/assets/tailwind/lostcoords/ui/typography.css +10 -0
  17. data/app/helpers/lostcoords/ui/badge_helper.rb +33 -15
  18. data/app/helpers/lostcoords/ui/button_helper.rb +71 -2
  19. data/app/helpers/lostcoords/ui/choice_helper.rb +9 -16
  20. data/app/helpers/lostcoords/ui/collapsible_helper.rb +26 -4
  21. data/app/helpers/lostcoords/ui/dialog_helper.rb +52 -12
  22. data/app/helpers/lostcoords/ui/form_helper.rb +30 -10
  23. data/app/helpers/lostcoords/ui/glass_helper.rb +6 -0
  24. data/app/helpers/lostcoords/ui/layout_helper.rb +13 -5
  25. data/app/helpers/lostcoords/ui/list_group_helper.rb +95 -0
  26. data/app/helpers/lostcoords/ui/menu_helper.rb +84 -13
  27. data/app/helpers/lostcoords/ui/navigation_helper.rb +57 -12
  28. data/app/helpers/lostcoords/ui/primitives_helper.rb +128 -34
  29. data/app/helpers/lostcoords/ui/render_attributes_helper.rb +3 -1
  30. data/app/helpers/lostcoords/ui/search_helper.rb +55 -0
  31. data/app/helpers/lostcoords/ui/sheet_helper.rb +20 -8
  32. data/app/helpers/lostcoords/ui/structures_helper.rb +114 -20
  33. data/app/helpers/lostcoords/ui/tailwind_helper.rb +1 -1
  34. data/app/helpers/lostcoords/ui/toast_helper.rb +11 -4
  35. data/app/helpers/lostcoords/ui/typography_helper.rb +5 -3
  36. data/app/javascript/lostcoords/ui/controllers/lc_menu_controller.js +5 -6
  37. data/app/javascript/lostcoords/ui/controllers/lc_nav_controller.js +79 -0
  38. data/app/javascript/lostcoords/ui/controllers/lc_search_controller.js +288 -0
  39. data/app/javascript/lostcoords/ui/controllers/lc_selection_controller.js +1 -6
  40. data/app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js +29 -15
  41. data/app/javascript/lostcoords/ui/helpers/confirm.js +57 -0
  42. data/app/javascript/lostcoords/ui/helpers/floating_panel.js +9 -0
  43. data/app/javascript/lostcoords/ui/index.js +4 -2
  44. data/app/views/lostcoords/ui/components/_lc_collapsible.html.erb +3 -3
  45. data/app/views/lostcoords/ui/components/_lc_confirm_sheet.html.erb +14 -0
  46. data/app/views/lostcoords/ui/components/_lc_dialog.html.erb +28 -16
  47. data/app/views/lostcoords/ui/components/_lc_floating_panel.html.erb +11 -6
  48. data/app/views/lostcoords/ui/components/_lc_search.html.erb +26 -0
  49. data/config/locales/en.yml +11 -0
  50. data/config/locales/es.yml +11 -0
  51. data/config/locales/ja.yml +11 -0
  52. data/lib/lostcoords/ui/builders.rb +1 -1
  53. data/lib/lostcoords/ui/form_builder.rb +27 -12
  54. data/lib/lostcoords/ui/parts.rb +72 -8
  55. data/lib/lostcoords/ui/tokens.rb +3 -1
  56. data/lib/lostcoords/ui/version.rb +1 -1
  57. metadata +10 -2
  58. data/app/javascript/lostcoords/ui/controllers/lc_confirm_dialog_controller.js +0 -39
@@ -1,8 +1,13 @@
1
- <%# locals: (id:, label:, title:, controller:, role:, trigger_variant:, attributes:, content:) %>
2
- <%= tag.div(class: "relative inline-flex", data: { controller: controller }) do %>
3
- <%= lc_button label, variant: trigger_variant, id: "#{id}-trigger", aria: { haspopup: role, expanded: false, controls: id }, data: { "#{controller}_target" => "trigger", action: "#{controller}#toggle" } %>
4
- <%= tag.div(**attributes) do %>
5
- <% if title %><h2 id="<%= id %>-title" class="<%= lc_heading_class(size: :subheading) %>"><%= title %></h2><% end %>
6
- <%= content %>
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 %>
7
10
  <% end %>
11
+ <% else %>
12
+ <%= panel %>
8
13
  <% end %>
@@ -0,0 +1,26 @@
1
+ <%# locals: (id:, label:, src:, param:, placeholder:, trigger:, empty:, prompt:, shortcut:, attributes:, content:) %>
2
+ <div class="contents" data-slot="search" data-controller="lc-search" data-action="turbo:before-cache@document->lc-search#reset" data-lc-search-src-value="<%= src %>" data-lc-search-param-value="<%= param %>" data-lc-search-empty-value="<%= empty %>" data-lc-search-one-value="<%= lc_t("lostcoords.ui.search.results.one", count: "%{count}") %>" data-lc-search-other-value="<%= lc_t("lostcoords.ui.search.results.other", count: "%{count}") %>">
3
+ <%= tag.button(**attributes) do %>
4
+ <%= lc_icon "magnifying-glass", options: { class: "size-4 shrink-0", "aria-hidden": true } %>
5
+ <span class="flex-1 truncate text-start max-sm:sr-only"><%= trigger %></span>
6
+ <% if shortcut %><%= lc_kbd shortcut, class: "hidden bg-transparent px-0 any-pointer-fine:sm:inline", aria: { hidden: true } %><% end %>
7
+ <% end %>
8
+ <dialog id="<%= id %>" class="lc-search" aria-label="<%= label %>" data-lc-search-target="dialog" data-action="close->lc-search#closed keydown->lc-search#navigate click->lc-search#dismiss">
9
+ <div class="lc-search-stack" data-lc-search-target="stack" data-lc-search-dismiss>
10
+ <%= tag.form action: src, method: :get, role: "search", class: "flex shrink-0 items-center gap-heading", data: { action: "submit->lc-search#submit" } do %>
11
+ <label class="<%= lc_glass_class(extra: "flex min-h-14 min-w-0 flex-1 cursor-text items-center gap-heading ps-5 pe-2 sm:min-h-16") %>" data-lc-search-target="bar">
12
+ <%= lc_icon "magnifying-glass", options: { class: "size-6 shrink-0 text-muted-foreground", "aria-hidden": true, "data-lc-search-target": "glyph" } %>
13
+ <input type="search" name="<%= param %>" class="lc-search-input min-w-0 flex-1 self-stretch border-0 bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground" aria-label="<%= label %>" placeholder="<%= placeholder %>" autocomplete="off" autocapitalize="off" spellcheck="false" enterkeyhint="search" data-lc-search-target="input" data-action="input->lc-search#input"<% if shortcut %> data-controller="lc-shortcut" data-lc-shortcut-keys-value="<%= shortcut %>"<% end %>>
14
+ <%= lc_icon_button lc_t("lostcoords.ui.search.clear"), icon: "x-circle", size: :sm, shape: :circle, hidden: true, data: { lc_search_target: "clear", action: "lc-search#clear" } %>
15
+ </label>
16
+ <%= lc_button lc_t("lostcoords.ui.search.cancel"), variant: :ghost, size: :sm, class: "sm:hidden", data: { lc_search_target: "cancel", action: "lc-search#close" } %>
17
+ <% end %>
18
+ <div class="<%= lc_glass_class(shape: :panel, extra: "lc-search-panel min-h-0 overflow-y-auto overscroll-contain p-related") %>" data-lc-search-target="panel" data-slot="search-panel">
19
+ <div data-lc-search-target="results" data-slot="search-results"><%= content %></div>
20
+ <p class="px-content py-10 text-center text-label text-muted-foreground" data-lc-search-target="empty" data-slot="search-empty" hidden><%= empty.sub("%{query}", "") %></p>
21
+ <% if prompt %><p class="px-content py-10 text-center text-label text-muted-foreground" data-lc-search-target="prompt" data-slot="search-prompt" hidden><%= prompt %></p><% end %>
22
+ </div>
23
+ <p class="sr-only" role="status" aria-atomic="true" data-lc-search-target="status"></p>
24
+ </div>
25
+ </dialog>
26
+ </div>
@@ -13,6 +13,9 @@ en:
13
13
  trigger: "Open dialog"
14
14
  cancel: "Cancel"
15
15
  close: "Close %{title}"
16
+ confirm:
17
+ cancel: "Cancel"
18
+ accept: "Confirm"
16
19
  menu:
17
20
  label: "Actions"
18
21
  popover:
@@ -54,3 +57,11 @@ en:
54
57
  objects: "Objects"
55
58
  symbols: "Symbols"
56
59
  flags: "Flags"
60
+ search:
61
+ trigger: "Search…"
62
+ clear: "Clear search"
63
+ cancel: "Cancel"
64
+ empty: "No results"
65
+ results:
66
+ one: "%{count} result"
67
+ other: "%{count} results"
@@ -13,6 +13,9 @@ es:
13
13
  trigger: "Abrir diálogo"
14
14
  cancel: "Cancelar"
15
15
  close: "Cerrar %{title}"
16
+ confirm:
17
+ cancel: "Cancelar"
18
+ accept: "Confirmar"
16
19
  menu:
17
20
  label: "Acciones"
18
21
  popover:
@@ -54,3 +57,11 @@ es:
54
57
  objects: "Objetos"
55
58
  symbols: "Símbolos"
56
59
  flags: "Banderas"
60
+ search:
61
+ trigger: "Buscar…"
62
+ clear: "Borrar búsqueda"
63
+ cancel: "Cancelar"
64
+ empty: "Sin resultados"
65
+ results:
66
+ one: "%{count} resultado"
67
+ other: "%{count} resultados"
@@ -13,6 +13,9 @@ ja:
13
13
  trigger: "ダイアログを開く"
14
14
  cancel: "キャンセル"
15
15
  close: "%{title}を閉じる"
16
+ confirm:
17
+ cancel: "キャンセル"
18
+ accept: "OK"
16
19
  menu:
17
20
  label: "操作"
18
21
  popover:
@@ -54,3 +57,11 @@ ja:
54
57
  objects: "もの"
55
58
  symbols: "記号"
56
59
  flags: "旗"
60
+ search:
61
+ trigger: "検索…"
62
+ clear: "検索をクリア"
63
+ cancel: "キャンセル"
64
+ empty: "見つかりませんでした"
65
+ results:
66
+ one: "%{count}件"
67
+ other: "%{count}件"
@@ -10,7 +10,7 @@ module Lostcoords::Ui
10
10
 
11
11
  def component?
12
12
  !name.to_s.end_with?("_class") &&
13
- !%i[lc_tw lc_sheet_data lc_shortcut_data lc_alert_icon].include?(name) &&
13
+ !%i[lc_tw lc_shortcut_data lc_alert_icon].include?(name) &&
14
14
  (helper != "EmojiPickerHelper" || name == :lc_emoji_picker)
15
15
  end
16
16
  end
@@ -62,8 +62,11 @@ module Lostcoords::Ui
62
62
  alias_method :rails_check_box, :check_box
63
63
  private :rails_check_box
64
64
 
65
+ # role: "switch" draws the checkbox as a switch, for a switch inside a custom label row.
65
66
  def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
66
- super(method, control_options(method, options, "checkbox-input", @template.lc_checkbox_class), checked_value, unchecked_value)
67
+ switch = options[:role].to_s == "switch"
68
+ classes = switch ? @template.lc_switch_class : @template.lc_checkbox_class
69
+ super(method, control_options(method, options, switch ? "switch-input" : "checkbox-input", classes), checked_value, unchecked_value)
67
70
  end
68
71
  alias checkbox check_box
69
72
 
@@ -91,22 +94,24 @@ module Lostcoords::Ui
91
94
  super(method, text, options.merge(class: @template.lc_field_label_class(extra: options[:class])), &block)
92
95
  end
93
96
 
97
+ # submit and button take lc_button's variant:, tone:, size: and block: options.
94
98
  def submit(value = nil, options = {})
95
- if value.is_a?(Hash)
96
- options = value
97
- value = nil
98
- end
99
- variant = options.delete(:variant) || :primary
100
- size = options.delete(:size) || :md
101
- data = { slot: "button", variant: variant, size: size }.merge(options.delete(:data) || {})
102
- super(value, options.merge(class: @template.lc_button_class(variant: variant, size: size, extra: options[:class]), data: data))
99
+ value, options = nil, value if value.is_a?(Hash)
100
+ super(value, button_options(options))
101
+ end
102
+
103
+ def button(value = nil, options = {}, &block)
104
+ value, options = nil, value if value.is_a?(Hash)
105
+ super(value, button_options(options), &block)
103
106
  end
104
107
 
105
108
  # Label, control, hint and the attribute's errors in one field. `as:` names the control helper;
106
- # `as: :select` takes `choices:` and Rails' select options such as `include_blank:`. A block renders
107
- # a custom control and receives its attributes to splat with `**control`.
109
+ # `as: :select` takes `choices:` and Rails' select options such as `include_blank:`. `size: :sm`
110
+ # compacts the label and the control. A block renders a custom control and receives its attributes to
111
+ # splat with `**control`.
108
112
  def field(method, label: nil, hint: nil, as: :text_field, choices: nil, **options, &block)
109
- @template.lc_field(label: label || human_name(method), id: field_id(method), hint: hint, error: errors_for(method)) do |control|
113
+ size = options[:size] == :sm ? :sm : :md
114
+ @template.lc_field(label: label || human_name(method), id: field_id(method), hint: hint, error: errors_for(method), size: size) do |control|
110
115
  next @template.capture(control, &block) if block
111
116
 
112
117
  attributes = @template.send(:lc_attributes, options.except(*SELECT_OPTIONS), control.to_hash.except(:id))
@@ -119,6 +124,16 @@ module Lostcoords::Ui
119
124
  end
120
125
 
121
126
  private
127
+ def button_options(options)
128
+ options = options.dup
129
+ variant = options.delete(:variant) || :primary
130
+ tone = options.delete(:tone) || :default
131
+ size = options.delete(:size) || :md
132
+ block = options.delete(:block) || false
133
+ data = { slot: "button", variant: variant, size: size }.merge(options.delete(:data) || {})
134
+ options.merge(class: @template.lc_button_class(variant: variant, tone: tone, size: size, block: block, extra: options[:class]), data: data)
135
+ end
136
+
122
137
  def without_field_error_wrapper
123
138
  previous = @template.instance_variable_get(:@lc_skip_field_error_wrapper)
124
139
  @template.instance_variable_set(:@lc_skip_field_error_wrapper, true)
@@ -72,10 +72,35 @@ module Lostcoords::Ui
72
72
  def to_hash = @control
73
73
  end
74
74
 
75
+ # trigger yields the attributes that wire an element to open the panel, merged with the ones passed
76
+ # to it, and the element it renders replaces the default trigger. Shared by menus and dialogs.
77
+ module CustomTrigger
78
+ attr_reader :rendered_trigger
79
+
80
+ def trigger(**attributes, &block)
81
+ raise ArgumentError, "trigger needs a block that renders the trigger element" unless block
82
+
83
+ @rendered_trigger = view.capture(view.send(:lc_attributes, attributes, {}, @wiring), &block)
84
+ nil
85
+ end
86
+ end
87
+
75
88
  class Dialog < Base
76
- def initialize(view, id)
89
+ include CustomTrigger
90
+
91
+ attr_reader :header_actions
92
+
93
+ def initialize(view, id, close_action = "lc-dialog#close")
77
94
  super(view)
78
95
  @id = id
96
+ @close_action = close_action
97
+ @wiring = { aria: { haspopup: "dialog", controls: id }, data: { action: "lc-dialog#open" } }
98
+ end
99
+
100
+ # Content placed in the header, before the close button. Renders nothing where it is called.
101
+ def actions(&block)
102
+ @header_actions = view.capture(&block)
103
+ nil
79
104
  end
80
105
 
81
106
  def footer(**attributes, &block)
@@ -84,7 +109,7 @@ module Lostcoords::Ui
84
109
 
85
110
  def close(label = nil, variant: :secondary, **attributes)
86
111
  label ||= view.send(:lc_t, "lostcoords.ui.dialog.cancel")
87
- view.lc_button(label, variant: variant, **merge({ data: { action: "lc-dialog#close", slot: "dialog-close" } }, attributes))
112
+ view.lc_button(label, variant: variant, **merge({ data: { action: @close_action, slot: "dialog-close" } }, attributes))
88
113
  end
89
114
  end
90
115
 
@@ -115,16 +140,46 @@ module Lostcoords::Ui
115
140
  end
116
141
  end
117
142
 
143
+ class Collapsible < Base
144
+ attr_reader :summary_content, :summary_attributes
145
+
146
+ def initialize(view)
147
+ super
148
+ @summary_attributes = {}
149
+ end
150
+
151
+ # Records the summary; lc_collapsible renders it before the content.
152
+ def summary(**attributes, &block)
153
+ @summary_content = view.capture(&block)
154
+ @summary_attributes = attributes
155
+ nil
156
+ end
157
+ end
158
+
118
159
  class NavList < Base
119
- def initialize(view, compact)
160
+ def initialize(view, compact, layout, indicator)
120
161
  super(view)
121
162
  @compact = compact
122
- end
163
+ @layout = layout
164
+ @indicator = indicator
165
+ end
166
+
167
+ # current: marks the page the reader is on with aria-current="page". icon: names an icon before
168
+ # the label; a block replaces both, as in `nav.link(url) { … }`. Outside the column layout the
169
+ # item takes no box, so a class that hides the link removes its cell too.
170
+ def link(label = nil, url = nil, icon: nil, current: false, indent: false, **attributes, &block)
171
+ if block
172
+ url = label
173
+ content = view.capture(&block)
174
+ else
175
+ view.send(:lc_label!, label, :label)
176
+ content = icon ? view.safe_join([ view.lc_icon(icon, options: { aria: { hidden: true } }), view.tag.span(label) ]) : label
177
+ end
178
+ raise ArgumentError, "nav link needs a URL" if url.blank?
123
179
 
124
- # current: marks the page the reader is on with aria-current="page".
125
- def link(label, url, current: false, indent: false, **attributes)
126
- view.tag.li(class: ("ps-content" if indent), data: { slot: "nav-item" }) do
127
- view.link_to(label, url, **merge({ class: view.lc_nav_link_class(compact: @compact), aria: { current: ("page" if current) }, data: { slot: "nav-link" } }, attributes))
180
+ data = { slot: "nav-link", lc_nav_target: ("link" if @indicator), action: ("lc-nav#select" if @indicator) }.compact
181
+ view.tag.li(class: view.lc_tw(("contents" unless @layout == :column), ("ps-content" if indent)).presence, data: { slot: "nav-item" }) do
182
+ view.link_to(content, url, **merge({ class: view.lc_nav_link_class(compact: @compact, layout: @layout), aria: { current: ("page" if current) }, data: data }, attributes))
128
183
  end
129
184
  end
130
185
 
@@ -140,6 +195,15 @@ module Lostcoords::Ui
140
195
  end
141
196
  end
142
197
 
198
+ class Panel < Base
199
+ include CustomTrigger
200
+
201
+ def initialize(view, wiring)
202
+ super(view)
203
+ @wiring = wiring
204
+ end
205
+ end
206
+
143
207
  class DescriptionList < Base
144
208
  def item(term, detail = nil, **attributes, &block)
145
209
  part(:div, "description-item", "grid min-w-0 gap-tight py-heading sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)] sm:gap-content", attributes) do
@@ -9,6 +9,8 @@ module Lostcoords::Ui
9
9
  "--foreground" => "Main text and headings",
10
10
  "--card" => "Cards and grouped content",
11
11
  "--card-foreground" => "Text on cards",
12
+ "--card-input" => "Fields on cards; defaults to --input",
13
+ "--card-secondary" => "Secondary buttons on cards; defaults to --secondary",
12
14
  "--popover" => "Menus, popovers and dialogs",
13
15
  "--popover-foreground" => "Text on menus, popovers and dialogs",
14
16
  "--primary" => "Primary actions, links, selected states and keyboard focus",
@@ -26,7 +28,7 @@ module Lostcoords::Ui
26
28
  "--input" => "Input and toggle fills",
27
29
  "--ring" => "Keyboard focus ring; unset, it follows --primary"
28
30
  }.freeze
29
- FONTS = %w[--font-sans --font-display --font-mono --font-japanese].freeze
31
+ FONTS = %w[--font-sans --font-display --font-mono --font-eyebrow --font-japanese].freeze
30
32
 
31
33
  def self.names
32
34
  (COLORS.keys + FONTS).sort
@@ -1,5 +1,5 @@
1
1
  module Lostcoords
2
2
  module Ui
3
- VERSION = "0.7.0"
3
+ VERSION = "0.8.1"
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.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lost Coordinates
@@ -98,6 +98,7 @@ files:
98
98
  - app/assets/tailwind/lostcoords/ui/components/emoji-picker.css
99
99
  - app/assets/tailwind/lostcoords/ui/components/menu.css
100
100
  - app/assets/tailwind/lostcoords/ui/components/prose.css
101
+ - app/assets/tailwind/lostcoords/ui/components/search.css
101
102
  - app/assets/tailwind/lostcoords/ui/components/table.css
102
103
  - app/assets/tailwind/lostcoords/ui/components/toast.css
103
104
  - app/assets/tailwind/lostcoords/ui/components/tooltip.css
@@ -110,6 +111,7 @@ files:
110
111
  - app/assets/tailwind/lostcoords/ui/layout.css
111
112
  - app/assets/tailwind/lostcoords/ui/popover.css
112
113
  - app/assets/tailwind/lostcoords/ui/prose.css
114
+ - app/assets/tailwind/lostcoords/ui/search.css
113
115
  - app/assets/tailwind/lostcoords/ui/sheet.css
114
116
  - app/assets/tailwind/lostcoords/ui/squircle.css
115
117
  - app/assets/tailwind/lostcoords/ui/table.css
@@ -135,11 +137,13 @@ files:
135
137
  - app/helpers/lostcoords/ui/glass_helper.rb
136
138
  - app/helpers/lostcoords/ui/icon_helper.rb
137
139
  - app/helpers/lostcoords/ui/layout_helper.rb
140
+ - app/helpers/lostcoords/ui/list_group_helper.rb
138
141
  - app/helpers/lostcoords/ui/menu_helper.rb
139
142
  - app/helpers/lostcoords/ui/navigation_helper.rb
140
143
  - app/helpers/lostcoords/ui/primitives_helper.rb
141
144
  - app/helpers/lostcoords/ui/reading_helper.rb
142
145
  - app/helpers/lostcoords/ui/render_attributes_helper.rb
146
+ - app/helpers/lostcoords/ui/search_helper.rb
143
147
  - app/helpers/lostcoords/ui/sheet_helper.rb
144
148
  - app/helpers/lostcoords/ui/structures_helper.rb
145
149
  - app/helpers/lostcoords/ui/table_helper.rb
@@ -150,13 +154,14 @@ files:
150
154
  - app/helpers/lostcoords/ui/typography_helper.rb
151
155
  - app/javascript/lostcoords/ui/controllers/lc_code_block_controller.js
152
156
  - app/javascript/lostcoords/ui/controllers/lc_collapsible_controller.js
153
- - app/javascript/lostcoords/ui/controllers/lc_confirm_dialog_controller.js
154
157
  - app/javascript/lostcoords/ui/controllers/lc_copy_controller.js
155
158
  - app/javascript/lostcoords/ui/controllers/lc_dialog_controller.js
156
159
  - app/javascript/lostcoords/ui/controllers/lc_emoji_picker_controller.js
157
160
  - app/javascript/lostcoords/ui/controllers/lc_kbd_controller.js
158
161
  - app/javascript/lostcoords/ui/controllers/lc_menu_controller.js
162
+ - app/javascript/lostcoords/ui/controllers/lc_nav_controller.js
159
163
  - app/javascript/lostcoords/ui/controllers/lc_popover_controller.js
164
+ - app/javascript/lostcoords/ui/controllers/lc_search_controller.js
160
165
  - app/javascript/lostcoords/ui/controllers/lc_selection_controller.js
161
166
  - app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js
162
167
  - app/javascript/lostcoords/ui/controllers/lc_shortcut_controller.js
@@ -166,6 +171,7 @@ files:
166
171
  - app/javascript/lostcoords/ui/controllers/lc_toggle_controller.js
167
172
  - app/javascript/lostcoords/ui/controllers/lc_tooltip_controller.js
168
173
  - app/javascript/lostcoords/ui/helpers/catalog_picker.js
174
+ - app/javascript/lostcoords/ui/helpers/confirm.js
169
175
  - app/javascript/lostcoords/ui/helpers/context_dialog.js
170
176
  - app/javascript/lostcoords/ui/helpers/dialog.js
171
177
  - app/javascript/lostcoords/ui/helpers/dismiss_stack.js
@@ -181,8 +187,10 @@ files:
181
187
  - app/views/lostcoords/ui/components/_emoji_picker_grid.html.erb
182
188
  - app/views/lostcoords/ui/components/_lc_code_block.html.erb
183
189
  - app/views/lostcoords/ui/components/_lc_collapsible.html.erb
190
+ - app/views/lostcoords/ui/components/_lc_confirm_sheet.html.erb
184
191
  - app/views/lostcoords/ui/components/_lc_dialog.html.erb
185
192
  - app/views/lostcoords/ui/components/_lc_floating_panel.html.erb
193
+ - app/views/lostcoords/ui/components/_lc_search.html.erb
186
194
  - config/emoji_search_aliases.yml
187
195
  - config/emoji_search_names.yml
188
196
  - config/emoji_search_names_ja.yml
@@ -1,39 +0,0 @@
1
- import { Controller } from "@hotwired/stimulus"
2
- import { showContextDialog } from "lostcoords/ui/helpers/context_dialog"
3
- import { registerDialog } from "lostcoords/ui/helpers/dialog"
4
-
5
- export default class extends Controller {
6
- static targets = ["dialog"]
7
-
8
- disconnect() {
9
- this.unregisterDialog?.()
10
- }
11
-
12
- open(event) {
13
- event.preventDefault()
14
-
15
- const dialog = this.findDialog(event.params.name)
16
- if (!dialog || dialog.open) return
17
-
18
- this.activeDialog = dialog
19
- if (dialog.matches(".lc-dialog-context")) {
20
- showContextDialog(dialog, this.element.querySelector("[data-lc-menu-target='popover']"))
21
- } else {
22
- dialog.showModal()
23
- }
24
- this.unregisterDialog?.()
25
- this.unregisterDialog = registerDialog(dialog)
26
- }
27
-
28
- close(event) {
29
- event?.preventDefault()
30
- const dialog = event?.target?.closest("dialog") || this.activeDialog
31
- dialog?.close()
32
- }
33
-
34
- findDialog(name) {
35
- if (!name) return this.dialogTarget
36
-
37
- return this.dialogTargets.find((dialog) => dialog.dataset.confirmDialogName === name)
38
- }
39
- }