sdr_view_components 0.3.0 → 0.4.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/Rakefile +1 -1
- data/app/assets/sdr_view_components.css +22 -0
- data/app/components/sdr_view_components/elements/toast_component.html.erb +2 -6
- data/app/components/sdr_view_components/elements/toast_component.rb +7 -2
- data/lib/sdr_view_components/version.rb +1 -1
- data/spec/components/previews/sdr_view_components/elements/toast_component_preview/disappearing.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/elements/toast_component_preview.rb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a3b49086535a4be91b25b4f4a5b68f51c72fd2478f5fc72d54c2b77afe5f7cf
|
|
4
|
+
data.tar.gz: dff1e70705204abaf6202df28826379dd8993d584445506e39f905250fed4795
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a34d248d460b3af61fdb39db821d45620e5444defed6de2505f260cce700b3c6babb9000d10063b98e59a52a171b2df7ca0162bbac8476648efa28b2ee008993
|
|
7
|
+
data.tar.gz: ed9d2ef885985c68e38f640ce30a67382be3cb9f258ac3d03946d896fdcaa651f09acd7059482b3a7f006163730748375a712f498e89832bd87dbe838a293292
|
data/Rakefile
CHANGED
|
@@ -116,3 +116,25 @@ table.table-data th {
|
|
|
116
116
|
cursor: default;
|
|
117
117
|
opacity: .5;
|
|
118
118
|
}
|
|
119
|
+
|
|
120
|
+
/* Toasts */
|
|
121
|
+
@keyframes fade-out {
|
|
122
|
+
0% {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
max-height: 200px;
|
|
125
|
+
visibility: visible;
|
|
126
|
+
}
|
|
127
|
+
79% { opacity: 1; }
|
|
128
|
+
80% { max-height: 200px; }
|
|
129
|
+
|
|
130
|
+
100% {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
max-height: 0;
|
|
133
|
+
visibility: hidden;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.toast-disappear {
|
|
138
|
+
animation: fade-out 5s ease-in forwards;
|
|
139
|
+
}
|
|
140
|
+
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
class="toast align-items-center show"
|
|
3
|
-
role="alert"
|
|
4
|
-
aria-live="assertive"
|
|
5
|
-
aria-atomic="true">
|
|
1
|
+
<%= tag.div class: classes, role: 'alert', aria: { live: 'assertive', atomic: 'true' } do %>
|
|
6
2
|
<%= tag.div class: toast_body_classes do %>
|
|
7
3
|
<div class="d-flex">
|
|
8
4
|
<div
|
|
@@ -29,4 +25,4 @@
|
|
|
29
25
|
</div>
|
|
30
26
|
</div>
|
|
31
27
|
<% end %>
|
|
32
|
-
|
|
28
|
+
<% end %>
|
|
@@ -4,15 +4,20 @@ module SdrViewComponents
|
|
|
4
4
|
module Elements
|
|
5
5
|
# Component for rendering a toast element.
|
|
6
6
|
class ToastComponent < BaseComponent
|
|
7
|
-
def initialize(title:, text: nil, close_text: nil, variant: :black)
|
|
7
|
+
def initialize(title:, text: nil, close_text: nil, variant: :black, disappearing: false)
|
|
8
8
|
@title = title
|
|
9
9
|
@text = text
|
|
10
10
|
@close_text = close_text
|
|
11
11
|
@variant = variant
|
|
12
|
+
@disappearing = disappearing
|
|
12
13
|
super()
|
|
13
14
|
end
|
|
14
15
|
|
|
15
|
-
attr_reader :title, :text, :close_text, :variant
|
|
16
|
+
attr_reader :title, :text, :close_text, :variant, :disappearing
|
|
17
|
+
|
|
18
|
+
def classes
|
|
19
|
+
merge_classes('toast align-items-center show', ('toast-disappear' if disappearing))
|
|
20
|
+
end
|
|
16
21
|
|
|
17
22
|
def toast_body_classes
|
|
18
23
|
merge_classes([background_color], %w[toast-body text-white])
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<%= render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Non-Disappearing Toast text') %>
|
|
2
|
+
|
|
3
|
+
<%= render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Disappearing Toast text. Wait 5 secs.', disappearing: true, variant: :green) %>
|
|
4
|
+
|
|
5
|
+
<%= render SdrViewComponents::Elements::ToastComponent.new(title: 'Alert!', text: 'Non-Disappearing Toast text') %>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sdr_view_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aaron Collier
|
|
@@ -190,6 +190,7 @@ files:
|
|
|
190
190
|
- spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/underline_variant.html.erb
|
|
191
191
|
- spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/with_header.html.erb
|
|
192
192
|
- spec/components/previews/sdr_view_components/elements/toast_component_preview.rb
|
|
193
|
+
- spec/components/previews/sdr_view_components/elements/toast_component_preview/disappearing.html.erb
|
|
193
194
|
- spec/components/previews/sdr_view_components/elements/tooltip_component_preview.rb
|
|
194
195
|
- spec/components/previews/sdr_view_components/elements/tooltip_component_preview/default.html.erb
|
|
195
196
|
- spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview.rb
|