tam_select 1.2.3 → 1.2.5

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: e3d70fb56c9207b30cbf94fa511904507ab603cfd2823fdb57abdfb5f8975fca
4
- data.tar.gz: dd4deef3509a263dd2782153f51706e0460df6190007106d2956585124e080a0
3
+ metadata.gz: '0578f460df897c76c9c1ac0226ddfebe2c212e1d03165ec6e8274c7a49428fd9'
4
+ data.tar.gz: 43a099f40cded849cb692ae5977e40c2d16aaf2314282a0660b2f6ec2e1cda83
5
5
  SHA512:
6
- metadata.gz: 2c9dc8c29d5680178904699e5f32e2d9506e2abae14918da3c3457bc640d7c92ce458f8439461470e11e244a4a2a477ca63d0e2b1df24a99cc7bbcc76304a743
7
- data.tar.gz: 4d4cb0845691bb1b4f1b1f814eafdbd5de506c4b36f9bfe8cbdbd6ab654dfef18502fab7bc92d98d02fca3349750f94d7484f8cb54ed3cdb711aa3a677a119fd
6
+ metadata.gz: ff3af882118f723d898b3b1376ce67fb360b4803122d227c9b797ca4b50f2fcf06357d7ca80567bd8c2baecbe2a453171a985fec6f594d293726fdf07d78bbc2
7
+ data.tar.gz: 44c3b6533294118d614d9e345dc3ae87bf4648f719092ad8f9a08ad24c3d743657b55e6ab9211c9a062262f7a148f01c7c52730db7a7b919ae254cfa4c151a33
data/README.md CHANGED
@@ -56,7 +56,7 @@ The generated Stimulus controller imports `TamSelect` from `"tam_select"`. Runni
56
56
 
57
57
  ### jsbundling-rails and esbuild
58
58
 
59
- The same generated controller works with esbuild when the bare `tam_select` import is aliased to the generated core file. Add the alias flag to the existing `build` script in `package.json`:
59
+ The same generated controller works with esbuild when the bare `tam_select` import is aliased to the generated core file. When Importmap is absent, the installer detects an existing esbuild `build` script in `package.json` and appends the alias automatically:
60
60
 
61
61
  ```json
62
62
  {
@@ -66,6 +66,8 @@ The same generated controller works with esbuild when the bare `tam_select` impo
66
66
  }
67
67
  ```
68
68
 
69
+ The update is idempotent, so rerunning the installer does not duplicate the alias. If `package.json` or an esbuild build script is not present, the installer prints the exact alias flag to add manually.
70
+
69
71
  This uses the local file installed by the generator. For non-Rails bundler use, install the npm package from GitHub and import its published package name instead:
70
72
 
71
73
  ```bash
@@ -109,6 +111,7 @@ Versions before this release generated a relative controller import. After upgra
109
111
  - Remote JSON search with debouncing and incremental pagination
110
112
  - Loading, empty, and error states
111
113
  - Select2-style closed selection and open search states with clear active, selected, disabled, loading, empty, and error feedback
114
+ - Right-aligned select chevron that remains pinned to the control edge for short and default labels
112
115
  - Keyboard navigation: arrows, Enter, Escape, Tab, and Backspace
113
116
  - Combobox/listbox ARIA semantics
114
117
  - Light and dark Tailwind themes
@@ -15,7 +15,7 @@ module TamSelect
15
15
  def configure_importmap
16
16
  importmap = "config/importmap.rb"
17
17
  unless File.exist?(destination_path(importmap))
18
- say "Importmap was not detected. For jsbundling/esbuild, alias tam_select to app/javascript/tam_select/tam_select.js.", :yellow
18
+ configure_esbuild
19
19
  return
20
20
  end
21
21
 
@@ -60,6 +60,27 @@ module TamSelect
60
60
 
61
61
  private
62
62
 
63
+ def configure_esbuild
64
+ package_json = "package.json"
65
+ unless File.exist?(destination_path(package_json))
66
+ say "Importmap and package.json were not detected; configure the tam_select JavaScript import manually.", :yellow
67
+ return
68
+ end
69
+
70
+ contents = File.read(destination_path(package_json))
71
+ alias_flag = "--alias:tam_select=./app/javascript/tam_select/tam_select.js"
72
+ return if contents.include?(alias_flag)
73
+
74
+ build_script = /(\"build\"\s*:\s*\")([^\"]*\besbuild\b[^\"]*)(\")/
75
+ if contents.match?(build_script)
76
+ gsub_file package_json, build_script do |match|
77
+ %(#{match.delete_suffix('"')} #{alias_flag}")
78
+ end
79
+ else
80
+ say "An esbuild script was not detected; add #{alias_flag} to the JavaScript build command.", :yellow
81
+ end
82
+ end
83
+
63
84
  def destination_path(relative_path)
64
85
  File.join(destination_root, relative_path)
65
86
  end
@@ -1,3 +1,3 @@
1
1
  module TamSelect
2
- VERSION = "1.2.3"
2
+ VERSION = "1.2.5"
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tam-select",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Accessible, searchable select component for Ruby on Rails, Simple Form, Stimulus, Turbo, and Tailwind CSS",
5
5
  "homepage": "https://github.com/tamiru/tam_select",
6
6
  "repository": {
data/src/tam-select.js CHANGED
@@ -12,7 +12,7 @@ const DEFAULT_CLASSES = {
12
12
  tag: "relative z-10 inline-flex max-w-full items-center gap-1 rounded-lg bg-blue-50 px-2 py-1 text-xs font-medium text-blue-700 ring-1 ring-inset ring-blue-200 transition-colors dark:bg-blue-950/50 dark:text-blue-300 dark:ring-blue-800",
13
13
  tagRemove: "rounded p-0.5 hover:bg-blue-100 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:hover:bg-blue-900",
14
14
  clear: "relative z-20 ml-auto rounded p-1 text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-700 focus:outline-none focus:ring-2 focus:ring-blue-500 dark:text-zinc-500 dark:hover:bg-zinc-800 dark:hover:text-zinc-200 dark:focus:ring-blue-400",
15
- chevron: "pointer-events-none relative z-10 ml-1 size-4 shrink-0 text-zinc-400 transition-transform",
15
+ chevron: "pointer-events-none relative z-10 ml-auto size-4 shrink-0 text-zinc-400 transition-transform",
16
16
  chevronOpen: "rotate-180",
17
17
  dropdown: "absolute z-50 mt-1.5 max-h-72 w-full origin-top overflow-auto rounded-xl border border-zinc-200 bg-white p-1.5 shadow-2xl ring-1 ring-black/5 dark:border-zinc-700 dark:bg-zinc-900 dark:shadow-black/50 dark:ring-white/10",
18
18
  option: "flex min-h-11 cursor-pointer items-center justify-between gap-3 rounded-lg px-3 py-2 text-sm text-zinc-700 outline-none transition-colors duration-100 dark:text-zinc-200",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tam_select
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tamiru Hailu