lostcoords-ui 0.6.0 → 0.8.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.
- checksums.yaml +4 -4
- data/README.md +296 -27
- data/app/assets/tailwind/lostcoords/ui/card.css +11 -5
- data/app/assets/tailwind/lostcoords/ui/collapsible.css +6 -0
- data/app/assets/tailwind/lostcoords/ui/components/dialog.css +2 -2
- data/app/assets/tailwind/lostcoords/ui/components/search.css +5 -0
- data/app/assets/tailwind/lostcoords/ui/components.css +1 -0
- data/app/assets/tailwind/lostcoords/ui/core.css +2 -2
- data/app/assets/tailwind/lostcoords/ui/popover.css +6 -56
- data/app/assets/tailwind/lostcoords/ui/search.css +96 -0
- data/app/assets/tailwind/lostcoords/ui/sheet.css +42 -69
- data/app/assets/tailwind/lostcoords/ui/theme.css +18 -0
- data/app/assets/tailwind/lostcoords/ui/toast.css +34 -4
- data/app/assets/tailwind/lostcoords/ui/typography.css +10 -0
- data/app/helpers/lostcoords/ui/badge_helper.rb +20 -12
- data/app/helpers/lostcoords/ui/button_helper.rb +63 -1
- data/app/helpers/lostcoords/ui/choice_helper.rb +9 -16
- data/app/helpers/lostcoords/ui/collapsible_helper.rb +23 -4
- data/app/helpers/lostcoords/ui/dialog_helper.rb +46 -11
- data/app/helpers/lostcoords/ui/form_helper.rb +23 -10
- data/app/helpers/lostcoords/ui/glass_helper.rb +6 -0
- data/app/helpers/lostcoords/ui/layout_helper.rb +13 -5
- data/app/helpers/lostcoords/ui/list_group_helper.rb +65 -0
- data/app/helpers/lostcoords/ui/menu_helper.rb +73 -13
- data/app/helpers/lostcoords/ui/navigation_helper.rb +57 -12
- data/app/helpers/lostcoords/ui/primitives_helper.rb +112 -34
- data/app/helpers/lostcoords/ui/render_attributes_helper.rb +2 -0
- data/app/helpers/lostcoords/ui/search_helper.rb +51 -0
- data/app/helpers/lostcoords/ui/sheet_helper.rb +20 -8
- data/app/helpers/lostcoords/ui/structures_helper.rb +106 -15
- data/app/helpers/lostcoords/ui/tailwind_helper.rb +1 -1
- data/app/helpers/lostcoords/ui/toast_helper.rb +11 -4
- data/app/helpers/lostcoords/ui/typography_helper.rb +5 -3
- data/app/javascript/lostcoords/ui/controllers/lc_menu_controller.js +5 -6
- data/app/javascript/lostcoords/ui/controllers/lc_nav_controller.js +79 -0
- data/app/javascript/lostcoords/ui/controllers/lc_search_controller.js +264 -0
- data/app/javascript/lostcoords/ui/controllers/lc_selection_controller.js +3 -8
- data/app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js +42 -16
- data/app/javascript/lostcoords/ui/helpers/confirm.js +57 -0
- data/app/javascript/lostcoords/ui/helpers/floating_panel.js +9 -0
- data/app/javascript/lostcoords/ui/index.js +4 -2
- data/app/views/lostcoords/ui/components/_lc_collapsible.html.erb +3 -3
- data/app/views/lostcoords/ui/components/_lc_confirm_sheet.html.erb +14 -0
- data/app/views/lostcoords/ui/components/_lc_dialog.html.erb +24 -16
- data/app/views/lostcoords/ui/components/_lc_floating_panel.html.erb +11 -6
- data/app/views/lostcoords/ui/components/_lc_search.html.erb +25 -0
- data/config/locales/en.yml +11 -0
- data/config/locales/es.yml +11 -0
- data/config/locales/ja.yml +11 -0
- data/lib/lostcoords/ui/builders.rb +1 -1
- data/lib/lostcoords/ui/form_builder.rb +59 -12
- data/lib/lostcoords/ui/parts.rb +65 -8
- data/lib/lostcoords/ui/tokens.rb +3 -1
- data/lib/lostcoords/ui/version.rb +1 -1
- metadata +10 -2
- data/app/javascript/lostcoords/ui/controllers/lc_confirm_dialog_controller.js +0 -39
data/config/locales/es.yml
CHANGED
|
@@ -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"
|
data/config/locales/ja.yml
CHANGED
|
@@ -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
|
|
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
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
module Lostcoords::Ui
|
|
2
|
+
# Rails wraps a field with errors in <div class="field_with_errors">. Controls this builder renders show
|
|
3
|
+
# errors themselves, so the wrapper is skipped while it renders; other forms keep Rails' behaviour.
|
|
4
|
+
module SkipsFieldErrorWrapper
|
|
5
|
+
def error_wrapping(html_tag)
|
|
6
|
+
@template_object.instance_variable_get(:@lc_skip_field_error_wrapper) ? html_tag : super
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
ActionView::Helpers::Tags::Base.prepend(SkipsFieldErrorWrapper)
|
|
10
|
+
|
|
2
11
|
# Rails form builder that renders the library's controls and connects model errors to them.
|
|
3
12
|
#
|
|
4
13
|
# <%= lc_form_with model: @project do |form| %>
|
|
@@ -16,6 +25,21 @@ module Lostcoords::Ui
|
|
|
16
25
|
date_field time_field datetime_field datetime_local_field month_field week_field
|
|
17
26
|
].freeze
|
|
18
27
|
|
|
28
|
+
# Every helper that renders a control, wrapped so Rails' error wrapper stays out of its markup.
|
|
29
|
+
WRAPPED = [ *field_helpers, :select, :collection_select, :grouped_collection_select, :time_zone_select,
|
|
30
|
+
:collection_check_boxes, :collection_radio_buttons, :switch, :choice ].uniq - %i[label fields_for fields hidden_field]
|
|
31
|
+
|
|
32
|
+
module WithoutFieldErrorWrapper
|
|
33
|
+
WRAPPED.each do |helper|
|
|
34
|
+
module_eval <<~RUBY, __FILE__, __LINE__ + 1
|
|
35
|
+
def #{helper}(...)
|
|
36
|
+
without_field_error_wrapper { super(...) }
|
|
37
|
+
end
|
|
38
|
+
RUBY
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
prepend WithoutFieldErrorWrapper
|
|
42
|
+
|
|
19
43
|
INPUTS.each do |selector|
|
|
20
44
|
define_method(selector) do |method, options = {}|
|
|
21
45
|
size = control_size!(options)
|
|
@@ -38,8 +62,11 @@ module Lostcoords::Ui
|
|
|
38
62
|
alias_method :rails_check_box, :check_box
|
|
39
63
|
private :rails_check_box
|
|
40
64
|
|
|
65
|
+
# role: "switch" draws the checkbox as a switch, for a switch inside a custom label row.
|
|
41
66
|
def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
|
|
42
|
-
|
|
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)
|
|
43
70
|
end
|
|
44
71
|
alias checkbox check_box
|
|
45
72
|
|
|
@@ -67,22 +94,24 @@ module Lostcoords::Ui
|
|
|
67
94
|
super(method, text, options.merge(class: @template.lc_field_label_class(extra: options[:class])), &block)
|
|
68
95
|
end
|
|
69
96
|
|
|
97
|
+
# submit and button take lc_button's variant:, tone:, size: and block: options.
|
|
70
98
|
def submit(value = nil, options = {})
|
|
71
|
-
if value.is_a?(Hash)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
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)
|
|
79
106
|
end
|
|
80
107
|
|
|
81
108
|
# Label, control, hint and the attribute's errors in one field. `as:` names the control helper;
|
|
82
|
-
# `as: :select` takes `choices:` and Rails' select options such as `include_blank:`.
|
|
83
|
-
# a custom control and receives its attributes to
|
|
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`.
|
|
84
112
|
def field(method, label: nil, hint: nil, as: :text_field, choices: nil, **options, &block)
|
|
85
|
-
|
|
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|
|
|
86
115
|
next @template.capture(control, &block) if block
|
|
87
116
|
|
|
88
117
|
attributes = @template.send(:lc_attributes, options.except(*SELECT_OPTIONS), control.to_hash.except(:id))
|
|
@@ -95,6 +124,24 @@ module Lostcoords::Ui
|
|
|
95
124
|
end
|
|
96
125
|
|
|
97
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
|
+
|
|
137
|
+
def without_field_error_wrapper
|
|
138
|
+
previous = @template.instance_variable_get(:@lc_skip_field_error_wrapper)
|
|
139
|
+
@template.instance_variable_set(:@lc_skip_field_error_wrapper, true)
|
|
140
|
+
yield
|
|
141
|
+
ensure
|
|
142
|
+
@template.instance_variable_set(:@lc_skip_field_error_wrapper, previous)
|
|
143
|
+
end
|
|
144
|
+
|
|
98
145
|
def control_size!(options)
|
|
99
146
|
options[:size].is_a?(Symbol) || options[:size].is_a?(String) && options[:size].match?(/\A[a-z]+\z/) ? options.delete(:size).to_sym : :md
|
|
100
147
|
end
|
data/lib/lostcoords/ui/parts.rb
CHANGED
|
@@ -73,9 +73,18 @@ module Lostcoords::Ui
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
class Dialog < Base
|
|
76
|
-
|
|
76
|
+
attr_reader :header_actions
|
|
77
|
+
|
|
78
|
+
def initialize(view, id, close_action = "lc-dialog#close")
|
|
77
79
|
super(view)
|
|
78
80
|
@id = id
|
|
81
|
+
@close_action = close_action
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Content placed in the header, before the close button. Renders nothing where it is called.
|
|
85
|
+
def actions(&block)
|
|
86
|
+
@header_actions = view.capture(&block)
|
|
87
|
+
nil
|
|
79
88
|
end
|
|
80
89
|
|
|
81
90
|
def footer(**attributes, &block)
|
|
@@ -84,7 +93,7 @@ module Lostcoords::Ui
|
|
|
84
93
|
|
|
85
94
|
def close(label = nil, variant: :secondary, **attributes)
|
|
86
95
|
label ||= view.send(:lc_t, "lostcoords.ui.dialog.cancel")
|
|
87
|
-
view.lc_button(label, variant: variant, **merge({ data: { action:
|
|
96
|
+
view.lc_button(label, variant: variant, **merge({ data: { action: @close_action, slot: "dialog-close" } }, attributes))
|
|
88
97
|
end
|
|
89
98
|
end
|
|
90
99
|
|
|
@@ -115,16 +124,46 @@ module Lostcoords::Ui
|
|
|
115
124
|
end
|
|
116
125
|
end
|
|
117
126
|
|
|
127
|
+
class Collapsible < Base
|
|
128
|
+
attr_reader :summary_content, :summary_attributes
|
|
129
|
+
|
|
130
|
+
def initialize(view)
|
|
131
|
+
super
|
|
132
|
+
@summary_attributes = {}
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Records the summary; lc_collapsible renders it before the content.
|
|
136
|
+
def summary(**attributes, &block)
|
|
137
|
+
@summary_content = view.capture(&block)
|
|
138
|
+
@summary_attributes = attributes
|
|
139
|
+
nil
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
118
143
|
class NavList < Base
|
|
119
|
-
def initialize(view, compact)
|
|
144
|
+
def initialize(view, compact, layout, indicator)
|
|
120
145
|
super(view)
|
|
121
146
|
@compact = compact
|
|
122
|
-
|
|
147
|
+
@layout = layout
|
|
148
|
+
@indicator = indicator
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# current: marks the page the reader is on with aria-current="page". icon: names an icon before
|
|
152
|
+
# the label; a block replaces both, as in `nav.link(url) { … }`. Outside the column layout the
|
|
153
|
+
# item takes no box, so a class that hides the link removes its cell too.
|
|
154
|
+
def link(label = nil, url = nil, icon: nil, current: false, indent: false, **attributes, &block)
|
|
155
|
+
if block
|
|
156
|
+
url = label
|
|
157
|
+
content = view.capture(&block)
|
|
158
|
+
else
|
|
159
|
+
view.send(:lc_label!, label, :label)
|
|
160
|
+
content = icon ? view.safe_join([ view.lc_icon(icon, options: { aria: { hidden: true } }), view.tag.span(label) ]) : label
|
|
161
|
+
end
|
|
162
|
+
raise ArgumentError, "nav link needs a URL" if url.blank?
|
|
123
163
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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))
|
|
164
|
+
data = { slot: "nav-link", lc_nav_target: ("link" if @indicator), action: ("lc-nav#select" if @indicator) }.compact
|
|
165
|
+
view.tag.li(class: view.lc_tw(("contents" unless @layout == :column), ("ps-content" if indent)).presence, data: { slot: "nav-item" }) do
|
|
166
|
+
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
167
|
end
|
|
129
168
|
end
|
|
130
169
|
|
|
@@ -140,6 +179,24 @@ module Lostcoords::Ui
|
|
|
140
179
|
end
|
|
141
180
|
end
|
|
142
181
|
|
|
182
|
+
# menu.trigger yields the attributes that wire an element as the panel's trigger, merged with
|
|
183
|
+
# the ones passed to it, and the element it renders replaces the default trigger.
|
|
184
|
+
class Panel < Base
|
|
185
|
+
attr_reader :rendered_trigger
|
|
186
|
+
|
|
187
|
+
def initialize(view, wiring)
|
|
188
|
+
super(view)
|
|
189
|
+
@wiring = wiring
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def trigger(**attributes, &block)
|
|
193
|
+
raise ArgumentError, "trigger needs a block that renders the trigger element" unless block
|
|
194
|
+
|
|
195
|
+
@rendered_trigger = view.capture(view.send(:lc_attributes, attributes, {}, @wiring), &block)
|
|
196
|
+
nil
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
143
200
|
class DescriptionList < Base
|
|
144
201
|
def item(term, detail = nil, **attributes, &block)
|
|
145
202
|
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
|
data/lib/lostcoords/ui/tokens.rb
CHANGED
|
@@ -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
|
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.
|
|
4
|
+
version: 0.8.0
|
|
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
|
-
}
|