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,12 @@
|
|
1
|
+
<%= content_tag :div, html_options do %>
|
2
|
+
<nav class="flex justify-between">
|
3
|
+
<ol class="inline-flex items-center mb-3 space-x-1 [&_.active-breadcrumb]:text-neutral-600 [&_.active-breadcrumb]:font-medium sm:mb-0">
|
4
|
+
<% breadcrumbs.each_with_index do |crumb, index| %>
|
5
|
+
<li>
|
6
|
+
<%= link_to crumb.name, crumb.path %>
|
7
|
+
</li>
|
8
|
+
<%= helpers.irelia_icon { "fa fa-chevron-right" } unless index == last_index %>
|
9
|
+
<% end %>
|
10
|
+
</ol>
|
11
|
+
</nav>
|
12
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Breadcrumbs::Component < Irelia::Component
|
4
|
+
option :breadcrumbs, default: -> { [] }
|
5
|
+
|
6
|
+
def variants
|
7
|
+
class_names(
|
8
|
+
"irelia-breadcrumbs",
|
9
|
+
"irelia-breadcrumbs--default": variant == :default
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def last_index
|
16
|
+
breadcrumbs.count - 1
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
@layer components {
|
2
|
+
.irelia-breadcrumbs {
|
3
|
+
@apply flex gap-y-1.5 flex-col justify-center text-sm;
|
4
|
+
|
5
|
+
li {
|
6
|
+
@apply flex items-center h-full;
|
7
|
+
}
|
8
|
+
|
9
|
+
.irelia-icon svg.fa-chevron-right {
|
10
|
+
@apply text-xs px-2 text-gray-400;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
.irelia-breadcrumbs--default {
|
15
|
+
}
|
16
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class
|
3
|
+
class Irelia::Breadcrumbs::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,27 @@
|
|
1
|
+
<% content_html = capture do %>
|
2
|
+
<% if icon %>
|
3
|
+
<span class="irelia-button__icon">
|
4
|
+
<%= helpers.irelia_icon icon_class: icon %>
|
5
|
+
</span>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% if content %>
|
9
|
+
<span class="irelia-button__content">
|
10
|
+
<span class="irelia-button__text"><%= content %></span>
|
11
|
+
</span>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% if right_icon %>
|
15
|
+
<span class="irelia-button__icon">
|
16
|
+
<%= helpers.irelia_icon icon_class: right_icon %>
|
17
|
+
</span>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<% if skip_tag %>
|
22
|
+
<%= content_html %>
|
23
|
+
<% else %>
|
24
|
+
<%= content_tag @tag, html_options do %>
|
25
|
+
<%= content_html %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Button::Component < Irelia::Component
|
4
|
+
include Irelia::Options::Width
|
5
|
+
|
6
|
+
option :url, default: -> { nil }
|
7
|
+
option :type, default: -> { :button }, in: [ :button, :submit, :reset ]
|
8
|
+
option :size, default: -> { :md }, in: [ :xs, :sm, :md, :lg, :xl ]
|
9
|
+
option :color, default: proc { :primary }, in: %i[primary secondary danger]
|
10
|
+
option :skip_tag, default: false, optional: true
|
11
|
+
option :modal, optional: true
|
12
|
+
|
13
|
+
option :icon, optional: true
|
14
|
+
option :right_icon, optional: true
|
15
|
+
|
16
|
+
def variants
|
17
|
+
class_names(
|
18
|
+
"irelia-button",
|
19
|
+
"irelia-button--default": variant == :default,
|
20
|
+
"irelia-button--dropdown-item": variant == :dropdown_item,
|
21
|
+
"irelia-button--color-primary": color == :primary,
|
22
|
+
"irelia-button--color-secondary": color == :secondary,
|
23
|
+
"irelia-button--color-danger": color == :danger,
|
24
|
+
"irelia-button--xs": size == :xs,
|
25
|
+
"irelia-button--sm": size == :sm,
|
26
|
+
"irelia-button--md": size == :md,
|
27
|
+
"irelia-button--lg": size == :lg,
|
28
|
+
"irelia-button--xl": size == :xl
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(**options)
|
33
|
+
super
|
34
|
+
|
35
|
+
@tag = @url.present? ? :a : :button
|
36
|
+
@html_options[:href] = @url if @url.present?
|
37
|
+
@html_options[:type] = @type
|
38
|
+
@html_options["data-turbo-frame"] = @modal if @modal.present?
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
@layer components {
|
2
|
+
.irelia-button {
|
3
|
+
@apply inline-flex justify-center items-center cursor-pointer rounded no-underline transition text-nowrap;
|
4
|
+
}
|
5
|
+
|
6
|
+
.irelia-button--default {
|
7
|
+
@apply font-bold w-min;
|
8
|
+
|
9
|
+
&.irelia-button--color-primary {
|
10
|
+
@apply bg-irelia-primary hover:bg-irelia-primary-hover text-white;
|
11
|
+
}
|
12
|
+
|
13
|
+
&.irelia-button--color-secondary {
|
14
|
+
@apply bg-irelia-gray hover:bg-irelia-gray-hover text-irelia-primary;
|
15
|
+
}
|
16
|
+
|
17
|
+
&.irelia-button--color-danger {
|
18
|
+
@apply bg-irelia-danger hover:bg-irelia-danger-hover text-white;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
.irelia-button--xs {
|
23
|
+
@apply px-3 py-1 gap-x-1.5 text-xs; /* Reduced padding for XS */
|
24
|
+
}
|
25
|
+
|
26
|
+
.irelia-button--sm {
|
27
|
+
@apply px-4 py-1.5 gap-x-2 text-sm; /* Adjusted padding for SM */
|
28
|
+
}
|
29
|
+
|
30
|
+
.irelia-button--md {
|
31
|
+
@apply px-5 py-2 gap-x-2.5 text-base; /* Slightly reduced padding for MD */
|
32
|
+
}
|
33
|
+
|
34
|
+
.irelia-button--lg {
|
35
|
+
@apply px-7 py-2.5 gap-x-3.5 text-lg; /* Reduced padding for LG */
|
36
|
+
}
|
37
|
+
|
38
|
+
.irelia-button--xl {
|
39
|
+
@apply px-10 py-4 gap-x-4 text-xl; /* Adjusted padding for XL */
|
40
|
+
}
|
41
|
+
|
42
|
+
.irelia-button--dropdown-item {
|
43
|
+
@apply relative flex justify-start w-full select-none items-center rounded px-2 py-1.5 hover:bg-neutral-100 hover:text-neutral-900 outline-none;
|
44
|
+
|
45
|
+
.irelia-button__content {
|
46
|
+
@apply pr-4;
|
47
|
+
}
|
48
|
+
|
49
|
+
.irelia-button__icon {
|
50
|
+
@apply w-[15px] text-center opacity-35;
|
51
|
+
}
|
52
|
+
|
53
|
+
.irelia-button__content + .irelia-button__icon {
|
54
|
+
@apply ml-auto;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Button::Preview < Irelia::ComponentPreview
|
4
|
+
# @label Default
|
5
|
+
# @param color select { choices: [primary, secondary, danger] } "Button theme color"
|
6
|
+
# @param size select { choices: [xs, sm, md, lg, xl] } "Size of the button"
|
7
|
+
def default(color: :primary, size: :md)
|
8
|
+
irelia_button(color:, size:) { "Default button" }
|
9
|
+
end
|
10
|
+
|
11
|
+
# @!group Colors
|
12
|
+
|
13
|
+
# @label Primary button (default)
|
14
|
+
def primary_color
|
15
|
+
irelia_button { "Button" }
|
16
|
+
end
|
17
|
+
|
18
|
+
# @label Secondary button
|
19
|
+
def secondary_color
|
20
|
+
irelia_button(color: :secondary) { "Button" }
|
21
|
+
end
|
22
|
+
|
23
|
+
# @label Danger button
|
24
|
+
def danger_color
|
25
|
+
irelia_button(color: :danger) { "Button" }
|
26
|
+
end
|
27
|
+
|
28
|
+
# @!endgroup
|
29
|
+
|
30
|
+
# @!group Sizes
|
31
|
+
|
32
|
+
# @label Extra small
|
33
|
+
def sizes_xs
|
34
|
+
irelia_button(size: :xs) { "Button" }
|
35
|
+
end
|
36
|
+
|
37
|
+
# @label Small
|
38
|
+
def sm_size
|
39
|
+
irelia_button(size: :sm) { "Button" }
|
40
|
+
end
|
41
|
+
|
42
|
+
# @label Medium (default)
|
43
|
+
def default_size
|
44
|
+
irelia_button(size: :md) { "Button" }
|
45
|
+
end
|
46
|
+
|
47
|
+
# @label Large
|
48
|
+
def lg_size
|
49
|
+
irelia_button(size: :lg) { "Large button" }
|
50
|
+
end
|
51
|
+
|
52
|
+
# @label Extra large
|
53
|
+
def xl_size
|
54
|
+
irelia_button(size: :xl) { "Extra large button" }
|
55
|
+
end
|
56
|
+
|
57
|
+
# @!endgroup
|
58
|
+
|
59
|
+
# @label Icon + text
|
60
|
+
def with_icon
|
61
|
+
irelia_button(icon: "fas fa-home", size: :md) { "Button with icon" }
|
62
|
+
end
|
63
|
+
|
64
|
+
# @label Text + icon
|
65
|
+
def with_right_icon
|
66
|
+
irelia_button(right_icon: "fas fa-arrow-right", size: :md) { "Button with icon" }
|
67
|
+
end
|
68
|
+
|
69
|
+
# @label Only icon
|
70
|
+
def only_icon
|
71
|
+
irelia_button(icon: "fas fa-save", size: :md)
|
72
|
+
end
|
73
|
+
|
74
|
+
# @label Link
|
75
|
+
# Pass a URL to the button to render an anchor tag instead of a button.
|
76
|
+
def link(color: :default, size: :md)
|
77
|
+
irelia_button(url: "#") { "Link button" }
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Card::Component < Irelia::Component
|
4
|
+
include Irelia::Options::Width
|
5
|
+
|
6
|
+
option :padding, default: -> { true }, optional: true
|
7
|
+
|
8
|
+
def variants
|
9
|
+
class_names(
|
10
|
+
"irelia-card",
|
11
|
+
"irelia-card--default": variant == :default,
|
12
|
+
"irelia-card--no-padding": padding == false
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Card::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_card do
|
9
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales fermentum tristique."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def no_padding
|
14
|
+
irelia_card(padding: false) do
|
15
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sodales fermentum tristique."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Irelia
|
2
|
+
class Component < ViewComponentContrib::Base
|
3
|
+
extend Dry::Initializer
|
4
|
+
|
5
|
+
option :html_options, default: proc { {} }
|
6
|
+
option :variant, default: proc { :default }
|
7
|
+
|
8
|
+
def initialize(**options)
|
9
|
+
super
|
10
|
+
|
11
|
+
@component_classes = +""
|
12
|
+
add_css_classes(variants)
|
13
|
+
self.class.run_after_initialize_hooks(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
def html_options
|
17
|
+
# Merge the component classes with the classes from the html_options.
|
18
|
+
@html_options.merge({ class: "#{@component_classes} #{@html_options[:class]}".strip })
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_css_classes(css_class)
|
22
|
+
@component_classes += " #{css_class}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def variants
|
26
|
+
end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def after_initialize(method_name = nil, &block)
|
30
|
+
@after_initialize_hooks ||= []
|
31
|
+
if method_name
|
32
|
+
@after_initialize_hooks << method_name
|
33
|
+
elsif block_given?
|
34
|
+
@after_initialize_hooks << block
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_after_initialize_hooks(instance)
|
39
|
+
return unless @after_initialize_hooks
|
40
|
+
@after_initialize_hooks.each do |hook|
|
41
|
+
if hook.is_a?(Symbol)
|
42
|
+
instance.send(hook)
|
43
|
+
elsif hook.is_a?(Proc)
|
44
|
+
instance.instance_eval(&hook)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def inherited(subclass)
|
50
|
+
super
|
51
|
+
subclass.instance_variable_set(:@after_initialize_hooks, @after_initialize_hooks.dup)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Container::Component < Irelia::Component
|
4
|
+
include Irelia::Options::Padding
|
5
|
+
|
6
|
+
option :center, default: -> { false }, in: %i[true false]
|
7
|
+
option :size, default: -> { :full_width }, in: %i[full_width xxs xs sm md lg xl]
|
8
|
+
|
9
|
+
def variants
|
10
|
+
class_names(
|
11
|
+
"irelia-container",
|
12
|
+
"irelia-container--default": variant == :default,
|
13
|
+
"irelia-container--size-full-width": size == :full_width,
|
14
|
+
"irelia-container--size-xxl": size == :xxl,
|
15
|
+
"irelia-container--size-xl": size == :xl,
|
16
|
+
"irelia-container--size-lg": size == :lg,
|
17
|
+
"irelia-container--size-md": size == :md,
|
18
|
+
"irelia-container--size-sm": size == :sm,
|
19
|
+
"irelia-container--size-xs": size == :xs,
|
20
|
+
"irelia-container--size-xxs": size == :xxs,
|
21
|
+
"irelia-container--center": center == true
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def call
|
26
|
+
content_tag :div, html_options do
|
27
|
+
content
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
@layer components {
|
2
|
+
.irelia-container {
|
3
|
+
@apply px-10 m-0;
|
4
|
+
|
5
|
+
&.irelia-container--center {
|
6
|
+
@apply mx-auto;
|
7
|
+
}
|
8
|
+
}
|
9
|
+
|
10
|
+
.irelia-app-shell .irelia-container {
|
11
|
+
@apply px-0;
|
12
|
+
}
|
13
|
+
|
14
|
+
.irelia-container--size-full-width {
|
15
|
+
@apply w-[100%];
|
16
|
+
}
|
17
|
+
|
18
|
+
.irelia-container--size-xxl {
|
19
|
+
@apply max-w-[1536px];
|
20
|
+
}
|
21
|
+
|
22
|
+
.irelia-container--size-xl {
|
23
|
+
@apply max-w-[1280px];
|
24
|
+
}
|
25
|
+
|
26
|
+
.irelia-container--size-lg {
|
27
|
+
@apply max-w-[1024px];
|
28
|
+
}
|
29
|
+
|
30
|
+
.irelia-container--size-md {
|
31
|
+
@apply max-w-[768px];
|
32
|
+
}
|
33
|
+
|
34
|
+
.irelia-container--size-sm {
|
35
|
+
@apply max-w-[640px];
|
36
|
+
}
|
37
|
+
|
38
|
+
.irelia-container--size-xs {
|
39
|
+
@apply max-w-[448px];
|
40
|
+
}
|
41
|
+
|
42
|
+
.irelia-container--size-xxs {
|
43
|
+
@apply max-w-[320px];
|
44
|
+
}
|
45
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Container::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_container size: :lg do
|
9
|
+
"The container class sets the max-width of an element to match the min-width of the current breakpoint. This is useful if you’d prefer to design for a fixed set of screen sizes instead of trying to accommodate a fully fluid viewport."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def centered
|
14
|
+
irelia_container size: :lg, center: true do
|
15
|
+
"The container class sets the max-width of an element to match the min-width of the current breakpoint. This is useful if you’d prefer to design for a fixed set of screen sizes instead of trying to accommodate a fully fluid viewport."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Div::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
|
+
def variants
|
10
|
+
class_names(
|
11
|
+
"irelia-div",
|
12
|
+
"irelia-div--default": variant == :default
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= content_tag :span, html_options.merge({"data-controller": "irelia-dropdown", "data-irelia-dropdown-open-value": open}) do %>
|
2
|
+
<span class="irelia-dropdown__trigger">
|
3
|
+
<%= custom_trigger || trigger %>
|
4
|
+
</span>
|
5
|
+
<div
|
6
|
+
data-irelia-dropdown-target="menu"
|
7
|
+
class="irelia-dropdown__content hidden"
|
8
|
+
data-transition-enter-from="transition-closed"
|
9
|
+
data-transition-enter-to="transition-open"
|
10
|
+
data-transition-leave-from="transition-open"
|
11
|
+
data-transition-leave-to="transition-closed"
|
12
|
+
>
|
13
|
+
<% items.each do |item| %>
|
14
|
+
<%= item %>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Dropdown::Component < Irelia::Component
|
4
|
+
option :open, default: -> { false }
|
5
|
+
option :direction, default: -> { :down }, in: %i[down up]
|
6
|
+
|
7
|
+
renders_one :trigger, "DropdownTrigger"
|
8
|
+
renders_one :custom_trigger, "CustomDropdownTrigger"
|
9
|
+
renders_many :items, "DropdownItem"
|
10
|
+
|
11
|
+
def variants
|
12
|
+
class_names(
|
13
|
+
"irelia-dropdown",
|
14
|
+
"irelia-dropdown--default": variant == :default,
|
15
|
+
"irelia-dropdown--direction-down": direction == :down,
|
16
|
+
"irelia-dropdown--direction-up": direction == :up
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(**options)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
class DropdownTrigger < Irelia::Button::Component
|
25
|
+
def initialize(**options)
|
26
|
+
options[:html_options] ||= {}
|
27
|
+
options[:html_options]["data"] = { "action": "irelia-dropdown#toggle click@window->irelia-dropdown#hide" }
|
28
|
+
super(**options)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class CustomDropdownTrigger < Irelia::Component
|
33
|
+
def initialize(**options)
|
34
|
+
options[:html_options] ||= {}
|
35
|
+
options[:html_options]["data"] = { "action": "irelia-dropdown#toggle click@window->irelia-dropdown#hide" }
|
36
|
+
options[:html_options]["style"] = "display:block;width:100%"
|
37
|
+
super(**options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def call
|
41
|
+
content_tag(:button, content, html_options)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class DropdownItem < Irelia::Button::Component
|
46
|
+
def initialize(**options)
|
47
|
+
options[:size] = :sm
|
48
|
+
options[:variant] = :dropdown_item
|
49
|
+
super(**options)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
@layer components {
|
2
|
+
.irelia-dropdown {
|
3
|
+
@apply relative;
|
4
|
+
|
5
|
+
&.irelia-dropdown--direction-down {
|
6
|
+
.irelia-dropdown__content {
|
7
|
+
@apply top-0 mt-10;
|
8
|
+
|
9
|
+
&.transition-closed {
|
10
|
+
@apply -translate-y-2 opacity-0;
|
11
|
+
}
|
12
|
+
|
13
|
+
&.transition-open {
|
14
|
+
@apply -translate-y-0 opacity-100;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
&.irelia-dropdown--direction-up {
|
20
|
+
.irelia-dropdown__content {
|
21
|
+
@apply bottom-0 mb-10 mt-0;
|
22
|
+
|
23
|
+
&.transition-closed {
|
24
|
+
@apply translate-y-2 opacity-0;
|
25
|
+
}
|
26
|
+
|
27
|
+
&.transition-open {
|
28
|
+
@apply translate-y-0 opacity-100;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
.irelia-dropdown__content {
|
35
|
+
@apply absolute duration-200 z-50 min-w-48 text-neutral-800 rounded-md border border-neutral-200/70 bg-white text-sm p-1 shadow-md -translate-x-0.5;
|
36
|
+
}
|
37
|
+
}
|