uikit_rails 0.1.1 → 0.1.3
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 +1 -0
- data/app/controllers/uikit_rails/styleguide_controller.rb +23 -0
- data/app/views/layouts/uikit_rails/application.html.erb +1918 -89
- data/app/views/uikit_rails/styleguide/index.html.erb +3 -1
- data/app/views/uikit_rails/styleguide/show.html.erb +38 -7
- data/config/routes.rb +1 -0
- data/lib/uikit_rails/templates/components/accordion/accordion.css +5 -1
- data/lib/uikit_rails/templates/components/accordion/component.html.erb +5 -3
- data/lib/uikit_rails/templates/components/alert/USAGE +10 -0
- data/lib/uikit_rails/templates/components/alert/alert.css +17 -1
- data/lib/uikit_rails/templates/components/alert/component.html.erb +11 -6
- data/lib/uikit_rails/templates/components/alert/component.rb +2 -1
- data/lib/uikit_rails/templates/components/alert/preview.yml +10 -0
- data/lib/uikit_rails/templates/components/form/builder.rb +10 -179
- data/lib/uikit_rails/templates/components/form/builder_mixin.rb +215 -0
- data/lib/uikit_rails/templates/components/toast/USAGE +59 -0
- data/lib/uikit_rails/templates/components/toast/component.html.erb +40 -0
- data/lib/uikit_rails/templates/components/toast/component.rb +102 -0
- data/lib/uikit_rails/templates/components/toast/preview.yml +96 -0
- data/lib/uikit_rails/templates/components/toast/toast.css +241 -0
- data/lib/uikit_rails/templates/stimulus/accordion_controller.js +126 -7
- data/lib/uikit_rails/templates/stimulus/toast_controller.js +38 -0
- data/lib/uikit_rails/version.rb +1 -1
- data/lib/uikit_rails.rb +1 -0
- data/test_app/Gemfile.lock +2 -2
- data/test_app/app/assets/stylesheets/ui/accordion.css +5 -1
- data/test_app/app/assets/stylesheets/ui/alert.css +17 -1
- data/test_app/app/assets/stylesheets/ui/toast.css +241 -0
- data/test_app/app/components/ui/accordion/component.html.erb +5 -3
- data/test_app/app/components/ui/alert/component.html.erb +11 -6
- data/test_app/app/components/ui/alert/component.rb +2 -1
- data/test_app/app/components/ui/alert/preview.yml +10 -0
- data/test_app/app/components/ui/form/builder.rb +10 -179
- data/test_app/app/components/ui/form/builder_mixin.rb +215 -0
- data/test_app/app/components/ui/toast/USAGE +59 -0
- data/test_app/app/components/ui/toast/component.html.erb +40 -0
- data/test_app/app/components/ui/toast/component.rb +102 -0
- data/test_app/app/components/ui/toast/preview.yml +96 -0
- data/test_app/app/javascript/controllers/ui/accordion_controller.js +126 -7
- data/test_app/app/javascript/controllers/ui/toast_controller.js +38 -0
- metadata +15 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f91b649381153711d5c2f5a78ad89d5d739504df3158e1ce81635fdc3f2e97c
|
|
4
|
+
data.tar.gz: 3f808888f9f379ef227fe9513ffa2978605eccc18370f2be66a5dc65103222d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2016553a1fc9de10ba54315362484a98bd6db0a8e661612712049d28cc3f66f825710dec2c14edb9d850d50422cb8c89ef9aa33361202fff676014181ca993a
|
|
7
|
+
data.tar.gz: 592e733bdb3f46e3ebdd710cfc894623a573d43c65caef6ebfa48fc03427db0cddabd04dacd16530f422190175fc8809c5508349fe2890ba4e0f60cd0787154b
|
data/README.md
CHANGED
|
@@ -187,6 +187,7 @@ The styleguide is self-contained — it has its own layout and styles that won't
|
|
|
187
187
|
| `popover` | Floating content panel triggered by click |
|
|
188
188
|
| `tabs` | Tabbed content panels with keyboard navigation |
|
|
189
189
|
| `tooltip` | Hover/focus tooltip (top, bottom, left, right) |
|
|
190
|
+
| `toast` | Dismissible notifications; `position:` sets fixed corner/center (six anchors), optional auto-dismiss (Stimulus) |
|
|
190
191
|
| `accordion` | Collapsible sections with single or multiple open |
|
|
191
192
|
| `collapsible` | Simple expand/collapse toggle |
|
|
192
193
|
|
|
@@ -23,6 +23,14 @@ module UikitRails
|
|
|
23
23
|
load_preview
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
# Development only: executes arbitrary ERB from the styleguide (same as preview.yml).
|
|
27
|
+
def render_preview
|
|
28
|
+
return head(:forbidden) unless Rails.env.development?
|
|
29
|
+
|
|
30
|
+
@component = params[:component]
|
|
31
|
+
render_snippet_json
|
|
32
|
+
end
|
|
33
|
+
|
|
26
34
|
private
|
|
27
35
|
|
|
28
36
|
def installed_components
|
|
@@ -68,5 +76,20 @@ module UikitRails
|
|
|
68
76
|
rescue StandardError => e
|
|
69
77
|
%(<span style="color:red">Render error: #{ERB::Util.html_escape(e.message)}</span>)
|
|
70
78
|
end
|
|
79
|
+
|
|
80
|
+
def render_snippet_json
|
|
81
|
+
unless installed_components.include?(@component)
|
|
82
|
+
render json: { error: "Component not found." }, status: :not_found
|
|
83
|
+
return
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
code = params[:code].to_s
|
|
87
|
+
if code.bytesize > 100_000
|
|
88
|
+
render json: { error: "Code is too large." }, status: :payload_too_large
|
|
89
|
+
return
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
render json: { html: render_example(code) }
|
|
93
|
+
end
|
|
71
94
|
end
|
|
72
95
|
end
|