jet_ui 0.2.10 → 0.3.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/CHANGELOG.md +25 -0
- data/README.md +30 -21
- data/app/assets/images/logo.svg +25 -0
- data/app/assets/javascripts/jet_ui/dialog_controller.js +95 -0
- data/app/assets/javascripts/jet_ui/dialogs_controller.js +248 -0
- data/app/assets/javascripts/jet_ui/drawer_controller.js +6 -0
- data/app/assets/javascripts/jet_ui/drawers_controller.js +5 -0
- data/app/assets/javascripts/jet_ui/modal_controller.js +6 -0
- data/app/assets/javascripts/jet_ui/modals_controller.js +5 -0
- data/app/assets/stylesheets/jet_ui/dialog.css +134 -0
- data/app/assets/stylesheets/jet_ui/theme.css +12 -0
- data/app/assets/stylesheets/jet_ui.css +1 -0
- data/app/components/jet_ui/dialog/body_component.rb +21 -0
- data/app/components/jet_ui/dialog/component.rb +86 -0
- data/app/components/jet_ui/dialog/footer_component.rb +45 -0
- data/app/components/jet_ui/dialog/header_component.rb +45 -0
- data/app/components/jet_ui/dialogs/component.rb +18 -0
- data/app/components/jet_ui/drawer/body_component.rb +2 -14
- data/app/components/jet_ui/drawer/component.rb +14 -44
- data/app/components/jet_ui/drawer/footer_component.rb +2 -38
- data/app/components/jet_ui/drawer/header_component.rb +6 -38
- data/app/components/jet_ui/flash/component.rb +2 -2
- data/app/components/jet_ui/icon/component.rb +1 -3
- data/app/components/jet_ui/modal/body_component.rb +2 -14
- data/app/components/jet_ui/modal/component.rb +14 -44
- data/app/components/jet_ui/modal/footer_component.rb +2 -38
- data/app/components/jet_ui/modal/header_component.rb +6 -38
- data/app/components/jet_ui/turbo_confirm/component.html.erb +13 -15
- data/lib/generators/jet_ui/eject/eject_generator.rb +19 -0
- data/lib/generators/jet_ui/install/install_generator.rb +3 -3
- data/lib/jet_ui/version.rb +1 -1
- metadata +33 -10
|
@@ -2,52 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module JetUi
|
|
4
4
|
module Modal
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@
|
|
12
|
-
@size = size
|
|
13
|
-
@id = id
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
erb_template <<~ERB
|
|
17
|
-
<%= container_tag do %>
|
|
18
|
-
<%= helpers.jet_ui.modal_header(title: @title, subtitle: @subtitle, closable: closable?, id: @id) %>
|
|
19
|
-
<%= content %>
|
|
20
|
-
<% end %>
|
|
21
|
-
ERB
|
|
22
|
-
|
|
23
|
-
private
|
|
24
|
-
|
|
25
|
-
def container_tag(&block)
|
|
26
|
-
return sync_dialog(&block) if @id
|
|
27
|
-
return turbo_frame_dialog(&block) if helpers.turbo_frame_request?
|
|
28
|
-
|
|
29
|
-
content_tag :div, class: class_names('modal modal-page', "w-#{@size}"), &block
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def sync_dialog(&block)
|
|
33
|
-
dialog_tag(id: @id, data: { modals_target: 'dialog' }, &block)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def turbo_frame_dialog(&block)
|
|
37
|
-
helpers.turbo_frame_tag :modal do
|
|
38
|
-
dialog_tag(id: :modalDialog, data: { controller: 'modal' }) do
|
|
39
|
-
helpers.turbo_frame_tag(:modalContent, &block)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def dialog_tag(**options, &block)
|
|
45
|
-
attrs = { tabindex: '-1', class: class_names('modal', 'animate-slide-up', "w-#{@size}") }
|
|
46
|
-
content_tag :dialog, **attrs, **options, &block
|
|
5
|
+
# @deprecated Use {JetUi::Dialog::Component} with `position: :center` instead.
|
|
6
|
+
# Kept as a thin shim so existing `jet_ui.modal(...)` calls and
|
|
7
|
+
# `data: { turbo_frame: :modal }` links keep working. Will be removed in the next
|
|
8
|
+
# major version.
|
|
9
|
+
class Component < JetUi::Dialog::Component
|
|
10
|
+
def self.deprecator
|
|
11
|
+
@deprecator ||= ActiveSupport::Deprecation.new('1.0', 'JetUi')
|
|
47
12
|
end
|
|
48
13
|
|
|
49
|
-
def
|
|
50
|
-
|
|
14
|
+
def initialize(title: nil, subtitle: nil, size: JetUi::Dialog::Component::DEFAULT_SIZE, id: nil)
|
|
15
|
+
self.class.deprecator.warn(
|
|
16
|
+
'JetUi::Modal::Component is deprecated and will be removed in the next major ' \
|
|
17
|
+
'version. Use JetUi::Dialog::Component with position: :center instead ' \
|
|
18
|
+
'(jet_ui.dialog).'
|
|
19
|
+
)
|
|
20
|
+
super(title: title, subtitle: subtitle, position: :center, size: size, id: id)
|
|
51
21
|
end
|
|
52
22
|
end
|
|
53
23
|
end
|
|
@@ -2,44 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
module JetUi
|
|
4
4
|
module Modal
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@direction = direction
|
|
8
|
-
@align = align
|
|
9
|
-
@justify = justify
|
|
10
|
-
@bordered = bordered
|
|
11
|
-
@options = options
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def call
|
|
15
|
-
content_tag :div, content, class: classes, **@options.except(:class)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
private
|
|
19
|
-
|
|
20
|
-
def classes
|
|
21
|
-
class_names(
|
|
22
|
-
'modal__footer',
|
|
23
|
-
{ 'modal__footer-bordered' => @bordered },
|
|
24
|
-
direction_class,
|
|
25
|
-
align_class,
|
|
26
|
-
justify_class,
|
|
27
|
-
@options[:class]
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def direction_class
|
|
32
|
-
{ col: 'flex flex-col gap-2', row: 'flex flex-row gap-2' }[@direction]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def align_class
|
|
36
|
-
{ start: 'items-start', center: 'items-center', end: 'items-end' }[@align]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def justify_class
|
|
40
|
-
{ start: 'justify-start', center: 'justify-center', end: 'justify-end',
|
|
41
|
-
between: 'justify-between' }[@justify]
|
|
42
|
-
end
|
|
5
|
+
# @deprecated Use {JetUi::Dialog::FooterComponent} instead.
|
|
6
|
+
class FooterComponent < JetUi::Dialog::FooterComponent
|
|
43
7
|
end
|
|
44
8
|
end
|
|
45
9
|
end
|
|
@@ -2,44 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module JetUi
|
|
4
4
|
module Modal
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@bordered = bordered
|
|
12
|
-
@options = options
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
erb_template <<~ERB
|
|
16
|
-
<div class="<%= classes %>">
|
|
17
|
-
<div>
|
|
18
|
-
<% if @title %>
|
|
19
|
-
<h3 class="modal__title"><%= @title %></h3>
|
|
20
|
-
<% end %>
|
|
21
|
-
<% if @subtitle %>
|
|
22
|
-
<div class="modal__subtitle"><%= @subtitle %></div>
|
|
23
|
-
<% end %>
|
|
24
|
-
<%= content %>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<% if @closable %>
|
|
28
|
-
<button type="button" class="modal__close" data-action="click->modal#close click->modals#close" aria-label="Close" data-id="<%= @id %>">
|
|
29
|
-
<%= helpers.jet_ui.icon("x-mark", size: 6) %>
|
|
30
|
-
</button>
|
|
31
|
-
<% end %>
|
|
32
|
-
</div>
|
|
33
|
-
ERB
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
def classes
|
|
38
|
-
class_names(
|
|
39
|
-
'modal__header',
|
|
40
|
-
{ 'modal__header-bordered' => @bordered },
|
|
41
|
-
@options[:class]
|
|
42
|
-
)
|
|
5
|
+
# @deprecated Use {JetUi::Dialog::HeaderComponent} instead.
|
|
6
|
+
class HeaderComponent < JetUi::Dialog::HeaderComponent
|
|
7
|
+
# `id:` accepted and ignored for signature compatibility with the pre-deprecation API.
|
|
8
|
+
def initialize(title: nil, subtitle: nil, closable: true, id: nil, bordered: true, # rubocop:disable Lint/UnusedMethodArgument
|
|
9
|
+
**options)
|
|
10
|
+
super(title: title, subtitle: subtitle, closable: closable, bordered: bordered, **options)
|
|
43
11
|
end
|
|
44
12
|
end
|
|
45
13
|
end
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
<dialog id="turbo-confirm" tabindex="-1"
|
|
2
|
-
class="
|
|
2
|
+
class="dialog dialog-center w-2xl"
|
|
3
3
|
data-controller="turbo-confirm">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
<h3 class="modal__title">Are you absolutely sure?</h3>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
4
|
+
<div class="dialog__panel">
|
|
5
|
+
<form method="dialog">
|
|
6
|
+
<%= helpers.jet_ui.dialog_header(title: 'Are you absolutely sure?', closable: false) %>
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
<%= helpers.jet_ui.dialog_body do %>
|
|
9
|
+
<p>This cannot be undone.</p>
|
|
10
|
+
<% end %>
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
<%= helpers.jet_ui.dialog_footer justify: :end do %>
|
|
13
|
+
<%= helpers.jet_ui.btn 'Cancel', type: :submit, variant: :outline, value: 'cancel' %>
|
|
14
|
+
<%= helpers.jet_ui.btn "Yes, I'm sure", type: :submit, variant: :danger, value: 'confirm' %>
|
|
15
|
+
<% end %>
|
|
16
|
+
</form>
|
|
17
|
+
</div>
|
|
20
18
|
</dialog>
|
|
@@ -237,6 +237,25 @@ module JetUi
|
|
|
237
237
|
{ src: 'test/components/previews/jet_ui/navbar/component_preview.rb', dest: 'test/components/previews/jet_ui/navbar/component_preview.rb', type: :preview }
|
|
238
238
|
]
|
|
239
239
|
},
|
|
240
|
+
'dialog' => {
|
|
241
|
+
files: [
|
|
242
|
+
{ src: 'app/components/jet_ui/dialog/component.rb', dest: 'app/components/jet_ui/dialog/component.rb' },
|
|
243
|
+
{ src: 'app/components/jet_ui/dialog/header_component.rb', dest: 'app/components/jet_ui/dialog/header_component.rb' },
|
|
244
|
+
{ src: 'app/components/jet_ui/dialog/body_component.rb', dest: 'app/components/jet_ui/dialog/body_component.rb' },
|
|
245
|
+
{ src: 'app/components/jet_ui/dialog/footer_component.rb', dest: 'app/components/jet_ui/dialog/footer_component.rb' },
|
|
246
|
+
{ src: 'app/assets/stylesheets/jet_ui/dialog.css', dest: 'app/assets/stylesheets/jet_ui/dialog.css' },
|
|
247
|
+
{ src: 'app/assets/javascripts/jet_ui/dialog_controller.js', dest: 'app/assets/javascripts/jet_ui/dialog_controller.js', type: :javascript },
|
|
248
|
+
{ src: 'app/assets/javascripts/jet_ui/dialogs_controller.js', dest: 'app/assets/javascripts/jet_ui/dialogs_controller.js', type: :javascript },
|
|
249
|
+
{ src: 'test/components/jet_ui/dialog/component_test.rb', dest: 'test/components/jet_ui/dialog/component_test.rb', type: :test },
|
|
250
|
+
{ src: 'test/components/previews/jet_ui/dialog/component_preview.rb', dest: 'test/components/previews/jet_ui/dialog/component_preview.rb', type: :preview }
|
|
251
|
+
]
|
|
252
|
+
},
|
|
253
|
+
'dialogs' => {
|
|
254
|
+
files: [
|
|
255
|
+
{ src: 'app/components/jet_ui/dialogs/component.rb', dest: 'app/components/jet_ui/dialogs/component.rb' },
|
|
256
|
+
{ src: 'test/components/jet_ui/dialogs/component_test.rb', dest: 'test/components/jet_ui/dialogs/component_test.rb', type: :test }
|
|
257
|
+
]
|
|
258
|
+
},
|
|
240
259
|
'modal' => {
|
|
241
260
|
files: [
|
|
242
261
|
{ src: 'app/components/jet_ui/modal/component.rb', dest: 'app/components/jet_ui/modal/component.rb' },
|
|
@@ -146,9 +146,9 @@ module JetUi
|
|
|
146
146
|
install_npm_package
|
|
147
147
|
say ' Ensure @hotwired/stimulus is installed — it is a peer dependency the controllers import.', :yellow
|
|
148
148
|
say ' Register the controllers you use, in your Stimulus controllers index:'
|
|
149
|
-
say %( import {
|
|
150
|
-
say %( application.register("
|
|
151
|
-
say %( application.register("
|
|
149
|
+
say %( import { DialogController, DialogsController } from "#{NPM_PACKAGE}")
|
|
150
|
+
say %( application.register("dialog", DialogController))
|
|
151
|
+
say %( application.register("dialogs", DialogsController))
|
|
152
152
|
say ' Import the styles, in your Tailwind/CSS entry point:'
|
|
153
153
|
say %( @import "#{NPM_PACKAGE}/css";)
|
|
154
154
|
end
|
data/lib/jet_ui/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jet_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JetRockets
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-09-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: railties
|
|
@@ -56,16 +56,30 @@ dependencies:
|
|
|
56
56
|
name: capybara
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- - "
|
|
59
|
+
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '3.36'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- - "
|
|
66
|
+
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '3.36'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: json
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "<"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '3.0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "<"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.0'
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: minitest
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -84,16 +98,16 @@ dependencies:
|
|
|
84
98
|
name: rails
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
86
100
|
requirements:
|
|
87
|
-
- -
|
|
101
|
+
- - ">="
|
|
88
102
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
103
|
+
version: '7.0'
|
|
90
104
|
type: :development
|
|
91
105
|
prerelease: false
|
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
107
|
requirements:
|
|
94
|
-
- -
|
|
108
|
+
- - ">="
|
|
95
109
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
110
|
+
version: '7.0'
|
|
97
111
|
- !ruby/object:Gem::Dependency
|
|
98
112
|
name: rubocop
|
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -501,7 +515,10 @@ files:
|
|
|
501
515
|
- app/assets/images/jet_ui/icons/wrench.svg
|
|
502
516
|
- app/assets/images/jet_ui/icons/x-circle.svg
|
|
503
517
|
- app/assets/images/jet_ui/icons/x-mark.svg
|
|
518
|
+
- app/assets/images/logo.svg
|
|
504
519
|
- app/assets/javascripts/jet_ui/clipboard_controller.js
|
|
520
|
+
- app/assets/javascripts/jet_ui/dialog_controller.js
|
|
521
|
+
- app/assets/javascripts/jet_ui/dialogs_controller.js
|
|
505
522
|
- app/assets/javascripts/jet_ui/drawer_controller.js
|
|
506
523
|
- app/assets/javascripts/jet_ui/drawers_controller.js
|
|
507
524
|
- app/assets/javascripts/jet_ui/dropdown_controller.js
|
|
@@ -519,6 +536,7 @@ files:
|
|
|
519
536
|
- app/assets/stylesheets/jet_ui/breadcrumbs.css
|
|
520
537
|
- app/assets/stylesheets/jet_ui/btn.css
|
|
521
538
|
- app/assets/stylesheets/jet_ui/card.css
|
|
539
|
+
- app/assets/stylesheets/jet_ui/dialog.css
|
|
522
540
|
- app/assets/stylesheets/jet_ui/divider.css
|
|
523
541
|
- app/assets/stylesheets/jet_ui/drawer.css
|
|
524
542
|
- app/assets/stylesheets/jet_ui/dropdown.css
|
|
@@ -560,6 +578,11 @@ files:
|
|
|
560
578
|
- app/components/jet_ui/card/subtitle_component.rb
|
|
561
579
|
- app/components/jet_ui/card/title_component.rb
|
|
562
580
|
- app/components/jet_ui/clipboard/component.rb
|
|
581
|
+
- app/components/jet_ui/dialog/body_component.rb
|
|
582
|
+
- app/components/jet_ui/dialog/component.rb
|
|
583
|
+
- app/components/jet_ui/dialog/footer_component.rb
|
|
584
|
+
- app/components/jet_ui/dialog/header_component.rb
|
|
585
|
+
- app/components/jet_ui/dialogs/component.rb
|
|
563
586
|
- app/components/jet_ui/divider/component.rb
|
|
564
587
|
- app/components/jet_ui/drawer/body_component.rb
|
|
565
588
|
- app/components/jet_ui/drawer/component.rb
|