@tangle-network/ui 11.30.1 → 11.30.2

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
@@ -1,5 +1,11 @@
1
1
  # @tangle-network/ui
2
2
 
3
+ ## 11.30.2
4
+
5
+ ### Patch Changes
6
+
7
+ - df8514f: `Toolbar` keeps its filters at content width on one `lg` line while they fit, and gives search the rest between a 16rem floor and `max-w-sm`. The even split had clipped the Assets bar's third field (Schedule for) at the scroll edge at 1440px while search sat at 384px. Filters now shrink and scroll only once search is at its floor.
8
+
3
9
  ## 11.30.1
4
10
 
5
11
  ### Patch Changes
@@ -10,22 +10,22 @@ import * as React from "react";
10
10
  * own visual language, so one row carried a native `<select>`, a custom input
11
11
  * and a segmented control side by side.
12
12
  *
13
- * So search and filters SHARE the free space and `actions` stays at its content
14
- * width, and the row is the one place those controls are composed, which is what
15
- * keeps them looking like one set.
13
+ * So on one `lg` line the filters keep their content width while it fits,
14
+ * search takes what is left between a 16rem floor and `max-w-sm`, and `actions`
15
+ * stays at its content width. The row is the one place those controls are
16
+ * composed, which is what keeps them looking like one set.
16
17
  *
17
- * Sharing is deliberate, and the alternative is worse. Giving the filter row its
18
- * content width starves search: measured with a 537px filter row in an 832px
19
- * toolbar, the search field collapses to 89px. Letting both flex bounds the
20
- * filter row instead, so it scrolls within its half — 313px each in that same
21
- * case — and search stays usable however many filters a page adds. `max-w-sm`
22
- * then stops search claiming more than it can use when there are few filters.
18
+ * Both earlier layouts failed one side. Filters at content width with no floor
19
+ * starved search: a 537px filter row in an 832px toolbar left it 89px. Splitting
20
+ * the row evenly clipped filters that would have fitted: at 1440px the Assets
21
+ * bar cut its third field at the scroll edge while search sat at 384px. With the
22
+ * floor, filters shrink and scroll only once search is down to 16rem.
23
23
  *
24
24
  * Below `lg` the row becomes a column and the filters wrap onto as many lines
25
25
  * as they need. Scrolling them as one line hid every filter past the first
26
26
  * behind the screen edge on a phone: at 390px the second select started at
27
27
  * 403px and a third at 652px, with nothing to say more were there. From `lg`
28
- * up they share one line and scroll within their half, as above.
28
+ * up they sit on one line as above.
29
29
  */
30
30
  /**
31
31
  * Slots only — `children` is omitted deliberately. A free child would render as
@@ -8,11 +8,11 @@ const Toolbar = React.forwardRef(({ className, search, filters, actions, ...prop
8
8
  ...props,
9
9
  children: [
10
10
  search && /* @__PURE__ */ jsx("div", {
11
- className: "min-w-0 lg:max-w-sm lg:flex-1",
11
+ className: "min-w-0 lg:min-w-64 lg:max-w-sm lg:flex-1",
12
12
  children: search
13
13
  }),
14
14
  filters && /* @__PURE__ */ jsx("div", {
15
- className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 py-1 lg:flex-1 lg:flex-nowrap lg:gap-2 lg:overflow-x-auto",
15
+ className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 py-1 lg:flex-initial lg:flex-nowrap lg:gap-2 lg:overflow-x-auto",
16
16
  children: filters
17
17
  }),
18
18
  actions && /* @__PURE__ */ jsx("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/ui",
3
- "version": "11.30.1",
3
+ "version": "11.30.2",
4
4
  "description": "Generic React UI components for Tangle products — primitives, chat, run, files, editor, markdown.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -24,11 +24,10 @@ describe("Toolbar", () => {
24
24
  expect(row.children).toHaveLength(1);
25
25
  });
26
26
 
