epages-essence 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +4 -3
  4. data/app/assets/images/essence/icon_component/arrow_right.svg +1 -0
  5. data/app/assets/images/essence/icon_component/chevron_up_down.svg +3 -0
  6. data/app/assets/images/essence/icon_component/power_off.svg +1 -0
  7. data/app/assets/images/essence/icon_component/sparkles.svg +1 -0
  8. data/app/assets/images/essence/icon_component/x_mark.svg +3 -0
  9. data/app/assets/stylesheets/essence/beyond/{_base.scss → layout/base.css} +0 -5
  10. data/app/assets/stylesheets/essence/beyond/layout/{_content.scss → content.css} +1 -1
  11. data/app/assets/stylesheets/essence/beyond/simple_form/control.css +249 -0
  12. data/app/assets/stylesheets/essence/beyond/simple_form/error.css +29 -0
  13. data/app/assets/stylesheets/essence/beyond/simple_form/fieldset.css +32 -0
  14. data/app/assets/stylesheets/essence/beyond/simple_form/group.css +21 -0
  15. data/app/assets/stylesheets/essence/beyond/simple_form/hint.css +6 -0
  16. data/app/assets/stylesheets/essence/beyond/simple_form/label.css +38 -0
  17. data/app/assets/stylesheets/essence/beyond/simple_form/row.css +5 -0
  18. data/app/assets/stylesheets/essence/beyond/simple_form/wrapper.css +3 -0
  19. data/app/assets/stylesheets/essence/beyond/utils/margin.css +15 -0
  20. data/app/assets/stylesheets/essence/beyond/variables.css +281 -0
  21. data/app/assets/stylesheets/essence/beyond.css +39 -0
  22. data/app/components/essence/action_bar_component/action_bar_component.css +23 -0
  23. data/app/components/essence/action_bar_component.rb +2 -1
  24. data/app/components/essence/app_info_component/app_info_component.css +45 -0
  25. data/app/components/essence/application_component.rb +1 -3
  26. data/app/components/essence/breadcrumb_component/breadcrumb_component.css +35 -0
  27. data/app/components/essence/button_component/button_component.css +140 -0
  28. data/app/components/essence/button_component/button_component.html.erb +2 -0
  29. data/app/components/essence/button_component/button_component_controller.js +27 -0
  30. data/app/components/essence/button_component.rb +27 -2
  31. data/app/components/essence/button_group_component/button_group_component.css +21 -0
  32. data/app/components/essence/button_group_component/button_group_component.html.erb +5 -0
  33. data/app/components/essence/button_group_component.rb +28 -0
  34. data/app/components/essence/card_component/card_component.css +66 -0
  35. data/app/components/essence/card_component/card_component.html.erb +6 -0
  36. data/app/components/essence/card_component/ribbon_component.html.erb +3 -0
  37. data/app/components/essence/card_component.rb +38 -4
  38. data/app/components/essence/clipboard_copy_component/{clipboard_copy_component.scss → clipboard_copy_component.css} +4 -4
  39. data/app/components/essence/empty_state_component/empty_state_component.css +42 -0
  40. data/app/components/essence/expandable_component/expandable_component.css +36 -0
  41. data/app/components/essence/expandable_component/expandable_component.html.erb +8 -0
  42. data/app/components/essence/expandable_component/expandable_component_controller.js +32 -0
  43. data/app/components/essence/expandable_component.rb +30 -0
  44. data/app/components/essence/expandable_toggle_component/expandable_toggle_component.css +7 -0
  45. data/app/components/essence/expandable_toggle_component/expandable_toggle_component.html.erb +3 -0
  46. data/app/components/essence/expandable_toggle_component/expandable_toggle_component.yml +4 -0
  47. data/app/components/essence/expandable_toggle_component/expandable_toggle_component_controller.js +52 -0
  48. data/app/components/essence/expandable_toggle_component.rb +38 -0
  49. data/app/components/essence/flash_component/container_component.html.erb +7 -0
  50. data/app/components/essence/flash_component/flash_component.css +101 -0
  51. data/app/components/essence/flash_component/flash_component.html.erb +11 -0
  52. data/app/components/essence/flash_component/flash_component_controller.js +24 -0
  53. data/app/components/essence/flash_component.rb +29 -0
  54. data/app/components/essence/link_component/link_component.css +49 -0
  55. data/app/components/essence/notification_component/notification_component.css +55 -0
  56. data/app/components/essence/notification_component.rb +6 -2
  57. data/app/components/essence/paragraph_component/{paragraph_component.scss → paragraph_component.css} +0 -5
  58. data/app/components/essence/scroll_shadow_component/{scroll_shadow_component.scss → scroll_shadow_component.css} +4 -0
  59. data/app/components/essence/spinner_component/{spinner_component.scss → spinner_component.css} +5 -12
  60. data/app/components/essence/spinner_component/spinner_component.html.erb +1 -1
  61. data/app/components/essence/spinner_component.rb +4 -2
  62. data/app/components/essence/status_component/status_component.css +64 -0
  63. data/app/components/essence/status_component.rb +1 -1
  64. data/app/components/essence/step_list_component/step_list_component.css +72 -0
  65. data/app/components/essence/step_list_component/step_list_component.html.erb +3 -1
  66. data/app/components/essence/step_list_component.rb +7 -1
  67. data/app/components/essence/table_component/{table_component.scss → table_component.css} +5 -8
  68. data/app/components/essence/title_component/{title_component.scss → title_component.css} +0 -4
  69. data/app/components/essence/tooltip_component/tooltip_component.css +55 -0
  70. data/app/inputs/file_input.rb +73 -0
  71. data/app/javascript/essence/application.js +2 -2
  72. data/app/javascript/essence/controllers/file_input_controller.js +41 -0
  73. data/app/javascript/essence/controllers/index.js +18 -3
  74. data/app/views/essence/beyond/body.html.erb +1 -0
  75. data/config/importmap.rb +3 -0
  76. data/config/initializers/essence/inline_svg.rb +5 -0
  77. data/config/initializers/essence/simple_form.rb +29 -8
  78. data/config/locales/essence.en.yml +3 -0
  79. data/lib/components/input_group.rb +19 -0
  80. data/lib/essence/engine.rb +20 -5
  81. data/lib/essence/version.rb +1 -1
  82. data/lib/essence.rb +1 -1
  83. data/vendor/assets/stylesheets/essence/flexboxgrid.css +824 -0
  84. metadata +78 -53
  85. data/app/assets/config/essence_manifest.js +0 -5
  86. data/app/assets/stylesheets/essence/beyond/components/_index.scss +0 -17
  87. data/app/assets/stylesheets/essence/beyond/layout/_index.scss +0 -1
  88. data/app/assets/stylesheets/essence/beyond/simple_form/_control.scss +0 -172
  89. data/app/assets/stylesheets/essence/beyond/simple_form/_error.scss +0 -27
  90. data/app/assets/stylesheets/essence/beyond/simple_form/_fieldset.scss +0 -34
  91. data/app/assets/stylesheets/essence/beyond/simple_form/_group.scss +0 -6
  92. data/app/assets/stylesheets/essence/beyond/simple_form/_hint.scss +0 -8
  93. data/app/assets/stylesheets/essence/beyond/simple_form/_index.scss +0 -43
  94. data/app/assets/stylesheets/essence/beyond/simple_form/_label.scss +0 -26
  95. data/app/assets/stylesheets/essence/beyond/simple_form/_wrapper.scss +0 -5
  96. data/app/assets/stylesheets/essence/beyond.scss +0 -4
  97. data/app/components/essence/action_bar_component/action_bar_component.scss +0 -29
  98. data/app/components/essence/app_info_component/app_info_component.scss +0 -45
  99. data/app/components/essence/breadcrumb_component/breadcrumb_component.scss +0 -39
  100. data/app/components/essence/button_component/button_component.scss +0 -105
  101. data/app/components/essence/card_component/card_component.scss +0 -21
  102. data/app/components/essence/empty_state_component/empty_state_component.scss +0 -50
  103. data/app/components/essence/link_component/link_component.scss +0 -58
  104. data/app/components/essence/notification_component/notification_component.scss +0 -63
  105. data/app/components/essence/status_component/status_component.scss +0 -80
  106. data/app/components/essence/step_list_component/step_list_component.scss +0 -79
  107. data/app/components/essence/tooltip_component/tooltip_component.scss +0 -63
