activeadmin-command_palette 0.1.6 → 0.1.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 509b73ad390b1fe9b43d2cb712f41afbccdd52af79a47ab7ab65121bd93d82ef
4
- data.tar.gz: d897245191a9056ff09d22cba322831a7ec2f8808ad2a44a2dea305dc205ba75
3
+ metadata.gz: 3801c8198b67b942accb14aa27744358b7991e66bf36de38de9fa94a796c89b4
4
+ data.tar.gz: 9e103a701673046e5203ef0878484c17047ebcf61fc83cc91e2cff94bef49723
5
5
  SHA512:
6
- metadata.gz: a74e1279e40fe8a1030fb2473b0d0b9af28f868a36147c946c0fb116cd6599fdaddecd5f3db0e869ff1b167c251c909980ad5f15ddc70b0ea206c28bdbe4ba47
7
- data.tar.gz: 0d49f774e833e14eab01da3f44fae9cfc6644149a2179a1e45cbcfafa4e4b49051e5c32baf9c993a4e6d7985f2929a4444ae1b179f0a3b7f77ed25b2840b3406
6
+ metadata.gz: 12c57eb1fa8b2682c53f4c2616806de2a8bc1449949d3850bff5deef2d10f687c5ebcb7fd861126ed0dafdc64a68b4c15b7186c09438bcb0eab4e5fb9cef670c
7
+ data.tar.gz: bd79f196c0e4a3330191b4bee534d2fce4010faa3199cbdcd46c19531b25a8dce41e7367476bbc691d6053f3264823df198c3f08c4a7e25cab7f80324d5ba96a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.8
6
+
7
+ - Document `ActiveAdmin::CommandPalette.tailwind_entry_path` in the install README.
8
+
9
+ ## 0.1.7
10
+
11
+ - Keep the highlighted list row visible when moving with Arrow Up or Arrow Down.
12
+ - Ship `ActiveAdmin::CommandPalette.tailwind_entry_path` so hosts can concatenate palette shell utilities into the ActiveAdmin Tailwind build.
13
+
5
14
  ## 0.1.6
6
15
 
7
16
  - Publish as `activeadmin-command_palette` so Bundler requires `activeadmin/command_palette` by default; yank mistaken `activeadmin-command-palette` 0.1.6.
data/README.md CHANGED
@@ -35,6 +35,16 @@ Register finders and actions in an initializer or with the resource DSL.
35
35
 
36
36
  Built-in UI locales: English (`en`), Finnish (`fi`), Swedish (`sv`).
37
37
 
38
+ ### Styles
39
+
40
+ Concatenate the gem Tailwind entry into the CSS file your ActiveAdmin Tailwind build compiles:
41
+
42
+ ```ruby
43
+ File.read(ActiveAdmin::CommandPalette.tailwind_entry_path)
44
+ ```
45
+
46
+ That entry keeps palette shell utilities available in the admin stylesheet.
47
+
38
48
  ## Configuration
39
49
 
40
50
  Prefer resource-level registration in `ActiveAdmin.register`:
@@ -555,15 +555,20 @@ export default class extends Controller {
555
555
  }
556
556
 
557
557
  if (this.highlightedIndex >= 0 && this.visibleItems.length > 0) {
558
- this.queryTarget.setAttribute(
559
- "aria-activedescendant",
560
- `activeadmin-command-palette-option-${this.highlightedIndex}`
561
- );
558
+ const optionId = `activeadmin-command-palette-option-${this.highlightedIndex}`;
559
+ this.queryTarget.setAttribute("aria-activedescendant", optionId);
560
+ this.scrollHighlightedIntoView(optionId);
562
561
  } else {
563
562
  this.queryTarget.removeAttribute("aria-activedescendant");
564
563
  }
565
564
  }
566
565
 
566
+ scrollHighlightedIntoView(optionId) {
567
+ if (!this.hasListTarget) return;
568
+ const option = this.listTarget.querySelector(`#${optionId}`);
569
+ option?.scrollIntoView({ block: "nearest" });
570
+ }
571
+
567
572
  appendSectionHeader(kind) {
568
573
  const header = document.createElement("li");
569
574
  header.className =
@@ -0,0 +1,2 @@
1
+ /* Tailwind entry for ActiveAdmin hosts. Keep class tokens in sync with the palette shell. */
2
+ @source inline("absolute bg-black/40 bg-gray-100 bg-transparent bg-white border border-0 border-b border-gray-200 border-t cursor-pointer dark:bg-gray-800 dark:bg-gray-900 dark:border-gray-700 dark:hover:bg-gray-800 dark:text-gray-100 dark:text-gray-400 dark:text-gray-500 fixed flex flex-col focus:outline-none focus:ring-0 font-semibold hidden hover:bg-gray-100 inset-0 items-center items-start justify-center max-h-80 max-w-xl me-2 min-w-0 overflow-auto pb-1 pt-2 pt-[12vh] px-3 px-4 py-1 py-2 py-3 relative rounded-lg shadow-2xl shrink-0 sr-only text-[10px] text-base text-gray-400 text-gray-500 text-gray-900 text-gray-950 text-sm text-xs tracking-wide underline uppercase w-full z-50");
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveAdmin
4
4
  module CommandPalette
5
- VERSION = "0.1.6"
5
+ VERSION = "0.1.8"
6
6
  end
7
7
  end
@@ -31,6 +31,11 @@ module ActiveAdmin
31
31
  def reload!
32
32
  configuration.reload!
33
33
  end
34
+
35
+ # Path to the Tailwind CSS entry hosts concatenate into the ActiveAdmin stylesheet build.
36
+ def tailwind_entry_path
37
+ Engine.root.join("app/assets/stylesheets/activeadmin_command_palette.css")
38
+ end
34
39
  end
35
40
  end
36
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin-command_palette
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
@@ -340,6 +340,7 @@ files:
340
340
  - SECURITY.md
341
341
  - activeadmin-command_palette.gemspec
342
342
  - app/assets/controllers/activeadmin_command_palette/command_palette_controller.js
343
+ - app/assets/stylesheets/activeadmin_command_palette.css
343
344
  - app/controllers/active_admin/command_palette/options_controller.rb
344
345
  - app/views/active_admin/command_palette/_palette.html.erb
345
346
  - config/locales/activeadmin_command_palette.en.yml