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.
- checksums.yaml +4 -4
- data/README.md +338 -28
- data/app/assets/tailwind/lostcoords/ui/card.css +14 -6
- 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/dialog.css +17 -0
- data/app/assets/tailwind/lostcoords/ui/emoji-picker.css +2 -1
- data/app/assets/tailwind/lostcoords/ui/popover.css +6 -4
- data/app/assets/tailwind/lostcoords/ui/search.css +96 -0
- data/app/assets/tailwind/lostcoords/ui/sheet.css +41 -8
- 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 +33 -15
- data/app/helpers/lostcoords/ui/button_helper.rb +71 -2
- data/app/helpers/lostcoords/ui/choice_helper.rb +9 -16
- data/app/helpers/lostcoords/ui/collapsible_helper.rb +26 -4
- data/app/helpers/lostcoords/ui/dialog_helper.rb +52 -12
- data/app/helpers/lostcoords/ui/form_helper.rb +30 -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 +95 -0
- data/app/helpers/lostcoords/ui/menu_helper.rb +84 -13
- data/app/helpers/lostcoords/ui/navigation_helper.rb +57 -12
- data/app/helpers/lostcoords/ui/primitives_helper.rb +128 -34
- data/app/helpers/lostcoords/ui/render_attributes_helper.rb +3 -1
- data/app/helpers/lostcoords/ui/search_helper.rb +55 -0
- data/app/helpers/lostcoords/ui/sheet_helper.rb +20 -8
- data/app/helpers/lostcoords/ui/structures_helper.rb +114 -20
- 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 +288 -0
- data/app/javascript/lostcoords/ui/controllers/lc_selection_controller.js +1 -6
- data/app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js +29 -15
- 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 +28 -16
- data/app/views/lostcoords/ui/components/_lc_floating_panel.html.erb +11 -6
- data/app/views/lostcoords/ui/components/_lc_search.html.erb +26 -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 +27 -12
- data/lib/lostcoords/ui/parts.rb +72 -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
|
@@ -1,77 +1,152 @@
|
|
|
1
1
|
module Lostcoords::Ui
|
|
2
2
|
module PrimitivesHelper
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
BUTTON_EXPANDED_SWAP = "[&>[data-slot=button-expanded-icon]]:hidden aria-expanded:[&>[data-slot=button-label]]:sr-only aria-expanded:[&>[data-slot=button-expanded-icon]]:block"
|
|
4
|
+
|
|
5
|
+
# as: :span renders the look without a control, for a decorative button inside a larger target
|
|
6
|
+
# such as a file drop zone's label. expanded_icon: swaps the content for that icon while
|
|
7
|
+
# aria-expanded is true; the content stays as the accessible name.
|
|
8
|
+
def lc_button(content = nil, variant: :primary, tone: :default, size: :md, block: false, icon: nil, icon_position: :start, as: :button, expanded_icon: nil, **attributes, &content_block)
|
|
9
|
+
as = lc_option!(:as, as, %i[button span])
|
|
10
|
+
content = lc_button_content(content, icon, icon_position, &content_block)
|
|
11
|
+
if expanded_icon
|
|
12
|
+
content = safe_join([
|
|
13
|
+
tag.span(content, class: "inline-flex items-center gap-related", data: { slot: "button-label" }),
|
|
14
|
+
lc_icon(expanded_icon, options: { "aria-hidden": true, "data-slot": "button-expanded-icon" })
|
|
15
|
+
])
|
|
16
|
+
attributes = lc_attributes({ class: BUTTON_EXPANDED_SWAP }, attributes)
|
|
17
|
+
end
|
|
18
|
+
attributes = lc_button_attributes(variant, tone, size, block, (as == :button ? { type: "button" } : {}), attributes)
|
|
19
|
+
tag.public_send(as, content, **attributes)
|
|
5
20
|
end
|
|
6
21
|
|
|
7
|
-
def lc_button_link_to(content = nil, url = nil, variant: :primary, size: :md, icon: nil, icon_position: :start, **attributes, &
|
|
8
|
-
attributes = lc_button_attributes(variant, size, {}, attributes)
|
|
22
|
+
def lc_button_link_to(content = nil, url = nil, variant: :primary, tone: :default, size: :md, block: false, icon: nil, icon_position: :start, **attributes, &content_block)
|
|
23
|
+
attributes = lc_button_attributes(variant, tone, size, block, {}, attributes)
|
|
9
24
|
raise ArgumentError, "Links cannot be disabled; use lc_button for a disabled control" if attributes[:disabled]
|
|
10
25
|
|
|
11
|
-
if
|
|
26
|
+
if content_block
|
|
12
27
|
url ||= content
|
|
13
|
-
content = capture(&
|
|
28
|
+
content = capture(&content_block)
|
|
14
29
|
end
|
|
15
30
|
|
|
16
31
|
link_to(lc_button_content(content, icon, icon_position), url, attributes)
|
|
17
32
|
end
|
|
18
33
|
|
|
19
|
-
def lc_button_to(content = nil, url = nil, variant: :primary, size: :md, icon: nil, icon_position: :start, **attributes, &
|
|
20
|
-
if
|
|
34
|
+
def lc_button_to(content = nil, url = nil, variant: :primary, tone: :default, size: :md, block: false, icon: nil, icon_position: :start, **attributes, &content_block)
|
|
35
|
+
if content_block
|
|
21
36
|
url ||= content
|
|
22
|
-
content = capture(&
|
|
37
|
+
content = capture(&content_block)
|
|
23
38
|
end
|
|
24
39
|
|
|
25
|
-
button_to(lc_button_content(content, icon, icon_position), url, lc_button_attributes(variant, size, {}, attributes))
|
|
40
|
+
button_to(lc_button_content(content, icon, icon_position), url, lc_button_attributes(variant, tone, size, block, {}, attributes))
|
|
26
41
|
end
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
# A button styled as a select for opening a menu or picker. A string label truncates; a block
|
|
44
|
+
# renders its own content, such as an avatar and a label. The chevron is appended either way.
|
|
45
|
+
def lc_select_trigger(label = nil, size: :md, block: false, **attributes, &content)
|
|
46
|
+
size = lc_option!(:size, size, TailwindHelper::CONTROL_SIZES.keys)
|
|
47
|
+
body = content ? capture(&content) : tag.span(label, class: "min-w-0 truncate")
|
|
48
|
+
chevron = lc_icon("chevron-down", variant: :mini, options: { "aria-hidden": true, "data-icon": "inline-end" })
|
|
49
|
+
defaults = { type: "button", class: lc_select_trigger_class(size: size, block: block), data: { slot: "select-trigger", size: size } }
|
|
50
|
+
tag.button(safe_join([ body, chevron ]), **lc_attributes(defaults, attributes))
|
|
51
|
+
end
|
|
35
52
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
# A block replaces the icon with custom content, such as an avatar or two stacked icons.
|
|
54
|
+
# One pill with a primary action and a toggle on its inline end that opens a menu of the block's
|
|
55
|
+
# lc_menu_option items. With href: the action is a link. label may be rendered HTML. action:,
|
|
56
|
+
# toggle: and menu: add attributes to those parts; other attributes go on the wrapper.
|
|
57
|
+
#
|
|
58
|
+
# <%= lc_split_button "Add expense", id: "add", href: new_expense_path, icon: "plus", menu_label: "More ways to add" do %>
|
|
59
|
+
# <%= lc_menu_option "Import a CSV", icon: "arrow-down-tray" %>
|
|
60
|
+
# <% end %>
|
|
61
|
+
def lc_split_button(label, id:, href: nil, menu_label: lc_t("lostcoords.ui.menu.label"), variant: :primary, tone: :default, size: :md,
|
|
62
|
+
icon: nil, icon_position: :start, block: false, align: :end, action: {}, toggle: {}, menu: {}, **attributes, &items)
|
|
63
|
+
lc_label!(id, :id)
|
|
64
|
+
lc_label!(menu_label, :menu_label)
|
|
65
|
+
variant = lc_option!(:variant, variant, ButtonHelper::BUTTON_VARIANTS.keys)
|
|
66
|
+
size = lc_option!(:size, size, ButtonHelper::BUTTON_SIZES.keys)
|
|
67
|
+
button = { variant: variant, tone: tone, size: size, icon: icon, icon_position: icon_position }
|
|
68
|
+
action = lc_attributes({ class: lc_tw(ButtonHelper::SPLIT_BUTTON_PART, ButtonHelper::SPLIT_BUTTON_ACTION) }, action)
|
|
69
|
+
primary = href ? lc_button_link_to(label, href, **button, **action) : lc_button(label, **button, **action)
|
|
70
|
+
|
|
71
|
+
toggle_class = lc_button_class(variant: variant, tone: tone, size: size, extra: lc_tw(
|
|
72
|
+
ButtonHelper::SPLIT_BUTTON_PART, ButtonHelper::SPLIT_BUTTON_TOGGLE, ButtonHelper::SPLIT_BUTTON_TOGGLE_WIDTHS.fetch(size),
|
|
73
|
+
(ButtonHelper::SPLIT_BUTTON_DIVIDER unless variant == :outline)
|
|
74
|
+
))
|
|
75
|
+
toggle = tag.button(lc_icon("chevron-down", variant: :mini, options: { "aria-hidden": true }), **lc_attributes(
|
|
76
|
+
{ type: "button", class: toggle_class, data: { slot: "split-button-toggle", action: "lc-menu#toggle" } }, toggle,
|
|
77
|
+
{ id: "#{id}-trigger", aria: { label: menu_label, haspopup: "menu", expanded: false, controls: id }, data: { lc_menu_target: "trigger" } }
|
|
78
|
+
))
|
|
79
|
+
|
|
80
|
+
popover = tag.div(capture(&items), **lc_attributes(
|
|
81
|
+
{ class: lc_menu_popover_class(align: align), data: { slot: "menu" } }, menu,
|
|
82
|
+
{ id: id, role: "menu", aria: { labelledby: "#{id}-trigger" }, data: { lc_menu_target: "popover" } }
|
|
83
|
+
))
|
|
84
|
+
|
|
85
|
+
defaults = { class: lc_tw(ButtonHelper::SPLIT_BUTTON_BASE, ("flex w-full" if block)), data: { controller: "lc-menu", slot: "split-button" } }
|
|
86
|
+
tag.div(safe_join([ primary, toggle, popover ]), **lc_attributes(defaults, attributes))
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def lc_icon_button(label, icon: nil, size: :md, shape: :circle, variant: :ghost, tone: :default, **attributes, &content)
|
|
90
|
+
attributes = lc_icon_button_attributes(label, size, shape, variant, tone, { type: "button" }, attributes)
|
|
91
|
+
tag.button(lc_icon_button_content(icon, &content), **attributes)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def lc_icon_button_link_to(label, url, icon: nil, size: :md, shape: :circle, variant: :ghost, tone: :default, **attributes, &content)
|
|
95
|
+
attributes = lc_icon_button_attributes(label, size, shape, variant, tone, {}, attributes)
|
|
96
|
+
raise ArgumentError, "Links cannot be disabled; use lc_icon_button for a disabled control" if attributes[:disabled]
|
|
97
|
+
|
|
98
|
+
link_to(lc_icon_button_content(icon, &content), url, attributes)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def lc_icon_button_to(label, url, icon: nil, size: :md, shape: :circle, variant: :ghost, tone: :default, **attributes, &content)
|
|
102
|
+
button_to(lc_icon_button_content(icon, &content), url, lc_icon_button_attributes(label, size, shape, variant, tone, {}, attributes))
|
|
39
103
|
end
|
|
40
104
|
|
|
41
|
-
def lc_badge(content = nil, tone: :neutral, **attributes, &block)
|
|
105
|
+
def lc_badge(content = nil, tone: :neutral, shape: :rounded, **attributes, &block)
|
|
42
106
|
tone = lc_option!(:tone, tone, BadgeHelper::BADGE_TONES.keys)
|
|
43
|
-
tag.span(content, **lc_attributes({ class: lc_badge_class(tone: tone), data: { slot: "badge", tone: tone } }, attributes), &block)
|
|
107
|
+
tag.span(content, **lc_attributes({ class: lc_badge_class(tone: tone, shape: shape), data: { slot: "badge", tone: tone } }, attributes), &block)
|
|
44
108
|
end
|
|
45
109
|
|
|
46
|
-
|
|
110
|
+
# Pass icon: for a library icon, or content or a block for an emoji or a custom glyph.
|
|
111
|
+
def lc_icon_badge(content = nil, icon: nil, size: :md, shape: :square, tone: :neutral, **attributes, &block)
|
|
112
|
+
raise ArgumentError, "Pass icon:, content or a block, not more than one" if [ icon, content, block ].compact.size > 1
|
|
113
|
+
|
|
47
114
|
tag.span(**lc_attributes({ class: lc_icon_badge_class(size: size, shape: shape, tone: tone), data: { slot: "icon-badge" } }, attributes)) do
|
|
48
|
-
lc_icon(icon, options: { class: "size-[1em]", "aria-hidden": true })
|
|
115
|
+
icon ? lc_icon(icon, options: { class: "size-[1em]", "aria-hidden": true }) : block ? capture(&block) : content
|
|
49
116
|
end
|
|
50
117
|
end
|
|
51
118
|
|
|
52
|
-
|
|
119
|
+
# as: :button makes the avatar itself the control, such as a picker's trigger.
|
|
120
|
+
def lc_avatar(content = nil, src: nil, alt: nil, size: :md, ink: false, linked: false, as: :span, **attributes, &block)
|
|
53
121
|
size = lc_option!(:size, size, BadgeHelper::AVATAR_SIZES.keys)
|
|
122
|
+
as = lc_option!(:as, as, %i[span button])
|
|
54
123
|
defaults = { class: lc_avatar_class(size: size, ink: ink, linked: linked), data: { slot: "avatar" } }
|
|
55
124
|
if src
|
|
56
125
|
tag.img(**lc_attributes(defaults.merge(src: src, alt: alt.to_s, class: lc_tw(defaults[:class], "object-cover")), attributes))
|
|
126
|
+
elsif as == :button
|
|
127
|
+
defaults.merge!(type: "button", class: lc_tw(defaults[:class], "cursor-pointer border-0 p-0"))
|
|
128
|
+
tag.button(content, **lc_attributes(defaults, attributes), &block)
|
|
57
129
|
else
|
|
58
130
|
tag.span(content, **lc_attributes(defaults, attributes), &block)
|
|
59
131
|
end
|
|
60
132
|
end
|
|
61
133
|
|
|
62
|
-
|
|
134
|
+
# row: takes attributes for the inner row that overlaps the avatars, such as a controller target.
|
|
135
|
+
def lc_avatar_stack(compact: false, row: {}, **attributes, &block)
|
|
63
136
|
tag.span(**lc_attributes({ class: lc_avatar_stack_class(compact: compact), data: { slot: "avatar-stack" } }, attributes)) do
|
|
64
|
-
tag.span(class: lc_avatar_stack_row_class, &block)
|
|
137
|
+
tag.span(**lc_attributes({ class: lc_avatar_stack_row_class }, row), &block)
|
|
65
138
|
end
|
|
66
139
|
end
|
|
67
140
|
|
|
141
|
+
CARD_ELEMENTS = %i[div section article aside li form].freeze
|
|
142
|
+
|
|
68
143
|
# Yields a card builder with header, title, description, content and footer parts. The card stacks
|
|
69
|
-
# its children with the same inset it pads with.
|
|
70
|
-
def lc_card(href: nil, interactive: false, padding: :md, **attributes, &block)
|
|
71
|
-
defaults = { class: lc_card_class(interactive: interactive || !href.nil?, padding: padding, extra: "flex flex-col gap-inset"), data: { slot: "card" } }
|
|
144
|
+
# its children with the same inset it pads with; an unpadded card's children meet edge to edge.
|
|
145
|
+
def lc_card(href: nil, interactive: false, padding: :md, as: :div, **attributes, &block)
|
|
146
|
+
defaults = { class: lc_card_class(interactive: interactive || !href.nil?, padding: padding, extra: [ "flex flex-col", ("gap-inset" unless padding.to_s == "none") ]), data: { slot: "card" } }
|
|
72
147
|
content = capture(Parts::Card.new(self), &block) if block
|
|
73
148
|
if href.nil?
|
|
74
|
-
tag.
|
|
149
|
+
tag.public_send(lc_option!(:as, as, CARD_ELEMENTS), content, **lc_attributes(defaults, attributes))
|
|
75
150
|
else
|
|
76
151
|
defaults.merge!(href: href, class: lc_tw(defaults[:class], "no-underline text-inherit"))
|
|
77
152
|
tag.a(content, **lc_attributes(defaults, attributes))
|
|
@@ -122,9 +197,28 @@ module Lostcoords::Ui
|
|
|
122
197
|
safe_join(position == :start ? [ glyph, content ] : [ content, glyph ])
|
|
123
198
|
end
|
|
124
199
|
|
|
125
|
-
def lc_button_attributes(variant, size, defaults, attributes)
|
|
126
|
-
|
|
127
|
-
|
|
200
|
+
def lc_button_attributes(variant, tone, size, block, defaults, attributes)
|
|
201
|
+
tone = lc_option!(:tone, tone, ButtonHelper::BUTTON_TONES.keys)
|
|
202
|
+
data = { slot: "button", variant: lc_option!(:variant, variant, ButtonHelper::BUTTON_VARIANTS.keys), tone: (tone unless tone == :default), size: lc_option!(:size, size, ButtonHelper::BUTTON_SIZES.keys) }
|
|
203
|
+
lc_attributes(defaults.merge(class: lc_button_class(variant: variant, tone: tone, size: size, block: block), data: data), attributes)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
def lc_icon_button_attributes(label, size, shape, variant, tone, defaults, attributes)
|
|
207
|
+
size = lc_option!(:size, size, ButtonHelper::ICON_BUTTON_SIZES.keys)
|
|
208
|
+
shape = lc_option!(:shape, shape, ButtonHelper::ICON_BUTTON_SHAPES.keys)
|
|
209
|
+
data = { slot: "icon-button", size: size, variant: (variant.to_sym unless variant.to_sym == :ghost), tone: (tone.to_sym unless tone.to_sym == :default) }.compact
|
|
210
|
+
defaults = defaults.merge(class: lc_icon_button_class(size: size, shape: shape, variant: variant, tone: tone), aria: { label: label }, data: data)
|
|
211
|
+
attributes = lc_attributes(defaults, attributes)
|
|
212
|
+
accessible_label = attributes.fetch(:"aria-label", attributes.dig(:aria, :label))
|
|
213
|
+
raise ArgumentError, "lc_icon_button requires a nonblank accessible label" if label.blank? || accessible_label.blank?
|
|
214
|
+
|
|
215
|
+
attributes
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
def lc_icon_button_content(icon, &content)
|
|
219
|
+
raise ArgumentError, "Pass icon: or a block" unless icon || content
|
|
220
|
+
|
|
221
|
+
content ? capture(&content) : lc_icon(icon, options: { "aria-hidden": true })
|
|
128
222
|
end
|
|
129
223
|
end
|
|
130
224
|
end
|
|
@@ -36,6 +36,8 @@ module Lostcoords::Ui
|
|
|
36
36
|
end
|
|
37
37
|
normalized[prefix] = values if values
|
|
38
38
|
end
|
|
39
|
+
# Rails renders popover: true as popover="true", which browsers read as manual: no light dismiss.
|
|
40
|
+
normalized[:popover] = "auto" if normalized[:popover] == true
|
|
39
41
|
normalized
|
|
40
42
|
end
|
|
41
43
|
|
|
@@ -53,7 +55,7 @@ module Lostcoords::Ui
|
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
def lc_option!(name, value, allowed)
|
|
56
|
-
normalized = value.to_sym if value.is_a?(String) || value.is_a?(Symbol)
|
|
58
|
+
normalized = value.is_a?(Integer) ? value : (value.to_sym if value.is_a?(String) || value.is_a?(Symbol))
|
|
57
59
|
return normalized if allowed.include?(normalized)
|
|
58
60
|
|
|
59
61
|
raise ArgumentError, "Invalid #{name}: #{value.inspect}. Expected one of: #{allowed.map(&:inspect).join(', ')}"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Lostcoords::Ui
|
|
2
|
+
module SearchHelper
|
|
3
|
+
RESULT_DETAIL = "line-clamp-2 text-xs text-muted-foreground [&_mark]:bg-transparent [&_mark]:font-semibold [&_mark]:text-foreground"
|
|
4
|
+
|
|
5
|
+
# A search trigger that opens a full-screen search over the page. Attributes go to the trigger,
|
|
6
|
+
# which is what sits in your layout. Results come from one of three places:
|
|
7
|
+
#
|
|
8
|
+
# - src: the server renders them. As the user types, the field requests src with the query in
|
|
9
|
+
# param and shows the HTML it answers, built from lc_search_group and lc_search_result. Without
|
|
10
|
+
# JavaScript the field submits to src as a normal GET.
|
|
11
|
+
# - The block: rows rendered there are filtered in the browser by their text and keywords.
|
|
12
|
+
# - Your own code: handle lc-search:query, call preventDefault and fill event.detail.results.
|
|
13
|
+
#
|
|
14
|
+
# The block also renders what shows before anything is typed. empty: is the note for a query with
|
|
15
|
+
# no results, where %{query} stands for the query, and prompt: the note shown before anything is
|
|
16
|
+
# typed when there is nothing else to show. Pass id: when a page has two searches, and shortcut: nil
|
|
17
|
+
# to drop the page shortcut.
|
|
18
|
+
def lc_search(label:, src: nil, param: "q", placeholder: label, trigger: lc_t("lostcoords.ui.search.trigger"), empty: lc_t("lostcoords.ui.search.empty"), prompt: nil,
|
|
19
|
+
shortcut: "mod+k", id: "lc-search", **attributes, &block)
|
|
20
|
+
lc_label!(label, :label)
|
|
21
|
+
lc_label!(trigger, :trigger)
|
|
22
|
+
lc_label!(param, :param)
|
|
23
|
+
lc_label!(id, :id)
|
|
24
|
+
lc_label!(empty, :empty)
|
|
25
|
+
defaults = { class: "lc-search-trigger", aria: { label: label } }
|
|
26
|
+
data = { lc_search_target: "trigger", action: "lc-search#open", slot: "search-trigger" }
|
|
27
|
+
required = { type: "button", aria: { haspopup: "dialog", controls: id }, data: shortcut ? lc_shortcut_data(shortcut, data) : data }
|
|
28
|
+
render "lostcoords/ui/components/lc_search", id:, label:, src:, param:, placeholder:, trigger:, empty:, prompt: prompt.presence, shortcut:,
|
|
29
|
+
attributes: lc_attributes(defaults, attributes, required), content: (capture(&block) if block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# A titled group of results.
|
|
33
|
+
def lc_search_group(title, **attributes, &block)
|
|
34
|
+
lc_label!(title, :title)
|
|
35
|
+
defaults = { class: "flex flex-col py-related", aria: { label: title }, data: { slot: "search-group" } }
|
|
36
|
+
tag.section(**lc_attributes(defaults, attributes)) do
|
|
37
|
+
safe_join([ tag.h2(title, class: "px-heading pb-related font-mono text-xs font-medium uppercase tracking-widest text-muted-foreground", data: { slot: "search-group-title" }), (capture(&block) if block) ])
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# One result: a link with an optional icon badge and a line of detail. keywords: adds words the
|
|
42
|
+
# browser filter matches without showing them. A block replaces the title and detail.
|
|
43
|
+
def lc_search_result(title, url, detail: nil, icon: nil, keywords: nil, **attributes, &block)
|
|
44
|
+
lc_label!(url, :url)
|
|
45
|
+
lc_label!(title, :title) unless block
|
|
46
|
+
defaults = { class: "lc-search-result group/result flex min-h-control-lg w-full items-center gap-heading rounded-2xl px-heading py-related text-start no-underline", data: { slot: "search-result", lc_search_target: "result", lc_search_keywords: keywords.presence } }
|
|
47
|
+
tag.a(**lc_attributes(defaults, attributes, { href: url })) do
|
|
48
|
+
body = block ? capture(&block) : tag.span(class: "flex min-w-0 flex-1 flex-col gap-tight") do
|
|
49
|
+
safe_join([ tag.span(title, class: "truncate text-label font-semibold", data: { slot: "search-result-title" }), tag.span(detail, class: RESULT_DETAIL, data: { slot: "search-result-detail" }) ])
|
|
50
|
+
end
|
|
51
|
+
safe_join([ (lc_icon_badge(icon: icon) if icon), body, lc_icon("arrow-turn-down-left", options: { class: "size-4 shrink-0 text-muted-foreground opacity-0 group-hover/result:opacity-100 group-focus-visible/result:opacity-100", "aria-hidden": true }) ].compact)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
module Lostcoords::Ui
|
|
2
2
|
module SheetHelper
|
|
3
|
-
|
|
4
|
-
# controllers. detents: "fit", "medium large" or "large".
|
|
3
|
+
SHEET_TAGS = %i[div dialog].freeze
|
|
5
4
|
SHEET_DETENTS = [ "fit", "medium large", "large" ].freeze
|
|
5
|
+
SHEET_HANDLE = "grid min-h-7 w-full flex-none cursor-grab touch-none place-items-center active:cursor-grabbing sm:hidden"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
# A panel that is an iOS sheet on phones, with the lc-sheet controller. tag: :dialog is a modal
|
|
8
|
+
# <dialog> (lc_dialog builds on it). A :div shows while [data-open] or, with popover:, :popover-open;
|
|
9
|
+
# from sm up it keeps your frame, or with anchored: true it is a popover under its trigger, opened by a
|
|
10
|
+
# FloatingPanel inside a positioned ancestor. detents: "fit", "medium large" or "large". handle: true
|
|
11
|
+
# adds a grab strip above the content; without one the sheet draws its grabber over it.
|
|
12
|
+
# A swipe down dispatches lc-sheet:dismiss; unless a listener cancels it, an open popover hides.
|
|
13
|
+
# With tag: :dialog, size: draws lc_dialog's modal frame at that width, for a dialog whose content
|
|
14
|
+
# brings its own header and labels the dialog with aria-label.
|
|
15
|
+
def lc_sheet(tag: :div, anchored: false, detents: "fit", handle: false, size: nil, **attributes, &block)
|
|
16
|
+
tag = lc_option!(:tag, tag, SHEET_TAGS)
|
|
8
17
|
detents = lc_option!(:detents, detents, SHEET_DETENTS.map(&:to_sym)).to_s
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
)
|
|
18
|
+
raise ArgumentError, "anchored: true needs tag: :div" if anchored && tag == :dialog
|
|
19
|
+
raise ArgumentError, "size: needs tag: :dialog" if size && tag != :dialog
|
|
20
|
+
|
|
21
|
+
defaults = { data: { slot: "sheet", controller: "lc-sheet", lc_sheet_detents_value: detents } }
|
|
22
|
+
defaults[:class] = lc_tw("lc-sheet", ("lc-sheet-anchored" if anchored)) unless tag == :dialog
|
|
23
|
+
defaults[:class] = lc_dialog_class(size: size) if size
|
|
24
|
+
strip = self.tag.span(class: SHEET_HANDLE, aria: { hidden: true }, data: { slot: "sheet-handle", lc_sheet_target: "handle" }) if handle
|
|
25
|
+
content_tag(tag, safe_join([ strip, (capture(&block) if block) ].compact), **lc_attributes(defaults, attributes))
|
|
14
26
|
end
|
|
15
27
|
end
|
|
16
28
|
end
|
|
@@ -2,10 +2,11 @@ module Lostcoords::Ui
|
|
|
2
2
|
module StructuresHelper
|
|
3
3
|
INPUT_TYPES = %i[text search email password tel url number date time datetime-local month week].freeze
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# plain: true drops the fill, border, padding and height, for a control in an lc_list_field row.
|
|
6
|
+
def lc_input(name: nil, value: nil, type: :text, size: :md, plain: false, **attributes)
|
|
6
7
|
type = lc_option!(:type, type, INPUT_TYPES)
|
|
7
|
-
|
|
8
|
-
tag.input(**lc_attributes({ type: type, name: name, value: value, class: lc_input_class(size: size
|
|
8
|
+
data = { slot: "input", plain: (true if plain) }.compact
|
|
9
|
+
tag.input(**lc_attributes({ type: type, name: name, value: value, class: lc_input_class(size: size, plain: plain), data: data }, attributes))
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
def lc_textarea(content = nil, name: nil, **attributes, &block)
|
|
@@ -20,43 +21,136 @@ module Lostcoords::Ui
|
|
|
20
21
|
|
|
21
22
|
# Yields the control's attributes; splat them into the control with `**field`. error: takes a
|
|
22
23
|
# message or a list of messages, such as `record.errors.full_messages_for(:name)`.
|
|
23
|
-
|
|
24
|
+
# size: :sm is the compact field for dense forms, with a caption label closer to its control.
|
|
25
|
+
def lc_field(label:, id:, hint: nil, error: nil, size: :md, **attributes, &block)
|
|
24
26
|
lc_label!(label, :label)
|
|
25
27
|
lc_label!(id, :id)
|
|
26
28
|
errors = Array(error).compact_blank
|
|
27
29
|
descriptions = [ ("#{id}-hint" if hint.present?), ("#{id}-error" if errors.any?) ].compact
|
|
28
30
|
control = { id: id, aria: { describedby: descriptions.presence&.join(" "), invalid: (true if errors.any?) } }
|
|
29
|
-
tag.div(**lc_attributes({ class: lc_field_class, data: { slot: "field", invalid: (true if errors.any?) } }, attributes)) do
|
|
31
|
+
tag.div(**lc_attributes({ class: lc_field_class(size: size), data: { slot: "field", invalid: (true if errors.any?) } }, attributes)) do
|
|
30
32
|
safe_join([
|
|
31
|
-
tag.label(label, for: id, class: lc_field_label_class, data: { slot: "field-label" }),
|
|
33
|
+
tag.label(label, for: id, class: lc_field_label_class(size: size), data: { slot: "field-label" }),
|
|
32
34
|
(capture(Parts::Field.new(self, id, control), &block) if block),
|
|
33
35
|
*lc_field_messages(id, hint, errors)
|
|
34
36
|
].compact)
|
|
35
37
|
end
|
|
36
38
|
end
|
|
37
39
|
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
|
|
40
|
+
# Names a group of controls that no single label can: toggles, a picker, several inputs. With an id,
|
|
41
|
+
# the fieldset's aria-describedby points at the hint and error, as lc_field does for its control.
|
|
42
|
+
# size: :sm matches lc_field's compact size. The legend's slot follows the fieldset's.
|
|
43
|
+
def lc_fieldset(legend:, id: nil, hint: nil, error: nil, size: :md, **attributes, &block)
|
|
44
|
+
lc_label!(legend, :legend)
|
|
45
|
+
errors = Array(error).compact_blank
|
|
46
|
+
described = [ ("#{id}-hint" if id && hint.present?), ("#{id}-error" if id && errors.any?) ].compact.presence&.join(" ")
|
|
47
|
+
defaults = { id: id, class: lc_field_class(size: size, extra: "m-0 min-w-0 border-0 p-0"), aria: { invalid: (true if errors.any?), describedby: described }, data: { slot: "fieldset", invalid: (true if errors.any?) } }
|
|
48
|
+
fieldset = lc_attributes(defaults, attributes)
|
|
49
|
+
tag.fieldset(**fieldset) do
|
|
50
|
+
safe_join([
|
|
51
|
+
tag.legend(legend, class: lc_field_label_class(size: size, extra: [ "p-0", ("mb-tight" if size.to_s == "sm") ]), data: { slot: "#{fieldset.dig(:data, :slot)}-legend" }),
|
|
52
|
+
(capture(&block) if block),
|
|
53
|
+
*lc_field_messages(id, hint, errors)
|
|
54
|
+
].compact)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# One choice from a few options, as a segmented control. The group decides what its items render:
|
|
59
|
+
# name: makes native radios inside labels, which bring their own arrows, form value and reset;
|
|
60
|
+
# as: :nav makes links, the current one marked with aria-current; otherwise radio buttons whose
|
|
61
|
+
# selection lives in the lc-selection controller.
|
|
62
|
+
# variant: :pills lays the items out as wrapping toggle pills, sized by size:, instead of a segmented track.
|
|
63
|
+
def lc_toggle_group(label:, name: nil, value: nil, as: :div, variant: :segmented, size: :md, **attributes, &block)
|
|
41
64
|
lc_label!(label, :label)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
65
|
+
as = lc_option!(:as, as, %i[div nav])
|
|
66
|
+
variant = lc_option!(:variant, variant, %i[segmented pills])
|
|
67
|
+
size = lc_option!(:size, size, ButtonHelper::BUTTON_SIZES.keys)
|
|
68
|
+
raise ArgumentError, "size: sizes pills; a segmented toggle group has one size" if variant == :segmented && size != :md
|
|
69
|
+
raise ArgumentError, "a nav toggle group marks its current link; it takes no name: or value:" if as == :nav && (name || value)
|
|
70
|
+
|
|
71
|
+
mode = as == :nav ? :links : (name ? :radios : :buttons)
|
|
72
|
+
content = lc_within_toggle_group({ mode: mode, name: name, value: value&.to_s, variant: variant, size: size }) { capture(&block) if block }
|
|
73
|
+
|
|
74
|
+
defaults = { class: (variant == :pills ? lc_inline_class : lc_toggle_group_class), data: { slot: "toggle-group" } }
|
|
75
|
+
case mode
|
|
76
|
+
when :links
|
|
77
|
+
tag.nav(content, **lc_attributes(defaults, attributes, { aria: { label: label } }))
|
|
78
|
+
when :radios
|
|
79
|
+
tag.div(content, **lc_attributes(defaults, attributes, { role: "radiogroup", aria: { label: label } }))
|
|
80
|
+
else
|
|
81
|
+
defaults[:data].merge!(controller: "lc-selection", action: "click->lc-selection#select keydown->lc-selection#navigate", lc_selection_value_value: value)
|
|
82
|
+
tag.div(content, **lc_attributes(defaults, attributes, { role: "radiogroup", aria: { label: label } }))
|
|
45
83
|
end
|
|
46
84
|
end
|
|
47
85
|
|
|
48
|
-
|
|
86
|
+
# Takes href: and current: in a nav group, value: and checked: in a named group, and value: and
|
|
87
|
+
# selected: in a button group; arguments from another kind of group raise.
|
|
88
|
+
def lc_toggle_group_item(label = nil, value: nil, selected: nil, checked: nil, href: nil, current: nil, input: {}, **attributes, &block)
|
|
89
|
+
group = @_lc_toggle_group || { mode: :buttons, variant: :segmented }
|
|
90
|
+
given = { value: value, selected: selected, checked: checked, href: href, current: current }.compact.keys
|
|
91
|
+
allowed = { links: %i[href current], radios: %i[value checked], buttons: %i[value selected] }.fetch(group[:mode])
|
|
92
|
+
stray = given - allowed
|
|
93
|
+
raise ArgumentError, "#{stray.join(', ')} can't be used on an item of a #{group[:mode]} toggle group" if stray.any?
|
|
94
|
+
raise ArgumentError, "an item of a nav toggle group needs href:" if group[:mode] == :links && !href
|
|
95
|
+
|
|
96
|
+
content = block ? capture(&block) : label
|
|
97
|
+
defaults = { class: (group[:variant] == :pills ? lc_toggle_class(size: group[:size]) : lc_toggle_group_item_class), data: { slot: "toggle-group-item" } }
|
|
98
|
+
return lc_toggle_link(content, href, current, defaults, attributes) if group[:mode] == :links
|
|
99
|
+
|
|
49
100
|
value ||= label
|
|
50
|
-
|
|
51
|
-
|
|
101
|
+
raise ArgumentError, "a toggle group item needs a value: or a label" if value.nil?
|
|
102
|
+
if group[:mode] == :radios
|
|
103
|
+
checked = group[:value] == value.to_s if checked.nil?
|
|
104
|
+
return lc_toggle_radio(content, group[:name], value, checked, input, defaults, attributes)
|
|
105
|
+
end
|
|
106
|
+
|
|
52
107
|
required = { type: "button", role: "radio", data: { lc_selection_target: "option", value: value } }
|
|
53
|
-
tag.button(
|
|
108
|
+
tag.button(content, **lc_attributes(defaults.merge(aria: { checked: selected || false }), attributes, required))
|
|
54
109
|
end
|
|
55
110
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
111
|
+
# A button that flips its own aria-pressed. href: renders a link marked current when active, and
|
|
112
|
+
# name: a label around a radio checked when active. A caller that sets aria-pressed or
|
|
113
|
+
# aria-expanded owns the state, so the toggle drops its own controller.
|
|
114
|
+
def lc_toggle(label = nil, active: false, ghost: false, size: :md, href: nil, name: nil, value: nil, input: {}, **attributes, &block)
|
|
115
|
+
content = block ? capture(&block) : label
|
|
116
|
+
defaults = { class: lc_toggle_class(ghost: ghost, size: size), data: { slot: "toggle" } }
|
|
117
|
+
return lc_toggle_link(content, href, active, defaults, attributes) if href
|
|
118
|
+
|
|
119
|
+
if name
|
|
120
|
+
value ||= label
|
|
121
|
+
lc_label!(value, :value)
|
|
122
|
+
return lc_toggle_radio(content, name, value, active, input, defaults, attributes)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if lc_normalize_attributes(attributes).fetch(:aria, {}).slice(:pressed, :expanded).any?
|
|
126
|
+
raise ArgumentError, "pass active: or aria: { pressed: }, not both" if active
|
|
127
|
+
else
|
|
128
|
+
defaults[:aria] = { pressed: active }
|
|
129
|
+
defaults[:data].merge!(controller: "lc-toggle", action: "click->lc-toggle#toggle")
|
|
130
|
+
end
|
|
131
|
+
tag.button(content, **lc_attributes(defaults, attributes).merge(type: "button"))
|
|
60
132
|
end
|
|
133
|
+
|
|
134
|
+
private
|
|
135
|
+
# Items read the enclosing group's mode, so a nested group restores the outer one.
|
|
136
|
+
def lc_within_toggle_group(group)
|
|
137
|
+
previous, @_lc_toggle_group = @_lc_toggle_group, group
|
|
138
|
+
yield
|
|
139
|
+
ensure
|
|
140
|
+
@_lc_toggle_group = previous
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def lc_toggle_link(content, href, current, defaults, attributes)
|
|
144
|
+
raise ArgumentError, "a link can't be disabled; render it as a button instead" if attributes.key?(:disabled) || attributes.key?("disabled")
|
|
145
|
+
link_to(content, href, **lc_attributes(defaults.merge(aria: { current: ("true" if current) }), attributes))
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def lc_toggle_radio(content, name, value, checked, input, defaults, attributes)
|
|
149
|
+
attributes = attributes.dup
|
|
150
|
+
input = input.merge(disabled: attributes.delete(:disabled)) if attributes.key?(:disabled)
|
|
151
|
+
tag.label(**lc_attributes(defaults, attributes)) do
|
|
152
|
+
safe_join([ radio_button_tag(name, value, checked, **lc_attributes({ class: "sr-only" }, input)), content ])
|
|
153
|
+
end
|
|
154
|
+
end
|
|
61
155
|
end
|
|
62
156
|
end
|
|
@@ -9,7 +9,7 @@ module Lostcoords::Ui
|
|
|
9
9
|
|
|
10
10
|
# The theme's own scales, so class merging knows text-label is a size and gap-related a gap.
|
|
11
11
|
MERGE_THEME = {
|
|
12
|
-
"text" => %w[display title heading subheading body small label caption],
|
|
12
|
+
"text" => %w[display title heading subheading body small label caption eyebrow],
|
|
13
13
|
"spacing" => %w[tight related heading content inset section gutter control-sm control-md control-lg],
|
|
14
14
|
"container" => %w[page reading form],
|
|
15
15
|
"radius" => %w[pill]
|
|
@@ -12,10 +12,17 @@ module Lostcoords::Ui
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
TOAST_PLACEMENTS = %i[bottom_end bottom_center top_end top_center].freeze
|
|
16
|
+
|
|
17
|
+
# Fixed edge that holds toasts. Render it once in the layout and append toasts to it, from flash
|
|
18
|
+
# or a Turbo Stream; it shows in the top layer, above dialogs and sticky chrome. mobile_placement:
|
|
19
|
+
# applies below the sm breakpoint. --lc-toast-offset sets the distance from the edges, and
|
|
20
|
+
# --lc-toast-offset-top or --lc-toast-offset-bottom one edge, such as below a sticky header.
|
|
21
|
+
def lc_toast_region(placement: :bottom_end, mobile_placement: nil, **attributes, &block)
|
|
22
|
+
placement = lc_option!(:placement, placement, TOAST_PLACEMENTS)
|
|
23
|
+
mobile_placement = lc_option!(:mobile_placement, mobile_placement, TOAST_PLACEMENTS) if mobile_placement
|
|
24
|
+
data = { slot: "toast-region", controller: "lc-toast-region", placement: placement.to_s.dasherize, mobile_placement: mobile_placement&.to_s&.dasherize }.compact
|
|
25
|
+
defaults = { class: "lc-toast-region", role: "status", aria: { live: "polite" }, data: data }
|
|
19
26
|
tag.div(**lc_attributes(defaults, attributes)) { capture(&block) if block }
|
|
20
27
|
end
|
|
21
28
|
end
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
module Lostcoords::Ui
|
|
2
2
|
module TypographyHelper
|
|
3
3
|
HEADING_SIZES = { display: "text-display", title: "text-title", heading: "text-heading", subheading: "text-subheading" }.freeze
|
|
4
|
-
TEXT_SIZES = { body: "text-body", small: "text-small", label: "text-label", caption: "text-caption" }.freeze
|
|
4
|
+
TEXT_SIZES = { body: "text-body", small: "text-small", label: "text-label font-semibold", caption: "text-caption", eyebrow: "text-eyebrow lc-eyebrow" }.freeze
|
|
5
5
|
TEXT_TONES = { default: "text-foreground", muted: "text-muted-foreground" }.freeze
|
|
6
|
+
TEXT_ELEMENTS = %i[p span div label legend figcaption dt dd h1 h2 h3 h4 h5 h6].freeze
|
|
6
7
|
KBD_BASE = "lc-kbd inline-flex items-center rounded-md bg-tile px-1.5 font-sans text-caption leading-5 whitespace-nowrap text-muted-foreground"
|
|
7
8
|
KBD_NAMES = { "mod" => "Ctrl", "ctrl" => "Ctrl", "alt" => "Alt", "shift" => "Shift", "meta" => "Meta", "escape" => "Esc", "enter" => "↵",
|
|
8
9
|
"arrowup" => "↑", "arrowdown" => "↓", "arrowleft" => "←", "arrowright" => "→" }.freeze
|
|
@@ -29,8 +30,9 @@ module Lostcoords::Ui
|
|
|
29
30
|
tag.public_send("h#{level}", content, **lc_attributes({ class: lc_heading_class(size: size, trim: trim) }, attributes), &block)
|
|
30
31
|
end
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
# as: picks the element, such as :span inside a row or :h3 for a heading set in a text role.
|
|
34
|
+
def lc_text(content = nil, size: :body, tone: :default, trim: false, as: :p, **attributes, &block)
|
|
35
|
+
tag.public_send(lc_option!(:as, as, TEXT_ELEMENTS), content, **lc_attributes({ class: lc_text_class(size: size, tone: tone, trim: trim) }, attributes), &block)
|
|
34
36
|
end
|
|
35
37
|
|
|
36
38
|
# A key hint, such as lc_kbd("mod+k"). "mod" renders Ctrl and reads ⌘ on Apple platforms once JS runs.
|
|
@@ -49,12 +49,11 @@ export default class extends FloatingPanel {
|
|
|
49
49
|
if (event.detail === 0) focusFirstMenuItem(this.popoverTarget)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
this.isOpen ? this.close() : this.open()
|
|
52
|
+
check(event) {
|
|
53
|
+
const item = event.currentTarget
|
|
54
|
+
const checked = item.getAttribute("aria-checked") !== "true"
|
|
55
|
+
item.setAttribute("aria-checked", String(checked))
|
|
56
|
+
this.dispatch("check", { target: item, detail: { checked } })
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
open() {
|