27
- // Search and filters both flex, on purpose: giving the filter row its content
28
- // width starves search — a 537px filter row in an 832px toolbar collapses the
29
- // search field to 89px. Sharing bounds the filter row so it scrolls within its
30
- // half and search stays usable. Only `actions` sits at content width.
31
- it("lets search and filters share the row, holding actions at content width", () => {
27
+ // Filters keep their content width while it fits and shrink (scrolling) only
28
+ // once search reaches its 16rem floor; an even split clipped a third filter at
29
+ // 1440px, and no floor left search 89px wide in an 832px toolbar.
30
+ it("keeps filters at content width above a search floor, actions at content width", () => {
32
31
  const { container } = render(
33
32
  <Toolbar
34
33
  actions={<button type="button">Export</button>}
@@ -39,11 +38,11 @@ describe("Toolbar", () => {
39
38
  const [searchSlot, filterSlot, actionsSlot] = Array.from(
40
39
  (container.firstElementChild as HTMLElement).children,
41
40
  ) as HTMLElement[];
42
- expect(searchSlot.className).toContain("lg:flex-1");
43
- expect(searchSlot.className).toContain("min-w-0");
44
- // Both flex, so neither can starve the other.
45
- expect(filterSlot.className).toContain("lg:flex-1");
46
- expect(filterSlot.className).toContain("min-w-0");
41
+ const search = searchSlot.className.split(" ");
42
+ const filters = filterSlot.className.split(" ");
43
+ expect(search).toEqual(expect.arrayContaining(["lg:flex-1", "lg:min-w-64", "lg:max-w-sm", "min-w-0"]));
44
+ expect(filters).toEqual(expect.arrayContaining(["lg:flex-initial", "min-w-0", "lg:overflow-x-auto"]));
45
+ expect(filters).not.toContain("lg:flex-1");
47
46
  expect(actionsSlot.className).toContain("shrink-0");
48
47
  expect(actionsSlot.className).not.toContain("flex-1");
49
48
  });
@@ -11,22 +11,22 @@ import { cn } from "../lib/utils";
11
11
  * own visual language, so one row carried a native `<select>`, a custom input
12
12
  * and a segmented control side by side.
13
13
  *
14
- * So search and filters SHARE the free space and `actions` stays at its content
15
- * width, and the row is the one place those controls are composed, which is what
16
- * keeps them looking like one set.
14
+ * So on one `lg` line the filters keep their content width while it fits,
15
+ * search takes what is left between a 16rem floor and `max-w-sm`, and `actions`
16
+ * stays at its content width. The row is the one place those controls are
17
+ * composed, which is what keeps them looking like one set.
17
18
  *
18
- * Sharing is deliberate, and the alternative is worse. Giving the filter row its
19
- * content width starves search: measured with a 537px filter row in an 832px
20
- * toolbar, the search field collapses to 89px. Letting both flex bounds the
21
- * filter row instead, so it scrolls within its half — 313px each in that same
22
- * case — and search stays usable however many filters a page adds. `max-w-sm`
23
- * then stops search claiming more than it can use when there are few filters.
19
+ * Both earlier layouts failed one side. Filters at content width with no floor
20
+ * starved search: a 537px filter row in an 832px toolbar left it 89px. Splitting
21
+ * the row evenly clipped filters that would have fitted: at 1440px the Assets
22
+ * bar cut its third field at the scroll edge while search sat at 384px. With the
23
+ * floor, filters shrink and scroll only once search is down to 16rem.
24
24
  *
25
25
  * Below `lg` the row becomes a column and the filters wrap onto as many lines
26
26
  * as they need. Scrolling them as one line hid every filter past the first
27
27
  * behind the screen edge on a phone: at 390px the second select started at
28
28
  * 403px and a third at 652px, with nothing to say more were there. From `lg`
29
- * up they share one line and scroll within their half, as above.
29
+ * up they sit on one line as above.
30
30
  */
31
31
  /**
32
32
  * Slots only — `children` is omitted deliberately. A free child would render as
@@ -56,14 +56,14 @@ const Toolbar = React.forwardRef<HTMLDivElement, ToolbarProps>(
56
56
  )}
57
57
  {...props}
58
58
  >
59
- {search && <div className="min-w-0 lg:max-w-sm lg:flex-1">{search}</div>}
59
+ {search && <div className="min-w-0 lg:min-w-64 lg:max-w-sm lg:flex-1">{search}</div>}
60
60
  {filters && (
61
61
  // `py-1` leaves room for a focus ring above and below; on the single
62
62
  // `lg` line the scroll container clips it horizontally, which is the
63
63
  // trade a one-line filter row makes. No negative margin — pulling the
64
64
  // row wider than its parent is what made every page report 4px of
65
65
  // horizontal overflow.
66
- <div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 py-1 lg:flex-1 lg:flex-nowrap lg:gap-2 lg:overflow-x-auto">
66
+ <div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 py-1 lg:flex-initial lg:flex-nowrap lg:gap-2 lg:overflow-x-auto">
67
67
  {filters}
68
68
  </div>
69
69
  )}