layered-ui-rails 0.28.2 → 0.29.1

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: d0f239bdc2e4c3003b0e877dd5e7820122f447c19aa13772c0445de8e2809aa0
4
- data.tar.gz: 86c4b71af97fceb7db059715be9b5440b51250f3e2cb2c189825f2c0abacab92
3
+ metadata.gz: a90616f59d7b9077f1433b8bf8c16d48cbe547399ce5f662608bae473f35bd30
4
+ data.tar.gz: 43ac67dad82424fcb968548d3e96a834c5797f64df158595a980f4e3d58bd965
5
5
  SHA512:
6
- metadata.gz: 35b11296d6b291b518731f08e7df45810644c9fa661db5adda10ff056e7b128cc58bf535a3a55b91585337ef7c049d5c5cca2d284b4d9e6ef5b3860d837b4ecd
7
- data.tar.gz: 6117f559bc283001afe48fdd1e54d3ce9a58c65a1c98d9f706da04bcfcf733876e0b0e604774832898c97e1c5893d40f7b8f5cc9c888f9ed13be1625d2b3276d
6
+ metadata.gz: 4d653151454ae0d23b9248dfdd04ef46fd233561d1b8f1bac80ecfa263913bf8f3c0b2d29ee9e4ed00e9ed1564a650e32e7939cdf55a51e6164de6db538eb604
7
+ data.tar.gz: f6f58207a8fd9ce844b5625971a07dd9f38c615f3be5520e59fdb6c0395cce9b545d8a230999eee04e2c20816ccc8e178b1ce13bcbadcfc2c3770508b71c01e3
@@ -150,6 +150,7 @@ Features:
150
150
  - Dragging is a pointer enhancement only, advertised by a decorative grip handle - the move buttons are the accessible path, as WCAG 2.2 SC 2.5.7 requires
151
151
  - Selections, filter counts, and moves are announced through a local `role="status"` region
152
152
  - With `url` set, each keystroke schedules a debounced fetch of `url?term=...`; the previous request is aborted and an overtaken response is dropped, so the list always answers what is currently typed. Leaving the field abandons a search in flight, so nothing spins beside a closed listbox and nothing is announced after focus has moved on. Responses replace the options wholesale, cloned from the `optionTemplate`, and the browser does no filtering of its own
153
+ - The `url` value can be changed on a connected combobox to repoint it, e.g. a branch field whose endpoint depends on the repository chosen beside it: set `data-l-ui--combobox-url-value` on the controller element (or assign `urlValue`). The options fetched from the old address are dropped, a request in flight is abandoned and paging is reset, so the list only ever shows options from the current address. An open list refetches straight away; a closed one fetches when it is next opened. Selected tokens are left as they are, so remove any that no longer apply yourself. Connecting does not count as a change, so it causes no extra fetch
153
154
  - Further pages are appended as the end of a remote list is reached - within `LOAD_MORE_MARGIN` of its foot (the `scrolled` action, bound to the listbox), or on Down/End at the last option, so the keyboard is not capped at the first page. Down loads instead of wrapping while pages remain, and highlights the first newly loaded option; option ids run on across pages so `aria-activedescendant` can never point at a reused id
154
155
  - The `notice` row carries only durable messages: how far into the matches the list has got, a failed request, and the character threshold. Each appended page is announced through the status region