@@ -0,0 +1,49 @@
1
+ .link {
2
+ align-items: center;
3
+ background-color: transparent;
4
+ border: 0;
5
+ cursor: pointer;
6
+ display: inline-flex;
7
+ height: fit-content;
8
+ padding: 0;
9
+ text-decoration: none;
10
+ white-space: nowrap;
11
+ }
12
+
13
+ .link-primary {
14
+ color: var(--primaryLink-color);
15
+
16
+ &:hover {
17
+ color: var(--primaryLink-hover-color);
18
+ }
19
+ }
20
+
21
+ .link-secondary {
22
+ color: var(--secondaryLink-color);
23
+
24
+ &:hover {
25
+ color: var(--secondaryLink-hover-color);
26
+ }
27
+ }
28
+
29
+ .link-danger {
30
+ color: var(--dangerLink-color);
31
+
32
+ &:hover {
33
+ color: var(--dangerLink-hover-color);
34
+ }
35
+ }
36
+
37
+ .link-icon {
38
+ fill: currentColor;
39
+ height: 15px;
40
+ width: 15px;
41
+
42
+ &:first-child {
43
+ margin-right: 5px;
44
+ }
45
+
46
+ &:last-child {
47
+ margin-left: 6px;
48
+ }
49
+ }
@@ -0,0 +1,55 @@
1
+ .notification {
2
+ background-color: var(--notification-background);
3
+ border-radius: var(--notification-borderRadius);
4
+ display: flex;
5
+ }
6
+
7
+ .notification-body {
8
+ color: var(--notification-text);
9
+ padding: 8px 14px;
10
+ }
11
+
12
+ .notification-danger,
13
+ .notification-alert {
14
+ border: 1px solid var(--notification-danger);
15
+
16
+ .notification-indicator {
17
+ background-color: var(--notification-danger);
18
+ }
19
+ }
20
+
21
+ .notification-icon {
22
+ display: block;
23
+ fill: var(--notification-background);
24
+ height: 18px;
25
+ width: 18px;
26
+ }
27
+
28
+ .notification-indicator {
29
+ padding: 10px 8px;
30
+ }
31
+
32
+ .notification-info {
33
+ border: 1px solid var(--notification-info);
34
+
35
+ .notification-indicator {
36
+ background-color: var(--notification-info);
37
+ }
38
+ }
39
+
40
+ .notification-success,
41
+ .notification-notice {
42
+ border: 1px solid var(--notification-success);
43
+
44
+ .notification-indicator {
45
+ background-color: var(--notification-success);
46
+ }
47
+ }
48
+
49
+ .notification-warning {
50
+ border: 1px solid var(--notification-warning);
51
+
52
+ .notification-indicator {
53
+ background-color: var(--notification-warning);
54
+ }
55
+ }
@@ -8,18 +8,22 @@ module Essence
8
8
 
