lightning_ui_kit 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/Rakefile +2 -9
- data/app/assets/builds/lightning_ui_kit.css +31 -588
- data/app/assets/builds/lightning_ui_kit.js +2 -9
- data/app/assets/builds/lightning_ui_kit.js.map +4 -4
- data/app/assets/vendor/lightning_ui_kit.css +88 -582
- data/app/assets/vendor/lightning_ui_kit.js +2 -9
- data/app/components/lightning_ui_kit/button_component.html.erb +0 -4
- data/app/components/lightning_ui_kit/button_component.rb +3 -24
- data/app/components/lightning_ui_kit/checkbox_component.html.erb +7 -2
- data/app/components/lightning_ui_kit/checkbox_component.rb +0 -13
- data/app/components/lightning_ui_kit/dropdown_component.html.erb +1 -1
- data/app/components/lightning_ui_kit/dropdown_component.rb +1 -1
- data/app/components/lightning_ui_kit/dropzone_component.html.erb +38 -13
- data/app/components/lightning_ui_kit/dropzone_component.rb +16 -43
- data/app/components/lightning_ui_kit/file_input_component.html.erb +34 -4
- data/app/components/lightning_ui_kit/file_input_component.rb +20 -54
- data/app/components/lightning_ui_kit/input_component.html.erb +98 -14
- data/app/components/lightning_ui_kit/input_component.rb +19 -154
- data/app/components/lightning_ui_kit/modal_component.html.erb +2 -2
- data/app/components/lightning_ui_kit/select_component.html.erb +27 -6
- data/app/components/lightning_ui_kit/select_component.rb +23 -65
- data/app/components/lightning_ui_kit/textarea_component.html.erb +37 -5
- data/app/components/lightning_ui_kit/textarea_component.rb +17 -50
- data/app/javascript/lightning_ui_kit/controllers/modal_controller.js +1 -7
- data/app/javascript/lightning_ui_kit/index.js +0 -8
- data/config/deploy.yml +5 -2
- data/lib/lightning_ui_kit/engine.rb +6 -1
- data/lib/lightning_ui_kit/version.rb +1 -1
- metadata +17 -17
- data/app/components/lightning_ui_kit/combobox_component.html.erb +0 -137
- data/app/components/lightning_ui_kit/combobox_component.rb +0 -205
- data/app/components/lightning_ui_kit/layout_component.html.erb +0 -118
- data/app/components/lightning_ui_kit/layout_component.rb +0 -26
- data/app/components/lightning_ui_kit/sidebar_link_component.html.erb +0 -6
- data/app/components/lightning_ui_kit/sidebar_link_component.rb +0 -33
- data/app/components/lightning_ui_kit/sidebar_section_component.html.erb +0 -8
- data/app/components/lightning_ui_kit/sidebar_section_component.rb +0 -18
- data/app/components/lightning_ui_kit/tooltip_component.html.erb +0 -15
- data/app/components/lightning_ui_kit/tooltip_component.rb +0 -26
- data/app/javascript/lightning_ui_kit/controllers/combobox_controller.js +0 -704
- data/app/javascript/lightning_ui_kit/controllers/field_controller.js +0 -23
- data/app/javascript/lightning_ui_kit/controllers/layout_controller.js +0 -19
- data/app/javascript/lightning_ui_kit/controllers/tooltip_controller.js +0 -235
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
<%= tag.div data:, class:
|
|
2
|
-
|
|
1
|
+
<%= tag.div data:, class: "lui:[&>[data-slot=label]+[data-slot=control]]:mt-3 lui:[&>[data-slot=label]+[data-slot=description]]:mt-1 lui:[&>[data-slot=description]+[data-slot=control]]:mt-3 lui:[&>[data-slot=control]+[data-slot=description]]:mt-3 lui:[&>[data-slot=control]+[data-slot=error]]:mt-3 lui:*:data-[slot=label]:font-medium" do %>
|
|
2
|
+
<% if @label %>
|
|
3
|
+
<label data-slot="label" class="lui:text-base/6 lui:text-zinc-950 lui:select-none lui:data-disabled:opacity-50 lui:sm:text-sm/6">
|
|
4
|
+
<%= @label %>
|
|
5
|
+
</label>
|
|
6
|
+
<% end %>
|
|
3
7
|
<% if @description %>
|
|
4
|
-
<p data-slot="description" class="lui:text-base/6 lui:text-zinc-500 lui:data-disabled:opacity-50 lui:sm:text-sm/6"
|
|
8
|
+
<p data-slot="description" class="lui:text-base/6 lui:text-zinc-500 lui:data-disabled:opacity-50 lui:sm:text-sm/6">
|
|
5
9
|
<%= @description %>
|
|
6
10
|
</p>
|
|
7
11
|
<% end %>
|
|
8
|
-
<span data-slot="control"
|
|
9
|
-
|
|
12
|
+
<span data-slot="control"
|
|
13
|
+
class="lui:group lui:relative lui:block lui:w-full lui:before:absolute lui:before:inset-px lui:before:rounded-[calc(var(--radius-lg)-1px)] lui:before:bg-white lui:before:shadow-sm lui:after:pointer-events-none lui:after:absolute lui:after:inset-0 lui:after:rounded-lg lui:after:ring-transparent lui:after:ring-inset lui:focus:after:ring-2 lui:focus:after:ring-blue-500 lui:has-data-disabled:opacity-50 lui:has-data-disabled:before:bg-zinc-950/5 lui:has-data-disabled:before:shadow-none">
|
|
14
|
+
<% if @form %>
|
|
15
|
+
<%= @form.select(
|
|
16
|
+
@name,
|
|
17
|
+
@options_for_select,
|
|
18
|
+
{ multiple: @multiple },
|
|
19
|
+
class: "lui:relative lui:block lui:w-full lui:appearance-none lui:rounded-lg lui:py-[calc(--spacing(2.5)-1px)] lui:sm:py-[calc(--spacing(1.5)-1px)] lui:pr-[calc(--spacing(10)-1px)] lui:pl-[calc(--spacing(3.5)-1px)] lui:sm:pr-[calc(--spacing(9)-1px)] lui:sm:pl-[calc(--spacing(3)-1px)] lui:[&_optgroup]:font-semibold lui:text-base/6 lui:text-zinc-950 lui:placeholder:text-zinc-500 lui:sm:text-sm/6 lui:border lui:border-zinc-950/10 lui:hover:border-zinc-950/20 lui:bg-transparent lui:focus:outline-hidden lui:data-invalid:border-red-500 lui:data-invalid:hover:border-red-500 lui:data-disabled:border-zinc-950/20 lui:data-disabled:opacity-100",
|
|
20
|
+
data: select_data
|
|
21
|
+
) %>
|
|
22
|
+
<% else %>
|
|
23
|
+
<%= select_tag(
|
|
24
|
+
@name,
|
|
25
|
+
@options_for_select,
|
|
26
|
+
multiple: @multiple,
|
|
27
|
+
class: "lui:relative lui:block lui:w-full lui:appearance-none lui:rounded-lg lui:py-[calc(--spacing(2.5)-1px)] lui:sm:py-[calc(--spacing(1.5)-1px)] lui:pr-[calc(--spacing(10)-1px)] lui:pl-[calc(--spacing(3.5)-1px)] lui:sm:pr-[calc(--spacing(9)-1px)] lui:sm:pl-[calc(--spacing(3)-1px)] lui:[&_optgroup]:font-semibold lui:text-base/6 lui:text-zinc-950 lui:placeholder:text-zinc-500 lui:sm:text-sm/6 lui:border lui:border-zinc-950/10 lui:hover:border-zinc-950/20 lui:bg-transparent lui:focus:outline-hidden lui:data-invalid:border-red-500 lui:data-invalid:hover:border-red-500 lui:data-disabled:border-zinc-950/20 lui:data-disabled:opacity-100",
|
|
28
|
+
data: select_data
|
|
29
|
+
) %>
|
|
30
|
+
<% end %>
|
|
10
31
|
<span class="lui:pointer-events-none lui:absolute lui:inset-y-0 lui:right-0 lui:flex lui:items-center lui:pr-2">
|
|
11
|
-
<svg class="lui:size-5 lui:stroke-zinc-500 lui:sm:size-4 lui:forced-colors:stroke-[CanvasText]" viewBox="0 0 16 16" aria-hidden="true" fill="none">
|
|
32
|
+
<svg class="lui:size-5 lui:stroke-zinc-500 lui:group-has-data-disabled:stroke-zinc-600 lui:sm:size-4 lui:forced-colors:stroke-[CanvasText]" viewBox="0 0 16 16" aria-hidden="true" fill="none">
|
|
12
33
|
<path d="M5.75 10.75L8 13L10.25 10.75" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
13
34
|
<path d="M10.25 5.25L8 3L5.75 5.25" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
14
35
|
</svg>
|
|
@@ -15,83 +15,41 @@ class LightningUiKit::SelectComponent < LightningUiKit::BaseComponent
|
|
|
15
15
|
@options = options
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def classes
|
|
19
|
-
"lui:[&>[data-slot=label]+[data-slot=control]]:mt-3 lui:[&>[data-slot=label]+[data-slot=description]]:mt-1 lui:[&>[data-slot=description]+[data-slot=control]]:mt-3 lui:[&>[data-slot=control]+[data-slot=description]]:mt-3 lui:[&>[data-slot=control]+[data-slot=error]]:mt-3 lui:*:data-[slot=label]:font-medium"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
18
|
def data
|
|
23
|
-
|
|
19
|
+
default_data = {
|
|
20
|
+
slot: "field",
|
|
21
|
+
action: "click->switch#toggle",
|
|
22
|
+
controller: "select",
|
|
23
|
+
disabled: @disabled
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
default_data.merge(@options[:data] || {})
|
|
24
27
|
end
|
|
25
28
|
|
|
26
29
|
def select_data
|
|
27
|
-
{
|
|
28
|
-
|
|
30
|
+
{}.tap do |data|
|
|
31
|
+
if has_errors?
|
|
32
|
+
data[:invalid] = "true"
|
|
33
|
+
end
|
|
29
34
|
end
|
|
30
35
|
end
|
|
31
36
|
|
|
32
37
|
def control_data
|
|
33
|
-
{slot: "control"}.merge(@options[:control_data] || {}).
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
{slot: "control"}.merge(@options[:control_data] || {}).tap do |data|
|
|
39
|
+
if @disabled
|
|
40
|
+
data[:disabled] = "true"
|
|
41
|
+
end
|
|
42
|
+
if has_errors?
|
|
43
|
+
data[:invalid] = "true"
|
|
44
|
+
end
|
|
36
45
|
end
|
|
37
46
|
end
|
|
38
47
|
|
|
39
48
|
def error_data
|
|
40
|
-
{slot: "error"}.merge(@options[:error_data] || {}).
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def label_data
|
|
46
|
-
{slot: "label"}.merge(@options[:label_data] || {}).dup.tap do |data|
|
|
47
|
-
data[:disabled] = "true" if @disabled
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def description_data
|
|
52
|
-
{slot: "description"}.merge(@options[:description_data] || {}).dup.tap do |data|
|
|
53
|
-
data[:disabled] = "true" if @disabled
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def label_html_options
|
|
58
|
-
{
|
|
59
|
-
class: "lui:text-base/6 lui:text-zinc-950 lui:select-none lui:data-disabled:opacity-50 lui:sm:text-sm/6",
|
|
60
|
-
data: label_data
|
|
61
|
-
}
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def render_label
|
|
65
|
-
return unless @label
|
|
66
|
-
|
|
67
|
-
if @form
|
|
68
|
-
@form.label(@name, @label, **label_html_options)
|
|
69
|
-
else
|
|
70
|
-
helpers.label_tag(@name, @label, **label_html_options)
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def select_classes
|
|
75
|
-
"lui:relative lui:block lui:w-full lui:appearance-none lui:rounded-lg lui:py-[calc(--spacing(2.5)-1px)] lui:sm:py-[calc(--spacing(1.5)-1px)] lui:pr-[calc(--spacing(10)-1px)] lui:pl-[calc(--spacing(3.5)-1px)] lui:sm:pr-[calc(--spacing(9)-1px)] lui:sm:pl-[calc(--spacing(3)-1px)] lui:[&_optgroup]:font-semibold lui:text-base/6 lui:text-zinc-950 lui:placeholder:text-zinc-500 lui:sm:text-sm/6 lui:border lui:border-zinc-950/10 lui:data-[hover]:border-zinc-950/20 lui:bg-transparent lui:focus:outline-hidden lui:data-invalid:border-red-500 lui:data-invalid:data-[hover]:border-red-500 lui:data-disabled:border-zinc-950/20 lui:data-disabled:opacity-100"
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def control_classes
|
|
79
|
-
"lui:relative lui:block lui:w-full lui:before:pointer-events-none lui:before:absolute lui:before:inset-px lui:before:rounded-[7px] lui:before:bg-white lui:before:shadow-sm lui:after:pointer-events-none lui:after:absolute lui:after:inset-0 lui:after:rounded-lg lui:after:ring-inset lui:focus-within:after:ring-2 lui:focus-within:after:ring-blue-500 lui:has-data-disabled:opacity-50 lui:has-data-disabled:before:bg-zinc-950/5 lui:has-data-disabled:before:shadow-none"
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def select_html_options
|
|
83
|
-
{
|
|
84
|
-
multiple: @multiple,
|
|
85
|
-
class: select_classes,
|
|
86
|
-
data: select_data
|
|
87
|
-
}
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def render_select
|
|
91
|
-
if @form
|
|
92
|
-
@form.select(@name, @options_for_select, {}, select_html_options)
|
|
93
|
-
else
|
|
94
|
-
helpers.select_tag(@name, helpers.options_for_select(@options_for_select), select_html_options)
|
|
49
|
+
{slot: "error"}.merge(@options[:error_data] || {}).tap do |data|
|
|
50
|
+
if @disabled
|
|
51
|
+
data[:disabled] = "true"
|
|
52
|
+
end
|
|
95
53
|
end
|
|
96
54
|
end
|
|
97
55
|
end
|
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
class: "lui:[&>[data-slot=label]+[data-slot=control]]:mt-3 lui:[&>[data-slot=label]+[data-slot=description]]:mt-1
|
|
3
3
|
lui:[&>[data-slot=description]+[data-slot=control]]:mt-3 lui:[&>[data-slot=control]+[data-slot=description]]:mt-3
|
|
4
4
|
lui:[&>[data-slot=control]+[data-slot=error]]:mt-3 lui:*:data-[slot=label]:font-medium",
|
|
5
|
-
data:
|
|
5
|
+
data:
|
|
6
6
|
) do %>
|
|
7
|
-
|
|
7
|
+
<% if @label %>
|
|
8
|
+
<%= tag.label(
|
|
9
|
+
@label,
|
|
10
|
+
class: "lui:text-base/6 lui:text-zinc-950 lui:select-none lui:data-disabled:opacity-50 lui:sm:text-sm/6",
|
|
11
|
+
data: label_data
|
|
12
|
+
) %>
|
|
13
|
+
<% end %>
|
|
8
14
|
<% if @description %>
|
|
9
15
|
<%= tag.p(
|
|
10
16
|
@description,
|
|
@@ -12,9 +18,35 @@
|
|
|
12
18
|
data: description_data
|
|
13
19
|
) %>
|
|
14
20
|
<% end %>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
<% if @form %>
|
|
22
|
+
<span data-slot="control" class="lui:relative lui:block lui:w-full lui:before:absolute lui:before:inset-px lui:before:rounded-[calc(var(--radius-lg)-1px)] lui:before:bg-white lui:before:shadow-sm lui:after:pointer-events-none lui:after:absolute lui:after:inset-0 lui:after:rounded-lg lui:after:ring-transparent lui:after:ring-inset lui:sm:focus-within:after:ring-2 lui:sm:focus-within:after:ring-blue-500 lui:has-data-disabled:opacity-50 lui:has-data-disabled:before:bg-zinc-950/5 lui:has-data-disabled:before:shadow-none lui:has-data-invalid:before:shadow-red-500/10">
|
|
23
|
+
<%= @form.text_area(
|
|
24
|
+
@name,
|
|
25
|
+
value: @value,
|
|
26
|
+
rows: @rows,
|
|
27
|
+
cols: @cols,
|
|
28
|
+
multiple: @multiple,
|
|
29
|
+
data: input_data,
|
|
30
|
+
class: "lui:relative lui:block lui:w-full lui:appearance-none lui:rounded-lg lui:px-[calc(--spacing(3.5)-1px)] lui:py-[calc(--spacing(2.5)-1px)] lui:sm:px-[calc(--spacing(3)-1px)] lui:sm:py-[calc(--spacing(1.5)-1px)] lui:text-base/6 lui:text-zinc-950 lui:placeholder:text-zinc-500 lui:sm:text-sm/6 lui:border lui:border-zinc-950/10 lui:hover:border-zinc-950/20 lui:bg-transparent lui:focus:outline-hidden lui:data-invalid:border-red-500 lui:data-invalid:hover:border-red-500 lui:data-disabled:border-zinc-950/20",
|
|
31
|
+
disabled: @disabled,
|
|
32
|
+
autofocus: @autofocus
|
|
33
|
+
) %>
|
|
34
|
+
</span>
|
|
35
|
+
<% else %>
|
|
36
|
+
<span data-slot="control" class="lui:relative lui:block lui:w-full lui:before:absolute lui:before:inset-px lui:before:rounded-[calc(var(--radius-lg)-1px)] lui:before:bg-white lui:before:shadow-sm lui:after:pointer-events-none lui:after:absolute lui:after:inset-0 lui:after:rounded-lg lui:after:ring-transparent lui:after:ring-inset lui:sm:focus-within:after:ring-2 lui:sm:focus-within:after:ring-blue-500 lui:has-data-disabled:opacity-50 lui:has-data-disabled:before:bg-zinc-950/5 lui:has-data-disabled:before:shadow-none lui:has-data-invalid:before:shadow-red-500/10">
|
|
37
|
+
<%= text_area_tag(
|
|
38
|
+
@name,
|
|
39
|
+
@value,
|
|
40
|
+
rows: @rows,
|
|
41
|
+
cols: @cols,
|
|
42
|
+
multiple: @multiple,
|
|
43
|
+
data: input_data,
|
|
44
|
+
class: "lui:relative lui:block lui:w-full lui:appearance-none lui:rounded-lg lui:px-[calc(--spacing(3.5)-1px)] lui:py-[calc(--spacing(2.5)-1px)] lui:sm:px-[calc(--spacing(3)-1px)] lui:sm:py-[calc(--spacing(1.5)-1px)] lui:text-base/6 lui:text-zinc-950 lui:placeholder:text-zinc-500 lui:sm:text-sm/6 lui:border lui:border-zinc-950/10 lui:hover:border-zinc-950/20 lui:bg-transparent lui:focus:outline-hidden lui:data-invalid:border-red-500 lui:data-invalid:hover:border-red-500 lui:data-disabled:border-zinc-950/20",
|
|
45
|
+
disabled: @disabled,
|
|
46
|
+
autofocus: @autofocus
|
|
47
|
+
) %>
|
|
48
|
+
</span>
|
|
49
|
+
<% end %>
|
|
18
50
|
<% if has_errors? %>
|
|
19
51
|
<%= tag.p(
|
|
20
52
|
error_messages,
|
|
@@ -20,71 +20,38 @@ class LightningUiKit::TextareaComponent < LightningUiKit::BaseComponent
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def data
|
|
23
|
-
|
|
23
|
+
@options[:data] || {}
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def input_data
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
(@options[:input_data] || {}).tap do |data|
|
|
28
|
+
if has_errors?
|
|
29
|
+
data[:invalid] = "true"
|
|
30
|
+
end
|
|
29
31
|
end
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
def label_data
|
|
33
|
-
{slot: "label"}.merge(@options[:label_data] || {}).
|
|
34
|
-
|
|
35
|
+
{slot: "label"}.merge(@options[:label_data] || {}).tap do |data|
|
|
36
|
+
if @disabled
|
|
37
|
+
data[:disabled] = "true"
|
|
38
|
+
end
|
|
35
39
|
end
|
|
36
40
|
end
|
|
37
41
|
|
|
38
42
|
def description_data
|
|
39
|
-
{slot: "description"}.merge(@options[:description_data] || {}).
|
|
40
|
-
|
|
43
|
+
{slot: "description"}.merge(@options[:description_data] || {}).tap do |data|
|
|
44
|
+
if @disabled
|
|
45
|
+
data[:disabled] = "true"
|
|
46
|
+
end
|
|
41
47
|
end
|
|
42
48
|
end
|
|
43
49
|
|
|
44
50
|
def error_data
|
|
45
|
-
{slot: "error"}.merge(@options[:error_data] || {}).
|
|
46
|
-
|
|
51
|
+
{slot: "error"}.merge(@options[:error_data] || {}).tap do |data|
|
|
52
|
+
if @disabled
|
|
53
|
+
data[:disabled] = "true"
|
|
54
|
+
end
|
|
47
55
|
end
|
|
48
56
|
end
|
|
49
|
-
|
|
50
|
-
def label_html_options
|
|
51
|
-
{
|
|
52
|
-
class: "lui:text-base/6 lui:text-zinc-950 lui:select-none lui:data-disabled:opacity-50 lui:sm:text-sm/6",
|
|
53
|
-
data: label_data
|
|
54
|
-
}
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def render_label
|
|
58
|
-
return unless @label
|
|
59
|
-
|
|
60
|
-
if @form
|
|
61
|
-
@form.label(@name, @label, **label_html_options)
|
|
62
|
-
else
|
|
63
|
-
helpers.label_tag(@name, @label, **label_html_options)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def textarea_html_options
|
|
68
|
-
{
|
|
69
|
-
rows: @rows,
|
|
70
|
-
cols: @cols,
|
|
71
|
-
multiple: @multiple,
|
|
72
|
-
data: input_data,
|
|
73
|
-
class: "lui:relative lui:block lui:w-full lui:appearance-none lui:rounded-lg lui:px-[calc(--spacing(3.5)-1px)] lui:py-[calc(--spacing(2.5)-1px)] lui:sm:px-[calc(--spacing(3)-1px)] lui:sm:py-[calc(--spacing(1.5)-1px)] lui:text-base/6 lui:text-zinc-950 lui:placeholder:text-zinc-500 lui:sm:text-sm/6 lui:border lui:border-zinc-950/10 lui:data-[hover]:border-zinc-950/20 lui:bg-transparent lui:focus:outline-hidden lui:data-invalid:border-red-500 lui:data-invalid:data-[hover]:border-red-500 lui:data-disabled:border-zinc-950/20",
|
|
74
|
-
disabled: @disabled,
|
|
75
|
-
autofocus: @autofocus
|
|
76
|
-
}
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def render_textarea
|
|
80
|
-
if @form
|
|
81
|
-
@form.text_area(@name, **textarea_html_options)
|
|
82
|
-
else
|
|
83
|
-
helpers.text_area_tag(@name, @value, **textarea_html_options)
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def control_classes
|
|
88
|
-
"lui:relative lui:block lui:w-full lui:before:absolute lui:before:inset-px lui:before:rounded-[7px] lui:before:bg-white lui:before:shadow-sm lui:after:pointer-events-none lui:after:absolute lui:after:inset-0 lui:after:rounded-lg lui:after:ring-transparent lui:after:ring-inset lui:sm:focus-within:after:ring-2 lui:sm:focus-within:after:ring-blue-500 lui:has-data-disabled:opacity-50 lui:has-data-disabled:before:bg-zinc-950/5 lui:has-data-disabled:before:shadow-none lui:has-data-invalid:before:shadow-red-500/10"
|
|
89
|
-
end
|
|
90
57
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
|
2
2
|
|
|
3
3
|
export default class extends Controller {
|
|
4
|
-
static targets = ["dialog"
|
|
4
|
+
static targets = ["dialog"]
|
|
5
5
|
static values = {
|
|
6
6
|
open: Boolean
|
|
7
7
|
}
|
|
@@ -38,12 +38,6 @@ export default class extends Controller {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
closeOnBackdrop(event) {
|
|
42
|
-
if (this.hasPanelTarget && !this.panelTarget.contains(event.target)) {
|
|
43
|
-
this.close()
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
41
|
submitForm() {
|
|
48
42
|
this.dialogTarget.querySelector("form").requestSubmit()
|
|
49
43
|
}
|
|
@@ -11,7 +11,6 @@ window.Stimulus = application
|
|
|
11
11
|
import ClipboardController from './controllers/clipboard_controller'
|
|
12
12
|
import CheckboxController from './controllers/checkbox_controller'
|
|
13
13
|
import BannerController from './controllers/banner_controller'
|
|
14
|
-
import LayoutController from './controllers/layout_controller'
|
|
15
14
|
import MainController from './controllers/main_controller'
|
|
16
15
|
import AccordionController from './controllers/accordion_controller'
|
|
17
16
|
import ModalController from './controllers/modal_controller'
|
|
@@ -20,15 +19,11 @@ import SwitchController from './controllers/switch_controller'
|
|
|
20
19
|
import DropdownController from './controllers/dropdown_controller'
|
|
21
20
|
import DropzoneController from './controllers/dropzone_controller'
|
|
22
21
|
import ToastController from './controllers/toast_controller'
|
|
23
|
-
import TooltipController from './controllers/tooltip_controller'
|
|
24
|
-
import ComboboxController from './controllers/combobox_controller'
|
|
25
|
-
import FieldController from './controllers/field_controller'
|
|
26
22
|
|
|
27
23
|
export function registerLuiControllers(application) {
|
|
28
24
|
application.register(`${namespace}-clipboard`, ClipboardController)
|
|
29
25
|
application.register(`${namespace}-checkbox`, CheckboxController)
|
|
30
26
|
application.register(`${namespace}-banner`, BannerController)
|
|
31
|
-
application.register(`${namespace}-layout`, LayoutController)
|
|
32
27
|
application.register(`${namespace}-main`, MainController)
|
|
33
28
|
application.register(`${namespace}-accordion`, AccordionController)
|
|
34
29
|
application.register(`${namespace}-modal`, ModalController)
|
|
@@ -37,9 +32,6 @@ export function registerLuiControllers(application) {
|
|
|
37
32
|
application.register(`${namespace}-dropdown`, DropdownController)
|
|
38
33
|
application.register(`${namespace}-dropzone`, DropzoneController)
|
|
39
34
|
application.register(`${namespace}-toast`, ToastController)
|
|
40
|
-
application.register(`${namespace}-tooltip`, TooltipController)
|
|
41
|
-
application.register(`${namespace}-combobox`, ComboboxController)
|
|
42
|
-
application.register(`${namespace}-field`, FieldController)
|
|
43
35
|
}
|
|
44
36
|
registerLuiControllers(application)
|
|
45
37
|
|
data/config/deploy.yml
CHANGED
|
@@ -5,7 +5,10 @@ ssh:
|
|
|
5
5
|
user: www
|
|
6
6
|
|
|
7
7
|
registry:
|
|
8
|
-
server:
|
|
8
|
+
server: ghcr.io
|
|
9
|
+
username: k0va1
|
|
10
|
+
password:
|
|
11
|
+
- KAMAL_REGISTRY_PASSWORD
|
|
9
12
|
|
|
10
13
|
builder:
|
|
11
14
|
arch: amd64
|
|
@@ -34,8 +37,8 @@ env:
|
|
|
34
37
|
|
|
35
38
|
proxy:
|
|
36
39
|
ssl: false
|
|
37
|
-
host: ui.k0va1.dev
|
|
38
40
|
app_port: 8000
|
|
41
|
+
host: ui.lightningrails.xyz
|
|
39
42
|
forward_headers: true
|
|
40
43
|
healthcheck:
|
|
41
44
|
interval: 3
|
|
@@ -4,7 +4,12 @@ module LightningUiKit
|
|
|
4
4
|
class Engine < ::Rails::Engine
|
|
5
5
|
isolate_namespace LightningUiKit
|
|
6
6
|
|
|
7
|
-
config.
|
|
7
|
+
config.autoload_paths = %W[
|
|
8
|
+
#{root}/app/components
|
|
9
|
+
#{root}/app/helpers
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
initializer "lightning_ui_kit.helpers" do
|
|
8
13
|
ActiveSupport.on_load(:action_controller_base) do
|
|
9
14
|
helper LightningUiKit::ApplicationHelper
|
|
10
15
|
helper LightningUiKit::HeroiconHelper
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lightning_ui_kit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Koval
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-07-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -80,6 +80,20 @@ dependencies:
|
|
|
80
80
|
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec-rails
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
83
97
|
description: Lightning UI is a collection of UI components for Rails applications
|
|
84
98
|
email:
|
|
85
99
|
- al3xander.koval@gmail.com
|
|
@@ -109,8 +123,6 @@ files:
|
|
|
109
123
|
- app/components/lightning_ui_kit/button_component.rb
|
|
110
124
|
- app/components/lightning_ui_kit/checkbox_component.html.erb
|
|
111
125
|
- app/components/lightning_ui_kit/checkbox_component.rb
|
|
112
|
-
- app/components/lightning_ui_kit/combobox_component.html.erb
|
|
113
|
-
- app/components/lightning_ui_kit/combobox_component.rb
|
|
114
126
|
- app/components/lightning_ui_kit/description_list/item_component.html.erb
|
|
115
127
|
- app/components/lightning_ui_kit/description_list/item_component.rb
|
|
116
128
|
- app/components/lightning_ui_kit/description_list_component.html.erb
|
|
@@ -125,8 +137,6 @@ files:
|
|
|
125
137
|
- app/components/lightning_ui_kit/file_input_component.rb
|
|
126
138
|
- app/components/lightning_ui_kit/input_component.html.erb
|
|
127
139
|
- app/components/lightning_ui_kit/input_component.rb
|
|
128
|
-
- app/components/lightning_ui_kit/layout_component.html.erb
|
|
129
|
-
- app/components/lightning_ui_kit/layout_component.rb
|
|
130
140
|
- app/components/lightning_ui_kit/link_component.html.erb
|
|
131
141
|
- app/components/lightning_ui_kit/link_component.rb
|
|
132
142
|
- app/components/lightning_ui_kit/modal_component.html.erb
|
|
@@ -137,10 +147,6 @@ files:
|
|
|
137
147
|
- app/components/lightning_ui_kit/select_component.rb
|
|
138
148
|
- app/components/lightning_ui_kit/sidebar_component.html.erb
|
|
139
149
|
- app/components/lightning_ui_kit/sidebar_component.rb
|
|
140
|
-
- app/components/lightning_ui_kit/sidebar_link_component.html.erb
|
|
141
|
-
- app/components/lightning_ui_kit/sidebar_link_component.rb
|
|
142
|
-
- app/components/lightning_ui_kit/sidebar_section_component.html.erb
|
|
143
|
-
- app/components/lightning_ui_kit/sidebar_section_component.rb
|
|
144
150
|
- app/components/lightning_ui_kit/skeleton_component.html.erb
|
|
145
151
|
- app/components/lightning_ui_kit/skeleton_component.rb
|
|
146
152
|
- app/components/lightning_ui_kit/spinner_component.html.erb
|
|
@@ -157,25 +163,19 @@ files:
|
|
|
157
163
|
- app/components/lightning_ui_kit/textarea_component.rb
|
|
158
164
|
- app/components/lightning_ui_kit/toast_component.html.erb
|
|
159
165
|
- app/components/lightning_ui_kit/toast_component.rb
|
|
160
|
-
- app/components/lightning_ui_kit/tooltip_component.html.erb
|
|
161
|
-
- app/components/lightning_ui_kit/tooltip_component.rb
|
|
162
166
|
- app/helpers/lightning_ui_kit/application_helper.rb
|
|
163
167
|
- app/helpers/lightning_ui_kit/heroicon_helper.rb
|
|
164
168
|
- app/javascript/lightning_ui_kit/controllers/accordion_controller.js
|
|
165
169
|
- app/javascript/lightning_ui_kit/controllers/banner_controller.js
|
|
166
170
|
- app/javascript/lightning_ui_kit/controllers/checkbox_controller.js
|
|
167
171
|
- app/javascript/lightning_ui_kit/controllers/clipboard_controller.js
|
|
168
|
-
- app/javascript/lightning_ui_kit/controllers/combobox_controller.js
|
|
169
172
|
- app/javascript/lightning_ui_kit/controllers/dropdown_controller.js
|
|
170
173
|
- app/javascript/lightning_ui_kit/controllers/dropzone_controller.js
|
|
171
|
-
- app/javascript/lightning_ui_kit/controllers/field_controller.js
|
|
172
|
-
- app/javascript/lightning_ui_kit/controllers/layout_controller.js
|
|
173
174
|
- app/javascript/lightning_ui_kit/controllers/main_controller.js
|
|
174
175
|
- app/javascript/lightning_ui_kit/controllers/modal_controller.js
|
|
175
176
|
- app/javascript/lightning_ui_kit/controllers/reveal_controller.js
|
|
176
177
|
- app/javascript/lightning_ui_kit/controllers/switch_controller.js
|
|
177
178
|
- app/javascript/lightning_ui_kit/controllers/toast_controller.js
|
|
178
|
-
- app/javascript/lightning_ui_kit/controllers/tooltip_controller.js
|
|
179
179
|
- app/javascript/lightning_ui_kit/index.js
|
|
180
180
|
- config/deploy.yml
|
|
181
181
|
- config/initializers/heroicons.rb
|
|
@@ -189,7 +189,7 @@ licenses:
|
|
|
189
189
|
metadata:
|
|
190
190
|
homepage_uri: https://github.com/k0va1/lightning_ui_kit
|
|
191
191
|
source_code_uri: https://github.com/k0va1/lightning_ui_kit
|
|
192
|
-
changelog_uri: https://github.com/k0va1/lightning_ui_kit/blob/
|
|
192
|
+
changelog_uri: https://github.com/k0va1/lightning_ui_kit/blob/main/CHANGELOG.md
|
|
193
193
|
post_install_message:
|
|
194
194
|
rdoc_options: []
|
|
195
195
|
require_paths:
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
<%= tag.div(data:, class: classes) do %>
|
|
2
|
-
<% if @label %>
|
|
3
|
-
<%= tag.label(
|
|
4
|
-
@label,
|
|
5
|
-
class: "lui:text-base/6 lui:text-zinc-950 lui:select-none lui:data-disabled:opacity-50 lui:sm:text-sm/6",
|
|
6
|
-
data: label_data
|
|
7
|
-
) %>
|
|
8
|
-
<% end %>
|
|
9
|
-
|
|
10
|
-
<% if @description %>
|
|
11
|
-
<%= tag.p(
|
|
12
|
-
@description,
|
|
13
|
-
class: "lui:text-base/6 lui:text-zinc-500 lui:data-disabled:opacity-50 lui:sm:text-sm/6",
|
|
14
|
-
data: description_data
|
|
15
|
-
) %>
|
|
16
|
-
<% end %>
|
|
17
|
-
|
|
18
|
-
<div data-slot="control" class="lui:relative lui:w-full">
|
|
19
|
-
<% if @multiple %>
|
|
20
|
-
<%# Multiple selection: tags + input in a styled container %>
|
|
21
|
-
<div
|
|
22
|
-
class="lui:relative lui:flex lui:flex-wrap lui:items-center lui:gap-1.5 lui:w-full lui:min-h-[42px] lui:sm:min-h-[38px] lui:rounded-lg lui:border lui:border-zinc-950/10 lui:data-[hover]:border-zinc-950/20 lui:bg-white lui:shadow-sm lui:px-2 lui:py-1.5 lui:focus-within:ring-2 lui:focus-within:ring-blue-500 lui:focus-within:ring-offset-0 <%= 'lui:opacity-50' if @disabled %> <%= 'lui:border-red-500' if has_errors? %>"
|
|
23
|
-
data-lui-combobox-target="inputWrapper selectedTags"
|
|
24
|
-
>
|
|
25
|
-
<input
|
|
26
|
-
type="text"
|
|
27
|
-
role="combobox"
|
|
28
|
-
aria-autocomplete="list"
|
|
29
|
-
aria-expanded="false"
|
|
30
|
-
aria-haspopup="listbox"
|
|
31
|
-
autocomplete="off"
|
|
32
|
-
class="lui:flex-1 lui:min-w-[120px] lui:border-0 lui:bg-transparent lui:p-0 lui:text-base/6 lui:text-zinc-950 lui:placeholder:text-zinc-500 lui:sm:text-sm/6 lui:focus:outline-none lui:focus:ring-0"
|
|
33
|
-
placeholder="<%= @placeholder %>"
|
|
34
|
-
data-lui-combobox-target="input"
|
|
35
|
-
data-action="input->lui-combobox#onInput focus->lui-combobox#onFocus keydown->lui-combobox#onKeydown"
|
|
36
|
-
<%= "disabled" if @disabled %>
|
|
37
|
-
<%= "data-disabled=true" if @disabled %>
|
|
38
|
-
<%= "data-invalid=true" if has_errors? %>
|
|
39
|
-
/>
|
|
40
|
-
<span class="lui:pointer-events-none lui:flex lui:items-center">
|
|
41
|
-
<svg class="lui:size-5 lui:stroke-zinc-500 lui:sm:size-4" viewBox="0 0 16 16" aria-hidden="true" fill="none">
|
|
42
|
-
<path d="M5.75 10.75L8 13L10.25 10.75" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
43
|
-
<path d="M10.25 5.25L8 3L5.75 5.25" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
44
|
-
</svg>
|
|
45
|
-
</span>
|
|
46
|
-
</div>
|
|
47
|
-
<% else %>
|
|
48
|
-
<%# Single selection: standard input styling %>
|
|
49
|
-
<span class="lui:relative lui:block lui:w-full lui:before:absolute lui:before:inset-px lui:before:rounded-[7px] lui:before:bg-white lui:before:shadow-sm lui:after:pointer-events-none lui:after:absolute lui:after:inset-0 lui:after:rounded-lg lui:after:ring-transparent lui:after:ring-inset lui:sm:focus-within:after:ring-2 lui:sm:focus-within:after:ring-blue-500 lui:has-data-disabled:opacity-50 lui:has-data-disabled:before:bg-zinc-950/5 lui:has-data-disabled:before:shadow-none lui:has-data-invalid:before:shadow-red-500/10">
|
|
50
|
-
<input
|
|
51
|
-
type="text"
|
|
52
|
-
role="combobox"
|
|
53
|
-
aria-autocomplete="list"
|
|
54
|
-
aria-expanded="false"
|
|
55
|
-
aria-haspopup="listbox"
|
|
56
|
-
autocomplete="off"
|
|
57
|
-
class="<%= input_classes %>"
|
|
58
|
-
placeholder="<%= @placeholder %>"
|
|
59
|
-
data-lui-combobox-target="input"
|
|
60
|
-
data-action="input->lui-combobox#onInput focus->lui-combobox#onFocus keydown->lui-combobox#onKeydown"
|
|
61
|
-
<%= "disabled" if @disabled %>
|
|
62
|
-
<%= "data-disabled=true" if @disabled %>
|
|
63
|
-
<%= "data-invalid=true" if has_errors? %>
|
|
64
|
-
/>
|
|
65
|
-
<span class="lui:pointer-events-none lui:absolute lui:inset-y-0 lui:right-0 lui:flex lui:items-center lui:pr-2">
|
|
66
|
-
<svg class="lui:size-5 lui:stroke-zinc-500 lui:sm:size-4" viewBox="0 0 16 16" aria-hidden="true" fill="none">
|
|
67
|
-
<path d="M5.75 10.75L8 13L10.25 10.75" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
68
|
-
<path d="M10.25 5.25L8 3L5.75 5.25" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path>
|
|
69
|
-
</svg>
|
|
70
|
-
</span>
|
|
71
|
-
</span>
|
|
72
|
-
<% end %>
|
|
73
|
-
|
|
74
|
-
<%# Dropdown listbox %>
|
|
75
|
-
<div
|
|
76
|
-
data-lui-combobox-target="listbox"
|
|
77
|
-
role="listbox"
|
|
78
|
-
aria-label="<%= @label || 'Options' %>"
|
|
79
|
-
class="lui:hidden lui:absolute lui:z-50 lui:mt-1 lui:w-full lui:max-h-60 lui:overflow-auto lui:rounded-lg lui:bg-white lui:shadow-lg lui:ring-1 lui:ring-zinc-950/10"
|
|
80
|
-
>
|
|
81
|
-
<template data-lui-combobox-target="optionTemplate">
|
|
82
|
-
<div
|
|
83
|
-
role="option"
|
|
84
|
-
data-lui-combobox-target="option"
|
|
85
|
-
class="lui:relative lui:cursor-pointer lui:select-none lui:py-2 lui:px-3 lui:text-zinc-900 lui:hover:bg-zinc-100 lui:data-[selected]:bg-blue-50 lui:data-[highlighted]:bg-zinc-100 lui:data-[disabled]:opacity-50 lui:data-[disabled]:cursor-not-allowed"
|
|
86
|
-
data-action="click->lui-combobox#selectOption mouseenter->lui-combobox#highlightOption"
|
|
87
|
-
>
|
|
88
|
-
<span data-label class="lui:block lui:truncate"></span>
|
|
89
|
-
<span data-checkmark class="lui:hidden lui:absolute lui:inset-y-0 lui:right-0 lui:flex lui:items-center lui:pr-3 lui:text-blue-600">
|
|
90
|
-
<svg class="lui:size-5" viewBox="0 0 20 20" fill="currentColor">
|
|
91
|
-
<path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
|
|
92
|
-
</svg>
|
|
93
|
-
</span>
|
|
94
|
-
</div>
|
|
95
|
-
</template>
|
|
96
|
-
|
|
97
|
-
<div data-lui-combobox-target="optionsContainer"></div>
|
|
98
|
-
|
|
99
|
-
<div data-lui-combobox-target="loading" class="lui:hidden lui:py-2 lui:px-3 lui:text-zinc-500 lui:text-sm">
|
|
100
|
-
Loading...
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
<div data-lui-combobox-target="noResults" class="lui:hidden lui:py-2 lui:px-3 lui:text-zinc-500 lui:text-sm">
|
|
104
|
-
No results found
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
<% if @allow_custom %>
|
|
108
|
-
<div
|
|
109
|
-
data-lui-combobox-target="createOption"
|
|
110
|
-
class="lui:hidden lui:cursor-pointer lui:py-2 lui:px-3 lui:text-blue-600 lui:hover:bg-blue-50 lui:border-t lui:border-zinc-100 lui:flex lui:items-center lui:gap-1.5"
|
|
111
|
-
data-action="click->lui-combobox#createCustomOption"
|
|
112
|
-
>
|
|
113
|
-
<%= heroicon "plus", variant: :solid, options: { class: "lui:size-4" } %>
|
|
114
|
-
Create "<span data-lui-combobox-target="createOptionText"></span>"
|
|
115
|
-
</div>
|
|
116
|
-
<% end %>
|
|
117
|
-
</div>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<% if @multiple %>
|
|
121
|
-
<div data-lui-combobox-target="hiddenFields" data-name="<%= hidden_field_name %>"></div>
|
|
122
|
-
<% else %>
|
|
123
|
-
<% if @form %>
|
|
124
|
-
<%= @form.hidden_field(@name, data: { "lui-combobox-target" => "hiddenField" }, value: @selected) %>
|
|
125
|
-
<% else %>
|
|
126
|
-
<%= hidden_field_tag(@name, @selected, data: { "lui-combobox-target" => "hiddenField" }) %>
|
|
127
|
-
<% end %>
|
|
128
|
-
<% end %>
|
|
129
|
-
|
|
130
|
-
<% if has_errors? %>
|
|
131
|
-
<%= tag.p(
|
|
132
|
-
error_messages,
|
|
133
|
-
class: "lui:text-base/6 lui:text-red-600 lui:data-disabled:opacity-50 lui:sm:text-sm/6",
|
|
134
|
-
data: error_data
|
|
135
|
-
) %>
|
|
136
|
-
<% end %>
|
|
137
|
-
<% end %>
|