155
156
  - A request in flight shows a spinner rather than a message - `busy` (trailing the input) while searching, `moreSpinner` (in the notice row) while a page loads - after `SPINNER_DELAY`, so a fast response never flashes one. `aria-busy` goes on the listbox immediately, since it costs nothing and says the same thing to a screen reader
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. This project follows [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## [0.29.1] - 2026-12-02
6
+
7
+ ### Fixed
8
+
9
+ - A modal's text now wraps when the modal is rendered inside an element that sets `white-space: nowrap`, such as a table cell or a tag row. A `<dialog>` inherits `white-space` from its DOM parent, so the body text ran off the edge of the modal on one line. `.l-ui-modal` now resets it.
10
+
11
+ ## [0.29.0] - 2026-12-02
12
+
13
+ ### Added
14
+
15
+ - A remote `l_ui_combobox` can be repointed after it has connected. Change `data-l-ui--combobox-url-value` on the controller element and the combobox drops the options it fetched from the old address, abandons any request in flight and resets paging, so it offers the new address's options: straight away if the list is open, otherwise the next time it is opened. Selections are left as they are. Previously the new address was ignored until the typed term changed.
16
+
5
17
  ## [0.28.2] - 2026-11-12
6
18
 
7
19
  ### Fixed
@@ -2655,7 +2655,7 @@ pre.l-ui-surface {
2655
2655
  @apply fixed inset-0
2656
2656
  w-screen h-screen max-w-none max-h-none md:w-full md:h-fit md:max-w-2xl md:max-h-[80vh]
2657
2657
  m-0 md:m-auto p-0
2658
- text-foreground
2658
+ whitespace-normal text-foreground
2659
2659
  bg-background
2660
2660
  border-0 md:border md:border-border rounded-none md:rounded-sm;
2661
2661
  }
@@ -14,7 +14,9 @@ import { Controller } from "@hotwired/stimulus"
14
14
  // instead of being filtered in the browser, and each response replaces the
15
15
  // list - cloned from the option <template> so remote options are built from the
16
16
  // same markup as server-rendered ones. Further pages are appended as the user
17
- // reaches the end of the list, by pointer and by keyboard alike.
17
+ // reaches the end of the list, by pointer and by keyboard alike. The `url` can
18
+ // be changed on a connected combobox, to repoint it at a different collection:
19
+ // see urlValueChanged.
18
20
  //
19
21
  // Each selection carries its own hidden input, so the control submits with a
20
22
  // normal form post. Values that exist in the collection post under `name`;
@@ -73,14 +75,36 @@ export default class extends Controller {
73
75
  // id that aria-activedescendant might still be pointing at.
74
76
  this._optionSequence = 0
75
77
  this._refreshMoveControls()
78
+ this._connected = true
76
79
  }
77
80
 
78
81
  disconnect() {
82
+ this._connected = false
79
83
  clearTimeout(this._searchTimer)
80
84
  clearTimeout(this._busyTimer)
81
85
  this._abort()
82
86
  }
83
87
 
88
+ // Repointing a connected combobox - a branch field whose endpoint depends on
89
+ // the repository chosen beside it, say. Everything fetched from the old
90
+ // address is dropped, along with any request still out to it, so the list
91
+ // can only ever show options from the current one: an open list refetches at
92
+ // once, a closed one when it is next opened. Selections are the user's
93
+ // answer rather than part of the list, so the tokens are left alone.
94
+ //
95
+ // Stimulus also reports the initial value, before connect() has run. That is
96
+ // not a change, and the first open fetches anyway, so it is ignored.
97
+ urlValueChanged() {
98
+ if (!this._connected) return
99
+
100
+ clearTimeout(this._searchTimer)
101
+ this._resetRemoteList()
102
+ this._setNotice(null)
103
+
104
+ if (this.isOpen && this.isRemote) this._scheduleSearch({ immediate: true })
105
+ this._filterOptions()
106
+ }
107
+
84
108
  get isRemote() {
85
109
  return this.urlValue !== ""
86
110
  }
@@ -567,14 +591,7 @@ export default class extends Controller {
567
591
  // Below the threshold there is nothing worth asking the server, so the list
568
592
  // says what it is waiting for instead of showing stale results.
569
593
  if (this._belowThreshold) {
570
- this._abort()
571
- this._stopBusy()
572
- this._loading = false
573
- this._loadingMore = false
574
- this._loadedTerm = null
575
- this._page = 0
576
- this._pages = 0
577
- this._renderOptions([], { replace: true })
594
+ this._resetRemoteList()
578
595
  this._setNotice(this._text("minChars"))
579
596
  return
580
597
  }
@@ -586,6 +603,19 @@ export default class extends Controller {
586
603
  }
587
604
  }
588
605
 
606
+ // Back to having fetched nothing: no options, no paging, no request out.
607
+ _resetRemoteList() {
608
+ this._abort()
609
+ this._stopBusy()
610
+ this._loading = false
611
+ this._loadingMore = false
612
+ this._loadedTerm = null
613
+ this._page = 0
614
+ this._pages = 0
615
+ this._count = 0
616
+ this._renderOptions([], { replace: true })
617
+ }
618
+
589
619
  // Whether the loaded list stops short of the matches the server has.
590
620
  get _hasMore() {
591
621
  return this.isRemote && this._page > 0 && this._page < this._pages
@@ -1,5 +1,5 @@
1
1
  module Layered
2
2
  module Ui
3
- VERSION = "0.28.2"
3
+ VERSION = "0.29.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: layered-ui-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.2
4
+ version: 0.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - layered.ai