sn_filterable 3.0.0 → 3.1.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/app/components/sn_filterable/base_components/button_component.rb +5 -5
- data/app/components/sn_filterable/category_component.html.erb +11 -4
- data/app/components/sn_filterable/chips_component.html.erb +10 -6
- data/app/components/sn_filterable/filter_category_component.html.erb +8 -5
- data/app/components/sn_filterable/main_component.html.erb +9 -9
- data/app/components/sn_filterable/search_component.html.erb +2 -2
- data/lib/sn_filterable/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ecd9de8d98107fab32a2eaf6f3933bfd9e425d6d40ecfd8e905ad5c992d0405
|
4
|
+
data.tar.gz: a75d2bc2044d11291202f34630d56300cf411bce160598f74feac720629ce6b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e0c80e747a3c7bbe2c892ce2604a1667a1160115ec3f10511a8584377c22870ded112332202c3f35a0b1b15785c968ced2caadc5aeca440368a1a675be8a39e
|
7
|
+
data.tar.gz: cf04f1827ab27eeefa04f7622411c8b62f34e893d93aab9e7e358fd9c882b81501d551cfb63d5f746556ed9e9ba000f8879ff5092fa01aba2e630a610b3e53c4
|
@@ -4,10 +4,10 @@ require_relative "base_component"
|
|
4
4
|
class SnFilterable::BaseComponents::ButtonComponent < SnFilterable::BaseComponents::BaseComponent
|
5
5
|
DEFAULT_BUTTON_TYPE = :default
|
6
6
|
BUTTON_TYPE_MAPPINGS = {
|
7
|
-
DEFAULT_BUTTON_TYPE => "shadow-sm border-gray-300 text-gray-700 bg-white hover:bg-gray-50 focus:ring-
|
8
|
-
:primary => "shadow-sm text-white bg-
|
9
|
-
:danger => "border-transparent text-red-700 bg-red-100 hover:bg-red-200 focus:ring-red-500",
|
10
|
-
:disabled => "shadow-sm border-gray-300 text-gray-700 bg-gray-200 cursor-default"
|
7
|
+
DEFAULT_BUTTON_TYPE => "shadow-sm border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:ring-violet-500 dark:focus:ring-violet-400",
|
8
|
+
:primary => "shadow-sm text-white bg-violet-600 dark:bg-violet-700 hover:bg-violet-700 dark:hover:bg-violet-600 focus:ring-violet-500 dark:focus:ring-violet-400",
|
9
|
+
:danger => "border-transparent text-red-700 dark:text-red-400 bg-red-100 dark:bg-red-900 hover:bg-red-200 dark:hover:bg-red-800 focus:ring-red-500 dark:focus:ring-red-400",
|
10
|
+
:disabled => "shadow-sm border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-400 bg-gray-200 dark:bg-gray-600 cursor-default"
|
11
11
|
}.freeze
|
12
12
|
BUTTON_TYPE_OPTIONS = BUTTON_TYPE_MAPPINGS.keys
|
13
13
|
|
@@ -56,7 +56,7 @@ class SnFilterable::BaseComponents::ButtonComponent < SnFilterable::BaseComponen
|
|
56
56
|
end
|
57
57
|
|
58
58
|
show_focus_ring = arguments[:show_focus_ring].nil? ? true : arguments[:show_focus_ring]
|
59
|
-
focus_ring_class = show_focus_ring ? "focus:ring-2 focus:ring-offset-2" : ""
|
59
|
+
focus_ring_class = show_focus_ring ? "focus:ring-2 focus:ring-offset-2 dark:focus:ring-offset-gray-800" : ""
|
60
60
|
|
61
61
|
@arguments[:classes] = class_names(
|
62
62
|
"inline-flex items-center border rounded-md #{focus_ring_class} focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed",
|
@@ -1,10 +1,17 @@
|
|
1
|
-
<%= content_tag :fieldset,
|
1
|
+
<%= content_tag :fieldset,
|
2
|
+
class: "w-full text-xs lg:text-sm app-word-break dark:bg-gray-800",
|
2
3
|
"x-data": { open: @open }.to_json do %>
|
3
|
-
<button class="flex border-b justify-between w-full px-4 py-3 font-medium text-left text-gray-900 transition-colors hover:bg-gray-200 rounded-sm focus:outline-none focus-visible:ring focus-visible:ring-gray-500 focus-visible:ring-opacity-75"
|
4
|
+
<button class="flex border-b dark:border-gray-700 justify-between w-full px-4 py-3 font-medium text-left text-gray-900 dark:text-white transition-colors hover:bg-gray-200 dark:hover:bg-gray-700 rounded-sm focus:outline-none focus-visible:ring focus-visible:ring-gray-500 dark:focus-visible:ring-gray-400 focus-visible:ring-opacity-75"
|
5
|
+
type="button"
|
6
|
+
@click="open = !open">
|
4
7
|
<span><%= @title %></span>
|
5
|
-
<%= heroicon "chevron-down",
|
8
|
+
<%= heroicon "chevron-down",
|
9
|
+
options: {
|
10
|
+
class: "transform w-5 h-5 text-gray-500 dark:text-gray-400 transition ease-out",
|
11
|
+
":class": "open && 'rotate-180'"
|
12
|
+
} %>
|
6
13
|
</button>
|
7
|
-
<div class="pb-2 text-gray-500" x-show="open" x-cloak>
|
14
|
+
<div class="pb-2 text-gray-500 dark:text-gray-400" x-show="open" x-cloak>
|
8
15
|
<%= filter %>
|
9
16
|
<%= content %>
|
10
17
|
</div>
|
@@ -1,21 +1,21 @@
|
|
1
1
|
<% unless @known_filters.empty? %>
|
2
|
-
<div class="relative app-filter-chips-content bg-gray-50 -mx-8 mt-4" x-data="filteringChipContainer" x-init="updateSidebarGap()">
|
2
|
+
<div class="relative app-filter-chips-content bg-gray-50 dark:bg-gray-700 -mx-8 mt-4" x-data="filteringChipContainer" x-init="updateSidebarGap()">
|
3
3
|
<div class="mx-auto py-3 px-4 flex items-center px-4 sm:px-6 lg:px-8">
|
4
|
-
<h3 class="sm:pr-0 text-xs font-semibold uppercase tracking-wide text-gray-500">
|
4
|
+
<h3 class="sm:pr-0 text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-300">
|
5
5
|
<span>Filters</span>
|
6
6
|
<span class="sr-only">, active</span>
|
7
7
|
</h3>
|
8
8
|
|
9
|
-
<div aria-hidden="true" class="w-px h-5 bg-gray-300 block ml-2 sm:ml-4"></div>
|
9
|
+
<div aria-hidden="true" class="w-px h-5 bg-gray-300 dark:bg-gray-500 block ml-2 sm:ml-4"></div>
|
10
10
|
|
11
11
|
<div class="ml-2 sm:ml-4 flex-1">
|
12
12
|
<div class="app-filter-chips-container -m-1 flex flex-wrap items-center">
|
13
13
|
<% @known_filters.each do |filter| %>
|
14
|
-
<span class="app-filter-chip m-1 inline-flex rounded-full border border-gray-200 items-center py-1.5 pl-3 pr-2 text-xs sm:text-sm font-medium bg-white text-gray-900" x-data>
|
14
|
+
<span class="app-filter-chip m-1 inline-flex rounded-full border border-gray-200 dark:border-gray-600 items-center py-1.5 pl-3 pr-2 text-xs sm:text-sm font-medium bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-300" x-data>
|
15
15
|
<span><%= filter[:name] %></span>
|
16
16
|
<%= content_tag :a,
|
17
17
|
href: filter[:multi] ? remove_sub_filter_url(@filtered, filter[:parent], filter[:value], url: @url) : remove_filter_url(@filtered, filter[:parent], url: @url),
|
18
|
-
class: "flex-shrink-0 ml-1 h-4 w-4 p-1 rounded-full inline-flex text-gray-400 hover:bg-gray-200 hover:text-gray-500",
|
18
|
+
class: "flex-shrink-0 ml-1 h-4 w-4 p-1 rounded-full inline-flex text-gray-400 hover:bg-gray-200 hover:text-gray-500 dark:hover:bg-gray-600 dark:hover:text-gray-300",
|
19
19
|
"x-data": "filteringChip(#{filter.to_json})",
|
20
20
|
"@click": "$event.preventDefault(); onClick()" do %>
|
21
21
|
<span class="sr-only">Remove filter for Objects</span>
|
@@ -28,7 +28,11 @@
|
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
<div class="pl-2 sm:pl-6">
|
31
|
-
<%= link_to t("shared.filterable.clear_all"),
|
31
|
+
<%= link_to t("shared.filterable.clear_all"),
|
32
|
+
clear_filter_url(@filtered, url: @url),
|
33
|
+
class: "text-sm text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-gray-100",
|
34
|
+
"x-data": "filteringClear",
|
35
|
+
"@click": "$event.preventDefault(); onClick()" %>
|
32
36
|
</div>
|
33
37
|
</div>
|
34
38
|
</div>
|
@@ -1,12 +1,15 @@
|
|
1
1
|
<% @filter[:filters].each_with_index do |sub_filter, index| %>
|
2
|
-
<div class="relative flex items-start px-4 transition-colors hover:bg-gray-200 text-gray-700 hover:text-gray-900">
|
2
|
+
<div class="relative flex items-start px-4 transition-colors hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
|
3
3
|
<div class="min-w-0 flex-1 flex-grow">
|
4
|
-
<%= content_tag :label,
|
4
|
+
<%= content_tag :label,
|
5
|
+
sub_filter[:name],
|
6
|
+
class: "block py-2 pr-4 text-gray-600 dark:text-gray-400 select-none w-full cursor-pointer",
|
7
|
+
for: "filter-#{@filter[:filter_name]}-#{index}" %>
|
5
8
|
</div>
|
6
9
|
<div class="my-2 flex items-center">
|
7
10
|
<% if @filter[:multi] %>
|
8
11
|
<%= content_tag :input, "",
|
9
|
-
class: "focus:ring-purple-400 cursor-pointer h-5 w-5 text-purple-500 bg-purple-100 border-0 rounded",
|
12
|
+
class: "focus:ring-purple-400 dark:focus:ring-purple-600 cursor-pointer h-5 w-5 text-purple-500 dark:text-purple-400 bg-purple-100 dark:bg-purple-900 border-0 rounded",
|
10
13
|
type: "checkbox",
|
11
14
|
name: "filter[#{@filter[:filter_name]}][]",
|
12
15
|
value: sub_filter[:value],
|
@@ -17,7 +20,7 @@
|
|
17
20
|
%>
|
18
21
|
<% else %>
|
19
22
|
<%= content_tag :input, "",
|
20
|
-
class: "focus:ring-purple-400 cursor-pointer h-5 w-5 text-purple-500 bg-purple-100 border-0",
|
23
|
+
class: "focus:ring-purple-400 dark:focus:ring-purple-600 cursor-pointer h-5 w-5 text-purple-500 dark:text-purple-400 bg-purple-100 dark:bg-purple-900 border-0",
|
21
24
|
type: "radio",
|
22
25
|
name: "filter[#{@filter[:filter_name]}]",
|
23
26
|
value: sub_filter[:value],
|
@@ -29,4 +32,4 @@
|
|
29
32
|
<% end %>
|
30
33
|
</div>
|
31
34
|
</div>
|
32
|
-
<% end %>
|
35
|
+
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% url = @url || url_for %>
|
2
|
-
<div x-data="{ filteringForm: $refs.filtering_form, entireComponenet: $el, filtersLoading: false, filtersPopupOpen: false, sidebarGapTarget: null }">
|
2
|
+
<div x-data="{ filteringForm: $refs.filtering_form, entireComponenet: $el, filtersLoading: false, filtersPopupOpen: false, sidebarGapTarget: null }" class="dark:bg-gray-800 dark:text-white">
|
3
3
|
<%= content_tag :form,
|
4
4
|
"x-ref": "filtering_form",
|
5
5
|
"action": url,
|
@@ -26,32 +26,32 @@
|
|
26
26
|
<% if @show_sidebar %>
|
27
27
|
<div class="mt-16 h-full pointer-events-auto">
|
28
28
|
<div class="h-full" x-init="sidebarGapTarget = $el">
|
29
|
-
<div x-show="filtersPopupOpen" class="fixed top-0 left-0 right-0 bottom-0 z-10 sm:z-0 bg-gray-600 bg-opacity-75 sm:hidden" @click="filtersPopupOpen = false" x-cloak></div>
|
30
|
-
<div x-show="filtersPopupOpen" class="fixed bottom-0 h-2/3 z-10 sm:z-0 left-0 w-full bg-white pt-4 sm:sticky sm:!block row-span-2 shrink-0 mr-4 self-start sm:top-16 lg:w-64 sm:w-52 sm:pt-2 sm:pb-6 sm:overflow-y-auto sm:h-[70vh] sm:max-h-[calc(100vh_-_5rem)]" x-cloak>
|
29
|
+
<div x-show="filtersPopupOpen" class="fixed top-0 left-0 right-0 bottom-0 z-10 sm:z-0 bg-gray-600 bg-opacity-75 dark:bg-gray-900 dark:bg-opacity-75 sm:hidden" @click="filtersPopupOpen = false" x-cloak></div>
|
30
|
+
<div x-show="filtersPopupOpen" class="fixed bottom-0 h-2/3 z-10 sm:z-0 left-0 w-full bg-white dark:bg-gray-800 pt-4 sm:sticky sm:!block row-span-2 shrink-0 mr-4 self-start sm:top-16 lg:w-64 sm:w-52 sm:pt-2 sm:pb-6 sm:overflow-y-auto sm:h-[70vh] sm:max-h-[calc(100vh_-_5rem)]" x-cloak>
|
31
31
|
<div class="absolute top-0 right-0 -mt-12 mb-2 mr-2" x-show="filtersPopupOpen">
|
32
|
-
<button type="button" class="ml-1 flex items-center justify-center h-10 w-10 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" @click="filtersPopupOpen = false">
|
32
|
+
<button type="button" class="ml-1 flex items-center justify-center h-10 w-10 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white dark:focus:ring-gray-600" @click="filtersPopupOpen = false">
|
33
33
|
<span class="sr-only">Close filters</span>
|
34
|
-
<%= heroicon "x-mark", variant: :outline, options: { class: "h-6 w-6 text-grey-500" } %>
|
34
|
+
<%= heroicon "x-mark", variant: :outline, options: { class: "h-6 w-6 text-grey-500 dark:text-gray-400" } %>
|
35
35
|
</button>
|
36
36
|
</div>
|
37
37
|
<div name="Filter Options" role="menu" aria-orientation="vertical" aria-labelledby="options-menu" class="overflow-y-auto max-h-full">
|
38
38
|
<% @filters.each do |filter| %>
|
39
39
|
<%= render SnFilterable::CategoryComponent.new(title: filter[:title], open: @filtered.queries.dig("filter", filter.try(:[], :filter_name)).present?) do |c| %>
|
40
|
-
<% c.
|
40
|
+
<% c.with_filter(filtered: @filtered, filter: filter) %>
|
41
41
|
<% end %>
|
42
42
|
<% end %>
|
43
43
|
<%= render SnFilterable::CategoryComponent.new(title: t("shared.filterable.results_per_page"), open: @filtered.queries.dig("per").present?) do %>
|
44
44
|
<fieldset class="pt-2" x-data="{ wasInteracted: false }">
|
45
45
|
<% ([@filtered.items.default_per_page] | [10, 25, 50]).sort.each do |value| %>
|
46
|
-
<div class="relative flex items-start px-4 transition-colors hover:bg-gray-200 text-gray-700 hover:text-gray-900">
|
46
|
+
<div class="relative flex items-start px-4 transition-colors hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
|
47
47
|
<div class="min-w-0 flex-1 flex-grow">
|
48
|
-
<%= content_tag :label, value, class: "block py-2 pr-4 text-gray-600 select-none w-full cursor-pointer", for: "per-#{value}" %>
|
48
|
+
<%= content_tag :label, value, class: "block py-2 pr-4 text-gray-600 dark:text-gray-400 select-none w-full cursor-pointer", for: "per-#{value}" %>
|
49
49
|
</div>
|
50
50
|
<div class="my-2 flex items-center">
|
51
51
|
<% selected_explcitly = value == @filtered.queries["per"].to_i %>
|
52
52
|
<% selected_by_default = @filtered.queries["per"].blank? && value == @filtered.items.default_per_page %>
|
53
53
|
<%= content_tag :input, "",
|
54
|
-
class: "focus:ring-purple-400 cursor-pointer h-5 w-5 text-purple-500 bg-purple-100 border-0",
|
54
|
+
class: "focus:ring-purple-400 dark:focus:ring-purple-600 cursor-pointer h-5 w-5 text-purple-500 dark:text-purple-400 bg-purple-100 dark:bg-purple-900 border-0",
|
55
55
|
type: "radio",
|
56
56
|
id: "per-#{value}",
|
57
57
|
"x-data": { iteracted: selected_explcitly }.to_json,
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<div class="mt-1 relative rounded-md shadow-sm">
|
2
2
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
3
|
-
<%= heroicon "magnifying-glass", options: { class: "h-5 w-5 text-gray-400" } %>
|
3
|
+
<%= heroicon "magnifying-glass", options: { class: "h-5 w-5 text-gray-400 dark:text-gray-500" } %>
|
4
4
|
</div>
|
5
5
|
<%= content_tag :input, "",
|
6
|
-
class: "focus:ring-
|
6
|
+
class: "focus:ring-violet-500 focus:border-violet-500 block w-full pl-10 sm:text-sm border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-300 placeholder-gray-500 dark:placeholder-gray-400",
|
7
7
|
placeholder: "Search...",
|
8
8
|
type: "search",
|
9
9
|
":name": "hasValue && `filter[#{@filter_name}]`",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sn_filterable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IBM Skills Network
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: heroicon
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: turbo-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pg
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,7 +235,7 @@ dependencies:
|
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '2'
|
237
237
|
description: This gem adds a ViewComponent powered filtering component for searching
|
238
|
-
and filtering your PostgreSQL data.
|
238
|
+
and filtering your PostgreSQL or MySQL data.
|
239
239
|
email:
|
240
240
|
- Skills.Network@ibm.com
|
241
241
|
executables: []
|
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
287
|
- !ruby/object:Gem::Version
|
288
288
|
version: '0'
|
289
289
|
requirements: []
|
290
|
-
rubygems_version: 3.
|
290
|
+
rubygems_version: 3.5.22
|
291
291
|
signing_key:
|
292
292
|
specification_version: 4
|
293
293
|
summary: Skills Network - Item filtering component
|