twico-ui 1.40.0 → 1.41.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to Twico UI are documented here (newest first). This file is generated automatically on each release by [semantic-release](https://semantic-release.gitbook.io/) from [Conventional Commits](https://www.conventionalcommits.org/) — do not edit it by hand. The same notes appear on each [GitHub Release](https://github.com/EncryptionL/twico-ui/releases).
4
4
 
5
+ # [1.41.0](https://github.com/EncryptionL/twico-ui/compare/v1.40.0...v1.41.0) (2026-09-23)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **combobox:** keep active option in sync with a filtering defaultQuery ([2d13c08](https://github.com/EncryptionL/twico-ui/commit/2d13c0813cad21c5cda267f5344b2213715b48e2)), closes [#425](https://github.com/EncryptionL/twico-ui/issues/425)
11
+
12
+
13
+ ### Features
14
+
15
+ * **combobox:** add defaultQuery + onOpenChange for cell-editor use ([4d65be7](https://github.com/EncryptionL/twico-ui/commit/4d65be7f0062cf77abd438a1b342393e944f5562))
16
+
5
17
  # [1.40.0](https://github.com/EncryptionL/twico-ui/compare/v1.39.0...v1.40.0) (2026-09-23)
6
18
 
7
19
 
package/dist/index.cjs CHANGED
@@ -6349,6 +6349,7 @@ function Combobox({
6349
6349
  options,
6350
6350
  value,
6351
6351
  defaultValue = null,
6352
+ defaultQuery,
6352
6353
  onChange,
6353
6354
  clearable = false,
6354
6355
  disabled = false,
@@ -6356,6 +6357,7 @@ function Combobox({
6356
6357
  portal = true,
6357
6358
  minWidth = 0,
6358
6359
  onInputChange,
6360
+ onOpenChange,
6359
6361
  filter,
6360
6362
  loading = false,
6361
6363
  emptyText = "No results found",
@@ -6472,9 +6474,18 @@ function Combobox({
6472
6474
  React53__namespace.default.useEffect(() => {
6473
6475
  setActive(0);
6474
6476
  }, [query]);
6477
+ const onOpenChangeRef = React53__namespace.default.useRef(onOpenChange);
6478
+ onOpenChangeRef.current = onOpenChange;
6479
+ const prevOpenRef = React53__namespace.default.useRef(open);
6480
+ React53__namespace.default.useEffect(() => {
6481
+ if (prevOpenRef.current !== open) {
6482
+ prevOpenRef.current = open;
6483
+ onOpenChangeRef.current?.(open);
6484
+ }
6485
+ }, [open]);
6475
6486
  React53__namespace.default.useEffect(() => {
6476
6487
  if (!open) return;
6477
- const idx = flat.findIndex((o) => o.value === current);
6488
+ const idx = visible.findIndex((o) => o.value === current);
6478
6489
  setActive(idx >= 0 ? idx : 0);
6479
6490
  }, [open]);
6480
6491
  React53__namespace.default.useEffect(() => {
@@ -6501,8 +6512,13 @@ function Combobox({
6501
6512
  }, [active, open, virtualized, rows, listH]);
6502
6513
  function openMenu() {
6503
6514
  if (disabled) return;
6504
- setQuery("");
6515
+ const seed = defaultQuery || "";
6516
+ setQuery(seed);
6505
6517
  setOpen(true);
6518
+ if (seed) requestAnimationFrame(() => {
6519
+ const el = inputRef.current;
6520
+ if (el) el.setSelectionRange(seed.length, seed.length);
6521
+ });
6506
6522
  }
6507
6523
  function close() {
6508
6524
  setOpen(false);