9
9
  VARIANT_MAPPINGS = {
10
10
  :success => 'notification-success',
11
+ :notice => 'notification-notice',
11
12
  DEFAULT_VARIANT => 'notification-info',
12
13
  :warning => 'notification-warning',
13
- :danger => 'notification-danger'
14
+ :danger => 'notification-danger',
15
+ :alert => 'notification-danger'
14
16
  }.freeze
15
17
 
16
18
  VARIANT_OPTIONS = VARIANT_MAPPINGS.keys.freeze
17
19
 
18
20
  ICON_MAPPINGS = {
19
21
  :success => 'circle_check',
22
+ :notice => 'circle_check',
20
23
  DEFAULT_VARIANT => 'circle_info',
21
24
  :warning => 'circle_exclamation',
22
- :danger => 'circle_xmark'
25
+ :danger => 'circle_xmark',
26
+ :alert => 'circle_xmark'
23
27
  }.freeze
24
28
 
25
29
  def initialize(variant: DEFAULT_VARIANT,
@@ -1,8 +1,3 @@
1
- :root {
2
- --primaryLink-color: deepskyblue;
3
- --primaryLink-hover-color: #0099cc;
4
- }
5
-
6
1
  .paragraph {
7
2
  & > *:first-child {
8
3
  margin-top: 0;
@@ -1,3 +1,7 @@
1
+ scroll-shadow {
2
+ width: 100%;
3
+ }
4
+
1
5
  .scroll-shadow {
2
6
  max-height: 100%;
3
7
  max-width: 100%;
@@ -1,25 +1,18 @@
1
- :root {
2
- --spinner-border: #c0c0c0;
3
- --spinner-border-highlighting: #676767;
4
- }
5
-
6
- $spinner-size: 40px;
7
-
8
1
  .spinner {
9
- height: $spinner-size;
2
+ height: var(--spinner-size);
10
3
  position: relative;
11
- width: $spinner-size;
4
+ width: var(--spinner-size);
12
5
 
13
6
  &::after {
14
7
  animation: spin 1.5s infinite linear;
15
8
  border: solid 4px var(--spinner-border);
16
9
  border-bottom-color: var(--spinner-border-highlighting);
17
10
  border-radius: 50%;
18
- content: '';
19
- height: $spinner-size;
11
+ content: "";
12
+ height: var(--spinner-size);
20
13
  position: absolute;
21
14
  transform-origin: center;
22
- width: $spinner-size;
15
+ width: var(--spinner-size);
23
16
  }
24
17
  }
25
18
 
@@ -1 +1 @@
1
- <div <%= tag.attributes **html_options %>></div>
1
+ <span <%= tag.attributes **html_options %>></span>
@@ -4,14 +4,16 @@ module Essence
4
4
  class SpinnerComponent < ApplicationComponent
5
5
  attr_reader :html_options
6
6
 
7
- def initialize(**html_options)
7
+ def initialize(size: 40,
8
+ **html_options)
9
+ @size = integer_or_fallback(size, 40)
8
10
  @html_options = html_options
9
11
  end
10
12
 
11
13
  private
12
14
 
13
15
  def before_render
14
- set_base_html_options('spinner')
16
+ set_base_html_options('spinner', style: "--spinner-size: #{@size}px;")
15
17
  end
16
18
  end
17
19
  end
@@ -0,0 +1,64 @@
1
+ .status {
2
+ align-items: center;
3
+ border-radius: 3px;
4
+ display: inline-flex;
5
+ font-size: 12px;
6
+ font-weight: 500;
7
+ line-height: 1.2;
8
+ padding: 4px 6px;
9
+ }
10
+
11
+ .status-bubble {
12
+ border-radius: 3px;
13
+ display: inline-flex;
14
+ flex-shrink: 0;
15
+ height: 10px;
16
+ margin-right: 6px;
17
+ width: 10px;
18
+
19
+ &.status-bubble-dotted {
20
+ border: 1px dotted currentColor;
21
+ }
22
+
23
+ &.status-bubble-outline,
24
+ &.status-bubble-solid {
25
+ border: 1px solid currentColor;
26
+ }
27
+ }
28
+
29
+ .status-todo {
30
+ background-color: var(--todo-status-background);
31
+ color: var(--todo-status-text);
32
+
33
+ .status-bubble-solid {
34
+ background-color: var(--todo-status-icon);
35
+ }
36
+ }
37
+
38
+ .status-active {
39
+ background-color: var(--active-status-background);
40
+ color: var(--active-status-text);
41
+
42
+ .status-bubble-solid {
43
+ background-color: var(--active-status-icon);
44
+ }
45
+ }
46
+
47
+ .status-danger {
48
+ background-color: var(--danger-status-background);
49
+ color: var(--danger-status-text);
50
+
51
+ .status-bubble-solid {
52
+ background-color: var(--danger-status-icon);
53
+ }
54
+ }
55
+
56
+ .status-outline {
57
+ background-color: var(--outline-status-background);
58
+ border: 1px solid var(--outline-status-border);
59
+ color: var(--outline-status-text);
60
+
61
+ .status-bubble-solid {
62
+ background-color: var(--outline-status-icon);
63
+ }
64
+ }
@@ -30,7 +30,7 @@ module Essence
30
30
  variant: DEFAULT_VARIANT,
31
31
  bubble: DEFAULT_BUBBLE,
32
32
  **html_options)
33
- @text = text&.to_s&.strip&.presence&.downcase
33
+ @text = text.presence&.strip&.downcase
34
34
  @variant = fetch_or_fallback(VARIANT_OPTIONS, variant.to_sym, DEFAULT_VARIANT)
35
35
  @bubble = fetch_or_fallback(BUBBLE_OPTIONS, bubble&.to_sym, DEFAULT_BUBBLE)
36
36
  @html_options = html_options
@@ -0,0 +1,72 @@
1
+ .step-list {
2
+ background-color: var(--stepList-background);
3
+ padding: 25px;
4
+ counter-reset: item-count;
5
+ }
6
+
7
+ .step-list-title {
8
+ color: var(--stepList-headline);
9
+ font-size: 20px;
10
+ font-weight: bold;
11
+ margin-bottom: 15px;
12
+ margin-top: 0;
13
+ }
14
+
15
+ .step-list-items {
16
+ margin-left: -2px;
17
+ }
18
+
19
+ .step-list-item {
20
+ display: flex;
21
+
22
+ &:not(:nth-last-child(1 of .step-list-item)) {
23
+ padding-bottom: 20px;
24
+
25
+ > div:first-child {
26
+ &::before {
27
+ content: " ";
28
+ position: absolute;
29
+ left: 10px;
30
+ width: 2px;
31
+ height: 100%;
32
+ background-color: var(--stepList-bubble-line);
33
+ top: 20px;
34
+ }
35
+ }
36
+ }
37
+
38
+ > div:first-child {
39
+ position: relative;
40
+ width: 35px;
41
+ flex-shrink: 0;
42
+ }
43
+ }
44
+
45
+ .step-list-bubble {
46
+ width: 20px;
47
+ height: 20px;
48
+ border-radius: 10px;
49
+ background-color: var(--stepList-bubble-background);
50
+ color: var(--stepList-bubble-text);
51
+ line-height: 19px;
52
+ font-size: 11px;
53
+ font-weight: bold;
54
+ text-align: center;
55
+
56
+ &::before {
57
+ counter-increment: item-count;
58
+ content: counter(item-count);
59
+ }
60
+ }
61
+
62
+ .step-list-headline {
63
+ font-weight: bold;
64
+ line-height: 1.2;
65
+ margin-bottom: 5px;
66
+ color: var(--stepList-headline);
67
+ }
68
+
69
+ .step-list-description {
70
+ font-size: 14px;
71
+ margin: 0;
72
+ }
@@ -1,5 +1,7 @@
1
1
  <div <%= tag.attributes **html_options %>>
2
- <h4 class="step-list-title"><%= title %></h4>
2
+ <% if title? %>
3
+ <h4 class="step-list-title"><%= title %></h4>
4
+ <% end %>
3
5
  <div class="step-list-items">
4
6
  <% items.each do |item| %>
5
7
  <%= item %>
@@ -6,7 +6,7 @@ module Essence
6
6
 
7
7
  renders_many :items, 'ItemComponent'
8
8
 
9
- def initialize(title:,
9
+ def initialize(title: nil,
10
10
  **html_options)
11
11
  @title = title
12
12
  @html_options = html_options
@@ -30,5 +30,11 @@ module Essence
30
30
  def render?
31
31
  items.any?
32
32
  end
33
+
34
+ [:title].each do |method_name|
35
+ define_method(:"#{method_name}?") do
36
+ instance_variable_get(:"@#{method_name}").present?
37
+ end
38
+ end
33
39
  end
34
40
  end
@@ -1,15 +1,8 @@
1
- :root {
2
- --table-row-border: 1px solid #e6e6e6;
3
- --table-row-background: white;
4
- --table-row-background-hover: #b3ecff;
5
- --table-header-background: #ebebeb;
6
- --table-header-link: #3e3e3e;
7
- }
8
-
9
1
  .table {
10
2
  border-collapse: collapse;
11
3
  overflow: hidden;
12
4
  text-align: left;
5
+ width: 100%;
13
6
 
14
7
  thead {
15
8
  background-color: var(--table-header-background);
@@ -20,6 +13,10 @@
20
13
  th {
21
14
  padding: 15px;
22
15
  white-space: nowrap;
16
+
17
+ &::first-letter {
18
+ text-transform: uppercase;
19
+ }
23
20
  }
24
21
  }
25
22
  }
@@ -1,7 +1,3 @@
1
- :root {
2
- --workspace-headline: #676767;
3
- }
4
-
5
1
  .title {
6
2
  color: var(--workspace-headline);
7
3
  font-size: 190%;
@@ -0,0 +1,55 @@
1
+ .tooltip {
2
+ display: flex;
3
+ }
4
+
5
+ .tooltip-arrow {
6
+ background: var(--tooltip-background);
7
+ height: 10px;
8
+ position: absolute;
9
+ width: 10px;
10
+ z-index: -1;
11
+ }
12
+
13
+ .tooltip-bubble {
14
+ background-color: var(--tooltip-background);
15
+ border-radius: var(--tooltip-borderRadius);
16
+ box-shadow: var(--tooltip-boxShadow);
17
+ color: var(--tooltip-text);
18
+ cursor: default;
19
+ display: none;
20
+ font-size: 13px;
21
+ font-weight: normal;
22
+ line-height: 1.4;
23
+ max-width: 350px;
24
+ padding: 1em;
25
+ position: absolute;
26
+ transition: opacity cubic-bezier(0, 0, 0.57, 0.74) 0.2s, 0.2s visibility;
27
+ z-index: 1;
28
+
29
+ &:before {
30
+ content: '';
31
+ display: block;
32
+ height: 14px;
33
+ left: -10px;
34
+ position: absolute;
35
+ top: 50%;
36
+ transform: translateY(-50%);
37
+ width: 10px;
38
+ }
39
+
40
+ &:hover {
41
+ display: block;
42
+ }
43
+ }
44
+
45
+ .tooltip-icon {
46
+ fill: var(--tooltip-icon);
47
+ height: 14px;
48
+ width: 14px;
49
+
50
+ &:hover {
51
+ ~.tooltip-bubble {
52
+ display: block;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ class FileInput < SimpleForm::Inputs::FileInput
4
+ def input(wrapper_options = nil)
5
+ merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
6
+
7
+ input_options = merged_input_options.extract!(:accept, :capture, :multiple)
8
+
9
+ template.content_tag(:div, **stimulus_configuration) do
10
+ template.concat(build_file_button_label(merged_input_options))
11
+ template.concat(build_filename_display)
12
+ template.concat(build_hidden_file_field(input_options))
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def build_file_button_label(merged_options)
19
+ template.content_tag(:label, button_text,
20
+ merged_options.merge(for: input_id, data: { file_input_target: 'button' }))
21
+ end
22
+
23
+ def build_filename_display
24
+ template.content_tag(:span, filename, class: 'form-label file-name',
25
+ data: { file_input_target: 'fileName' })
26
+ end
27
+
28
+ def build_hidden_file_field(input_options)
29
+ @builder.file_field(attribute_name, input_options.merge(style: 'display: none;',
30
+ data: {
31
+ file_input_target: 'input',
32
+ action: 'change->file-input#change'
33
+ }))
34
+ end
35
+
36
+ def input_id
37
+ ActionView::Helpers::Tags::Base.new(@builder.object_name, attribute_name, template).send(:tag_id)
38
+ end
39
+
40
+ def stimulus_configuration
41
+ {
42
+ data: {
43
+ controller: 'file-input',
44
+ file_input_change_file_text_value: translate_text(:change_file),
45
+ file_input_button_text_value: translate_text(:choose_file)
46
+ }
47
+ }
48
+ end
49
+
50
+ def button_text
51
+ file_present? ? translate_text(:change_file) : translate_text(:choose_file)
52
+ end
53
+
54
+ def translate_text(key)
55
+ I18n.t("simple_form.file_input.#{key}")
56
+ end
57
+
58
+ def file_present?
59
+ return false unless @builder.object.respond_to?(attribute_name)
60
+
61
+ file = @builder.object.send(attribute_name)
62
+
63
+ file.present? && file.respond_to?(:filename)
64
+ end
65
+
66
+ def filename
67
+ return nil unless file_present?
68
+
69
+ @builder.object.send(attribute_name).filename
70
+ rescue StandardError
71
+ nil
72
+ end
73
+ end
@@ -1,4 +1,4 @@
1
1
  // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2
- import "./controllers"
3
-
2
+ import "@hotwired/turbo-rails"
3
+ import "controllers"
4
4
  import "scroll-shadow-element"
@@ -0,0 +1,41 @@
1
+ import { Controller } from "@hotwired/stimulus"
2
+
3
+ // Connects to data-controller="file-input"
4
+ export default class extends Controller {
5
+ static values = {
6
+ buttonText: String,
7
+ changeFileText: String
8
+ }
9
+
10
+ static targets = [
11
+ "button",
12
+ "fileName",
13
+ "input"
14
+ ]
15
+
16
+ change() {
17
+ this.#updateFileName()
18
+ this.#updateButtonText()
19
+ }
20
+
21
+ #updateFileName() {
22
+ const files = this.inputTarget.files
23
+ let displayText = this.noFileSelectedTextValue
24
+
25
+ if (files.length === 1) {
26
+ displayText = files[0].name
27
+ } else if (files.length > 1) {
28
+ displayText = `${files.length} files selected`
29
+ }
30
+
31
+ this.fileNameTarget.textContent = displayText;
32
+ }
33
+
34
+ #updateButtonText() {
35
+ if (this.inputTarget.files.length > 0) {
36
+ this.buttonTarget.textContent = this.changeFileTextValue;
37
+ } else {
38
+ this.buttonTarget.textContent = this.buttonTextValue;
39
+ }
40
+ }
41
+ }
@@ -1,12 +1,27 @@
1
1
  // Import and register all your controllers from the importmap under controllers/*
2
2
 
3
- import { application } from "./controllers/application"
3
+ import { application } from "controllers/application"
4
4
 
5
- import ParagraphComponentController from 'components/essence/paragraph_component/paragraph_component_controller'
6
- application.register('paragraph', ParagraphComponentController)
5
+ import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
6
+ eagerLoadControllersFrom("controllers", application)
7
+
8
+ import ButtonComponentController from 'components/essence/button_component/button_component_controller'
9
+ application.register('button', ButtonComponentController)
7
10
 
8
11
  import ClipboardCopyComponentController from 'components/essence/clipboard_copy_component/clipboard_copy_component_controller'
9
12
  application.register('clipboard-copy', ClipboardCopyComponentController)
10
13
 
14
+ import ExpandableComponentController from 'components/essence/expandable_component/expandable_component_controller'
15
+ application.register('expandable', ExpandableComponentController)
16
+
17
+ import ExpandableToggleComponentController from 'components/essence/expandable_toggle_component/expandable_toggle_component_controller'
18
+ application.register('expandable-toggle', ExpandableToggleComponentController)
19
+
20
+ import FlashComponentController from 'components/essence/flash_component/flash_component_controller'
21
+ application.register('flash', FlashComponentController)
22
+
23
+ import ParagraphComponentController from 'components/essence/paragraph_component/paragraph_component_controller'
24
+ application.register('paragraph', ParagraphComponentController)
25
+
11
26
  import TooltipComponentController from 'components/essence/tooltip_component/tooltip_component_controller'
12
27
  application.register('tooltip', TooltipComponentController)
@@ -1,5 +1,6 @@
1
1
  <%= yield :action_bar %>
2
2
  <div class="content">
3
+ <%= render Essence::FlashComponent::ContainerComponent.new %>
3
4
  <%= render Essence::BreadcrumbComponent.new(style: 'margin-bottom: 30px;') %>
4
5
  <%= render Essence::TitleComponent.new(text: yield(:title), style: 'margin-bottom: 30px;') %>
5
6
  <main>
data/config/importmap.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  pin 'essence/application', to: 'essence/application.js', preload: true
4
+ pin '@hotwired/turbo-rails', to: 'turbo.min.js', preload: true
4
5
  pin '@hotwired/stimulus', to: 'stimulus.min.js', preload: true
5
6
  pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js', preload: true
7
+ pin_all_from Essence::Engine.root.join('app/javascript/essence/controllers'), under: 'controllers',
8
+ to: 'essence/controllers'
6
9
  pin_all_from Essence::Engine.root.join('app/components'), under: 'components', to: ''
7
10
  pin '@floating-ui/dom', to: '@floating-ui--dom.js' # @1.6.11
8
11
  pin '@floating-ui/core', to: '@floating-ui--core.js' # @1.6.8
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ InlineSvg.configure do |config|
4
+ config.asset_finder = InlineSvg::PropshaftAssetFinder
5
+ end