lostcoords-ui 0.9.1 → 0.10.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 +149 -8
- data/app/assets/tailwind/lostcoords/ui/base.css +1 -0
- data/app/assets/tailwind/lostcoords/ui/components/shell.css +2 -2
- data/app/assets/tailwind/lostcoords/ui/core.css +2 -1
- data/app/assets/tailwind/lostcoords/ui/shell.css +66 -9
- data/app/assets/tailwind/lostcoords/ui/theme.css +65 -39
- data/app/assets/tailwind/lostcoords/ui/toggle-group.css +58 -0
- data/app/helpers/lostcoords/ui/badge_helper.rb +9 -7
- data/app/helpers/lostcoords/ui/description_list_helper.rb +39 -0
- data/app/helpers/lostcoords/ui/form_helper.rb +4 -4
- data/app/helpers/lostcoords/ui/layout_helper.rb +31 -0
- data/app/helpers/lostcoords/ui/list_group_helper.rb +21 -6
- data/app/helpers/lostcoords/ui/navigation_helper.rb +13 -0
- data/app/helpers/lostcoords/ui/primitives_helper.rb +37 -8
- data/app/helpers/lostcoords/ui/shell_helper.rb +32 -1
- data/app/helpers/lostcoords/ui/structures_helper.rb +65 -14
- data/app/helpers/lostcoords/ui/tooltip_helper.rb +5 -4
- data/app/helpers/lostcoords/ui/typography_helper.rb +30 -0
- data/app/javascript/lostcoords/ui/controllers/lc_char_counter_controller.js +63 -0
- data/app/javascript/lostcoords/ui/controllers/lc_sidebar_controller.js +48 -0
- data/app/javascript/lostcoords/ui/index.js +4 -0
- data/config/locales/en.yml +14 -0
- data/config/locales/es.yml +14 -0
- data/config/locales/ja.yml +14 -0
- data/lib/lostcoords/ui/parts.rb +86 -0
- data/lib/lostcoords/ui/version.rb +1 -1
- metadata +4 -1
data/config/locales/en.yml
CHANGED
|
@@ -29,6 +29,20 @@ en:
|
|
|
29
29
|
navigation: "Main"
|
|
30
30
|
dock:
|
|
31
31
|
close: "Close %{label}"
|
|
32
|
+
sidebar:
|
|
33
|
+
label: "Sidebar"
|
|
34
|
+
collapse: "Collapse sidebar"
|
|
35
|
+
expand: "Expand sidebar"
|
|
36
|
+
char_counter:
|
|
37
|
+
label: "%{count} of %{max} characters"
|
|
38
|
+
time:
|
|
39
|
+
now: "now"
|
|
40
|
+
minutes: "%{count}m"
|
|
41
|
+
hours: "%{count}h"
|
|
42
|
+
formats:
|
|
43
|
+
date: "%-d %b"
|
|
44
|
+
date_with_year: "%-d %b %Y"
|
|
45
|
+
full: "%-d %B %Y, %H:%M"
|
|
32
46
|
breadcrumb:
|
|
33
47
|
label: "Breadcrumb"
|
|
34
48
|
code_block:
|
data/config/locales/es.yml
CHANGED
|
@@ -29,6 +29,20 @@ es:
|
|
|
29
29
|
navigation: "Principal"
|
|
30
30
|
dock:
|
|
31
31
|
close: "Cerrar %{label}"
|
|
32
|
+
sidebar:
|
|
33
|
+
label: "Barra lateral"
|
|
34
|
+
collapse: "Contraer la barra lateral"
|
|
35
|
+
expand: "Expandir la barra lateral"
|
|
36
|
+
char_counter:
|
|
37
|
+
label: "%{count} de %{max} caracteres"
|
|
38
|
+
time:
|
|
39
|
+
now: "ahora"
|
|
40
|
+
minutes: "%{count} min"
|
|
41
|
+
hours: "%{count} h"
|
|
42
|
+
formats:
|
|
43
|
+
date: "%-d %b"
|
|
44
|
+
date_with_year: "%-d %b %Y"
|
|
45
|
+
full: "%-d de %B de %Y, %H:%M"
|
|
32
46
|
breadcrumb:
|
|
33
47
|
label: "Ruta de navegación"
|
|
34
48
|
code_block:
|
data/config/locales/ja.yml
CHANGED
|
@@ -29,6 +29,20 @@ ja:
|
|
|
29
29
|
navigation: "メイン"
|
|
30
30
|
dock:
|
|
31
31
|
close: "%{label}を閉じる"
|
|
32
|
+
sidebar:
|
|
33
|
+
label: "サイドバー"
|
|
34
|
+
collapse: "サイドバーを折りたたむ"
|
|
35
|
+
expand: "サイドバーを展開する"
|
|
36
|
+
char_counter:
|
|
37
|
+
label: "%{max}文字中%{count}文字"
|
|
38
|
+
time:
|
|
39
|
+
now: "たった今"
|
|
40
|
+
minutes: "%{count}分"
|
|
41
|
+
hours: "%{count}時間"
|
|
42
|
+
formats:
|
|
43
|
+
date: "%-m月%-d日"
|
|
44
|
+
date_with_year: "%Y年%-m月%-d日"
|
|
45
|
+
full: "%Y年%-m月%-d日 %H:%M"
|
|
32
46
|
breadcrumb:
|
|
33
47
|
label: "パンくずリスト"
|
|
34
48
|
code_block:
|
data/lib/lostcoords/ui/parts.rb
CHANGED
|
@@ -195,6 +195,35 @@ module Lostcoords::Ui
|
|
|
195
195
|
end
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
+
class TabBar < Base
|
|
199
|
+
LINK = "flex justify-center px-content text-small text-muted-foreground no-underline transition-colors duration-(--lc-motion-quick) " \
|
|
200
|
+
"hover:bg-accent hover:text-foreground aria-[current=page]:font-semibold aria-[current=page]:text-foreground"
|
|
201
|
+
|
|
202
|
+
def initialize(view, fill)
|
|
203
|
+
super(view)
|
|
204
|
+
@fill = fill
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# current: marks the tab of the page the reader is on with aria-current="page". count: shows a
|
|
208
|
+
# muted number after the label; nil shows none.
|
|
209
|
+
def link(label, url, current: false, count: nil, **attributes)
|
|
210
|
+
view.send(:lc_label!, label, :label)
|
|
211
|
+
raise ArgumentError, "tab bar link needs a URL" if url.blank?
|
|
212
|
+
|
|
213
|
+
view.tag.li(class: (@fill ? "min-w-fit flex-1" : "shrink-0"), data: { slot: "tab-bar-item" }) do
|
|
214
|
+
view.link_to(url, **merge({ class: LINK, aria: { current: ("page" if current) }, data: { slot: "tab-bar-link" } }, attributes)) do
|
|
215
|
+
view.tag.span(class: "relative flex items-center gap-tight py-content whitespace-nowrap") do
|
|
216
|
+
view.safe_join([
|
|
217
|
+
label,
|
|
218
|
+
(view.tag.span(count, class: "font-normal tabular-nums text-muted-foreground", data: { slot: "tab-bar-count" }) unless count.nil?),
|
|
219
|
+
(view.tag.span(class: "absolute inset-x-0 bottom-0 h-1 rounded-pill bg-(--lc-tab-bar-indicator,var(--primary))", aria: { hidden: true }, data: { slot: "tab-bar-indicator" }) if current)
|
|
220
|
+
].compact)
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
198
227
|
class Toc < Base
|
|
199
228
|
LINK = "relative block py-tight ps-content pe-tight text-small text-muted-foreground no-underline transition-colors " \
|
|
200
229
|
"duration-(--lc-motion-quick) hover:text-foreground aria-[current=location]:font-medium aria-[current=location]:text-foreground"
|
|
@@ -233,6 +262,63 @@ module Lostcoords::Ui
|
|
|
233
262
|
end
|
|
234
263
|
end
|
|
235
264
|
|
|
265
|
+
class Sidebar < Base
|
|
266
|
+
ACCOUNT_TRIGGER = "flex w-full min-w-0 cursor-pointer items-center gap-related rounded-xl lc-squircle px-heading py-related text-start " \
|
|
267
|
+
"transition-colors duration-(--lc-motion-quick) hover:bg-accent aria-expanded:bg-accent lc-rail:justify-center lc-rail:px-0"
|
|
268
|
+
|
|
269
|
+
def initialize(view, toggle_label, expanded)
|
|
270
|
+
super(view)
|
|
271
|
+
@toggle_label = toggle_label
|
|
272
|
+
@expanded = expanded
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# The top row: the block, usually a wordmark linking home, then the toggle. On the rail the row
|
|
276
|
+
# stacks; show a short mark there with the lc-rail: variant. toggle: false leaves the toggle out.
|
|
277
|
+
def header(toggle: true, **attributes, &block)
|
|
278
|
+
part(:div, "sidebar-header", "flex items-center justify-between gap-related ps-heading lc-rail:flex-col lc-rail:ps-0", attributes) do
|
|
279
|
+
view.safe_join([ (view.capture(&block) if block), (self.toggle if toggle) ].compact)
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
# The button that folds the sidebar to a rail and back. Its label, title and aria-expanded follow the state.
|
|
284
|
+
def toggle(**attributes)
|
|
285
|
+
view.lc_icon_button(@toggle_label, icon: "chevron-double-left", size: :sm,
|
|
286
|
+
**merge({ class: "lc-sidebar__toggle", title: @toggle_label, aria: { expanded: @expanded },
|
|
287
|
+
data: { slot: "sidebar-toggle", action: "lc-sidebar#toggle", lc_sidebar_target: "toggle" } }, attributes))
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
# The growing middle, usually an lc_nav_list. On the rail its group titles and link labels stay
|
|
291
|
+
# for screen readers only and the links center their icons; give each link a title:.
|
|
292
|
+
def body(**attributes, &block)
|
|
293
|
+
part(:div, "sidebar-body", "flex min-h-0 flex-1 flex-col gap-content", attributes, &block)
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
def footer(**attributes, &block)
|
|
297
|
+
part(:div, "sidebar-footer", "flex min-w-0 flex-col gap-related", attributes, &block)
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
# A full-width row that opens an lc_menu of the block's lc_menu_option items: avatar:, the name and
|
|
301
|
+
# a detail line, such as an email. On the rail only the avatar shows. Attributes go to the row.
|
|
302
|
+
def account(name, detail: nil, avatar: nil, id: "sidebar-account", align: :start, **attributes, &block)
|
|
303
|
+
view.send(:lc_label!, name, :name)
|
|
304
|
+
raise ArgumentError, "sidebar account needs a block of menu options" unless block
|
|
305
|
+
|
|
306
|
+
text = view.tag.span(class: "min-w-0 grow lc-rail:sr-only", data: { slot: "sidebar-account-text" }) do
|
|
307
|
+
view.safe_join([
|
|
308
|
+
view.tag.span(name, class: "block truncate text-label"),
|
|
309
|
+
(view.tag.span(detail, class: "block truncate text-caption text-muted-foreground") if detail.present?)
|
|
310
|
+
].compact)
|
|
311
|
+
end
|
|
312
|
+
ellipsis = view.lc_icon("ellipsis-horizontal", options: { class: "size-4 shrink-0 text-muted-foreground lc-rail:hidden", "aria-hidden": true })
|
|
313
|
+
view.lc_menu(id: id, align: align, wrapper_attributes: { class: "flex w-full", data: { slot: "sidebar-account" } }) do |menu|
|
|
314
|
+
menu.trigger(**merge({ class: ACCOUNT_TRIGGER, title: name, data: { slot: "sidebar-account-trigger" } }, attributes)) do |wiring|
|
|
315
|
+
view.tag.button(view.safe_join([ avatar, text, ellipsis ].compact), type: "button", **wiring)
|
|
316
|
+
end
|
|
317
|
+
view.capture(&block)
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
|
|
236
322
|
class Dock < Base
|
|
237
323
|
# The primary destinations, icon above label; yields the lc_nav_list builder.
|
|
238
324
|
def nav(label:, **attributes, &block)
|
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.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lost Coordinates
|
|
@@ -119,6 +119,7 @@ files:
|
|
|
119
119
|
- app/assets/tailwind/lostcoords/ui/table.css
|
|
120
120
|
- app/assets/tailwind/lostcoords/ui/theme.css
|
|
121
121
|
- app/assets/tailwind/lostcoords/ui/toast.css
|
|
122
|
+
- app/assets/tailwind/lostcoords/ui/toggle-group.css
|
|
122
123
|
- app/assets/tailwind/lostcoords/ui/tooltip.css
|
|
123
124
|
- app/assets/tailwind/lostcoords/ui/typography.css
|
|
124
125
|
- app/assets/tailwind/lostcoords/ui/ui.css
|
|
@@ -156,6 +157,7 @@ files:
|
|
|
156
157
|
- app/helpers/lostcoords/ui/translation_helper.rb
|
|
157
158
|
- app/helpers/lostcoords/ui/typography_helper.rb
|
|
158
159
|
- app/javascript/lostcoords/ui/controllers/lc_app_header_controller.js
|
|
160
|
+
- app/javascript/lostcoords/ui/controllers/lc_char_counter_controller.js
|
|
159
161
|
- app/javascript/lostcoords/ui/controllers/lc_code_block_controller.js
|
|
160
162
|
- app/javascript/lostcoords/ui/controllers/lc_collapsible_controller.js
|
|
161
163
|
- app/javascript/lostcoords/ui/controllers/lc_copy_controller.js
|
|
@@ -171,6 +173,7 @@ files:
|
|
|
171
173
|
- app/javascript/lostcoords/ui/controllers/lc_selection_controller.js
|
|
172
174
|
- app/javascript/lostcoords/ui/controllers/lc_sheet_controller.js
|
|
173
175
|
- app/javascript/lostcoords/ui/controllers/lc_shortcut_controller.js
|
|
176
|
+
- app/javascript/lostcoords/ui/controllers/lc_sidebar_controller.js
|
|
174
177
|
- app/javascript/lostcoords/ui/controllers/lc_tabs_controller.js
|
|
175
178
|
- app/javascript/lostcoords/ui/controllers/lc_toast_controller.js
|
|
176
179
|
- app/javascript/lostcoords/ui/controllers/lc_toast_region_controller.js
|