lesli_view 1.1.7 → 1.1.8
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/app/assets/stylesheets/lesli_view/view.css +3122 -2430
- data/lib/lesli_view/charts/general/general.css +25 -0
- data/lib/lesli_view/charts/{general.html.erb → general/general.html.erb} +5 -5
- data/lib/lesli_view/components/header/header.css +33 -0
- data/lib/lesli_view/components/{header.html.erb → header/header.html.erb} +9 -9
- data/lib/lesli_view/components/panel/panel.css +49 -0
- data/lib/lesli_view/components/panel/panel.html.erb +55 -0
- data/lib/lesli_view/components/tabs/tabs.css +57 -0
- data/lib/lesli_view/components/{tabs.html.erb → tabs/tabs.html.erb} +9 -9
- data/lib/lesli_view/components/timeline/timeline.css +48 -0
- data/lib/lesli_view/components/timeline/timeline.html.erb +42 -0
- data/lib/lesli_view/components/{toolbar.css → toolbar/toolbar.css} +8 -5
- data/lib/lesli_view/components/{toolbar.html.erb → toolbar/toolbar.html.erb} +2 -2
- data/lib/lesli_view/elements/avatar/avatar.css +36 -0
- data/lib/lesli_view/elements/avatar/avatar.html.erb +7 -0
- data/lib/lesli_view/elements/avatar.rb +6 -6
- data/lib/lesli_view/elements/{button.css → button/button.css} +82 -82
- data/lib/lesli_view/elements/button.rb +1 -1
- data/lib/lesli_view/elements/empty/empty.css +25 -0
- data/lib/lesli_view/elements/{empty.html.erb → empty/empty.html.erb} +6 -6
- data/lib/lesli_view/elements/table/table-chart.css +9 -0
- data/lib/lesli_view/elements/{table-chart.html.erb → table/table-chart.html.erb} +2 -2
- data/lib/lesli_view/elements/{table.css → table/table.css} +17 -14
- data/lib/lesli_view/elements/{table.html.erb → table/table.html.erb} +1 -1
- data/lib/lesli_view/forms/builder.rb +1 -1
- data/lib/lesli_view/forms/form.css +26 -23
- data/lib/lesli_view/items/actions/actions.css +13 -0
- data/lib/lesli_view/items/{actions.html.erb → actions/actions.html.erb} +3 -3
- data/lib/lesli_view/items/activities/activities.css +5 -0
- data/lib/lesli_view/items/{activities.html.erb → activities/activities.html.erb} +1 -1
- data/lib/lesli_view/items/attachment/attachment.css +41 -0
- data/lib/lesli_view/items/attachment/attachment.html.erb +45 -0
- data/lib/lesli_view/items/attachments/attachments.css +33 -0
- data/lib/lesli_view/items/{attachments.html.erb → attachments/attachments.html.erb} +8 -8
- data/lib/lesli_view/items/discussion/discussion.css +17 -0
- data/lib/lesli_view/items/discussion/discussion.html.erb +12 -0
- data/lib/lesli_view/items/discussions/discussions.css +25 -0
- data/lib/lesli_view/items/{discussions.html.erb → discussions/discussions.html.erb} +7 -7
- data/lib/lesli_view/items/task/task.css +41 -0
- data/lib/lesli_view/items/{task.html.erb → task/task.html.erb} +6 -6
- data/lib/lesli_view/items/tasks/tasks.css +21 -0
- data/lib/lesli_view/items/{tasks.html.erb → tasks/tasks.html.erb} +5 -5
- data/lib/lesli_view/layout/container/container.css +13 -0
- data/lib/lesli_view/layout/{container.html.erb → container/container.html.erb} +2 -2
- data/lib/lesli_view/layout/navigation_sidebar/navigation_sidebar.css +68 -0
- data/lib/lesli_view/layout/navigation_sidebar/navigation_sidebar.html.erb +52 -0
- data/lib/lesli_view/partials/announcements/announcements.css +50 -0
- data/lib/lesli_view/partials/announcements/announcements.html.erb +23 -0
- data/lib/lesli_view/partials/announcements.rb +33 -0
- data/lib/lesli_view/partials/engine_spec/engine_spec.css +37 -0
- data/lib/lesli_view/partials/engine_spec/engine_spec.html.erb +38 -0
- data/lib/lesli_view/partials/error/error.css +38 -0
- data/lib/lesli_view/partials/error/error.html.erb +14 -0
- data/lib/lesli_view/partials/error.rb +24 -0
- data/lib/lesli_view/partials/header/header.css +54 -0
- data/lib/lesli_view/partials/header/header.html.erb +31 -0
- data/lib/lesli_view/partials/header.rb +22 -0
- data/lib/lesli_view/partials/notifications/notifications.css +38 -0
- data/lib/lesli_view/partials/notifications/notifications.html.erb +7 -0
- data/lib/lesli_view/partials/notifications.rb +28 -0
- data/lib/lesli_view/version.rb +2 -2
- data/lib/lesli_view/widgets/calendar/calendar.css +57 -0
- data/lib/lesli_view/widgets/calendar/calendar.html.erb +44 -0
- data/lib/lesli_view/widgets/chart/chart.css +21 -0
- data/lib/lesli_view/widgets/{chart.html.erb → chart/chart.html.erb} +5 -5
- data/lib/lesli_view/widgets/count/count.css +21 -0
- data/lib/lesli_view/widgets/count/count.html.erb +18 -0
- data/lib/lesli_view/widgets/date/date.css +29 -0
- data/lib/lesli_view/widgets/date/date.html.erb +24 -0
- data/lib/lesli_view/widgets/weather/weather.css +81 -0
- data/lib/lesli_view/widgets/weather/weather.html.erb +46 -0
- data/lib/lesli_view.rb +4 -0
- data/readme.md +1 -1
- metadata +68 -34
- data/lib/lesli_view/components/panel.html.erb +0 -55
- data/lib/lesli_view/components/timeline.html.erb +0 -42
- data/lib/lesli_view/elements/avatar.html.erb +0 -7
- data/lib/lesli_view/forms/form.scss +0 -35
- data/lib/lesli_view/items/attachment.html.erb +0 -45
- data/lib/lesli_view/items/discussion.html.erb +0 -12
- data/lib/lesli_view/layout/navigation_sidebar.css +0 -19
- data/lib/lesli_view/layout/navigation_sidebar.html.erb +0 -52
- data/lib/lesli_view/partials/engine_spec.html.erb +0 -38
- data/lib/lesli_view/widgets/calendar.html.erb +0 -44
- data/lib/lesli_view/widgets/count.html.erb +0 -18
- data/lib/lesli_view/widgets/date.html.erb +0 -24
- data/lib/lesli_view/widgets/weather.html.erb +0 -46
- /data/lib/lesli_view/elements/{button.html.erb → button/button.html.erb} +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LesliView
|
|
4
|
+
module Partials
|
|
5
|
+
# Core supplies display data and authorized dismissal URLs, never models to query.
|
|
6
|
+
class Announcements < ViewComponent::Base
|
|
7
|
+
ICONS = {
|
|
8
|
+
"info" => "info",
|
|
9
|
+
"success" => "check_circle",
|
|
10
|
+
"warning" => "warning",
|
|
11
|
+
"danger" => "error"
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
attr_reader :announcements, :label, :link_label, :dismiss_label
|
|
15
|
+
|
|
16
|
+
def initialize(announcements:, label:, link_label:, dismiss_label:)
|
|
17
|
+
@announcements = announcements
|
|
18
|
+
@label = label
|
|
19
|
+
@link_label = link_label
|
|
20
|
+
@dismiss_label = dismiss_label
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def render?
|
|
24
|
+
announcements.present?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def category_for(announcement)
|
|
28
|
+
category = announcement.fetch(:category).to_s
|
|
29
|
+
ICONS.key?(category) ? category : "info"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-engine-spec-header {
|
|
3
|
+
@apply mb-4 border-b border-neutral-300 pb-3;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-engine-spec-title {
|
|
7
|
+
@apply text-xl font-semibold text-neutral-800;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-engine-spec-summary {
|
|
11
|
+
@apply mt-1 text-xl leading-7 text-neutral-600;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-engine-spec-list {
|
|
15
|
+
@apply m-0 list-none space-y-2 p-0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-engine-spec-item {
|
|
19
|
+
@apply ml-1.5 flex items-center gap-2 text-[1.1rem] text-neutral-600;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.lesli-engine-spec-icon {
|
|
23
|
+
@apply shrink-0 text-2xl leading-none text-neutral-400;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.lesli-engine-spec-details {
|
|
27
|
+
@apply ml-1.5 flex min-w-0 items-center gap-2 text-[1.1rem] text-neutral-600;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.lesli-engine-spec-value {
|
|
31
|
+
@apply min-w-0 break-all;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.lesli-engine-spec-link {
|
|
35
|
+
@apply font-sans text-[var(--lesli-color-primary)] underline-offset-4 hover:underline focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--lesli-color-primary)];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<div class="partial-engine-spec">
|
|
2
|
+
<div class="lesli-engine-spec-header">
|
|
3
|
+
<h5 class="lesli-engine-spec-title"><%= engine[:name] %></h5>
|
|
4
|
+
<p class="lesli-engine-spec-summary"><%= engine[:summary] %></p>
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
<ul class="lesli-engine-spec-list">
|
|
8
|
+
<li class="lesli-engine-spec-item">
|
|
9
|
+
<span class="material-symbols lesli-engine-spec-icon" aria-hidden="true">
|
|
10
|
+
pest_control
|
|
11
|
+
</span>
|
|
12
|
+
<span>Version: <%= engine[:version] %></span>
|
|
13
|
+
</li>
|
|
14
|
+
|
|
15
|
+
<li class="lesli-engine-spec-item">
|
|
16
|
+
<span class="material-symbols lesli-engine-spec-icon" aria-hidden="true">
|
|
17
|
+
schedule
|
|
18
|
+
</span>
|
|
19
|
+
<span>Build: <%= LesliDate::Formatter.new(Time.at(engine[:build].to_i)).date_time %></span>
|
|
20
|
+
</li>
|
|
21
|
+
|
|
22
|
+
<li class="lesli-engine-spec-details">
|
|
23
|
+
<span class="material-symbols lesli-engine-spec-icon" aria-hidden="true">
|
|
24
|
+
library_books
|
|
25
|
+
</span>
|
|
26
|
+
<span class="lesli-engine-spec-value">
|
|
27
|
+
<%= link_to_if(
|
|
28
|
+
engine.dig(:metadata, "documentation_uri"),
|
|
29
|
+
engine.dig(:metadata, "documentation_uri"),
|
|
30
|
+
engine.dig(:metadata, "documentation_uri"),
|
|
31
|
+
target: "_blank",
|
|
32
|
+
rel: "noopener noreferrer",
|
|
33
|
+
class: "lesli-engine-spec-link"
|
|
34
|
+
) %>
|
|
35
|
+
</span>
|
|
36
|
+
</li>
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-error {
|
|
3
|
+
@apply px-4 py-24 sm:px-6 sm:py-36;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-error-content {
|
|
7
|
+
@apply mx-auto max-w-2xl text-center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-error-illustration {
|
|
11
|
+
@apply mb-6;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-error-icon {
|
|
15
|
+
@apply text-[8rem]! leading-none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-error-title {
|
|
19
|
+
@apply mb-4 text-[2rem] font-semibold leading-tight text-foreground;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.lesli-error.is-danger .lesli-error-title,
|
|
23
|
+
.lesli-error.is-danger .lesli-error-icon {
|
|
24
|
+
@apply text-danger-800;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.lesli-error-message {
|
|
28
|
+
@apply text-[1.4rem] font-light leading-relaxed text-neutral-700;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.lesli-error-details {
|
|
32
|
+
@apply mx-auto mt-6 max-w-xl rounded-lg border border-neutral-200 bg-white p-5 text-sm text-neutral-600 shadow-sm;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.lesli-error-details ul {
|
|
36
|
+
@apply space-y-1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<section class="<%= class_names("lesli-error", "is-danger": tone.to_s == "danger") %>" aria-labelledby="<%= title_id %>">
|
|
2
|
+
<div class="lesli-error-content">
|
|
3
|
+
<% if illustration? %>
|
|
4
|
+
<div class="lesli-error-illustration" aria-hidden="true">
|
|
5
|
+
<%= illustration %>
|
|
6
|
+
</div>
|
|
7
|
+
<% end %>
|
|
8
|
+
<h2 id="<%= title_id %>" class="lesli-error-title"><%= title %></h2>
|
|
9
|
+
<p class="lesli-error-message"><%= message %></p>
|
|
10
|
+
<% if details? %>
|
|
11
|
+
<div class="lesli-error-details"><%= details %></div>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
14
|
+
</section>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LesliView
|
|
4
|
+
module Partials
|
|
5
|
+
# Presentation only: the caller owns HTTP status, authorization and error data.
|
|
6
|
+
class Error < ViewComponent::Base
|
|
7
|
+
renders_one :illustration
|
|
8
|
+
renders_one :details
|
|
9
|
+
|
|
10
|
+
attr_reader :title, :message, :tone, :id
|
|
11
|
+
|
|
12
|
+
def initialize(title:, message:, id: nil, tone: :default)
|
|
13
|
+
@title = title
|
|
14
|
+
@message = message
|
|
15
|
+
@tone = tone
|
|
16
|
+
@id = id || "lesli-error-#{object_id}"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def title_id
|
|
20
|
+
"#{id}-title"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-application-header, .lesli-application-header-navigation {
|
|
3
|
+
@apply border-b border-neutral-200/80 bg-white;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-application-header-container {
|
|
7
|
+
@apply mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 flex h-20 items-center justify-between;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-application-header-logo-link {
|
|
11
|
+
@apply flex items-center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-application-header-logo {
|
|
15
|
+
@apply flex items-center [&_img]:h-12 [&_img]:w-auto;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-application-header-actions {
|
|
19
|
+
@apply flex items-center gap-2;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.lesli-application-header-action {
|
|
23
|
+
@apply relative flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-neutral-500 transition-colors hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.lesli-application-header-action.is-active {
|
|
27
|
+
@apply text-primary-strong;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.lesli-application-header-action.is-danger {
|
|
31
|
+
@apply hover:bg-danger-50 hover:text-danger-600 focus-visible:ring-danger-500/30;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.lesli-application-header-icon {
|
|
35
|
+
@apply text-[24px] leading-none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.lesli-application-header-icon.is-highlighted {
|
|
39
|
+
@apply text-primary;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.lesli-application-header-count {
|
|
43
|
+
@apply absolute right-0 top-0 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[9px] font-semibold leading-none text-white ring-2 ring-white;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.lesli-application-header-navigation-container {
|
|
47
|
+
@apply mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 overflow-x-auto;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.lesli-application-header-links {
|
|
51
|
+
@apply flex min-h-14 w-max min-w-full items-center justify-start gap-1 py-2 sm:justify-center;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<header class="lesli-application-header">
|
|
2
|
+
<div class="lesli-application-header-container">
|
|
3
|
+
<%= link_to home_url, class: "lesli-application-header-logo-link",
|
|
4
|
+
aria: { label: home_label }, data: { turbo_frame: "_top" } do %>
|
|
5
|
+
<div class="lesli-application-header-logo"><%= logo %></div>
|
|
6
|
+
<% end %>
|
|
7
|
+
<nav class="lesli-application-header-actions" aria-label="<%= actions_label %>">
|
|
8
|
+
<% actions.each do |action| %>
|
|
9
|
+
<%= link_to action.fetch(:url),
|
|
10
|
+
class: class_names("lesli-application-header-action",
|
|
11
|
+
"is-active": action[:active], "is-danger": action[:danger]),
|
|
12
|
+
aria: { label: action.fetch(:label), current: action[:active] ? "page" : nil },
|
|
13
|
+
title: action.fetch(:label), data: action[:data] do %>
|
|
14
|
+
<i class="<%= class_names(action.fetch(:icon), "lesli-application-header-icon", "is-highlighted": action[:highlighted]) %>" aria-hidden="true"></i>
|
|
15
|
+
<% if action[:count].to_i.positive? %>
|
|
16
|
+
<span class="lesli-application-header-count" aria-hidden="true">
|
|
17
|
+
<%= action[:count] > 99 ? "99+" : action[:count] %>
|
|
18
|
+
</span>
|
|
19
|
+
<% end %>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% end %>
|
|
22
|
+
</nav>
|
|
23
|
+
</div>
|
|
24
|
+
</header>
|
|
25
|
+
<% if navigation? %>
|
|
26
|
+
<nav class="lesli-application-header-navigation" aria-label="<%= navigation_label %>">
|
|
27
|
+
<div class="lesli-application-header-navigation-container">
|
|
28
|
+
<ul class="lesli-application-header-links"><%= navigation %></ul>
|
|
29
|
+
</div>
|
|
30
|
+
</nav>
|
|
31
|
+
<% end %>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LesliView
|
|
4
|
+
module Partials
|
|
5
|
+
# Core resolves routes, selected states and optional engines.
|
|
6
|
+
# Slots carry the host's branding and engine-specific navigation.
|
|
7
|
+
class Header < ViewComponent::Base
|
|
8
|
+
renders_one :logo
|
|
9
|
+
renders_one :navigation
|
|
10
|
+
|
|
11
|
+
attr_reader :home_url, :home_label, :actions, :actions_label, :navigation_label
|
|
12
|
+
|
|
13
|
+
def initialize(home_url:, home_label:, actions:, actions_label:, navigation_label:)
|
|
14
|
+
@home_url = home_url
|
|
15
|
+
@home_label = home_label
|
|
16
|
+
@actions = actions
|
|
17
|
+
@actions_label = actions_label
|
|
18
|
+
@navigation_label = navigation_label
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-notifications {
|
|
3
|
+
@apply fixed inset-x-0 z-[999] mx-auto w-[90%] max-w-[600px];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-notifications-message {
|
|
7
|
+
@apply my-1 break-words rounded-lg border-2 px-4 py-3 text-center text-sm font-medium shadow-sm;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-notifications-message.is-info {
|
|
11
|
+
@apply border-info-300 bg-info-50 text-info-900;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-notifications-message.is-success {
|
|
15
|
+
@apply border-success-300 bg-success-50 text-success-900;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-notifications-message.is-warning {
|
|
19
|
+
@apply border-warning-300 bg-warning-50 text-warning-900;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.lesli-notifications-message.is-danger {
|
|
23
|
+
@apply border-danger-300 bg-danger-50 text-danger-900;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.lesli-notifications-message.is-neutral {
|
|
27
|
+
@apply border-neutral-300 bg-neutral-50 text-neutral-900;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.lesli-notifications-message {
|
|
31
|
+
animation: lesli-view-notification-fade-out 5s forwards;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@keyframes lesli-view-notification-fade-out {
|
|
36
|
+
0%, 80% { opacity: 1; }
|
|
37
|
+
100% { opacity: 0; display: none; }
|
|
38
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<section id="application-lesli-notifications" class="lesli-notifications" aria-live="polite" aria-atomic="true">
|
|
2
|
+
<% messages.each do |type, message| %>
|
|
3
|
+
<div class="lesli-notifications-message is-<%= category_for(type) %>">
|
|
4
|
+
<%= message %>
|
|
5
|
+
</div>
|
|
6
|
+
<% end %>
|
|
7
|
+
</section>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LesliView
|
|
4
|
+
module Partials
|
|
5
|
+
# Rendering must not consume flash; Core owns that request lifecycle.
|
|
6
|
+
class Notifications < ViewComponent::Base
|
|
7
|
+
CATEGORIES = {
|
|
8
|
+
"info" => "info",
|
|
9
|
+
"notice" => "success",
|
|
10
|
+
"success" => "success",
|
|
11
|
+
"warning" => "warning",
|
|
12
|
+
"alert" => "danger",
|
|
13
|
+
"danger" => "danger",
|
|
14
|
+
"error" => "danger"
|
|
15
|
+
}.freeze
|
|
16
|
+
|
|
17
|
+
attr_reader :messages
|
|
18
|
+
|
|
19
|
+
def initialize(messages:)
|
|
20
|
+
@messages = messages
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def category_for(type)
|
|
24
|
+
CATEGORIES.fetch(type.to_s, "neutral")
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/lib/lesli_view/version.rb
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-calendar-widget {
|
|
3
|
+
@apply p-3 sm:p-4 h-full rounded-2xl border border-neutral-200 bg-white shadow-sm;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-calendar-widget-weekdays {
|
|
7
|
+
@apply grid grid-cols-7 gap-0.5;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-calendar-widget-weekday {
|
|
11
|
+
@apply py-0.5 text-center text-[11px] font-semibold uppercase tracking-wide text-neutral-400;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-calendar-widget-weekday-label {
|
|
15
|
+
@apply no-underline;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-calendar-widget-days {
|
|
19
|
+
@apply mt-0.5 grid grid-cols-7 gap-0.5;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.lesli-calendar-widget-placeholder {
|
|
23
|
+
@apply h-8 sm:h-9;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.lesli-calendar-widget-day {
|
|
27
|
+
@apply h-8 sm:h-9 relative flex items-center justify-center rounded-lg text-sm font-medium;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.lesli-calendar-widget-selected {
|
|
31
|
+
@apply bg-primary text-white shadow-sm;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.lesli-calendar-widget-today {
|
|
35
|
+
@apply bg-primary-soft text-primary-strong ring-1 ring-inset ring-primary-muted;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.lesli-calendar-widget-regular {
|
|
39
|
+
@apply text-neutral-600;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.lesli-calendar-widget-indicator {
|
|
43
|
+
@apply absolute bottom-1 h-1 w-1 rounded-full;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.lesli-calendar-widget-selected-indicator {
|
|
47
|
+
@apply bg-white;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.lesli-calendar-widget-event-indicator {
|
|
51
|
+
@apply bg-primary;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.lesli-calendar-widget-accessible-label {
|
|
55
|
+
@apply sr-only;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<section
|
|
2
|
+
class="lesli-calendar-widget"
|
|
3
|
+
aria-label="<%= calendar_title %>">
|
|
4
|
+
|
|
5
|
+
<div class="lesli-calendar-widget-weekdays">
|
|
6
|
+
<% weekdays.each do |abbreviated_name, full_name| %>
|
|
7
|
+
<div class="lesli-calendar-widget-weekday">
|
|
8
|
+
<abbr class="lesli-calendar-widget-weekday-label" title="<%= full_name %>"><%= abbreviated_name %></abbr>
|
|
9
|
+
</div>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="lesli-calendar-widget-days">
|
|
14
|
+
<% calendar_days.each do |day| %>
|
|
15
|
+
<% if day.nil? %>
|
|
16
|
+
<span class="lesli-calendar-widget-placeholder" aria-hidden="true"></span>
|
|
17
|
+
<% else %>
|
|
18
|
+
<% day_date = date_for(day) %>
|
|
19
|
+
<div
|
|
20
|
+
class="lesli-calendar-widget-day
|
|
21
|
+
<%= if selected?(day)
|
|
22
|
+
"lesli-calendar-widget-selected"
|
|
23
|
+
elsif today?(day)
|
|
24
|
+
"lesli-calendar-widget-today"
|
|
25
|
+
else
|
|
26
|
+
"lesli-calendar-widget-regular"
|
|
27
|
+
end %>">
|
|
28
|
+
|
|
29
|
+
<time
|
|
30
|
+
datetime="<%= day_date.iso8601 %>"
|
|
31
|
+
aria-label="<%= I18n.l(day_date, format: :long) %>"
|
|
32
|
+
<% if today?(day) %>aria-current="date"<% end %>><%= day %></time>
|
|
33
|
+
|
|
34
|
+
<% if event?(day) %>
|
|
35
|
+
<span
|
|
36
|
+
class="lesli-calendar-widget-indicator <%= selected?(day) ? 'lesli-calendar-widget-selected-indicator' : 'lesli-calendar-widget-event-indicator' %>"
|
|
37
|
+
aria-hidden="true"></span>
|
|
38
|
+
<span class="lesli-calendar-widget-accessible-label"><%= I18n.t("date.has_events", default: "Has events") %></span>
|
|
39
|
+
<% end %>
|
|
40
|
+
</div>
|
|
41
|
+
<% end %>
|
|
42
|
+
<% end %>
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-chart-widget {
|
|
3
|
+
@apply h-full rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-chart-widget-body {
|
|
7
|
+
@apply flex h-full min-h-40 flex-col;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-chart-widget-title {
|
|
11
|
+
@apply mb-3 text-sm font-medium leading-5 text-neutral-500;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-chart-widget-content {
|
|
15
|
+
@apply min-h-0 flex-1;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-chart-widget-empty {
|
|
19
|
+
@apply flex flex-1 items-center justify-center text-sm text-neutral-400;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<section
|
|
2
|
-
class="lesli-chart-widget
|
|
2
|
+
class="lesli-chart-widget"
|
|
3
3
|
<% if title.present? %>aria-labelledby="<%= title_id %>"<% else %>aria-label="<%= I18n.t('charts.chart', default: 'Chart') %>"<% end %>>
|
|
4
4
|
|
|
5
|
-
<div class="
|
|
5
|
+
<div class="lesli-chart-widget-body">
|
|
6
6
|
<% if title.present? %>
|
|
7
|
-
<h2 id="<%= title_id %>" class="
|
|
7
|
+
<h2 id="<%= title_id %>" class="lesli-chart-widget-title">
|
|
8
8
|
<%= title %>
|
|
9
9
|
</h2>
|
|
10
10
|
<% end %>
|
|
11
11
|
|
|
12
12
|
<% if data? %>
|
|
13
|
-
<div class="
|
|
13
|
+
<div class="lesli-chart-widget-content">
|
|
14
14
|
<%= render(chart_component.new(
|
|
15
15
|
labels: labels,
|
|
16
16
|
datasets: [{ label: title, data: dataset }],
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
)) %>
|
|
20
20
|
</div>
|
|
21
21
|
<% else %>
|
|
22
|
-
<div class="
|
|
22
|
+
<div class="lesli-chart-widget-empty">
|
|
23
23
|
<%= I18n.t("charts.empty", default: "No chart data") %>
|
|
24
24
|
</div>
|
|
25
25
|
<% end %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-count-widget {
|
|
3
|
+
@apply h-full rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-count-widget-body {
|
|
7
|
+
@apply flex h-full min-h-40 flex-col;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-count-widget-title {
|
|
11
|
+
@apply text-sm font-medium leading-5 text-neutral-500;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-count-widget-content {
|
|
15
|
+
@apply flex flex-1 items-center justify-center py-4;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-count-widget-value {
|
|
19
|
+
@apply text-5xl sm:text-6xl break-all text-center font-semibold leading-none tracking-tight text-primary tabular-nums;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<section
|
|
2
|
+
class="lesli-count-widget"
|
|
3
|
+
<% if title.present? %>aria-labelledby="<%= title_id %>"<% else %>aria-label="<%= I18n.t('metrics.count', default: 'Count') %>"<% end %>>
|
|
4
|
+
|
|
5
|
+
<div class="lesli-count-widget-body">
|
|
6
|
+
<% if title.present? %>
|
|
7
|
+
<h2 id="<%= title_id %>" class="lesli-count-widget-title">
|
|
8
|
+
<%= title %>
|
|
9
|
+
</h2>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<div class="lesli-count-widget-content">
|
|
13
|
+
<p class="lesli-count-widget-value">
|
|
14
|
+
<%= display_number %>
|
|
15
|
+
</p>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</section>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.lesli-date-widget {
|
|
3
|
+
@apply h-full rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.lesli-date-widget-body {
|
|
7
|
+
@apply flex h-full min-h-40 items-center justify-center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.lesli-date-widget-day {
|
|
11
|
+
@apply text-6xl font-light leading-none tracking-tight text-primary;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.lesli-date-widget-divider {
|
|
15
|
+
@apply mx-5 h-20 w-px shrink-0 bg-neutral-200 sm:mx-6;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lesli-date-widget-details {
|
|
19
|
+
@apply min-w-0 text-left;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.lesli-date-widget-month {
|
|
23
|
+
@apply block text-lg font-semibold capitalize tracking-tight text-neutral-700;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.lesli-date-widget-weekday {
|
|
27
|
+
@apply mt-1 block text-base font-medium capitalize text-neutral-400;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<section
|
|
2
|
+
class="lesli-date-widget"
|
|
3
|
+
aria-label="<%= accessible_date %>">
|
|
4
|
+
|
|
5
|
+
<time
|
|
6
|
+
class="lesli-date-widget-body"
|
|
7
|
+
datetime="<%= date.iso8601 %>">
|
|
8
|
+
|
|
9
|
+
<span class="lesli-date-widget-day">
|
|
10
|
+
<%= date.day %>
|
|
11
|
+
</span>
|
|
12
|
+
|
|
13
|
+
<span class="lesli-date-widget-divider" aria-hidden="true"></span>
|
|
14
|
+
|
|
15
|
+
<span class="lesli-date-widget-details">
|
|
16
|
+
<span class="lesli-date-widget-month">
|
|
17
|
+
<%= weekday_name %>
|
|
18
|
+
</span>
|
|
19
|
+
<span class="lesli-date-widget-weekday">
|
|
20
|
+
<%= month_name %> <%= date.year %>
|
|
21
|
+
</span>
|
|
22
|
+
</span>
|
|
23
|
+
</time>
|
|
24
|
+
</section>
|