pulse_view_components 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 +7 -0
- data/CHANGELOG.md +88 -0
- data/LICENSE.txt +22 -0
- data/README.md +78 -0
- data/app/assets/builds/js/pulse_view_components.js +9543 -0
- data/app/assets/builds/js/pulse_view_components.js.map +7 -0
- data/app/assets/builds/pulse_view_components.css +1 -0
- data/app/assets/config/manifest.js +2 -0
- data/app/assets/images/pulse_view_components/icons/alert.svg +3 -0
- data/app/assets/images/pulse_view_components/icons/archive.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/arrow-both.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/arrow-down.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/arrow-left.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/arrow-right.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/arrow-switch.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/arrow-up.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/beaker.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/bell-slash.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/bell.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/bookmark-slash.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/bookmark.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/calendar.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/check-circle.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/check.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/chevron-down.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/circle.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/clock.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/close.svg +9 -0
- data/app/assets/images/pulse_view_components/icons/cloud.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/comment-discussion.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/comment.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/copy.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/database.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/dot.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/dots-outline.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/download.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/duplicate.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/eye.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/file-added.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/file-directory.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/file-media.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/file.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/filter.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/flame.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/gear.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/gift.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/globe.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/goal.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/graph.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/heart-fill.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/heart.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/history.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/home.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/hourglass.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/image.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/inbox.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/info.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/issue.svg +3 -0
- data/app/assets/images/pulse_view_components/icons/key.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/law.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/link-external.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/link.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/location.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/log.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/mail.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/mark-github.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/mark-jira.svg +3 -0
- data/app/assets/images/pulse_view_components/icons/megaphone.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/no-entry.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/note.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/organization.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/package.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/paintbrush.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/paperclip.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/paste.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/pencil.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/people.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/person-add.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/person.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/pin-slash.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/pin.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/play.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/plus-circle.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/plus.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/project.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/pulse.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/question.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/redo.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/reply.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/report.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/rss.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/ruby.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/search.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/share.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/shield.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/sliders.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/smiley.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/sort.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/sort_asc.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/sort_desc.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/stack.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/star-fill.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/star.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/stopwatch.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/sun.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/sync.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/table.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/tag.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/tasklist.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/telescope.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/three-bars.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/thumbsdown.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/thumbsup.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/tools.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/trash.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/trophy.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/undo.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/unlink.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/upload.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/x-circle.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/x.svg +1 -0
- data/app/assets/images/pulse_view_components/icons/zap.svg +1 -0
- data/app/assets/javascripts/pulse_view_components.js +0 -0
- data/app/assets/stylesheets/pulse_view_components/application.tailwind.css +10 -0
- data/app/components/pulse/action_list/divider.rb +35 -0
- data/app/components/pulse/action_list/form_wrapper.html.slim +9 -0
- data/app/components/pulse/action_list/form_wrapper.rb +63 -0
- data/app/components/pulse/action_list/heading.rb +52 -0
- data/app/components/pulse/action_list/item.html.slim +43 -0
- data/app/components/pulse/action_list/item.rb +319 -0
- data/app/components/pulse/action_list.css +568 -0
- data/app/components/pulse/action_list.rb +261 -0
- data/app/components/pulse/badge.rb +59 -0
- data/app/components/pulse/base_component.rb +36 -0
- data/app/components/pulse/blank_slate.html.slim +10 -0
- data/app/components/pulse/blank_slate.rb +19 -0
- data/app/components/pulse/blank_slate.yml +2 -0
- data/app/components/pulse/border_box/header.html.slim +4 -0
- data/app/components/pulse/border_box/header.rb +48 -0
- data/app/components/pulse/border_box.html.slim +10 -0
- data/app/components/pulse/border_box.rb +124 -0
- data/app/components/pulse/box.rb +17 -0
- data/app/components/pulse/breadcrumb_item.rb +40 -0
- data/app/components/pulse/breadcrumbs.html.slim +9 -0
- data/app/components/pulse/breadcrumbs.rb +17 -0
- data/app/components/pulse/button.rb +148 -0
- data/app/components/pulse/component.rb +99 -0
- data/app/components/pulse/conditional_wrapper.rb +21 -0
- data/app/components/pulse/content.rb +11 -0
- data/app/components/pulse/counter.css +10 -0
- data/app/components/pulse/counter.rb +107 -0
- data/app/components/pulse/flash.html.slim +9 -0
- data/app/components/pulse/flash.rb +52 -0
- data/app/components/pulse/forms/error_explanation.html.slim +8 -0
- data/app/components/pulse/forms/error_explanation.rb +36 -0
- data/app/components/pulse/icon.rb +30 -0
- data/app/components/pulse/label.html.slim +5 -0
- data/app/components/pulse/label.rb +42 -0
- data/app/components/pulse/layout.css +239 -0
- data/app/components/pulse/layout.html.slim +7 -0
- data/app/components/pulse/layout.rb +141 -0
- data/app/components/pulse/link.html.slim +7 -0
- data/app/components/pulse/link.rb +52 -0
- data/app/components/pulse/modal.html.slim +51 -0
- data/app/components/pulse/modal.rb +64 -0
- data/app/components/pulse/modal_controller.js +77 -0
- data/app/components/pulse/nav_link.html.slim +16 -0
- data/app/components/pulse/nav_link.rb +25 -0
- data/app/components/pulse/nav_list/divider.rb +13 -0
- data/app/components/pulse/nav_list/group.html.slim +6 -0
- data/app/components/pulse/nav_list/group.rb +110 -0
- data/app/components/pulse/nav_list/heading.rb +36 -0
- data/app/components/pulse/nav_list/item.rb +171 -0
- data/app/components/pulse/nav_list.html.slim +11 -0
- data/app/components/pulse/nav_list.rb +225 -0
- data/app/components/pulse/popover.html.slim +5 -0
- data/app/components/pulse/popover.rb +88 -0
- data/app/components/pulse/progress_bar.html.slim +5 -0
- data/app/components/pulse/progress_bar.rb +23 -0
- data/app/components/pulse/progress_bar.yml +2 -0
- data/app/components/pulse/table/cell.html.slim +10 -0
- data/app/components/pulse/table/cell.rb +90 -0
- data/app/components/pulse/table/cell.yml +5 -0
- data/app/components/pulse/table/column.rb +22 -0
- data/app/components/pulse/table.html.slim +50 -0
- data/app/components/pulse/table.rb +111 -0
- data/app/components/pulse/table.yml +2 -0
- data/app/components/pulse/text.rb +72 -0
- data/app/components/pulse/toast.html.slim +14 -0
- data/app/components/pulse/toast.rb +85 -0
- data/app/components/pulse/toast_controller.js +32 -0
- data/app/javascript/pulse_view_components/application.js +24 -0
- data/app/javascript/pulse_view_components.js +4 -0
- data/app/lib/pulse/attributes_helper.rb +107 -0
- data/app/lib/pulse/fetch_or_fallback_helper.rb +53 -0
- data/app/lib/pulse/svg_helper.rb +28 -0
- data/lib/pulse/view_components/engine.rb +74 -0
- data/lib/pulse/view_components/version.rb +17 -0
- data/lib/pulse/view_components.rb +14 -0
- data/lib/pulse_view_components.rb +3 -0
- data/lib/tasks/pulse_view_components_tasks.rake +8 -0
- data/previews/pulse/badge_preview.rb +51 -0
- data/previews/pulse/blank_slate_preview.rb +14 -0
- data/previews/pulse/border_box_preview.rb +48 -0
- data/previews/pulse/breadcrumbs_preview.rb +13 -0
- data/previews/pulse/button_preview.rb +137 -0
- data/previews/pulse/counter_preview.rb +14 -0
- data/previews/pulse/flash_preview.rb +85 -0
- data/previews/pulse/icon_preview.rb +12 -0
- data/previews/pulse/label_preview.rb +10 -0
- data/previews/pulse/layout_preview.rb +34 -0
- data/previews/pulse/link_preview.rb +55 -0
- data/previews/pulse/modal_preview.rb +48 -0
- data/previews/pulse/nav_link_preview.rb +48 -0
- data/previews/pulse/nav_list_preview.rb +138 -0
- data/previews/pulse/popover_preview.rb +77 -0
- data/previews/pulse/progress_bar_preview.rb +23 -0
- data/previews/pulse/table_preview.rb +168 -0
- data/previews/pulse/text_preview.rb +102 -0
- data/previews/pulse/toast_preview.rb +67 -0
- metadata +344 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# :nodoc:
|
|
5
|
+
class ModalPreview < ViewComponent::Preview
|
|
6
|
+
# @label Playground
|
|
7
|
+
# @param title text
|
|
8
|
+
# @param content text
|
|
9
|
+
# @param size select {{ Pulse::Modal::SIZE_OPTIONS }}
|
|
10
|
+
# @param close_button toggle
|
|
11
|
+
# @param close_on_esc toggle
|
|
12
|
+
# @param close_on_overlay_click toggle
|
|
13
|
+
# @param close_on_submit toggle
|
|
14
|
+
# @param auto_close toggle
|
|
15
|
+
def playground(
|
|
16
|
+
title: 'Modal title',
|
|
17
|
+
content: 'Modal content',
|
|
18
|
+
footer: 'Footer content',
|
|
19
|
+
size: Pulse::Modal::DEFAULT_SIZE,
|
|
20
|
+
close_button: true,
|
|
21
|
+
close_on_esc: true,
|
|
22
|
+
close_on_overlay_click: true,
|
|
23
|
+
close_on_submit: true,
|
|
24
|
+
auto_close: false
|
|
25
|
+
)
|
|
26
|
+
render Pulse::Modal.new(size:,
|
|
27
|
+
close_button:,
|
|
28
|
+
close_on_esc:,
|
|
29
|
+
close_on_overlay_click:,
|
|
30
|
+
close_on_submit:,
|
|
31
|
+
auto_close:) do |component|
|
|
32
|
+
component.with_title { title }
|
|
33
|
+
component.with_footer { footer }
|
|
34
|
+
content
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @label Default options
|
|
39
|
+
# @param title text
|
|
40
|
+
# @param content text
|
|
41
|
+
def default(title: 'Modal title', content: 'Modal content')
|
|
42
|
+
render Pulse::Modal.new do |component|
|
|
43
|
+
component.with_title { title }
|
|
44
|
+
content
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# :nodoc:
|
|
5
|
+
class NavLinkPreview < ViewComponent::Preview
|
|
6
|
+
# @label Playground
|
|
7
|
+
# @display bg_color "rgb(31 41 55)"
|
|
8
|
+
# @param label text
|
|
9
|
+
# @param path text
|
|
10
|
+
# @param active_mode select [inclusive, exclusive]
|
|
11
|
+
# @param variant select {{ Pulse::NavLink::VARIANT_OPTIONS }}
|
|
12
|
+
def playground(label: 'Link', path: '#', active_mode: :inclusive,
|
|
13
|
+
variant: :desktop)
|
|
14
|
+
render Pulse::NavLink.new(
|
|
15
|
+
label:,
|
|
16
|
+
path:,
|
|
17
|
+
active_mode:,
|
|
18
|
+
variant:
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @label Active
|
|
23
|
+
# @display bg_color "rgb(31 41 55)"
|
|
24
|
+
# @param label text
|
|
25
|
+
# @param variant select {{ Pulse::NavLink::VARIANT_OPTIONS }}
|
|
26
|
+
def active(label: 'Link', variant: :desktop)
|
|
27
|
+
render Pulse::NavLink.new(
|
|
28
|
+
label:,
|
|
29
|
+
path: '#',
|
|
30
|
+
active_mode: :inclusive,
|
|
31
|
+
variant:
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @label Inactive
|
|
36
|
+
# @display bg_color "rgb(31 41 55)"
|
|
37
|
+
# @param label text
|
|
38
|
+
# @param variant select {{ Pulse::NavLink::VARIANT_OPTIONS }}
|
|
39
|
+
def inactive(label: 'Link', variant: :desktop)
|
|
40
|
+
render Pulse::NavLink.new(
|
|
41
|
+
label:,
|
|
42
|
+
path: '/elsewhere',
|
|
43
|
+
active_mode: :inclusive,
|
|
44
|
+
variant:
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# @label NavList
|
|
5
|
+
class NavListPreview < ViewComponent::Preview
|
|
6
|
+
# @label default
|
|
7
|
+
def default
|
|
8
|
+
render Pulse::NavList.new do |list|
|
|
9
|
+
list.with_heading(title: 'Settings')
|
|
10
|
+
|
|
11
|
+
list.with_item(label: 'Access', href: '#') do |item|
|
|
12
|
+
item.with_leading_visual_icon(icon: :gear)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
list.with_item(label: 'More', href: '#') do |item|
|
|
16
|
+
item.with_leading_visual_icon(icon: :ruby)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
# # @label Playground
|
|
21
|
+
# def playground
|
|
22
|
+
# render(Pulse::NavList.new(selected_item_id: :collaborators)) do |list|
|
|
23
|
+
# list.with_heading(title: 'Repository settings')
|
|
24
|
+
|
|
25
|
+
# list.with_item(label: 'General', href: '/general') do |item|
|
|
26
|
+
# item.with_leading_visual_icon(icon: :gear)
|
|
27
|
+
# end
|
|
28
|
+
|
|
29
|
+
# list.with_group do |group|
|
|
30
|
+
# group.with_heading(title: 'Access')
|
|
31
|
+
|
|
32
|
+
# group.with_item(label: 'Collaborators and teams', href: '/collaborators',
|
|
33
|
+
# selected_by_ids: :collaborators) do |item|
|
|
34
|
+
# item.with_leading_visual_icon(icon: :people)
|
|
35
|
+
# end
|
|
36
|
+
|
|
37
|
+
# group.with_item(label: 'Moderation options') do |item|
|
|
38
|
+
# item.with_leading_visual_icon(icon: :'comment-discussion')
|
|
39
|
+
|
|
40
|
+
# item.with_item(label: 'Interaction limits', href: '/interaction-limits',
|
|
41
|
+
# selected_by_ids: :interaction_limits)
|
|
42
|
+
# item.with_item(label: 'Code review limits', href: '/review-limits', selected_by_ids: :code_review_limits)
|
|
43
|
+
# item.with_item(label: 'Reported content', href: '/reported-content', selected_by_ids: :reported_content)
|
|
44
|
+
# end
|
|
45
|
+
# end
|
|
46
|
+
# end
|
|
47
|
+
# end
|
|
48
|
+
|
|
49
|
+
# # @label Default
|
|
50
|
+
# def default
|
|
51
|
+
# render(Pulse::NavList.new(selected_item_id: :code_review_limits)) do |list|
|
|
52
|
+
# list.with_heading(title: 'Repository settings')
|
|
53
|
+
|
|
54
|
+
# list.with_item(label: 'General', href: '/general') do |item|
|
|
55
|
+
# item.with_leading_visual_icon(icon: :gear)
|
|
56
|
+
# end
|
|
57
|
+
|
|
58
|
+
# list.with_divider
|
|
59
|
+
|
|
60
|
+
# list.with_item(label: 'Settings', href: '/settings') do |item|
|
|
61
|
+
# item.with_leading_visual_icon(icon: :beaker)
|
|
62
|
+
# end
|
|
63
|
+
|
|
64
|
+
# list.with_group do |group|
|
|
65
|
+
# group.with_heading(title: 'Access')
|
|
66
|
+
|
|
67
|
+
# group.with_avatar_item(
|
|
68
|
+
# src: 'https://avatars.githubusercontent.com/u/103004183?v=4',
|
|
69
|
+
# username: 'hulk_smash',
|
|
70
|
+
# full_name: 'Bruce Banner',
|
|
71
|
+
# full_name_scheme: :inline,
|
|
72
|
+
# href: '/profile',
|
|
73
|
+
# avatar_arguments: { shape: :square }
|
|
74
|
+
# )
|
|
75
|
+
|
|
76
|
+
# group.with_item(label: 'Collaborators and teams', href: '/collaborators',
|
|
77
|
+
# selected_by_ids: :collaborators) do |item|
|
|
78
|
+
# item.with_leading_visual_icon(icon: :people)
|
|
79
|
+
# end
|
|
80
|
+
|
|
81
|
+
# group.with_item(label: 'Moderation options') do |item|
|
|
82
|
+
# item.with_leading_visual_icon(icon: :'comment-discussion')
|
|
83
|
+
|
|
84
|
+
# item.with_item(label: 'Interaction limits', href: '/interaction-limits',
|
|
85
|
+
# selected_by_ids: :interaction_limits)
|
|
86
|
+
# item.with_item(label: 'Code review limits', href: '/review-limits', selected_by_ids: :code_review_limits)
|
|
87
|
+
# item.with_item(label: 'Reported content', href: '/reported-content', selected_by_ids: :reported_content)
|
|
88
|
+
# end
|
|
89
|
+
# end
|
|
90
|
+
# end
|
|
91
|
+
# end
|
|
92
|
+
|
|
93
|
+
# # @label Top-level items
|
|
94
|
+
# #
|
|
95
|
+
# def top_level_items
|
|
96
|
+
# render(Pulse::NavList.new) do |list|
|
|
97
|
+
# list.with_heading(title: 'Account settings')
|
|
98
|
+
|
|
99
|
+
# list.with_item(label: 'General', href: '/general') do |item|
|
|
100
|
+
# item.with_leading_visual_icon(icon: :gear)
|
|
101
|
+
# end
|
|
102
|
+
|
|
103
|
+
# list.with_item(label: 'Billing', href: '/billing') do |item|
|
|
104
|
+
# item.with_leading_visual_icon(icon: :'credit-card')
|
|
105
|
+
# end
|
|
106
|
+
|
|
107
|
+
# list.with_item(label: 'Change password', href: '/change_password') do |item|
|
|
108
|
+
# item.with_leading_visual_icon(icon: :key)
|
|
109
|
+
# end
|
|
110
|
+
|
|
111
|
+
# list.with_avatar_item(
|
|
112
|
+
# src: 'https://avatars.githubusercontent.com/u/103004183?v=4',
|
|
113
|
+
# username: 'hulk_smash',
|
|
114
|
+
# full_name: 'Bruce Banner',
|
|
115
|
+
# full_name_scheme: :inline,
|
|
116
|
+
# href: '/profile'
|
|
117
|
+
# )
|
|
118
|
+
# end
|
|
119
|
+
# end
|
|
120
|
+
|
|
121
|
+
# # @label Show more item
|
|
122
|
+
# def show_more_item
|
|
123
|
+
# render(Pulse::NavList.new(aria: { label: 'My favorite foods' })) do |list|
|
|
124
|
+
# list.with_group do |group|
|
|
125
|
+
# group.with_heading(title: 'My favorite foods')
|
|
126
|
+
# group.with_item(label: 'Popplers', href: '/foods/popplers')
|
|
127
|
+
# group.with_item(label: 'Slurm', href: '/foods/slurm')
|
|
128
|
+
# group.with_show_more_item(label: 'Show more foods', src: UrlHelpers.nav_list_items_path, pages: 2) do |item|
|
|
129
|
+
# item.with_trailing_visual_icon(icon: :plus)
|
|
130
|
+
# end
|
|
131
|
+
# end
|
|
132
|
+
# end
|
|
133
|
+
# end
|
|
134
|
+
|
|
135
|
+
# # @label Trailing action
|
|
136
|
+
# def trailing_action; end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# @label Popover
|
|
5
|
+
class PopoverPreview < ViewComponent::Preview
|
|
6
|
+
# @label Playground
|
|
7
|
+
#
|
|
8
|
+
# @param caret [Symbol] select [top, right, bottom, left, top_right, top_left, bottom_right, bottom_left, left_bottom, left_top, right_bottom, right_top]
|
|
9
|
+
def playground(caret: :top)
|
|
10
|
+
render Pulse::Popover.new do |component|
|
|
11
|
+
component.with_heading do
|
|
12
|
+
'Popover Heading'
|
|
13
|
+
end
|
|
14
|
+
component.with_body(caret:) do
|
|
15
|
+
'This is the Popover body.'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @label Default
|
|
21
|
+
#
|
|
22
|
+
# @param caret [Symbol] select [top, right, bottom, left, top_right, top_left, bottom_right, bottom_left, left_bottom, left_top, right_bottom, right_top]
|
|
23
|
+
def default(caret: :top)
|
|
24
|
+
render Pulse::Popover.new do |component|
|
|
25
|
+
component.with_heading do
|
|
26
|
+
'Popover Heading'
|
|
27
|
+
end
|
|
28
|
+
component.with_body(caret:) do
|
|
29
|
+
'This is the Popover body.'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @label Large
|
|
35
|
+
def large
|
|
36
|
+
render Pulse::Popover.new do |component|
|
|
37
|
+
component.with_body(large: true) do
|
|
38
|
+
'This is a large Popover body.'
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @!group Directions
|
|
44
|
+
def bottom_right
|
|
45
|
+
render Pulse::Popover.new do |component|
|
|
46
|
+
component.with_body(caret: :bottom_right) do
|
|
47
|
+
'This is the Popover body.'
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def top_right
|
|
53
|
+
render Pulse::Popover.new do |component|
|
|
54
|
+
component.with_body(caret: :top_right) do
|
|
55
|
+
'This is the Popover body.'
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def bottom_left
|
|
61
|
+
render Pulse::Popover.new do |component|
|
|
62
|
+
component.with_body(caret: :bottom_left) do
|
|
63
|
+
'This is the Popover body.'
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def top_left
|
|
69
|
+
render Pulse::Popover.new do |component|
|
|
70
|
+
component.with_body(caret: :top_left) do
|
|
71
|
+
'This is the Popover body.'
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
# @!endgroup
|
|
76
|
+
end
|
|
77
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# @label ProgressBar
|
|
5
|
+
class ProgressBarPreview < ViewComponent::Preview
|
|
6
|
+
# @label Playground
|
|
7
|
+
#
|
|
8
|
+
# @display wrapper true
|
|
9
|
+
# @display wrapper_classes 'flex justify-center items-center p-4 bg-gray-50 h-10 w-24'
|
|
10
|
+
# @param percentage number
|
|
11
|
+
# @param title text
|
|
12
|
+
def playground(percentage: 50, title: nil)
|
|
13
|
+
render Pulse::ProgressBar.new(percentage:, title:)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# @label Default
|
|
17
|
+
#
|
|
18
|
+
# @param percentage number
|
|
19
|
+
def default(percentage: 50)
|
|
20
|
+
render Pulse::ProgressBar.new(percentage:)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# @label Table
|
|
5
|
+
class TablePreview < ViewComponent::Preview
|
|
6
|
+
COLLECTION = [
|
|
7
|
+
{ column1: 'A1', column2: 'A2', column3: 'A3' },
|
|
8
|
+
{ column1: 'B1', column2: 'B2', column3: 'B3' },
|
|
9
|
+
{ column1: 'C1', column2: 'C2', column3: 'C3' },
|
|
10
|
+
{ column1: 'D1', column2: 'D2', column3: 'D3' },
|
|
11
|
+
{ column1: 'E1', column2: 'E2', column3: 'E3' }
|
|
12
|
+
].freeze
|
|
13
|
+
|
|
14
|
+
# @label Playground
|
|
15
|
+
# def playground
|
|
16
|
+
# end
|
|
17
|
+
|
|
18
|
+
# @label Default options
|
|
19
|
+
def default
|
|
20
|
+
collection = ::Kaminari.paginate_array(COLLECTION).page(1).per(2)
|
|
21
|
+
render(Pulse::Table.new(collection)) do |c|
|
|
22
|
+
c.with_column(title: 'Column 1') do |row|
|
|
23
|
+
row[:column1]
|
|
24
|
+
end
|
|
25
|
+
c.with_column(title: 'Column 2') do |row|
|
|
26
|
+
row[:column2]
|
|
27
|
+
end
|
|
28
|
+
c.with_column do |row|
|
|
29
|
+
row[:column3]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def striped
|
|
35
|
+
render(Pulse::Table.new(COLLECTION, striped: true)) do |c|
|
|
36
|
+
c.with_column(title: 'Column 1') do |row|
|
|
37
|
+
row[:column1]
|
|
38
|
+
end
|
|
39
|
+
c.with_column(title: 'Column 2') do |row|
|
|
40
|
+
row[:column2]
|
|
41
|
+
end
|
|
42
|
+
c.with_column do |row|
|
|
43
|
+
row[:column3]
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def hoverable
|
|
49
|
+
render(Pulse::Table.new(COLLECTION, hoverable: true)) do |c|
|
|
50
|
+
c.with_column(title: 'Column 1') do |row|
|
|
51
|
+
row[:column1]
|
|
52
|
+
end
|
|
53
|
+
c.with_column(title: 'Column 2') do |row|
|
|
54
|
+
row[:column2]
|
|
55
|
+
end
|
|
56
|
+
c.with_column do |row|
|
|
57
|
+
row[:column3]
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def without_header
|
|
63
|
+
render(Pulse::Table.new(COLLECTION, header: false)) do |c|
|
|
64
|
+
c.with_column do |row|
|
|
65
|
+
row[:column1]
|
|
66
|
+
end
|
|
67
|
+
c.with_column do |row|
|
|
68
|
+
row[:column2]
|
|
69
|
+
end
|
|
70
|
+
c.with_column do |row|
|
|
71
|
+
row[:column3]
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def custom_table_classes
|
|
77
|
+
render(Pulse::Table.new(COLLECTION, classes: 'pulse-mt-4')) do |c|
|
|
78
|
+
c.with_column(title: 'Column 1') do |row|
|
|
79
|
+
row[:column1]
|
|
80
|
+
end
|
|
81
|
+
c.with_column(title: 'Column 2') do |row|
|
|
82
|
+
row[:column2]
|
|
83
|
+
end
|
|
84
|
+
c.with_column do |row|
|
|
85
|
+
row[:column3]
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def custom_head_classes
|
|
91
|
+
render(
|
|
92
|
+
Pulse::Table.new(COLLECTION, head_classes: 'pulse-bg-secondary-100')
|
|
93
|
+
) do |c|
|
|
94
|
+
c.with_column(title: 'Column 1') do |row|
|
|
95
|
+
row[:column1]
|
|
96
|
+
end
|
|
97
|
+
c.with_column(title: 'Column 2') do |row|
|
|
98
|
+
row[:column2]
|
|
99
|
+
end
|
|
100
|
+
c.with_column do |row|
|
|
101
|
+
row[:column3]
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def custom_row_classes
|
|
107
|
+
render(
|
|
108
|
+
Pulse::Table.new(COLLECTION, row_classes: 'pulse-bg-secondary-50')
|
|
109
|
+
) do |c|
|
|
110
|
+
c.with_column(title: 'Column 1') do |row|
|
|
111
|
+
row[:column1]
|
|
112
|
+
end
|
|
113
|
+
c.with_column(title: 'Column 2') do |row|
|
|
114
|
+
row[:column2]
|
|
115
|
+
end
|
|
116
|
+
c.with_column do |row|
|
|
117
|
+
row[:column3]
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def custom_column_classes
|
|
123
|
+
render(
|
|
124
|
+
Pulse::Table.new(COLLECTION)
|
|
125
|
+
) do |c|
|
|
126
|
+
c.with_column(title: 'Column 1',
|
|
127
|
+
classes: 'pulse-bg-secondary-50') do |row|
|
|
128
|
+
row[:column1]
|
|
129
|
+
end
|
|
130
|
+
c.with_column(title: 'Column 2', classes: 'pulse-text-primary') do |row|
|
|
131
|
+
row[:column2]
|
|
132
|
+
end
|
|
133
|
+
c.with_column(classes: 'pulse-font-bold') do |row|
|
|
134
|
+
row[:column3]
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def sortable
|
|
140
|
+
render(Pulse::Table.new(COLLECTION, current_sort_column: 'c2',
|
|
141
|
+
current_sort_direction: :desc)) do |c|
|
|
142
|
+
c.with_column(title: 'Column 1', sort_by: 'c1') do |row|
|
|
143
|
+
row[:column1]
|
|
144
|
+
end
|
|
145
|
+
c.with_column(title: 'Column 2', sort_by: 'c2') do |row|
|
|
146
|
+
row[:column2]
|
|
147
|
+
end
|
|
148
|
+
c.with_column do |row|
|
|
149
|
+
row[:column3]
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def with_footers
|
|
155
|
+
render(Pulse::Table.new(COLLECTION)) do |c|
|
|
156
|
+
c.with_column(title: 'Column 1') do |row|
|
|
157
|
+
row[:column1]
|
|
158
|
+
end
|
|
159
|
+
c.with_column(title: 'Column 2', footer: 'foot') do |row|
|
|
160
|
+
row[:column2]
|
|
161
|
+
end
|
|
162
|
+
c.with_column(footer: 'total') do |row|
|
|
163
|
+
row[:column3]
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# :nodoc:
|
|
5
|
+
class TextPreview < ViewComponent::Preview
|
|
6
|
+
# @param text text
|
|
7
|
+
# @param type select [h1, h2, h3, h4, subtitle, subtitle2, subtitle3,
|
|
8
|
+
# subtitle4, body1, body2, body3, body4, body5, body6, body7, body8,
|
|
9
|
+
# caption1, caption2]
|
|
10
|
+
# @param tag text
|
|
11
|
+
# @param classes text
|
|
12
|
+
def default(text: 'Welcome', type: :h1, tag: nil, classes: nil)
|
|
13
|
+
render Pulse::Text.new(
|
|
14
|
+
type:,
|
|
15
|
+
tag:,
|
|
16
|
+
classes:
|
|
17
|
+
) do
|
|
18
|
+
text
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def h1
|
|
23
|
+
render(Pulse::Text.new(type: :h1)) { 'Heading' }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def h2
|
|
27
|
+
render(Pulse::Text.new(type: :h2)) { 'Heading' }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def h3
|
|
31
|
+
render(Pulse::Text.new(type: :h3)) { 'Heading' }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def h4
|
|
35
|
+
render(Pulse::Text.new(type: :h4)) { 'Heading' }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def subtitle
|
|
39
|
+
render(Pulse::Text.new(type: :subtitle)) { 'Subtitle' }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def body1
|
|
43
|
+
render(Pulse::Text.new(type: :body1)) do
|
|
44
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia consequa.'
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def body2
|
|
49
|
+
render(Pulse::Text.new(type: :body2)) do
|
|
50
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia consequa.'
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def body3
|
|
55
|
+
render(Pulse::Text.new(type: :body3)) do
|
|
56
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia consequa.'
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def body4
|
|
61
|
+
render(Pulse::Text.new(type: :body4)) do
|
|
62
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia conseatr.'
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def body5
|
|
67
|
+
render(Pulse::Text.new(type: :body5)) do
|
|
68
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia consequa.'
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def body6
|
|
73
|
+
render(Pulse::Text.new(type: :body6)) do
|
|
74
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia consequa.'
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def body7
|
|
79
|
+
render(Pulse::Text.new(type: :body7)) do
|
|
80
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia consequa.'
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def body8
|
|
85
|
+
render(Pulse::Text.new(type: :body8)) do
|
|
86
|
+
'Lorem ipsum esse soluta voluptas maiores omnis nihil officia consequa.'
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def caption1
|
|
91
|
+
render(Pulse::Text.new(type: :caption1)) do
|
|
92
|
+
'At dolorem rerum ea cupiditate vel eos facilis ea beatae vitae tempor'
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def caption2
|
|
97
|
+
render(Pulse::Text.new(type: :caption2)) do
|
|
98
|
+
'At dolorem rerum ea cupiditate vel eos facilis ea beatae vitae tempoe.'
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pulse
|
|
4
|
+
# :nodoc:
|
|
5
|
+
class ToastPreview < ViewComponent::Preview
|
|
6
|
+
# @label Playground
|
|
7
|
+
# @param theme [Symbol] select [[Default, ~], [Error, error], [Success, success]]
|
|
8
|
+
# @param auto_hide toggle
|
|
9
|
+
# @param text text
|
|
10
|
+
def default(auto_hide: true, theme: :default, text: 'A default toast.')
|
|
11
|
+
render Pulse::Toast.new(auto_hide:, theme:) do |c|
|
|
12
|
+
c.with_action(url: 'https://www.jamieoliver.com/snacks/') do
|
|
13
|
+
'Undo'
|
|
14
|
+
end
|
|
15
|
+
text
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# @label Default
|
|
20
|
+
def default_theme
|
|
21
|
+
render Pulse::Toast.new do |c|
|
|
22
|
+
c.with_action(url: 'https://www.jamieoliver.com/snacks/') do
|
|
23
|
+
'Undo'
|
|
24
|
+
end
|
|
25
|
+
'A default toast.'
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def error
|
|
30
|
+
render Pulse::Toast.new(theme: :error) do |c|
|
|
31
|
+
c.with_action(url: 'https://www.jamieoliver.com/snacks/') do
|
|
32
|
+
'Undo'
|
|
33
|
+
end
|
|
34
|
+
'An error toast.'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def success
|
|
39
|
+
render Pulse::Toast.new(theme: :success) do |c|
|
|
40
|
+
c.with_action(url: 'https://www.jamieoliver.com/snacks/') do
|
|
41
|
+
'Undo'
|
|
42
|
+
end
|
|
43
|
+
'This is a success toast.'
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def auto_hide_off
|
|
48
|
+
render Pulse::Toast.new(auto_hide: false) do |c|
|
|
49
|
+
c.with_action(url: 'https://www.jamieoliver.com/snacks/') do
|
|
50
|
+
'Undo'
|
|
51
|
+
end
|
|
52
|
+
'This is a toast message.'
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def long_text
|
|
57
|
+
render Pulse::Toast.new do |c|
|
|
58
|
+
c.with_action(url: 'https://www.jamieoliver.com/snacks/') do
|
|
59
|
+
'Undo'
|
|
60
|
+
end
|
|
61
|
+
'Blanditiis ut autem nesciunt ex sunt similique tempora et enim ' \
|
|
62
|
+
'dolorum sit maiores sunt voluptas amet. Cupiditate dolorem ' \
|
|
63
|
+
'suscipit sapiente eos eligendi eos iste quos'
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|