element_component 0.6.0 → 0.7.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/AGENTS.md +3 -3
- data/README.md +339 -32
- data/examples/alert_example.rb +10 -10
- data/examples/badge_example.rb +63 -0
- data/examples/breadcrumb_example.rb +36 -0
- data/examples/button_example.rb +86 -0
- data/examples/button_group_example.rb +55 -0
- data/examples/card_example.rb +62 -0
- data/examples/carousel_example.rb +95 -0
- data/examples/close_button_example.rb +40 -0
- data/examples/dropdown_example.rb +123 -0
- data/examples/list_group_example.rb +60 -0
- data/examples/modal_example.rb +120 -0
- data/examples/nav_example.rb +75 -0
- data/examples/navbar_example.rb +96 -0
- data/examples/pagination_example.rb +47 -0
- data/examples/progress_example.rb +54 -0
- data/examples/spinner_example.rb +49 -0
- data/examples/table_example.rb +41 -0
- data/lib/element_component/components/alert.rb +3 -3
- data/lib/element_component/components/badge.rb +18 -0
- data/lib/element_component/components/breadcrumb/item.rb +29 -0
- data/lib/element_component/components/breadcrumb.rb +26 -0
- data/lib/element_component/components/button.rb +25 -0
- data/lib/element_component/components/button_group.rb +18 -0
- data/lib/element_component/components/card/body.rb +14 -0
- data/lib/element_component/components/card/footer.rb +14 -0
- data/lib/element_component/components/card/header.rb +14 -0
- data/lib/element_component/components/card/image.rb +17 -0
- data/lib/element_component/components/card/text.rb +14 -0
- data/lib/element_component/components/card/title.rb +14 -0
- data/lib/element_component/components/card.rb +21 -0
- data/lib/element_component/components/carousel/caption.rb +14 -0
- data/lib/element_component/components/carousel/item.rb +16 -0
- data/lib/element_component/components/carousel.rb +70 -0
- data/lib/element_component/components/close_button.rb +17 -0
- data/lib/element_component/components/dropdown/divider.rb +20 -0
- data/lib/element_component/components/dropdown/header.rb +22 -0
- data/lib/element_component/components/dropdown/item.rb +33 -0
- data/lib/element_component/components/dropdown/menu.rb +15 -0
- data/lib/element_component/components/dropdown.rb +43 -0
- data/lib/element_component/components/list_group/item.rb +23 -0
- data/lib/element_component/components/list_group.rb +18 -0
- data/lib/element_component/components/modal/body.rb +14 -0
- data/lib/element_component/components/modal/content.rb +14 -0
- data/lib/element_component/components/modal/dialog.rb +21 -0
- data/lib/element_component/components/modal/footer.rb +14 -0
- data/lib/element_component/components/modal/header.rb +16 -0
- data/lib/element_component/components/modal/title.rb +14 -0
- data/lib/element_component/components/modal.rb +42 -0
- data/lib/element_component/components/nav/item.rb +14 -0
- data/lib/element_component/components/nav/link.rb +18 -0
- data/lib/element_component/components/nav.rb +23 -0
- data/lib/element_component/components/navbar/brand.rb +15 -0
- data/lib/element_component/components/navbar/collapse.rb +16 -0
- data/lib/element_component/components/navbar/nav.rb +14 -0
- data/lib/element_component/components/navbar/toggler.rb +22 -0
- data/lib/element_component/components/navbar.rb +51 -0
- data/lib/element_component/components/pagination/item.rb +27 -0
- data/lib/element_component/components/pagination.rb +33 -0
- data/lib/element_component/components/progress/bar.rb +24 -0
- data/lib/element_component/components/progress.rb +17 -0
- data/lib/element_component/components/spinner.rb +19 -0
- data/lib/element_component/components/table.rb +21 -0
- data/lib/element_component/components.rb +16 -0
- data/lib/element_component/version.rb +1 -1
- metadata +61 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ElementComponent
|
|
4
|
+
module Components
|
|
5
|
+
class ProgressBar < Element
|
|
6
|
+
VALID_VARIANTS = %i[primary secondary success danger warning info light dark].freeze
|
|
7
|
+
|
|
8
|
+
def initialize(value: 0, variant: nil, striped: false, animated: false, **attributes, &block)
|
|
9
|
+
super("div", &block)
|
|
10
|
+
|
|
11
|
+
add_attribute(class: "progress-bar")
|
|
12
|
+
add_attribute(class: "bg-#{variant}") if variant
|
|
13
|
+
add_attribute(class: "progress-bar-striped") if striped
|
|
14
|
+
add_attribute(class: "progress-bar-animated") if animated
|
|
15
|
+
add_attribute(role: "progressbar")
|
|
16
|
+
add_attribute("aria-valuenow": value.to_s)
|
|
17
|
+
add_attribute("aria-valuemin": "0")
|
|
18
|
+
add_attribute("aria-valuemax": "100")
|
|
19
|
+
add_attribute(style: "width: #{value}%")
|
|
20
|
+
add_attribute(attributes) unless attributes.empty?
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "progress/bar"
|
|
4
|
+
|
|
5
|
+
module ElementComponent
|
|
6
|
+
module Components
|
|
7
|
+
class Progress < Element
|
|
8
|
+
def initialize(**attributes, &)
|
|
9
|
+
super("div", &)
|
|
10
|
+
|
|
11
|
+
add_attribute(class: "progress")
|
|
12
|
+
add_attribute(role: "progressbar")
|
|
13
|
+
add_attribute(attributes) unless attributes.empty?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ElementComponent
|
|
4
|
+
module Components
|
|
5
|
+
class Spinner < Element
|
|
6
|
+
VALID_VARIANTS = %i[primary secondary success danger warning info light dark].freeze
|
|
7
|
+
VALID_TYPES = %i[border grow].freeze
|
|
8
|
+
|
|
9
|
+
def initialize(type: :border, variant: nil, **attributes, &block)
|
|
10
|
+
super("div", &block)
|
|
11
|
+
|
|
12
|
+
add_attribute(class: "spinner-#{type}")
|
|
13
|
+
add_attribute(class: "text-#{variant}") if variant
|
|
14
|
+
add_attribute(role: "status")
|
|
15
|
+
add_attribute(attributes) unless attributes.empty?
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ElementComponent
|
|
4
|
+
module Components
|
|
5
|
+
class Table < Element
|
|
6
|
+
VALID_VARIANTS = %i[primary secondary success danger warning info light dark].freeze
|
|
7
|
+
|
|
8
|
+
def initialize(striped: false, bordered: false, hover: false, small: false, variant: nil, **attributes, &block)
|
|
9
|
+
super("table", &block)
|
|
10
|
+
|
|
11
|
+
add_attribute(class: "table")
|
|
12
|
+
add_attribute(class: "table-striped") if striped
|
|
13
|
+
add_attribute(class: "table-bordered") if bordered
|
|
14
|
+
add_attribute(class: "table-hover") if hover
|
|
15
|
+
add_attribute(class: "table-sm") if small
|
|
16
|
+
add_attribute(class: "table-#{variant}") if variant
|
|
17
|
+
add_attribute(attributes) unless attributes.empty?
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "components/alert"
|
|
4
|
+
require_relative "components/badge"
|
|
5
|
+
require_relative "components/breadcrumb"
|
|
6
|
+
require_relative "components/button"
|
|
7
|
+
require_relative "components/button_group"
|
|
8
|
+
require_relative "components/card"
|
|
9
|
+
require_relative "components/carousel"
|
|
10
|
+
require_relative "components/close_button"
|
|
11
|
+
require_relative "components/dropdown"
|
|
12
|
+
require_relative "components/list_group"
|
|
13
|
+
require_relative "components/modal"
|
|
14
|
+
require_relative "components/nav"
|
|
15
|
+
require_relative "components/navbar"
|
|
16
|
+
require_relative "components/pagination"
|
|
17
|
+
require_relative "components/progress"
|
|
18
|
+
require_relative "components/spinner"
|
|
19
|
+
require_relative "components/table"
|
|
4
20
|
|
|
5
21
|
module ElementComponent
|
|
6
22
|
module Components
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: element_component
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- João Paulo Correia
|
|
@@ -23,12 +23,72 @@ files:
|
|
|
23
23
|
- README.md
|
|
24
24
|
- Rakefile
|
|
25
25
|
- examples/alert_example.rb
|
|
26
|
+
- examples/badge_example.rb
|
|
27
|
+
- examples/breadcrumb_example.rb
|
|
28
|
+
- examples/button_example.rb
|
|
29
|
+
- examples/button_group_example.rb
|
|
30
|
+
- examples/card_example.rb
|
|
31
|
+
- examples/carousel_example.rb
|
|
32
|
+
- examples/close_button_example.rb
|
|
33
|
+
- examples/dropdown_example.rb
|
|
34
|
+
- examples/list_group_example.rb
|
|
35
|
+
- examples/modal_example.rb
|
|
36
|
+
- examples/nav_example.rb
|
|
37
|
+
- examples/navbar_example.rb
|
|
38
|
+
- examples/pagination_example.rb
|
|
39
|
+
- examples/progress_example.rb
|
|
40
|
+
- examples/spinner_example.rb
|
|
41
|
+
- examples/table_example.rb
|
|
26
42
|
- lib/element_component.rb
|
|
27
43
|
- lib/element_component/components.rb
|
|
28
44
|
- lib/element_component/components/alert.rb
|
|
29
45
|
- lib/element_component/components/alert/close_button.rb
|
|
30
46
|
- lib/element_component/components/alert/heading.rb
|
|
31
47
|
- lib/element_component/components/alert/link.rb
|
|
48
|
+
- lib/element_component/components/badge.rb
|
|
49
|
+
- lib/element_component/components/breadcrumb.rb
|
|
50
|
+
- lib/element_component/components/breadcrumb/item.rb
|
|
51
|
+
- lib/element_component/components/button.rb
|
|
52
|
+
- lib/element_component/components/button_group.rb
|
|
53
|
+
- lib/element_component/components/card.rb
|
|
54
|
+
- lib/element_component/components/card/body.rb
|
|
55
|
+
- lib/element_component/components/card/footer.rb
|
|
56
|
+
- lib/element_component/components/card/header.rb
|
|
57
|
+
- lib/element_component/components/card/image.rb
|
|
58
|
+
- lib/element_component/components/card/text.rb
|
|
59
|
+
- lib/element_component/components/card/title.rb
|
|
60
|
+
- lib/element_component/components/carousel.rb
|
|
61
|
+
- lib/element_component/components/carousel/caption.rb
|
|
62
|
+
- lib/element_component/components/carousel/item.rb
|
|
63
|
+
- lib/element_component/components/close_button.rb
|
|
64
|
+
- lib/element_component/components/dropdown.rb
|
|
65
|
+
- lib/element_component/components/dropdown/divider.rb
|
|
66
|
+
- lib/element_component/components/dropdown/header.rb
|
|
67
|
+
- lib/element_component/components/dropdown/item.rb
|
|
68
|
+
- lib/element_component/components/dropdown/menu.rb
|
|
69
|
+
- lib/element_component/components/list_group.rb
|
|
70
|
+
- lib/element_component/components/list_group/item.rb
|
|
71
|
+
- lib/element_component/components/modal.rb
|
|
72
|
+
- lib/element_component/components/modal/body.rb
|
|
73
|
+
- lib/element_component/components/modal/content.rb
|
|
74
|
+
- lib/element_component/components/modal/dialog.rb
|
|
75
|
+
- lib/element_component/components/modal/footer.rb
|
|
76
|
+
- lib/element_component/components/modal/header.rb
|
|
77
|
+
- lib/element_component/components/modal/title.rb
|
|
78
|
+
- lib/element_component/components/nav.rb
|
|
79
|
+
- lib/element_component/components/nav/item.rb
|
|
80
|
+
- lib/element_component/components/nav/link.rb
|
|
81
|
+
- lib/element_component/components/navbar.rb
|
|
82
|
+
- lib/element_component/components/navbar/brand.rb
|
|
83
|
+
- lib/element_component/components/navbar/collapse.rb
|
|
84
|
+
- lib/element_component/components/navbar/nav.rb
|
|
85
|
+
- lib/element_component/components/navbar/toggler.rb
|
|
86
|
+
- lib/element_component/components/pagination.rb
|
|
87
|
+
- lib/element_component/components/pagination/item.rb
|
|
88
|
+
- lib/element_component/components/progress.rb
|
|
89
|
+
- lib/element_component/components/progress/bar.rb
|
|
90
|
+
- lib/element_component/components/spinner.rb
|
|
91
|
+
- lib/element_component/components/table.rb
|
|
32
92
|
- lib/element_component/element.rb
|
|
33
93
|
- lib/element_component/version.rb
|
|
34
94
|
homepage: https://github.com/joaopaulocorreia/element_component
|