irelia 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -10
- data/Rakefile +18 -4
- data/app/assets/config/irelia_manifest.js +2 -2
- data/app/assets/dist/javascripts/irelia.js +1 -0
- data/app/assets/dist/stylesheets/irelia.css +1 -0
- data/app/assets/src/main.js +2 -0
- data/app/assets/src/main.pcss +245 -0
- data/app/components/index.js +7 -0
- data/app/components/index.pcss +38 -0
- data/app/components/irelia/app_shell/component.html.erb +18 -0
- data/app/components/irelia/app_shell/component.rb +14 -0
- data/app/components/irelia/app_shell/index.pcss +20 -0
- data/app/{frontend/components/page/header → components/irelia/app_shell}/preview.rb +1 -1
- data/app/components/irelia/app_shell/previews/default.html.erb +21 -0
- data/app/components/irelia/avatar/component.html.erb +3 -0
- data/app/components/irelia/avatar/component.rb +16 -0
- data/app/components/irelia/avatar/index.pcss +8 -0
- data/{lib/generators/view_component/templates/preview.rb.tt → app/components/irelia/avatar/preview.rb} +1 -1
- data/app/components/irelia/breadcrumbs/component.html.erb +12 -0
- data/app/components/irelia/breadcrumbs/component.rb +18 -0
- data/app/components/irelia/breadcrumbs/index.pcss +16 -0
- data/app/{frontend/components/page/container → components/irelia/breadcrumbs}/preview.rb +1 -1
- data/app/components/irelia/button/component.html.erb +27 -0
- data/app/components/irelia/button/component.rb +40 -0
- data/app/components/irelia/button/index.pcss +57 -0
- data/app/components/irelia/button/preview.rb +79 -0
- data/app/components/irelia/card/component.html.erb +5 -0
- data/app/components/irelia/card/component.rb +15 -0
- data/app/components/irelia/card/index.pcss +9 -0
- data/app/components/irelia/card/preview.rb +18 -0
- data/app/components/irelia/component.rb +55 -0
- data/app/components/irelia/component_preview.rb +7 -0
- data/app/components/irelia/container/component.rb +30 -0
- data/app/components/irelia/container/index.pcss +45 -0
- data/app/components/irelia/container/preview.rb +18 -0
- data/app/components/irelia/div/component.html.erb +3 -0
- data/app/components/irelia/div/component.rb +15 -0
- data/app/components/irelia/div/index.pcss +7 -0
- data/app/components/irelia/divider/component.html.erb +7 -0
- data/app/components/irelia/divider/component.rb +10 -0
- data/app/components/irelia/divider/index.pcss +15 -0
- data/app/components/irelia/dropdown/component.html.erb +17 -0
- data/app/components/irelia/dropdown/component.rb +52 -0
- data/app/components/irelia/dropdown/controller.js +14 -0
- data/app/components/irelia/dropdown/index.pcss +37 -0
- data/app/components/irelia/dropdown/preview.rb +42 -0
- data/app/components/irelia/dropdown/previews/direction_up.html.erb +10 -0
- data/app/components/irelia/empty_collection/component.html.erb +19 -0
- data/app/components/irelia/empty_collection/component.rb +15 -0
- data/app/components/irelia/empty_collection/index.pcss +23 -0
- data/app/components/irelia/empty_collection/preview.rb +9 -0
- data/app/components/irelia/flex/component.html.erb +3 -0
- data/app/components/irelia/flex/component.rb +21 -0
- data/app/components/irelia/flex/index.pcss +37 -0
- data/app/components/irelia/form/base/component.rb +51 -0
- data/app/components/irelia/form/base/index.pcss +7 -0
- data/app/components/irelia/form/email_field/component.html.erb +3 -0
- data/app/components/irelia/form/email_field/component.rb +10 -0
- data/app/components/irelia/form/email_field/index.pcss +7 -0
- data/app/{frontend/components/page/breadcrumbs → components/irelia/form/email_field}/preview.rb +1 -1
- data/app/components/irelia/form/email_field/previews/default.html.erb +3 -0
- data/app/components/irelia/form/group/component.html.erb +19 -0
- data/app/components/irelia/form/group/component.rb +26 -0
- data/app/components/irelia/form/group/index.pcss +32 -0
- data/app/components/irelia/form/password_field/component.html.erb +3 -0
- data/app/components/irelia/form/password_field/component.rb +10 -0
- data/app/components/irelia/form/password_field/index.pcss +7 -0
- data/app/components/irelia/form/password_field/preview.rb +9 -0
- data/app/components/irelia/form/password_field/previews/default.html.erb +3 -0
- data/app/components/irelia/form/select/component.html.erb +3 -0
- data/app/components/irelia/form/select/component.rb +18 -0
- data/app/components/irelia/form/select/index.pcss +7 -0
- data/app/components/irelia/form/select/preview.rb +9 -0
- data/app/components/irelia/form/select/previews/default.html.erb +3 -0
- data/app/components/irelia/form/text_field/component.html.erb +3 -0
- data/app/components/irelia/form/text_field/component.rb +10 -0
- data/app/components/irelia/form/text_field/index.pcss +7 -0
- data/app/components/irelia/form/text_field/preview.rb +9 -0
- data/app/components/irelia/form/text_field/previews/default.html.erb +3 -0
- data/app/components/irelia/html/component.html.erb +3 -0
- data/app/components/irelia/html/component.rb +10 -0
- data/app/components/irelia/html/index.pcss +16 -0
- data/app/components/irelia/html/preview.rb +9 -0
- data/app/components/irelia/icon/component.rb +18 -0
- data/app/components/irelia/icon/index.pcss +7 -0
- data/app/components/irelia/icon/preview.rb +10 -0
- data/app/components/irelia/icon/previews/font_awesome.html.erb +23 -0
- data/app/components/irelia/modal/component.html.erb +28 -0
- data/app/components/irelia/modal/component.rb +29 -0
- data/app/components/irelia/modal/controller.js +50 -0
- data/app/components/irelia/modal/index.pcss +41 -0
- data/app/{frontend/components/navbar/select_account → components/irelia/modal}/preview.rb +5 -2
- data/app/components/irelia/modal/previews/remote_content.html.erb +6 -0
- data/app/components/irelia/modal/previews/static_content.html.erb +4 -0
- data/app/components/irelia/navbar/brand/component.rb +25 -0
- data/app/components/irelia/navbar/brand/index.pcss +9 -0
- data/app/components/irelia/navbar/brand/preview.rb +10 -0
- data/app/components/irelia/navbar/component.html.erb +10 -0
- data/app/components/irelia/navbar/component.rb +20 -0
- data/app/components/irelia/navbar/index.pcss +13 -0
- data/app/components/irelia/navbar/navigation/component.html.erb +5 -0
- data/app/components/irelia/navbar/navigation/component.rb +15 -0
- data/app/components/irelia/navbar/navigation/index.pcss +9 -0
- data/app/components/irelia/navbar/navigation/link/component.html.erb +5 -0
- data/app/components/irelia/navbar/navigation/link/component.rb +18 -0
- data/app/components/irelia/navbar/navigation/link/index.pcss +13 -0
- data/app/components/irelia/navbar/navigation/link/preview.rb +10 -0
- data/app/components/irelia/navbar/navigation/preview.rb +15 -0
- data/app/components/irelia/navbar/preview.rb +17 -0
- data/app/components/irelia/navbar/previews/default.html.erb +19 -0
- data/app/components/irelia/navbar/previews/full_width.html.erb +19 -0
- data/app/components/irelia/navbar/previews/navigation_right.html.erb +19 -0
- data/app/components/irelia/navbar/section/component.html.erb +3 -0
- data/app/components/irelia/navbar/section/component.rb +13 -0
- data/app/components/irelia/navbar/section/index.pcss +8 -0
- data/app/components/irelia/navbar/separator/component.rb +14 -0
- data/app/components/irelia/navbar/separator/index.pcss +8 -0
- data/app/components/irelia/navigation/component.html.erb +7 -0
- data/app/components/irelia/navigation/component.rb +23 -0
- data/app/components/irelia/navigation/index.pcss +7 -0
- data/app/components/irelia/navigation/preview.rb +14 -0
- data/app/components/irelia/notification/component.html.erb +9 -0
- data/app/components/irelia/notification/component.rb +27 -0
- data/app/components/irelia/notification/index.pcss +41 -0
- data/app/components/irelia/notification/preview.rb +22 -0
- data/app/components/irelia/page_header/component.html.erb +15 -0
- data/app/components/irelia/page_header/component.rb +17 -0
- data/app/components/irelia/page_header/index.pcss +36 -0
- data/app/components/irelia/page_header/preview.rb +13 -0
- data/app/components/irelia/sidebar/brand/component.html.erb +6 -0
- data/app/components/irelia/sidebar/brand/component.rb +19 -0
- data/app/components/irelia/sidebar/brand/index.pcss +13 -0
- data/app/components/irelia/sidebar/brand/preview.rb +10 -0
- data/app/components/irelia/sidebar/component.html.erb +8 -0
- data/app/components/irelia/sidebar/component.rb +16 -0
- data/app/components/irelia/sidebar/index.pcss +12 -0
- data/app/components/irelia/sidebar/navigation/component.html.erb +5 -0
- data/app/components/irelia/sidebar/navigation/component.rb +12 -0
- data/app/components/irelia/sidebar/navigation/index.pcss +8 -0
- data/app/components/irelia/sidebar/navigation/link/component.html.erb +10 -0
- data/app/components/irelia/sidebar/navigation/link/component.rb +26 -0
- data/app/components/irelia/sidebar/navigation/link/index.pcss +20 -0
- data/app/components/irelia/sidebar/navigation/link/preview.rb +14 -0
- data/app/components/irelia/sidebar/navigation/preview.rb +16 -0
- data/app/components/irelia/sidebar/preview.rb +9 -0
- data/app/components/irelia/sidebar/previews/default.html.erb +12 -0
- data/app/components/irelia/sidebar/section/component.html.erb +3 -0
- data/app/components/irelia/sidebar/section/component.rb +16 -0
- data/app/components/irelia/sidebar/section/index.pcss +11 -0
- data/app/components/irelia/split_screen/component.html.erb +8 -0
- data/app/components/irelia/split_screen/component.rb +18 -0
- data/app/components/irelia/split_screen/index.pcss +35 -0
- data/app/components/irelia/split_screen/preview.rb +12 -0
- data/app/components/irelia/stack/component.html.erb +3 -0
- data/app/components/irelia/stack/component.rb +21 -0
- data/app/components/irelia/stack/index.pcss +25 -0
- data/app/components/irelia/stack/preview.rb +47 -0
- data/app/components/irelia/stack/previews/default.html.erb +5 -0
- data/app/components/irelia/stack/previews/horizontal.html.erb +5 -0
- data/app/components/irelia/stack/previews/vertical.html.erb +5 -0
- data/app/components/irelia/table/component.html.erb +23 -0
- data/app/components/irelia/table/component.rb +31 -0
- data/app/components/irelia/table/index.pcss +32 -0
- data/app/components/irelia/table/preview.rb +9 -0
- data/app/components/irelia/table/previews/default.html.erb +19 -0
- data/app/components/irelia/table/row/component.html.erb +5 -0
- data/app/components/irelia/table/row/component.rb +34 -0
- data/app/components/irelia/table/row/index.pcss +7 -0
- data/app/helpers/irelia/components_helper.rb +62 -0
- data/app/helpers/irelia/form_helper.rb +9 -0
- data/app/helpers/irelia/head_helper.rb +7 -0
- data/app/views/irelia/_head.html.erb +25 -0
- data/lib/irelia/config.rb +18 -0
- data/lib/irelia/engine.rb +13 -11
- data/lib/irelia/form_builder.rb +48 -0
- data/lib/irelia/options/fixed.rb +26 -0
- data/lib/irelia/options/flex/direction.rb +22 -0
- data/lib/irelia/options/flex/gap.rb +25 -0
- data/lib/irelia/options/flex/grow.rb +21 -0
- data/lib/irelia/options/flex/items.rb +25 -0
- data/lib/irelia/options/flex/justify.rb +27 -0
- data/lib/irelia/options/padding.rb +46 -0
- data/lib/irelia/options/text_formatting.rb +30 -0
- data/lib/irelia/options/width.rb +19 -0
- data/lib/irelia/version.rb +1 -1
- data/lib/irelia.rb +20 -24
- metadata +199 -168
- data/app/frontend/components/application_view_component.rb +0 -5
- data/app/frontend/components/application_view_component_preview.rb +0 -5
- data/app/frontend/components/navbar/button/component.html.erb +0 -8
- data/app/frontend/components/navbar/button/component.rb +0 -13
- data/app/frontend/components/navbar/button/preview.rb +0 -12
- data/app/frontend/components/navbar/container/component.html.erb +0 -5
- data/app/frontend/components/navbar/container/component.rb +0 -8
- data/app/frontend/components/navbar/container/preview.rb +0 -12
- data/app/frontend/components/navbar/dark_mode_switcher/component.html.erb +0 -4
- data/app/frontend/components/navbar/dark_mode_switcher/component.rb +0 -8
- data/app/frontend/components/navbar/dark_mode_switcher/preview.rb +0 -12
- data/app/frontend/components/navbar/menu_items/component.html.erb +0 -3
- data/app/frontend/components/navbar/menu_items/component.rb +0 -8
- data/app/frontend/components/navbar/menu_items/preview.rb +0 -12
- data/app/frontend/components/navbar/navlink/component.html.erb +0 -8
- data/app/frontend/components/navbar/navlink/component.rb +0 -13
- data/app/frontend/components/navbar/navlink/preview.rb +0 -12
- data/app/frontend/components/navbar/right_section/component.html.erb +0 -3
- data/app/frontend/components/navbar/right_section/component.rb +0 -8
- data/app/frontend/components/navbar/right_section/preview.rb +0 -12
- data/app/frontend/components/navbar/select_account/component.html.erb +0 -36
- data/app/frontend/components/navbar/select_account/component.rb +0 -6
- data/app/frontend/components/navbar/separator/component.html.erb +0 -1
- data/app/frontend/components/navbar/separator/component.rb +0 -7
- data/app/frontend/components/navbar/separator/preview.rb +0 -12
- data/app/frontend/components/page/breadcrumbs/component.html.erb +0 -16
- data/app/frontend/components/page/breadcrumbs/component.rb +0 -6
- data/app/frontend/components/page/container/component.html.erb +0 -3
- data/app/frontend/components/page/container/component.rb +0 -4
- data/app/frontend/components/page/header/component.html.erb +0 -12
- data/app/frontend/components/page/header/component.rb +0 -6
- data/app/helpers/navbar_helper.rb +0 -35
- data/app/helpers/page_helper.rb +0 -15
- data/app/javascript/controllers/dark_mode_switcher_controller.js +0 -20
- data/app/javascript/controllers/dropdown_controller.js +0 -3
- data/app/views/devise/registrations/new.html.erb +0 -21
- data/app/views/devise/sessions/new.html.erb +0 -18
- data/app/views/layouts/application.html.erb +0 -11
- data/app/views/layouts/devise.html.erb +0 -23
- data/app/views/layouts/mailer.html.erb +0 -13
- data/app/views/layouts/mailer.text.erb +0 -1
- data/app/views/layouts/teamable.html.erb +0 -31
- data/app/views/shared/_head.html.erb +0 -26
- data/app/views/shared/_navbar.html.erb +0 -30
- data/app/views/shared/_navbar_logo.html.erb +0 -3
- data/app/views/teamable/accounts/new.html.erb +0 -10
- data/app/views/teamable/setup/new.html.erb +0 -8
- data/app/views/teamable/shared/_form.html.erb +0 -4
- data/config/importmap.rb +0 -7
- data/config/initializers/devise.rb +0 -313
- data/config/initializers/simple_form.rb +0 -148
- data/config/initializers/view_component.rb +0 -18
- data/lib/generators/irelia/install_generator.rb +0 -19
- data/lib/generators/templates/irelia.rb +0 -14
- data/lib/generators/view_component/USAGE +0 -15
- data/lib/generators/view_component/templates/component.html.erb.tt +0 -1
- data/lib/generators/view_component/templates/component.rb.tt +0 -8
- data/lib/generators/view_component/templates/component_system_test.rb.tt +0 -13
- data/lib/generators/view_component/templates/component_test.rb.tt +0 -19
- data/lib/generators/view_component/view_component_generator.rb +0 -53
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Dropdown::Preview < Irelia::ComponentPreview
|
4
|
+
# You can specify the container class for the default template
|
5
|
+
# self.container_class = "w-1/2 border border-gray-300"
|
6
|
+
|
7
|
+
def default
|
8
|
+
irelia_dropdown(open: true) do |dropdown|
|
9
|
+
dropdown.with_trigger(size: :sm, icon: "fas fa-gear")
|
10
|
+
dropdown.with_item { "Profile" }
|
11
|
+
dropdown.with_item { "Settings" }
|
12
|
+
dropdown.with_item { "Switch account" }
|
13
|
+
dropdown.with_item { "Sign out" }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# @label Icons on left
|
18
|
+
def icons_left
|
19
|
+
irelia_dropdown(open: true) do |dropdown|
|
20
|
+
dropdown.with_trigger(size: :sm, icon: "fas fa-gear")
|
21
|
+
dropdown.with_item(icon: "fas fa-user") { "Profile" }
|
22
|
+
dropdown.with_item(icon: "fas fa-gear") { "Settings" }
|
23
|
+
dropdown.with_item(icon: "fas fa-users") { "Switch account" }
|
24
|
+
dropdown.with_item(icon: "fas fa-right-from-bracket") { "Sign out" }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# @label Icons on right
|
29
|
+
def icons_right
|
30
|
+
irelia_dropdown(open: true) do |dropdown|
|
31
|
+
dropdown.with_trigger(size: :sm, icon: "fas fa-gear")
|
32
|
+
dropdown.with_item(right_icon: "fas fa-user") { "Profile" }
|
33
|
+
dropdown.with_item(right_icon: "fas fa-gear") { "Settings" }
|
34
|
+
dropdown.with_item(right_icon: "fas fa-users") { "Switch account" }
|
35
|
+
dropdown.with_item(right_icon: "fas fa-right-from-bracket") { "Sign out" }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# @label Direction up
|
40
|
+
def direction_up
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<div style="margin-top: 120px">
|
2
|
+
<%= irelia_dropdown(open: true, direction: :up) do |dropdown|
|
3
|
+
dropdown.with_trigger(size: :sm, icon: "fas fa-gear")
|
4
|
+
dropdown.with_item(right_icon: "fas fa-user") { "Profile" }
|
5
|
+
dropdown.with_item(right_icon: "fas fa-gear") { "Settings" }
|
6
|
+
dropdown.with_item(right_icon: "fas fa-users") { "Switch account" }
|
7
|
+
dropdown.with_item(right_icon: "fas fa-right-from-bracket") { "Sign out" }
|
8
|
+
end
|
9
|
+
%>
|
10
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= render(Irelia::Card::Component.new(padding: false)) do |card| %>
|
2
|
+
<%= content_tag :div, html_options do %>
|
3
|
+
<div class="irelia-empty-collection--content">
|
4
|
+
<h1><%= title %></h1>
|
5
|
+
<p><%= description %></p>
|
6
|
+
<% if buttons %>
|
7
|
+
<%= render(Irelia::Flex::Component.new(direction: :row, gap: :small, padding_top: :md)) do |flex| %>
|
8
|
+
<% buttons.each do |button| %>
|
9
|
+
<%= button %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
14
|
+
<div class="irelia-empty-collection--image-container">
|
15
|
+
<img width="200" height="200" src="https://rankzon.com/assets/undraw/rocket_launch-87eb4798f5e680120a6fe78d908e9df35bf6cc2e0282f35b258ec03a48f159b2.svg">
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::EmptyCollection::Component < Irelia::Component
|
4
|
+
option :title, default: -> { nil }
|
5
|
+
option :description, default: -> { nil }
|
6
|
+
|
7
|
+
renders_many :buttons, Irelia::Button::Component
|
8
|
+
|
9
|
+
def variants
|
10
|
+
class_names(
|
11
|
+
"irelia-empty-collection",
|
12
|
+
"irelia-empty-collection--default": variant == :default
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@layer components {
|
2
|
+
.irelia-empty-collection {
|
3
|
+
@apply flex py-10 px-12 gap-32;
|
4
|
+
}
|
5
|
+
|
6
|
+
.irelia-empty-collection--content {
|
7
|
+
@apply flex flex-col w-2/3 justify-center gap-y-5;
|
8
|
+
h1 {
|
9
|
+
@apply text-2xl font-bold text-irelia-primary;
|
10
|
+
}
|
11
|
+
p {
|
12
|
+
@apply text-base;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
|
16
|
+
.irelia-empty-collection--image-container {
|
17
|
+
@apply flex flex-shrink text-center items-center justify-center w-1/3;
|
18
|
+
}
|
19
|
+
|
20
|
+
.irelia-empty-collection--actions {
|
21
|
+
@apply flex gap-x-2;
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Flex::Component < Irelia::Component
|
4
|
+
include Irelia::Options::Padding
|
5
|
+
include Irelia::Options::TextFormatting
|
6
|
+
include Irelia::Options::Width
|
7
|
+
include Irelia::Options::Fixed
|
8
|
+
|
9
|
+
include Irelia::Options::Flex::Justify
|
10
|
+
include Irelia::Options::Flex::Direction
|
11
|
+
include Irelia::Options::Flex::Gap
|
12
|
+
include Irelia::Options::Flex::Grow
|
13
|
+
include Irelia::Options::Flex::Items
|
14
|
+
|
15
|
+
def variants
|
16
|
+
class_names(
|
17
|
+
"irelia-flex",
|
18
|
+
"irelia-flex--default": variant == :default,
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
@layer components {
|
2
|
+
.irelia-flex {
|
3
|
+
@apply flex;
|
4
|
+
}
|
5
|
+
|
6
|
+
.irelia-flex--row {
|
7
|
+
@apply flex-row;
|
8
|
+
}
|
9
|
+
|
10
|
+
.irelia-flex--column {
|
11
|
+
@apply flex-col;
|
12
|
+
}
|
13
|
+
|
14
|
+
.irelia-flex--default {
|
15
|
+
@apply gap-5;
|
16
|
+
}
|
17
|
+
|
18
|
+
.irelia-flex--gap-none {
|
19
|
+
@apply gap-0;
|
20
|
+
}
|
21
|
+
|
22
|
+
.irelia-flex--gap-xs {
|
23
|
+
@apply gap-1.5;
|
24
|
+
}
|
25
|
+
|
26
|
+
.irelia-flex--gap-sm {
|
27
|
+
@apply gap-2.5;
|
28
|
+
}
|
29
|
+
|
30
|
+
.irelia-flex--gap-md {
|
31
|
+
@apply gap-5;
|
32
|
+
}
|
33
|
+
|
34
|
+
.irelia-flex--gap-lg {
|
35
|
+
@apply gap-10;
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Form::Base::Component < Irelia::Component
|
4
|
+
option :object, required: true
|
5
|
+
option :object_name, required: true
|
6
|
+
option :method, required: true
|
7
|
+
option :options, default: -> { {} }, required: false
|
8
|
+
|
9
|
+
def label_text
|
10
|
+
options[:label] || object&.class&.human_attribute_name(method)
|
11
|
+
end
|
12
|
+
|
13
|
+
def hint_text
|
14
|
+
options[:hint]
|
15
|
+
end
|
16
|
+
|
17
|
+
def input_options
|
18
|
+
html_options.merge(
|
19
|
+
value: value,
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def value
|
24
|
+
object&.send(method)
|
25
|
+
end
|
26
|
+
|
27
|
+
def group_component
|
28
|
+
Irelia::Form::Group::Component.new(
|
29
|
+
object: object,
|
30
|
+
object_name: object_name,
|
31
|
+
method: method,
|
32
|
+
options: options
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def errors
|
37
|
+
object ? object.errors[method] : []
|
38
|
+
end
|
39
|
+
|
40
|
+
def error_messages
|
41
|
+
errors&.join(", ")
|
42
|
+
end
|
43
|
+
|
44
|
+
def has_errors?
|
45
|
+
errors&.any?
|
46
|
+
end
|
47
|
+
|
48
|
+
def has_hint?
|
49
|
+
hint_text.present?
|
50
|
+
end
|
51
|
+
end
|
data/app/{frontend/components/page/breadcrumbs → components/irelia/form/email_field}/preview.rb
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class
|
3
|
+
class Irelia::Form::EmailField::Preview < Irelia::ComponentPreview
|
4
4
|
# You can specify the container class for the default template
|
5
5
|
# self.container_class = "w-1/2 border border-gray-300"
|
6
6
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= content_tag :div, group_options do %>
|
2
|
+
<% if label_text %>
|
3
|
+
<label for="<%= field_id(object_name, method) %>"><%= label_text %></label>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= content %>
|
7
|
+
|
8
|
+
<% if has_hint? %>
|
9
|
+
<div class="irelia-group__hint">
|
10
|
+
<%= hint_text %>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if has_errors? %>
|
15
|
+
<div class="irelia-group__errors">
|
16
|
+
<%= error_messages %>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Form::Group::Component < Irelia::Form::Base::Component
|
4
|
+
def initialize(**options)
|
5
|
+
super
|
6
|
+
|
7
|
+
add_css_classes "irelia-form__group--invalid" if errors.present?
|
8
|
+
end
|
9
|
+
|
10
|
+
def group_options
|
11
|
+
html_options.merge(
|
12
|
+
id: group_id
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def group_id
|
17
|
+
"#{object_name}_#{method}_group"
|
18
|
+
end
|
19
|
+
|
20
|
+
def variants
|
21
|
+
class_names(
|
22
|
+
"irelia-form__group",
|
23
|
+
"irelia-form__group--default": variant == :default
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
@layer components {
|
2
|
+
.irelia-form__group {
|
3
|
+
@apply flex flex-col shadow-sm bg-white rounded p-5 relative w-full gap-y-1.5 text-left;
|
4
|
+
|
5
|
+
label {
|
6
|
+
@apply font-bold uppercase text-sm text-irelia-primary whitespace-nowrap;
|
7
|
+
}
|
8
|
+
|
9
|
+
&.irelia-form__group--invalid {
|
10
|
+
label {
|
11
|
+
@apply text-irelia-danger;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
input:not([type="checkbox"]),
|
16
|
+
textarea,
|
17
|
+
select {
|
18
|
+
@apply appearance-none p-0 m-0 w-full border-0 focus:ring-0 focus:outline-none bg-white hover:text-irelia-primary focus:text-irelia-primary placeholder-neutral-400;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
.irelia-group__errors {
|
23
|
+
@apply text-irelia-danger text-sm -mb-1.5;
|
24
|
+
}
|
25
|
+
|
26
|
+
.irelia-group__hint {
|
27
|
+
@apply text-neutral-500 text-xs mt-1.5;
|
28
|
+
}
|
29
|
+
|
30
|
+
.irelia-form__group--default {
|
31
|
+
}
|
32
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Form::Select::Component < Irelia::Form::Base::Component
|
4
|
+
option :choices, required: false, default: -> { nil }
|
5
|
+
|
6
|
+
def options
|
7
|
+
@options.merge({
|
8
|
+
selected: value
|
9
|
+
})
|
10
|
+
end
|
11
|
+
|
12
|
+
def variants
|
13
|
+
class_names(
|
14
|
+
"irelia-form__select",
|
15
|
+
"irelia-form__select--default": variant == :default
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Icon::Component < Irelia::Component
|
4
|
+
option :icon_class, optional: true
|
5
|
+
|
6
|
+
def variants
|
7
|
+
class_names(
|
8
|
+
"irelia-icon",
|
9
|
+
"irelia-icon--default": variant == :default
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
content_tag(:span, html_options) do
|
15
|
+
content_tag(:i, nil, class: (icon_class || content))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= irelia_stack do %>
|
2
|
+
<%= irelia_stack direction: :vertical, items: :center do %>
|
3
|
+
<%= irelia_icon { "fas fa-home" } %>
|
4
|
+
<span>fas fa-home</span>
|
5
|
+
<% end %>
|
6
|
+
<%= irelia_stack direction: :vertical, items: :center do %>
|
7
|
+
<%= irelia_icon { "fas fa-user" } %>
|
8
|
+
<span>fas fa-user</span>
|
9
|
+
<% end %>
|
10
|
+
<%= irelia_stack direction: :vertical, items: :center do %>
|
11
|
+
<%= irelia_icon { "fab fa-github" } %>
|
12
|
+
<span>fab fa-github</span>
|
13
|
+
<% end %>
|
14
|
+
<%= irelia_stack direction: :vertical, items: :center do %>
|
15
|
+
<%= irelia_icon { "fab fa-facebook" } %>
|
16
|
+
<span>fab fa-facebook</span>
|
17
|
+
<% end %>
|
18
|
+
<!-- Add more icons as needed -->
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<br>
|
22
|
+
<strong>For full icon list, check:</strong><br>
|
23
|
+
<a href="https://fontawesome.com/search?o=r&m=free" target="_blank">https://fontawesome.com/search</a>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<div data-controller="irelia-modal">
|
2
|
+
<div class="irelia-modal__container hidden"
|
3
|
+
data-irelia-modal-target="container"
|
4
|
+
data-action="keyup@window->irelia-modal#closeWithKeyboard"
|
5
|
+
>
|
6
|
+
<div class="irelia-modal__background" data-action="click->irelia-modal#close" data-irelia-modal-target="background"></div>
|
7
|
+
<%= content_tag :div, html_options do %>
|
8
|
+
<div class="irelia-modal__header">
|
9
|
+
<% if title %>
|
10
|
+
<h3><%= title %></h3>
|
11
|
+
<% end %>
|
12
|
+
<button class="irelia-modal__close-button" data-action="click->irelia-modal#close">
|
13
|
+
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>
|
14
|
+
</button>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="irelia-modal__content">
|
18
|
+
<% if content %>
|
19
|
+
<%= content %>
|
20
|
+
<% else %>
|
21
|
+
<div data-irelia-modal-target="loader">Loading</div>
|
22
|
+
<turbo-frame id="<%= @name %>" data-irelia-modal-target="frame" src="" target="_top"></turbo-frame>
|
23
|
+
<% end %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
<%= button %>
|
28
|
+
</div>
|