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,19 @@
|
|
1
|
+
<%=
|
2
|
+
irelia_table do |table|
|
3
|
+
table.with_column { "Name" }
|
4
|
+
table.with_column { "Age" }
|
5
|
+
table.with_column { "Address" }
|
6
|
+
table.with_column(html_options: { class: "text-right" }) { "Action" }
|
7
|
+
|
8
|
+
5.times do
|
9
|
+
table.with_row do |row|
|
10
|
+
row.with_cell { Faker::Name.name }
|
11
|
+
row.with_cell { Faker::Number.leading_zero_number(digits: 2) }
|
12
|
+
row.with_cell { Faker::Address.full_address }
|
13
|
+
row.with_cell(html_options: { class: "text-right flex justify-end gap-x-2" }) do
|
14
|
+
irelia_button(size: :xs) { "Edit" }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
%>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Irelia::Table::Row::Component < Irelia::Component
|
4
|
+
renders_many :cells, "CellComponent"
|
5
|
+
|
6
|
+
def initialize(**options)
|
7
|
+
super(**options)
|
8
|
+
end
|
9
|
+
|
10
|
+
def variants
|
11
|
+
class_names(
|
12
|
+
"irelia-table__row",
|
13
|
+
"irelia-table__row--default": variant == :default
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
class CellComponent < Irelia::Component
|
18
|
+
def initialize(**options)
|
19
|
+
super(**options)
|
20
|
+
end
|
21
|
+
|
22
|
+
def variants
|
23
|
+
class_names(
|
24
|
+
"irelia-table__cell",
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def call
|
29
|
+
content_tag :td, html_options do
|
30
|
+
content
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module Irelia
|
2
|
+
module ComponentsHelper
|
3
|
+
include ActionView::Helpers::UrlHelper
|
4
|
+
|
5
|
+
IRELIA_COMPONENTS_HELPERS = {
|
6
|
+
account_switcher: "Irelia::AccountSwitcher::Component",
|
7
|
+
avatar: "Irelia::Avatar::Component",
|
8
|
+
app_shell: "Irelia::AppShell::Component",
|
9
|
+
button: "Irelia::Button::Component",
|
10
|
+
breadcrumbs: "Irelia::Breadcrumbs::Component",
|
11
|
+
card: "Irelia::Card::Component",
|
12
|
+
container: "Irelia::Container::Component",
|
13
|
+
div: "Irelia::Div::Component",
|
14
|
+
divider: "Irelia::Divider::Component",
|
15
|
+
dropdown: "Irelia::Dropdown::Component",
|
16
|
+
empty_collection: "Irelia::EmptyCollection::Component",
|
17
|
+
flex: "Irelia::Flex::Component",
|
18
|
+
html: "Irelia::Html::Component",
|
19
|
+
icon: "Irelia::Icon::Component",
|
20
|
+
modal: "Irelia::Modal::Component",
|
21
|
+
notification: "Irelia::Notification::Component",
|
22
|
+
page_header: "Irelia::PageHeader::Component",
|
23
|
+
sidebar: "Irelia::Sidebar::Component",
|
24
|
+
stack: "Irelia::Stack::Component",
|
25
|
+
table: "Irelia::Table::Component",
|
26
|
+
navbar: "Irelia::Navbar::Component",
|
27
|
+
navbar_section: "Irelia::Navbar::Section::Component",
|
28
|
+
navbar_separator: "Irelia::Navbar::Separator::Component",
|
29
|
+
navigation: "Irelia::Navigation::Component",
|
30
|
+
split_screen: "Irelia::SplitScreen::Component"
|
31
|
+
}.freeze
|
32
|
+
|
33
|
+
IRELIA_COMPONENTS_HELPERS.each do |name, component|
|
34
|
+
define_method :"irelia_#{name}" do |*args, **kwargs, &block|
|
35
|
+
render component.constantize.new(*args, **kwargs), &block
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def irelia_button_to(name = nil, options = nil, args = nil, &block)
|
40
|
+
args, options = options, name if args.nil?
|
41
|
+
options ||= {}
|
42
|
+
args ||= {}
|
43
|
+
args[:html_options] ||= {}
|
44
|
+
args[:html_options][:class] ||= args[:class]
|
45
|
+
|
46
|
+
component = Irelia::Button::Component.new(skip_tag: true, **args)
|
47
|
+
component_attributes = component.class.dry_initializer.definitions.keys
|
48
|
+
|
49
|
+
if block
|
50
|
+
component.with_content(capture(&block))
|
51
|
+
elsif name != options
|
52
|
+
component.with_content(name)
|
53
|
+
end
|
54
|
+
|
55
|
+
html_options = args.merge(component.html_options)
|
56
|
+
|
57
|
+
button_to(options, html_options.except(*component_attributes)) do
|
58
|
+
render(component)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Irelia
|
2
|
+
module FormHelper
|
3
|
+
def irelia_form(model: nil, scope: nil, url: nil, format: nil, **options, &block)
|
4
|
+
options[:builder] ||= Irelia::FormBuilder
|
5
|
+
options[:class] = "irelia-form"
|
6
|
+
form_with(model: model, scope: scope, url: url, format: format, **options, &block)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= stylesheet_link_tag "irelia", "data-turbo-track": "reload" %>
|
2
|
+
|
3
|
+
<% if Irelia.config.load_poppins %>
|
4
|
+
<!-- Poppins Google font -->
|
5
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
6
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="true">
|
7
|
+
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if Irelia.config.icon_packs.include? "font_awesome" %>
|
11
|
+
<!-- Font Awesome icons -->
|
12
|
+
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
|
13
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer">
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/js/all.min.js" integrity="sha512-fD9DI5bZwQxOi7MhYWnnNPlvXdp/2Pj3XSTRrFs5FQa4mizyGLnJcN6tuvUS6LbmgN1ut+XGSABKvjN0H6Aoow==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
15
|
+
<script>FontAwesome.config.mutateApproach = 'sync'</script>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% if Irelia.config.multi_appearance %>
|
19
|
+
<!-- Use system apperance mode or selected -->
|
20
|
+
<script>
|
21
|
+
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
22
|
+
document.documentElement.classList.add('dark')
|
23
|
+
}
|
24
|
+
</script>
|
25
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Irelia
|
2
|
+
class Config
|
3
|
+
include ActiveSupport::Configurable
|
4
|
+
|
5
|
+
# ==> Icok Packs
|
6
|
+
# Icon pack's to use for the application. This will be autoloaded
|
7
|
+
# in the application layout when using the `irelia_head` helper.
|
8
|
+
config_accessor :icon_packs, default: [ "font_awesome" ]
|
9
|
+
|
10
|
+
# => Load Poppins Google font.
|
11
|
+
# This will be autoloaded in the application layout when using the `irelia_head` helper.
|
12
|
+
config_accessor :load_poppins, default: true
|
13
|
+
|
14
|
+
# => Enable Multi Appearance (Dark & Light Mode)
|
15
|
+
# This will be autoloaded in the application layout when using the `irelia_head` helper.
|
16
|
+
config_accessor :multi_appearance, default: true
|
17
|
+
end
|
18
|
+
end
|
data/lib/irelia/engine.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
module Irelia
|
4
2
|
class Engine < ::Rails::Engine
|
5
|
-
config.autoload_paths << Irelia::Engine.root.join("
|
6
|
-
|
7
|
-
|
3
|
+
config.autoload_paths << Irelia::Engine.root.join("app", "components")
|
4
|
+
|
5
|
+
initializer "irelia.configure.view_components" do |app|
|
6
|
+
config.view_component.preview_paths << Irelia::Engine.root.join("app", "components")
|
7
|
+
config.view_component.preview_controller = "PreviewController"
|
8
|
+
end
|
9
|
+
|
10
|
+
initializer "irelia.configure.lookbook" do |app|
|
11
|
+
app.config.lookbook.project_name = "Irelia components"
|
12
|
+
app.config.lookbook.preview_collection_label = "Components"
|
13
|
+
end
|
8
14
|
|
9
15
|
# Add the app/javascript directory to the asset pipeline
|
10
16
|
initializer "irelia.assets.precompile" do |app|
|
11
|
-
app.config.assets.paths << Irelia::Engine.root.join("app", "
|
17
|
+
app.config.assets.paths << Irelia::Engine.root.join("app", "assets", "dist", "javascripts")
|
18
|
+
app.config.assets.paths << Irelia::Engine.root.join("app", "assets", "dist", "stylesheets")
|
12
19
|
app.config.assets.precompile += %w[irelia_manifest]
|
13
20
|
end
|
14
|
-
|
15
|
-
# Add the importmap paths
|
16
|
-
initializer "irelia.importmap", before: "importmap" do |app|
|
17
|
-
app.config.importmap.paths << Irelia::Engine.root.join("config/importmap.rb")
|
18
|
-
end
|
19
21
|
end
|
20
22
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Irelia
|
2
|
+
class FormBuilder < ActionView::Helpers::FormBuilder
|
3
|
+
# [:text_field, :text_area].each do |method_name|
|
4
|
+
# define_method(method_name) do |method, options = {}|
|
5
|
+
# render_component(method_name, method, options)
|
6
|
+
# end
|
7
|
+
# end
|
8
|
+
|
9
|
+
def text_field(method, html_options = {}, &block)
|
10
|
+
render_component(:text_field, method, options: options, html_options: html_options, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def password_field(method, html_options = {}, &block)
|
14
|
+
render_component(:password_field, method, options: options, html_options: html_options, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def email_field(method, html_options = {}, &block)
|
18
|
+
render_component(:email_field, method, options: options, html_options: html_options, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def select(method, choices = nil, options = {}, html_options = {}, &block)
|
22
|
+
render_component(:select, method, choices: choices, options: options, html_options: html_options, &block)
|
23
|
+
end
|
24
|
+
|
25
|
+
def submit(value = nil, options = {})
|
26
|
+
component = Irelia::Button::Component.new(type: :submit, html_options: options)
|
27
|
+
component.with_content(value) if value
|
28
|
+
component.render_in(@template)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def render_component(component_name, method, **args, &block)
|
34
|
+
args[:options] = args[:options].merge({
|
35
|
+
label: args[:html_options].delete(:label),
|
36
|
+
hint: args[:html_options].delete(:hint)
|
37
|
+
})
|
38
|
+
|
39
|
+
component = component_klass(component_name).new(method: method, object: @object, object_name: @object_name, **args)
|
40
|
+
component.render_in(@template, &block)
|
41
|
+
end
|
42
|
+
|
43
|
+
def component_klass(component_name)
|
44
|
+
class_name = component_name.to_s.camelize
|
45
|
+
"Irelia::Form::#{class_name}::Component".safe_constantize
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Fixed
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
option :fixed, default: -> { false }, in: [ :top, :top_right, :right, :bottom_right, :bottom, :bottom_left, :left, :top_left ]
|
7
|
+
|
8
|
+
after_initialize do
|
9
|
+
add_css_classes(
|
10
|
+
class_names(
|
11
|
+
"irelia-fixed-top": fixed == :top,
|
12
|
+
"irelia-fixed-top-right": fixed == :top_right,
|
13
|
+
"irelia-fixed-right": fixed == :right,
|
14
|
+
"irelia-fixed-bottom-right": fixed == :bottom_right,
|
15
|
+
"irelia-fixed-bottom": fixed == :bottom,
|
16
|
+
"irelia-fixed-bottom-left": fixed == :bottom_left,
|
17
|
+
"irelia-fixed-left": fixed == :left,
|
18
|
+
"irelia-fixed-top-left": fixed == :top_left
|
19
|
+
)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Flex
|
4
|
+
module Direction
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
option :direction, default: -> { :row }, in: [ :row, :column ]
|
8
|
+
|
9
|
+
after_initialize do
|
10
|
+
add_css_classes(
|
11
|
+
class_names(
|
12
|
+
"irelia-flex--row": direction == :row,
|
13
|
+
"irelia-flex--column": direction == :column,
|
14
|
+
)
|
15
|
+
)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Flex
|
4
|
+
module Gap
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
option :gap, default: -> { :md }, in: [ :none, :xs, :sm, :md, :lg ]
|
8
|
+
|
9
|
+
after_initialize do
|
10
|
+
add_css_classes(
|
11
|
+
class_names(
|
12
|
+
"irelia-flex--gap-none": gap == :none,
|
13
|
+
"irelia-flex--gap-xs": gap == :xs,
|
14
|
+
"irelia-flex--gap-sm": gap == :sm,
|
15
|
+
"irelia-flex--gap-md": gap == :md,
|
16
|
+
"irelia-flex--gap-lg": gap == :lg,
|
17
|
+
)
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Flex
|
4
|
+
module Grow
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
option :grow, default: -> { false }, in: [ true, false ]
|
8
|
+
|
9
|
+
after_initialize do
|
10
|
+
add_css_classes(
|
11
|
+
class_names(
|
12
|
+
"irelia-grow": grow
|
13
|
+
)
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Flex
|
4
|
+
module Items
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
option :items, default: -> { nil }, in: %i[start center end baseline stretch]
|
8
|
+
|
9
|
+
after_initialize do
|
10
|
+
add_css_classes(
|
11
|
+
class_names(
|
12
|
+
"irelia-items-start": items == :start,
|
13
|
+
"irelia-items-center": items == :center,
|
14
|
+
"irelia-items-end": items == :end,
|
15
|
+
"irelia-items-baseline": items == :baseline,
|
16
|
+
"irelia-items-stretch": items == :stretch,
|
17
|
+
)
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Flex
|
4
|
+
module Justify
|
5
|
+
def self.included(base)
|
6
|
+
base.class_eval do
|
7
|
+
option :justify, default: -> { nil }, in: %i[start center between around evenly stretch end]
|
8
|
+
|
9
|
+
after_initialize do
|
10
|
+
add_css_classes(
|
11
|
+
class_names(
|
12
|
+
"irelia-justify-start": justify == :start,
|
13
|
+
"irelia-justify-center": justify == :center,
|
14
|
+
"irelia-justify-between": justify == :between,
|
15
|
+
"irelia-justify-end": justify == :end,
|
16
|
+
"irelia-justify-around": justify == :around,
|
17
|
+
"irelia-justify-evenly": justify == :evenly,
|
18
|
+
"irelia-justify-stretch": justify == :stretch
|
19
|
+
)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Padding
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
option :padding, default: -> { nil }, in: [ :none, :sm, :md, :lg ]
|
7
|
+
option :padding_top, default: -> { nil }, in: [ :none, :sm, :md, :lg ]
|
8
|
+
option :padding_right, default: -> { nil }, in: [ :none, :sm, :md, :lg ]
|
9
|
+
option :padding_bottom, default: -> { nil }, in: [ :none, :sm, :md, :lg ]
|
10
|
+
option :padding_left, default: -> { nil }, in: [ :none, :sm, :md, :lg ]
|
11
|
+
|
12
|
+
after_initialize do
|
13
|
+
add_css_classes(
|
14
|
+
class_names(
|
15
|
+
"irelia-padding-none": padding == :none,
|
16
|
+
"irelia-padding-sm": padding == :sm,
|
17
|
+
"irelia-padding-md": padding == :md,
|
18
|
+
"irelia-padding-lg": padding == :lg,
|
19
|
+
|
20
|
+
"irelia-padding-top-none": padding_top == :none,
|
21
|
+
"irelia-padding-top-sm": padding_top == :sm,
|
22
|
+
"irelia-padding-top-md": padding_top == :md,
|
23
|
+
"irelia-padding-top-lg": padding_top == :lg,
|
24
|
+
|
25
|
+
"irelia-padding-right-none": padding_right == :none,
|
26
|
+
"irelia-padding-right-sm": padding_right == :sm,
|
27
|
+
"irelia-padding-right-md": padding_right == :md,
|
28
|
+
"irelia-padding-right-lg": padding_right == :lg,
|
29
|
+
|
30
|
+
"irelia-padding-left-none": padding_left == :none,
|
31
|
+
"irelia-padding-left-sm": padding_left == :sm,
|
32
|
+
"irelia-padding-left-md": padding_left == :md,
|
33
|
+
"irelia-padding-left-lg": padding_left == :lg,
|
34
|
+
|
35
|
+
"irelia-padding-bottom-none": padding_bottom == :none,
|
36
|
+
"irelia-padding-bottom-sm": padding_bottom == :sm,
|
37
|
+
"irelia-padding-bottom-md": padding_bottom == :md,
|
38
|
+
"irelia-padding-bottom-lg": padding_bottom == :lg,
|
39
|
+
)
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module TextFormatting
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
option :text, default: -> { :base }, in: [ :xs, :sm, :base, :lg, :xl, :xxl, :xxxl ]
|
7
|
+
option :bold, default: -> { false }, in: [ true, false, :bold, :semibold, :extrabold ]
|
8
|
+
|
9
|
+
after_initialize do
|
10
|
+
add_css_classes(
|
11
|
+
class_names(
|
12
|
+
"irelia-text-base": text == :none,
|
13
|
+
"irelia-text-xs": text == :xs,
|
14
|
+
"irelia-text-sm": text == :sm,
|
15
|
+
"irelia-text-lg": text == :lg,
|
16
|
+
"irelia-text-xl": text == :xl,
|
17
|
+
"irelia-text-2xl": text == :xxl,
|
18
|
+
"irelia-text-3xl": text == :xxxl,
|
19
|
+
"irelia-text-no-bold": bold == false,
|
20
|
+
"irelia-text-bold": bold == true || bold == :bold,
|
21
|
+
"irelia-text-semibold": bold == :semibold,
|
22
|
+
"irelia-text-extrabold": bold == :extrabold
|
23
|
+
)
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Irelia
|
2
|
+
module Options
|
3
|
+
module Width
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
option :width, default: -> { nil }, in: [ :full ]
|
7
|
+
|
8
|
+
after_initialize do
|
9
|
+
add_css_classes(
|
10
|
+
class_names(
|
11
|
+
"irelia-width-full": width == :full
|
12
|
+
)
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/irelia/version.rb
CHANGED
data/lib/irelia.rb
CHANGED
@@ -1,29 +1,25 @@
|
|
1
|
-
|
1
|
+
require "irelia/version"
|
2
|
+
require "irelia/engine"
|
2
3
|
|
3
|
-
require "
|
4
|
-
require "dry-configurable"
|
5
|
-
require "dry-initializer"
|
6
|
-
require "importmap-rails"
|
7
|
-
require "loaf"
|
8
|
-
require "meta-tags"
|
9
|
-
require "simple_form"
|
10
|
-
require "teamable"
|
4
|
+
require "view_component"
|
11
5
|
require "view_component-contrib"
|
6
|
+
require "dry-initializer"
|
7
|
+
require "lookbook"
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
require "irelia/config"
|
10
|
+
require "irelia/form_builder"
|
11
|
+
require "irelia/options/text_formatting"
|
12
|
+
require "irelia/options/padding"
|
13
|
+
require "irelia/options/fixed"
|
14
|
+
require "irelia/options/width"
|
15
|
+
require "irelia/options/flex/items"
|
16
|
+
require "irelia/options/flex/direction"
|
17
|
+
require "irelia/options/flex/gap"
|
18
|
+
require "irelia/options/flex/grow"
|
19
|
+
require "irelia/options/flex/justify"
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
setting :default_from_email, default: "please-change-me-at-config-initializers-irelia@example.com"
|
21
|
+
module Irelia
|
22
|
+
def self.config
|
23
|
+
@config ||= Irelia::Config
|
24
|
+
end
|
26
25
|
end
|
27
|
-
|
28
|
-
require "irelia/version"
|
29
|
-
require "irelia/engine"
|