lightning_ui_kit 0.3.2 → 0.3.4
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 +2 -2
- data/app/assets/stylesheets/lightning_ui_kit/application.css +1 -0
- data/app/assets/stylesheets/lightning_ui_kit/themes.css +15 -2
- data/app/assets/vendor/lightning_ui_kit.css +3568 -0
- data/app/assets/vendor/lightning_ui_kit.js +12 -0
- data/app/components/lightning_ui_kit/accordion/item_component.html.erb +30 -0
- data/app/components/lightning_ui_kit/accordion/item_component.rb +13 -0
- data/app/components/lightning_ui_kit/accordion_component.html.erb +5 -0
- data/app/components/lightning_ui_kit/accordion_component.rb +22 -0
- data/app/components/lightning_ui_kit/alert_component.html.erb +14 -3
- data/app/components/lightning_ui_kit/alert_component.rb +58 -5
- data/app/components/lightning_ui_kit/card_component.html.erb +34 -0
- data/app/components/lightning_ui_kit/card_component.rb +22 -0
- data/app/components/lightning_ui_kit/layout_component.html.erb +3 -3
- data/app/components/lightning_ui_kit/radio_group/option_component.html.erb +1 -0
- data/app/components/lightning_ui_kit/radio_group/option_component.rb +14 -0
- data/app/components/lightning_ui_kit/radio_group_component.html.erb +60 -0
- data/app/components/lightning_ui_kit/radio_group_component.rb +70 -0
- data/app/components/lightning_ui_kit/tabs/tab_component.html.erb +1 -0
- data/app/components/lightning_ui_kit/tabs/tab_component.rb +8 -0
- data/app/components/lightning_ui_kit/tabs_component.html.erb +30 -0
- data/app/components/lightning_ui_kit/tabs_component.rb +65 -0
- data/app/javascript/lightning_ui_kit/controllers/radio_group_controller.js +74 -0
- data/app/javascript/lightning_ui_kit/controllers/tabs_controller.js +77 -0
- data/app/javascript/lightning_ui_kit/index.js +6 -2
- data/lib/lightning_ui_kit/builder.rb +16 -4
- data/lib/lightning_ui_kit/version.rb +1 -1
- metadata +20 -4
- data/app/components/lightning_ui_kit/banner_component.html.erb +0 -17
- data/app/components/lightning_ui_kit/banner_component.rb +0 -33
- /data/app/javascript/lightning_ui_kit/controllers/{banner_controller.js → alert_controller.js} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
class LightningUiKit::RadioGroupComponent < LightningUiKit::BaseComponent
|
|
2
|
+
include LightningUiKit::Errors
|
|
3
|
+
include LightningUiKit::Labelable
|
|
4
|
+
|
|
5
|
+
renders_many :options, LightningUiKit::RadioGroup::OptionComponent
|
|
6
|
+
|
|
7
|
+
def initialize(name:, label: nil, form: nil, error: nil, description: nil, selected: nil, disabled: false, **options)
|
|
8
|
+
@name = name
|
|
9
|
+
@label = label
|
|
10
|
+
@form = form
|
|
11
|
+
@error = error
|
|
12
|
+
@description = description
|
|
13
|
+
@selected = selected
|
|
14
|
+
@disabled = disabled
|
|
15
|
+
@options = options
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def classes
|
|
19
|
+
merge_classes([
|
|
20
|
+
"lui:[&>[data-slot=label]+[data-slot=description]]:mt-1 lui:[&>[data-slot=label]+[data-slot=options]]:mt-3 lui:[&>[data-slot=description]+[data-slot=options]]:mt-3 lui:[&>[data-slot=options]+[data-slot=error]]:mt-3 lui:*:data-[slot=label]:font-medium",
|
|
21
|
+
@options[:class]
|
|
22
|
+
].compact.join(" "))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def data
|
|
26
|
+
{
|
|
27
|
+
controller: "lui-radio-group"
|
|
28
|
+
}.merge(@options[:data] || {})
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def label_data
|
|
32
|
+
{slot: "label"}.tap do |data|
|
|
33
|
+
data[:disabled] = "true" if @disabled
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def description_data
|
|
38
|
+
{slot: "description"}.tap do |data|
|
|
39
|
+
data[:disabled] = "true" if @disabled
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def error_data
|
|
44
|
+
{slot: "error"}.tap do |data|
|
|
45
|
+
data[:disabled] = "true" if @disabled
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def render_label
|
|
50
|
+
return unless render_label?
|
|
51
|
+
|
|
52
|
+
tag.label(
|
|
53
|
+
effective_label,
|
|
54
|
+
class: "lui:text-base/6 lui:text-foreground lui:select-none lui:data-disabled:opacity-50 lui:sm:text-sm/6",
|
|
55
|
+
data: label_data
|
|
56
|
+
)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def render_hidden_field
|
|
60
|
+
if @form
|
|
61
|
+
@form.hidden_field(@name, value: @selected, data: {lui_radio_group_target: "field"})
|
|
62
|
+
else
|
|
63
|
+
helpers.hidden_field_tag(@name, @selected, data: {lui_radio_group_target: "field"})
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def selected?(value)
|
|
68
|
+
@selected.to_s == value.to_s
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= content %>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<%= tag.div(class: classes, data: data) do %>
|
|
2
|
+
<div role="tablist" class="<%= list_classes %>">
|
|
3
|
+
<% tabs.each_with_index do |tab, index| %>
|
|
4
|
+
<button
|
|
5
|
+
type="button"
|
|
6
|
+
role="tab"
|
|
7
|
+
id="<%= tab_id(index) %>"
|
|
8
|
+
aria-controls="<%= panel_id(index) %>"
|
|
9
|
+
aria-selected="<%= index == @default_tab %>"
|
|
10
|
+
class="<%= tab_classes %>"
|
|
11
|
+
data-lui-tabs-target="tab"
|
|
12
|
+
data-action="click->lui-tabs#select"
|
|
13
|
+
>
|
|
14
|
+
<%= tab.title %>
|
|
15
|
+
</button>
|
|
16
|
+
<% end %>
|
|
17
|
+
</div>
|
|
18
|
+
<% tabs.each_with_index do |tab, index| %>
|
|
19
|
+
<div
|
|
20
|
+
role="tabpanel"
|
|
21
|
+
id="<%= panel_id(index) %>"
|
|
22
|
+
aria-labelledby="<%= tab_id(index) %>"
|
|
23
|
+
class="lui:flex-1 lui:outline-hidden lui:hidden"
|
|
24
|
+
tabindex="0"
|
|
25
|
+
data-lui-tabs-target="panel"
|
|
26
|
+
>
|
|
27
|
+
<%= tab %>
|
|
28
|
+
</div>
|
|
29
|
+
<% end %>
|
|
30
|
+
<% end %>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
class LightningUiKit::TabsComponent < LightningUiKit::BaseComponent
|
|
2
|
+
renders_many :tabs, LightningUiKit::Tabs::TabComponent
|
|
3
|
+
|
|
4
|
+
VARIANTS = %i[default line].freeze
|
|
5
|
+
|
|
6
|
+
def initialize(default_tab: 0, variant: :default, **options)
|
|
7
|
+
@default_tab = default_tab
|
|
8
|
+
@variant = VARIANTS.include?(variant) ? variant : :default
|
|
9
|
+
@options = options
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def classes
|
|
13
|
+
merge_classes([
|
|
14
|
+
"lui:flex lui:flex-col lui:gap-2 lui:w-full",
|
|
15
|
+
@options[:class]
|
|
16
|
+
].compact.join(" "))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def data
|
|
20
|
+
{
|
|
21
|
+
controller: "lui-tabs",
|
|
22
|
+
lui_tabs_default_tab_value: @default_tab
|
|
23
|
+
}.merge(@options[:data] || {})
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def list_classes
|
|
27
|
+
base = "lui:inline-flex lui:w-fit lui:items-center lui:justify-center lui:text-foreground-muted"
|
|
28
|
+
case @variant
|
|
29
|
+
when :line
|
|
30
|
+
"#{base} lui:gap-1 lui:rounded-none lui:bg-transparent"
|
|
31
|
+
else
|
|
32
|
+
"#{base} lui:h-9 lui:rounded-lg lui:bg-surface-tertiary lui:p-[3px]"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def tab_classes
|
|
37
|
+
base = "lui:relative lui:inline-flex lui:items-center lui:justify-center lui:gap-1.5 lui:rounded-md lui:px-3 lui:py-1 lui:text-sm lui:font-medium lui:whitespace-nowrap lui:cursor-pointer " \
|
|
38
|
+
"lui:transition-all lui:duration-150 " \
|
|
39
|
+
"lui:text-foreground-muted lui:hover:text-foreground " \
|
|
40
|
+
"lui:focus:outline-hidden lui:focus-visible:outline lui:focus-visible:outline-2 lui:focus-visible:outline-offset-[-2px] lui:focus-visible:outline-focus " \
|
|
41
|
+
"lui:disabled:pointer-events-none lui:disabled:opacity-50"
|
|
42
|
+
|
|
43
|
+
case @variant
|
|
44
|
+
when :line
|
|
45
|
+
"#{base} lui:bg-transparent lui:data-[active]:bg-transparent " \
|
|
46
|
+
"lui:data-[active]:text-foreground " \
|
|
47
|
+
"lui:after:absolute lui:after:inset-x-0 lui:after:bottom-[-5px] lui:after:h-0.5 lui:after:bg-foreground lui:after:opacity-0 lui:after:transition-opacity lui:data-[active]:after:opacity-100"
|
|
48
|
+
else
|
|
49
|
+
"#{base} lui:h-[calc(100%-1px)] lui:border lui:border-transparent " \
|
|
50
|
+
"lui:data-[active]:bg-surface lui:data-[active]:text-foreground lui:data-[active]:border-border lui:data-[active]:shadow-sm"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def line_variant?
|
|
55
|
+
@variant == :line
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def tab_id(index)
|
|
59
|
+
"tab-#{object_id}-#{index}"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def panel_id(index)
|
|
63
|
+
"panel-#{object_id}-#{index}"
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
|
|
3
|
+
export default class extends Controller {
|
|
4
|
+
static targets = ["field", "option"];
|
|
5
|
+
|
|
6
|
+
select(event) {
|
|
7
|
+
const option = event.currentTarget;
|
|
8
|
+
if (option.dataset.disabled !== undefined) return;
|
|
9
|
+
|
|
10
|
+
this.activate(option);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
keydown(event) {
|
|
14
|
+
const currentIndex = this.optionTargets.indexOf(event.currentTarget);
|
|
15
|
+
let newIndex;
|
|
16
|
+
|
|
17
|
+
switch (event.key) {
|
|
18
|
+
case "ArrowDown":
|
|
19
|
+
case "ArrowRight":
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
newIndex = this.nextEnabledIndex(currentIndex, 1);
|
|
22
|
+
break;
|
|
23
|
+
case "ArrowUp":
|
|
24
|
+
case "ArrowLeft":
|
|
25
|
+
event.preventDefault();
|
|
26
|
+
newIndex = this.nextEnabledIndex(currentIndex, -1);
|
|
27
|
+
break;
|
|
28
|
+
case " ":
|
|
29
|
+
case "Enter":
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
this.activate(event.currentTarget);
|
|
32
|
+
return;
|
|
33
|
+
default:
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (newIndex !== -1) {
|
|
38
|
+
this.activate(this.optionTargets[newIndex]);
|
|
39
|
+
this.optionTargets[newIndex].focus();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
activate(option) {
|
|
44
|
+
const value = option.dataset.value;
|
|
45
|
+
|
|
46
|
+
this.optionTargets.forEach((opt) => {
|
|
47
|
+
if (opt === option) {
|
|
48
|
+
opt.dataset.checked = "";
|
|
49
|
+
opt.setAttribute("aria-checked", "true");
|
|
50
|
+
opt.setAttribute("tabindex", "0");
|
|
51
|
+
} else {
|
|
52
|
+
delete opt.dataset.checked;
|
|
53
|
+
opt.setAttribute("aria-checked", "false");
|
|
54
|
+
opt.setAttribute("tabindex", "-1");
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
this.fieldTarget.value = value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
nextEnabledIndex(currentIndex, direction) {
|
|
62
|
+
const length = this.optionTargets.length;
|
|
63
|
+
let index = currentIndex;
|
|
64
|
+
|
|
65
|
+
for (let i = 0; i < length; i++) {
|
|
66
|
+
index = (index + direction + length) % length;
|
|
67
|
+
if (this.optionTargets[index].dataset.disabled === undefined) {
|
|
68
|
+
return index;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return -1;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
|
|
3
|
+
export default class extends Controller {
|
|
4
|
+
static targets = ["tab", "panel"];
|
|
5
|
+
static values = {
|
|
6
|
+
defaultTab: { type: Number, default: 0 }
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
connect() {
|
|
10
|
+
this.activate(this.defaultTabValue);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
select(event) {
|
|
14
|
+
event.preventDefault();
|
|
15
|
+
const index = this.tabTargets.indexOf(event.currentTarget);
|
|
16
|
+
if (index !== -1) {
|
|
17
|
+
this.activate(index);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
activate(index) {
|
|
22
|
+
this.tabTargets.forEach((tab, i) => {
|
|
23
|
+
if (i === index) {
|
|
24
|
+
tab.dataset.active = "";
|
|
25
|
+
tab.setAttribute("aria-selected", "true");
|
|
26
|
+
tab.setAttribute("tabindex", "0");
|
|
27
|
+
} else {
|
|
28
|
+
delete tab.dataset.active;
|
|
29
|
+
tab.setAttribute("aria-selected", "false");
|
|
30
|
+
tab.setAttribute("tabindex", "-1");
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
this.panelTargets.forEach((panel, i) => {
|
|
35
|
+
if (i === index) {
|
|
36
|
+
panel.classList.remove("lui:hidden");
|
|
37
|
+
} else {
|
|
38
|
+
panel.classList.add("lui:hidden");
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
tabTargetConnected() {
|
|
44
|
+
this.tabTargets.forEach((tab) => {
|
|
45
|
+
tab.addEventListener("keydown", this.handleKeydown.bind(this));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
handleKeydown(event) {
|
|
50
|
+
const currentIndex = this.tabTargets.indexOf(event.currentTarget);
|
|
51
|
+
let newIndex;
|
|
52
|
+
|
|
53
|
+
switch (event.key) {
|
|
54
|
+
case "ArrowLeft":
|
|
55
|
+
event.preventDefault();
|
|
56
|
+
newIndex = currentIndex === 0 ? this.tabTargets.length - 1 : currentIndex - 1;
|
|
57
|
+
break;
|
|
58
|
+
case "ArrowRight":
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
newIndex = currentIndex === this.tabTargets.length - 1 ? 0 : currentIndex + 1;
|
|
61
|
+
break;
|
|
62
|
+
case "Home":
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
newIndex = 0;
|
|
65
|
+
break;
|
|
66
|
+
case "End":
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
newIndex = this.tabTargets.length - 1;
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.activate(newIndex);
|
|
75
|
+
this.tabTargets[newIndex].focus();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -10,7 +10,7 @@ window.Stimulus = application
|
|
|
10
10
|
|
|
11
11
|
import ClipboardController from './controllers/clipboard_controller'
|
|
12
12
|
import CheckboxController from './controllers/checkbox_controller'
|
|
13
|
-
import
|
|
13
|
+
import AlertController from './controllers/alert_controller'
|
|
14
14
|
import LayoutController from './controllers/layout_controller'
|
|
15
15
|
import MainController from './controllers/main_controller'
|
|
16
16
|
import AccordionController from './controllers/accordion_controller'
|
|
@@ -23,11 +23,13 @@ import ToastController from './controllers/toast_controller'
|
|
|
23
23
|
import TooltipController from './controllers/tooltip_controller'
|
|
24
24
|
import ComboboxController from './controllers/combobox_controller'
|
|
25
25
|
import FieldController from './controllers/field_controller'
|
|
26
|
+
import TabsController from './controllers/tabs_controller'
|
|
27
|
+
import RadioGroupController from './controllers/radio_group_controller'
|
|
26
28
|
|
|
27
29
|
export function registerLuiControllers(application) {
|
|
28
30
|
application.register(`${namespace}-clipboard`, ClipboardController)
|
|
29
31
|
application.register(`${namespace}-checkbox`, CheckboxController)
|
|
30
|
-
application.register(`${namespace}-
|
|
32
|
+
application.register(`${namespace}-alert`, AlertController)
|
|
31
33
|
application.register(`${namespace}-layout`, LayoutController)
|
|
32
34
|
application.register(`${namespace}-main`, MainController)
|
|
33
35
|
application.register(`${namespace}-accordion`, AccordionController)
|
|
@@ -40,6 +42,8 @@ export function registerLuiControllers(application) {
|
|
|
40
42
|
application.register(`${namespace}-tooltip`, TooltipController)
|
|
41
43
|
application.register(`${namespace}-combobox`, ComboboxController)
|
|
42
44
|
application.register(`${namespace}-field`, FieldController)
|
|
45
|
+
application.register(`${namespace}-tabs`, TabsController)
|
|
46
|
+
application.register(`${namespace}-radio-group`, RadioGroupController)
|
|
43
47
|
}
|
|
44
48
|
registerLuiControllers(application)
|
|
45
49
|
|
|
@@ -4,6 +4,10 @@ module LightningUiKit
|
|
|
4
4
|
@view_context = view_context
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
def accordion(*, **, &block)
|
|
8
|
+
render(AccordionComponent.new(*, **), &block)
|
|
9
|
+
end
|
|
10
|
+
|
|
7
11
|
def alert(*, **, &block)
|
|
8
12
|
render(AlertComponent.new(*, **), &block)
|
|
9
13
|
end
|
|
@@ -16,14 +20,14 @@ module LightningUiKit
|
|
|
16
20
|
render(BadgeComponent.new(*, **), &block)
|
|
17
21
|
end
|
|
18
22
|
|
|
19
|
-
def banner(*, **, &block)
|
|
20
|
-
render(BannerComponent.new(*, **), &block)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
23
|
def button(*, **, &block)
|
|
24
24
|
render(ButtonComponent.new(*, **), &block)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def card(*, **, &block)
|
|
28
|
+
render(CardComponent.new(*, **), &block)
|
|
29
|
+
end
|
|
30
|
+
|
|
27
31
|
def checkbox(*, **, &block)
|
|
28
32
|
render(CheckboxComponent.new(*, **), &block)
|
|
29
33
|
end
|
|
@@ -68,6 +72,10 @@ module LightningUiKit
|
|
|
68
72
|
render(PaginationComponent.new(*, **), &block)
|
|
69
73
|
end
|
|
70
74
|
|
|
75
|
+
def radio_group(*, **, &block)
|
|
76
|
+
render(RadioGroupComponent.new(*, **), &block)
|
|
77
|
+
end
|
|
78
|
+
|
|
71
79
|
def select(*, **, &block)
|
|
72
80
|
render(SelectComponent.new(*, **), &block)
|
|
73
81
|
end
|
|
@@ -100,6 +108,10 @@ module LightningUiKit
|
|
|
100
108
|
render(TableComponent.new(*, **), &block)
|
|
101
109
|
end
|
|
102
110
|
|
|
111
|
+
def tabs(*, **, &block)
|
|
112
|
+
render(TabsComponent.new(*, **), &block)
|
|
113
|
+
end
|
|
114
|
+
|
|
103
115
|
def text(*, **, &block)
|
|
104
116
|
render(TextComponent.new(*, **), &block)
|
|
105
117
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lightning_ui_kit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Koval
|
|
@@ -91,17 +91,23 @@ files:
|
|
|
91
91
|
- Rakefile
|
|
92
92
|
- app/assets/stylesheets/lightning_ui_kit/application.css
|
|
93
93
|
- app/assets/stylesheets/lightning_ui_kit/themes.css
|
|
94
|
+
- app/assets/vendor/lightning_ui_kit.css
|
|
95
|
+
- app/assets/vendor/lightning_ui_kit.js
|
|
96
|
+
- app/components/lightning_ui_kit/accordion/item_component.html.erb
|
|
97
|
+
- app/components/lightning_ui_kit/accordion/item_component.rb
|
|
98
|
+
- app/components/lightning_ui_kit/accordion_component.html.erb
|
|
99
|
+
- app/components/lightning_ui_kit/accordion_component.rb
|
|
94
100
|
- app/components/lightning_ui_kit/alert_component.html.erb
|
|
95
101
|
- app/components/lightning_ui_kit/alert_component.rb
|
|
96
102
|
- app/components/lightning_ui_kit/avatar_component.html.erb
|
|
97
103
|
- app/components/lightning_ui_kit/avatar_component.rb
|
|
98
104
|
- app/components/lightning_ui_kit/badge_component.html.erb
|
|
99
105
|
- app/components/lightning_ui_kit/badge_component.rb
|
|
100
|
-
- app/components/lightning_ui_kit/banner_component.html.erb
|
|
101
|
-
- app/components/lightning_ui_kit/banner_component.rb
|
|
102
106
|
- app/components/lightning_ui_kit/base_component.rb
|
|
103
107
|
- app/components/lightning_ui_kit/button_component.html.erb
|
|
104
108
|
- app/components/lightning_ui_kit/button_component.rb
|
|
109
|
+
- app/components/lightning_ui_kit/card_component.html.erb
|
|
110
|
+
- app/components/lightning_ui_kit/card_component.rb
|
|
105
111
|
- app/components/lightning_ui_kit/checkbox_component.html.erb
|
|
106
112
|
- app/components/lightning_ui_kit/checkbox_component.rb
|
|
107
113
|
- app/components/lightning_ui_kit/combobox_component.html.erb
|
|
@@ -129,6 +135,10 @@ files:
|
|
|
129
135
|
- app/components/lightning_ui_kit/modal_component.rb
|
|
130
136
|
- app/components/lightning_ui_kit/pagination_component.html.erb
|
|
131
137
|
- app/components/lightning_ui_kit/pagination_component.rb
|
|
138
|
+
- app/components/lightning_ui_kit/radio_group/option_component.html.erb
|
|
139
|
+
- app/components/lightning_ui_kit/radio_group/option_component.rb
|
|
140
|
+
- app/components/lightning_ui_kit/radio_group_component.html.erb
|
|
141
|
+
- app/components/lightning_ui_kit/radio_group_component.rb
|
|
132
142
|
- app/components/lightning_ui_kit/select_component.html.erb
|
|
133
143
|
- app/components/lightning_ui_kit/select_component.rb
|
|
134
144
|
- app/components/lightning_ui_kit/sidebar_component.html.erb
|
|
@@ -147,6 +157,10 @@ files:
|
|
|
147
157
|
- app/components/lightning_ui_kit/table/column_component.rb
|
|
148
158
|
- app/components/lightning_ui_kit/table_component.html.erb
|
|
149
159
|
- app/components/lightning_ui_kit/table_component.rb
|
|
160
|
+
- app/components/lightning_ui_kit/tabs/tab_component.html.erb
|
|
161
|
+
- app/components/lightning_ui_kit/tabs/tab_component.rb
|
|
162
|
+
- app/components/lightning_ui_kit/tabs_component.html.erb
|
|
163
|
+
- app/components/lightning_ui_kit/tabs_component.rb
|
|
150
164
|
- app/components/lightning_ui_kit/text_component.html.erb
|
|
151
165
|
- app/components/lightning_ui_kit/text_component.rb
|
|
152
166
|
- app/components/lightning_ui_kit/textarea_component.html.erb
|
|
@@ -159,7 +173,7 @@ files:
|
|
|
159
173
|
- app/helpers/lightning_ui_kit/component_helper.rb
|
|
160
174
|
- app/helpers/lightning_ui_kit/heroicon_helper.rb
|
|
161
175
|
- app/javascript/lightning_ui_kit/controllers/accordion_controller.js
|
|
162
|
-
- app/javascript/lightning_ui_kit/controllers/
|
|
176
|
+
- app/javascript/lightning_ui_kit/controllers/alert_controller.js
|
|
163
177
|
- app/javascript/lightning_ui_kit/controllers/checkbox_controller.js
|
|
164
178
|
- app/javascript/lightning_ui_kit/controllers/clipboard_controller.js
|
|
165
179
|
- app/javascript/lightning_ui_kit/controllers/combobox_controller.js
|
|
@@ -169,8 +183,10 @@ files:
|
|
|
169
183
|
- app/javascript/lightning_ui_kit/controllers/layout_controller.js
|
|
170
184
|
- app/javascript/lightning_ui_kit/controllers/main_controller.js
|
|
171
185
|
- app/javascript/lightning_ui_kit/controllers/modal_controller.js
|
|
186
|
+
- app/javascript/lightning_ui_kit/controllers/radio_group_controller.js
|
|
172
187
|
- app/javascript/lightning_ui_kit/controllers/reveal_controller.js
|
|
173
188
|
- app/javascript/lightning_ui_kit/controllers/switch_controller.js
|
|
189
|
+
- app/javascript/lightning_ui_kit/controllers/tabs_controller.js
|
|
174
190
|
- app/javascript/lightning_ui_kit/controllers/toast_controller.js
|
|
175
191
|
- app/javascript/lightning_ui_kit/controllers/tooltip_controller.js
|
|
176
192
|
- app/javascript/lightning_ui_kit/index.js
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<%= tag.div(class: classes, data: { type: @type, controller: "lui-banner" }) do %>
|
|
2
|
-
<div data-slot="header" class="lui:flex lui:items-center lui:px-4 lui:py-3">
|
|
3
|
-
<%= heroicon(icon, variant: :outline, options: { class: "lui:shrink-0 lui:w-5 lui:h-5 lui:me-2" }) %>
|
|
4
|
-
<span class="lui:sr-only"><%= @type.to_s.humanize %></span>
|
|
5
|
-
<h3 class="lui:text-md lui:font-medium"><%= @title %></h3>
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<div class="lui:text-sm lui:text-neutral-text lui:p-4">
|
|
9
|
-
<%= content %>
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
<% if footer.present? %>
|
|
13
|
-
<div class="lui:p-4 lui:pt-0">
|
|
14
|
-
<%= footer %>
|
|
15
|
-
</div>
|
|
16
|
-
<% end %>
|
|
17
|
-
<% end %>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
class LightningUiKit::BannerComponent < LightningUiKit::BaseComponent
|
|
2
|
-
renders_one :footer
|
|
3
|
-
|
|
4
|
-
def initialize(title:, type: :info, **options)
|
|
5
|
-
@type = type
|
|
6
|
-
@title = title
|
|
7
|
-
@options = options
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def classes
|
|
11
|
-
type_classes = case @type
|
|
12
|
-
when :error
|
|
13
|
-
"lui:*:data-[slot=header]:bg-destructive/80 lui:*:data-[slot=header]:text-foreground-invert"
|
|
14
|
-
else
|
|
15
|
-
"lui:*:data-[slot=header]:bg-neutral-bg"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
merge_classes([default_classes, type_classes, @options[:class]].compact.join(" "))
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def icon
|
|
22
|
-
case @type
|
|
23
|
-
when :error
|
|
24
|
-
"exclamation-triangle"
|
|
25
|
-
else
|
|
26
|
-
"info-circle"
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def default_classes
|
|
31
|
-
"lui:border lui:border-border lui:rounded-lg lui:overflow-hidden lui:transition-opacity lui:duration-300 lui:ease-out lui:opacity-100"
|
|
32
|
-
end
|
|
33
|
-
end
|
/data/app/javascript/lightning_ui_kit/controllers/{banner_controller.js → alert_controller.js}
RENAMED
|
File without changes
|