ariadne_view_components 0.0.12-x64-mingw32 → 0.0.13-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ariadne.d.ts +1 -0
- data/app/assets/javascripts/ariadne_view_components.js +2 -2
- data/app/assets/javascripts/ariadne_view_components.js.map +1 -1
- data/app/assets/javascripts/tab-container-component.d.ts +1 -0
- data/app/assets/javascripts/tab-nav-component.d.ts +9 -0
- data/app/components/ariadne/ariadne.ts +3 -0
- data/app/components/ariadne/body_component.rb +1 -1
- data/app/components/ariadne/button_component.rb +2 -2
- data/app/components/ariadne/comment_component.html.erb +2 -6
- data/app/components/ariadne/comment_component.rb +1 -1
- data/app/components/ariadne/component.rb +3 -5
- data/app/components/ariadne/container_component.rb +1 -1
- data/app/components/ariadne/counter_component.rb +1 -1
- data/app/components/ariadne/flash_component.rb +1 -1
- data/app/components/ariadne/flex_component.rb +1 -1
- data/app/components/ariadne/footer_component.rb +1 -1
- data/app/components/ariadne/grid_component.html.erb +2 -2
- data/app/components/ariadne/grid_component.rb +10 -8
- data/app/components/ariadne/header_component.rb +1 -1
- data/app/components/ariadne/heroicon_component.html.erb +1 -1
- data/app/components/ariadne/heroicon_component.rb +1 -2
- data/app/components/ariadne/list_component.html.erb +3 -5
- data/app/components/ariadne/list_component.rb +5 -5
- data/app/components/ariadne/main_component.rb +1 -1
- data/app/components/ariadne/narrow_container_component.rb +1 -1
- data/app/components/ariadne/panel_bar_component.rb +2 -2
- data/app/components/ariadne/pill_component.rb +1 -1
- data/app/components/ariadne/rich_text_area_component.html.erb +1 -1
- data/app/components/ariadne/rich_text_area_component.rb +1 -1
- data/app/components/ariadne/slideover_component.rb +2 -2
- data/app/components/ariadne/tab-container-component.ts +24 -0
- data/app/components/ariadne/tab-nav-component.ts +34 -0
- data/app/components/ariadne/tab_component.html.erb +2 -6
- data/app/components/ariadne/tab_component.rb +77 -18
- data/app/components/ariadne/tab_container_component.erb +12 -0
- data/app/components/ariadne/tab_container_component.rb +61 -0
- data/app/components/ariadne/tab_nav_component.html.erb +7 -0
- data/app/components/ariadne/tab_nav_component.rb +72 -0
- data/app/components/ariadne/table_component.html.erb +17 -0
- data/app/components/ariadne/table_component.rb +281 -0
- data/app/components/ariadne/time_ago_component.rb +1 -1
- data/app/components/ariadne/timeline_component.rb +1 -1
- data/app/lib/ariadne/fetch_or_fallback_helper.rb +11 -3
- data/app/lib/ariadne/icon_helper.rb +17 -13
- data/lib/ariadne/view_components/constants.rb +2 -2
- data/lib/ariadne/view_components/statuses.rb +2 -2
- data/lib/ariadne/view_components/version.rb +1 -1
- data/lib/rubocop/config/default.yml +1 -1
- data/lib/tasks/docs.rake +5 -96
- data/static/arguments.yml +51 -15
- data/static/audited_at.json +9 -1
- data/static/classes.yml +157 -269
- data/static/constants.json +55 -15
- data/static/statuses.json +9 -1
- data/tailwind.config.js +11 -26
- metadata +13 -10
- data/app/components/ariadne/tab_bar_component.html.erb +0 -3
- data/app/components/ariadne/tab_bar_component.rb +0 -45
- data/app/lib/ariadne/join_style_arguments_helper.rb +0 -14
- data/app/lib/ariadne/tab_nav_helper.rb +0 -35
- data/app/lib/ariadne/tabbed_component_helper.rb +0 -39
- data/app/lib/ariadne/test_selector_helper.rb +0 -20
- data/app/lib/ariadne/underline_nav_helper.rb +0 -44
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ariadne_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: x64-mingw32
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tailwind_merge
|
@@ -118,6 +118,8 @@ files:
|
|
118
118
|
- app/assets/javascripts/comment-component.d.ts
|
119
119
|
- app/assets/javascripts/rich-text-area-component.d.ts
|
120
120
|
- app/assets/javascripts/slideover-component.d.ts
|
121
|
+
- app/assets/javascripts/tab-container-component.d.ts
|
122
|
+
- app/assets/javascripts/tab-nav-component.d.ts
|
121
123
|
- app/assets/javascripts/time-ago-component.d.ts
|
122
124
|
- app/assets/javascripts/time_ago_component.d.ts
|
123
125
|
- app/assets/javascripts/tooltip-component.d.ts
|
@@ -175,10 +177,16 @@ files:
|
|
175
177
|
- app/components/ariadne/slideover-component.ts
|
176
178
|
- app/components/ariadne/slideover_component.html.erb
|
177
179
|
- app/components/ariadne/slideover_component.rb
|
178
|
-
- app/components/ariadne/
|
179
|
-
- app/components/ariadne/
|
180
|
+
- app/components/ariadne/tab-container-component.ts
|
181
|
+
- app/components/ariadne/tab-nav-component.ts
|
180
182
|
- app/components/ariadne/tab_component.html.erb
|
181
183
|
- app/components/ariadne/tab_component.rb
|
184
|
+
- app/components/ariadne/tab_container_component.erb
|
185
|
+
- app/components/ariadne/tab_container_component.rb
|
186
|
+
- app/components/ariadne/tab_nav_component.html.erb
|
187
|
+
- app/components/ariadne/tab_nav_component.rb
|
188
|
+
- app/components/ariadne/table_component.html.erb
|
189
|
+
- app/components/ariadne/table_component.rb
|
182
190
|
- app/components/ariadne/text.rb
|
183
191
|
- app/components/ariadne/time-ago-component.ts
|
184
192
|
- app/components/ariadne/time_ago_component.rb
|
@@ -193,13 +201,8 @@ files:
|
|
193
201
|
- app/lib/ariadne/fetch_or_fallback_helper.rb
|
194
202
|
- app/lib/ariadne/form_builder.rb
|
195
203
|
- app/lib/ariadne/icon_helper.rb
|
196
|
-
- app/lib/ariadne/join_style_arguments_helper.rb
|
197
204
|
- app/lib/ariadne/logger_helper.rb
|
198
205
|
- app/lib/ariadne/status/dsl.rb
|
199
|
-
- app/lib/ariadne/tab_nav_helper.rb
|
200
|
-
- app/lib/ariadne/tabbed_component_helper.rb
|
201
|
-
- app/lib/ariadne/test_selector_helper.rb
|
202
|
-
- app/lib/ariadne/underline_nav_helper.rb
|
203
206
|
- app/lib/ariadne/view_helper.rb
|
204
207
|
- exe/tailwindcss
|
205
208
|
- exe/x64-mingw32/tailwindcss
|
@@ -247,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
247
250
|
requirements:
|
248
251
|
- - ">="
|
249
252
|
- !ruby/object:Gem::Version
|
250
|
-
version: '3.
|
253
|
+
version: '3.1'
|
251
254
|
- - "<"
|
252
255
|
- !ruby/object:Gem::Version
|
253
256
|
version: '4.0'
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# A container for a row of tags.
|
5
|
-
# @accessibility This component requires you to pass in a `sr_label`
|
6
|
-
# attribute, which will be used to label the tabs for screen readers.
|
7
|
-
class TabBarComponent < Ariadne::Component
|
8
|
-
DEFAULT_TAG = :nav
|
9
|
-
TAG_OPTIONS = [DEFAULT_TAG].freeze
|
10
|
-
|
11
|
-
DEFAULT_CLASSES = "ariadne--mb-px ariadne-flex ariadne-space-x-8 ariadne-bg-transparent"
|
12
|
-
|
13
|
-
# Tabs to be rendered. For more information, refer to <%= link_to_component(Ariadne::TabComponent) %>.
|
14
|
-
#
|
15
|
-
# @param selected [Boolean] Whether the tab is selected.
|
16
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
17
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
18
|
-
renders_many :tabs, lambda { |selected: false, classes: "", attributes: {}|
|
19
|
-
Ariadne::TabComponent.new(
|
20
|
-
selected: selected,
|
21
|
-
classes: classes,
|
22
|
-
attributes: attributes
|
23
|
-
)
|
24
|
-
}
|
25
|
-
|
26
|
-
# @example Default
|
27
|
-
#
|
28
|
-
# <%= render(Ariadne::TabBarComponent.new(sr_label: "Navigation tabs")) { "Example" } %>
|
29
|
-
#
|
30
|
-
# @param tag [Symbol, String] The rendered tag name.
|
31
|
-
# @param sr_label [String] A label to introduce these tabs for screen readers.
|
32
|
-
# @param classes [String] <%= link_to_classes_docs %>
|
33
|
-
# @param attributes [Hash] <%= link_to_attributes_docs %>
|
34
|
-
def initialize(tag: DEFAULT_TAG, sr_label:, classes: "", attributes: {})
|
35
|
-
@tag = check_incoming_tag(DEFAULT_TAG, tag)
|
36
|
-
@classes = class_names(
|
37
|
-
DEFAULT_CLASSES,
|
38
|
-
classes
|
39
|
-
)
|
40
|
-
@sr_label = sr_label
|
41
|
-
@attributes = attributes
|
42
|
-
@attributes[:"aria-label"] ||= "Tabs"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# :nodoc:
|
5
|
-
module JoinStyleArgumentsHelper
|
6
|
-
# Join two `style` arguments
|
7
|
-
#
|
8
|
-
# join_style_arguments("width: 100%", "height: 100%") =>
|
9
|
-
# "width: 100%;height: 100%"
|
10
|
-
def join_style_arguments(*args)
|
11
|
-
args.compact.join(";")
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Ariadne
|
6
|
-
# Helper to share tab validation logic between components.
|
7
|
-
# The component will raise an error if there are 0 or 2+ selected tabs.
|
8
|
-
module TabNavHelper
|
9
|
-
extend ActiveSupport::Concern
|
10
|
-
|
11
|
-
EXTRA_ALIGN_DEFAULT = :left
|
12
|
-
EXTRA_ALIGN_OPTIONS = [EXTRA_ALIGN_DEFAULT, :right].freeze
|
13
|
-
|
14
|
-
def tab_nav_tab_classes(classes)
|
15
|
-
class_names(
|
16
|
-
"tabnav-tab",
|
17
|
-
classes
|
18
|
-
)
|
19
|
-
end
|
20
|
-
|
21
|
-
def tab_nav_classes(classes)
|
22
|
-
class_names(
|
23
|
-
"tabnav",
|
24
|
-
classes
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def tab_nav_body_classes(classes)
|
29
|
-
class_names(
|
30
|
-
"tabnav-tabs",
|
31
|
-
classes
|
32
|
-
)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Ariadne
|
6
|
-
# Helper to share tab validation logic between components.
|
7
|
-
# The component will raise an error if there are 0 or 2+ selected tabs.
|
8
|
-
module TabbedComponentHelper
|
9
|
-
extend ActiveSupport::Concern
|
10
|
-
|
11
|
-
class MultipleSelectedTabsError < StandardError; end
|
12
|
-
|
13
|
-
def before_render
|
14
|
-
validate_single_selected_tab unless Rails.env.production?
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def aria_label_for_page_nav(label)
|
20
|
-
@attributes[:tag] == :nav ? @attributes[:"aria-label"] = label : @body_arguments[:"aria-label"] = label
|
21
|
-
end
|
22
|
-
|
23
|
-
def tab_container_wrapper(with_panel:, **attributes)
|
24
|
-
return yield unless with_panel
|
25
|
-
|
26
|
-
render(Ariadne::TabContainerComponent.new(**attributes)) do
|
27
|
-
yield if block_given?
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def validate_single_selected_tab
|
32
|
-
raise MultipleSelectedTabsError, "only one tab can be selected" if selected_tabs_count > 1
|
33
|
-
end
|
34
|
-
|
35
|
-
def selected_tabs_count
|
36
|
-
@selected_tabs_count ||= tabs.count(&:selected)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Ariadne
|
4
|
-
# Module to allow components to deal with the `test_selector` argument.
|
5
|
-
# It will only add the selector if env is not Production.
|
6
|
-
#
|
7
|
-
# test_selector: "foo" => data-test-selector="foo"
|
8
|
-
module TestSelectorHelper
|
9
|
-
TEST_SELECTOR_TAG = :test_selector
|
10
|
-
|
11
|
-
def add_test_selector(args)
|
12
|
-
if args.key?(TEST_SELECTOR_TAG)
|
13
|
-
args[:data] ||= {}
|
14
|
-
args[:data][TEST_SELECTOR_TAG] = args[TEST_SELECTOR_TAG]
|
15
|
-
end
|
16
|
-
|
17
|
-
args.except(TEST_SELECTOR_TAG)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Ariadne
|
6
|
-
# Helper to share tab validation logic between components.
|
7
|
-
# The component will raise an error if there are 0 or 2+ selected tabs.
|
8
|
-
module UnderlineNavHelper
|
9
|
-
extend ActiveSupport::Concern
|
10
|
-
|
11
|
-
ALIGN_DEFAULT = :left
|
12
|
-
ALIGN_OPTIONS = [ALIGN_DEFAULT, :right].freeze
|
13
|
-
|
14
|
-
ACTIONS_TAG_DEFAULT = :div
|
15
|
-
ACTIONS_TAG_OPTIONS = [ACTIONS_TAG_DEFAULT, :span].freeze
|
16
|
-
|
17
|
-
def underline_nav_classes(classes, align)
|
18
|
-
class_names(
|
19
|
-
classes,
|
20
|
-
"UnderlineNav",
|
21
|
-
"UnderlineNav--right" => align == :right
|
22
|
-
)
|
23
|
-
end
|
24
|
-
|
25
|
-
def underline_nav_body_classes(classes)
|
26
|
-
class_names(
|
27
|
-
"UnderlineNav-body",
|
28
|
-
classes,
|
29
|
-
"list-style-none"
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
def underline_nav_action_classes(classes)
|
34
|
-
class_names("UnderlineNav-actions", classes)
|
35
|
-
end
|
36
|
-
|
37
|
-
def underline_nav_tab_classes(classes)
|
38
|
-
class_names(
|
39
|
-
"UnderlineNav-item",
|
40
|
-
classes
|
41
|
-
)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|