@memobit/libs 3.2.0 → 3.3.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.
@@ -1,52 +1,57 @@
1
1
  import './MiniSort.css';
2
- import { Icon as t } from "../Icon/Icon2.js";
3
- import { Button as d } from "../Button/Button2.js";
4
- import { Tooltip as u } from "../Tooltip/Tooltip2.js";
2
+ import { Icon as u } from "../Icon/Icon2.js";
3
+ import { Button as f } from "../Button/Button2.js";
4
+ import { Tooltip as p } from "../Tooltip/Tooltip2.js";
5
5
  /* empty css */
6
6
  import "react";
7
- import { jsx as l, jsxs as b } from "react/jsx-runtime";
8
- var j = ({ items: e, sortKey: n, sortDirection: i, onSort: r, align: m = "left", showDirectionToggle: s = !1, className: v = "" }) => e.length === 0 ? null : /* @__PURE__ */ b("div", {
7
+ import { jsx as s, jsxs as z } from "react/jsx-runtime";
8
+ var B = ({ items: o, sortKey: i, sortDirection: n, onSort: v, align: _ = "left", showDirectionToggle: l = !1, className: $ = "" }) => o.length === 0 ? null : /* @__PURE__ */ z("div", {
9
9
  className: [
10
10
  "mini-sort",
11
- `mini-sort--align-${m}`,
12
- v
11
+ `mini-sort--align-${_}`,
12
+ $
13
13
  ].filter(Boolean).join(" "),
14
- children: [e.map((a, p) => {
15
- const c = a.direction ?? "asc", o = s ? n === a.value : n === a.value && i === c;
16
- return /* @__PURE__ */ l(u, {
17
- title: `Sort by ${typeof a.label == "string" || typeof a.label == "number" ? String(a.label) : a.value}${s ? "" : ` ${c === "asc" ? "ascending" : "descending"}`}`,
18
- children: /* @__PURE__ */ l(d, {
19
- className: `mini-sort__button${o ? " is-active" : ""}`,
14
+ children: [o.map((a, x) => {
15
+ const c = a.direction ?? "asc", t = i === a.value, r = !l && o.filter((m) => m.value === a.value).length === 1, e = l || r ? t : t && n === c, d = typeof a.label == "string" || typeof a.label == "number" ? String(a.label) : a.value, b = (m) => m === "asc" ? "ascending" : "descending", N = l ? t ? n : c : r && e ? n === "asc" ? "desc" : "asc" : c;
16
+ return /* @__PURE__ */ s(p, {
17
+ title: l ? `Sort by ${d}` : r && e ? `Sorted by ${d} ${b(n)} — click to reverse` : `Sort by ${d} ${b(c)}`,
18
+ children: /* @__PURE__ */ s(f, {
19
+ className: `mini-sort__button${e ? " is-active" : ""}`,
20
20
  disabled: a.disabled,
21
- icon: a.icon ? /* @__PURE__ */ l(t, {
21
+ icon: a.icon ? /* @__PURE__ */ s(u, {
22
22
  className: "mini-sort__icon",
23
23
  name: a.icon,
24
24
  size: "sm",
25
- variant: o ? "accent" : "muted"
25
+ variant: e ? "accent" : "muted"
26
+ }) : void 0,
27
+ sufixIcon: r && e ? /* @__PURE__ */ s(u, {
28
+ className: "mini-sort__icon",
29
+ name: n === "asc" ? "arrow-up" : "arrow-down",
30
+ size: "sm"
26
31
  }) : void 0,
27
32
  size: "small",
28
33
  variant: "ghost",
29
- onClick: () => r(a.value, s && n === a.value ? i : c),
34
+ onClick: () => v(a.value, N),
30
35
  children: a.label ?? a.value
31
36
  })
32
- }, `${a.value}-${p}`);
33
- }), s && /* @__PURE__ */ l(u, {
34
- title: `Direction: ${i === "asc" ? "ascending" : "descending"}`,
35
- children: /* @__PURE__ */ l(d, {
37
+ }, `${a.value}-${x}`);
38
+ }), l && /* @__PURE__ */ s(p, {
39
+ title: `Direction: ${n === "asc" ? "ascending" : "descending"}`,
40
+ children: /* @__PURE__ */ s(f, {
36
41
  className: "mini-sort__button mini-sort__direction",
37
- disabled: n === null,
38
- icon: /* @__PURE__ */ l(t, {
42
+ disabled: i === null,
43
+ icon: /* @__PURE__ */ s(u, {
39
44
  className: "mini-sort__icon",
40
- name: i === "asc" ? "arrow-up" : "arrow-down",
45
+ name: n === "asc" ? "arrow-up" : "arrow-down",
41
46
  size: "sm",
42
47
  variant: "accent"
43
48
  }),
44
49
  size: "small",
45
50
  variant: "ghost",
46
- onClick: () => n !== null && r(n, i === "asc" ? "desc" : "asc")
51
+ onClick: () => i !== null && v(i, n === "asc" ? "desc" : "asc")
47
52
  })
48
53
  })]
49
54
  });
50
55
  export {
51
- j as MiniSort
56
+ B as MiniSort
52
57
  };
@@ -23,7 +23,7 @@ var r = (i) => {
23
23
  const o = {
24
24
  ...i,
25
25
  lib: d,
26
- libBuildNumber: 461,
26
+ libBuildNumber: 463,
27
27
  libCommit: n,
28
28
  libBuildDate: t
29
29
  };
package/dist/index.d.ts CHANGED
@@ -2315,7 +2315,11 @@ export declare interface MiniSortItem {
2315
2315
  value: string;
2316
2316
  label?: default_2.ReactNode;
2317
2317
  icon?: IconName;
2318
- /** Fixed direction for this item. Used only when `showDirectionToggle` is false. */
2318
+ /**
2319
+ * Starting direction for this item when `showDirectionToggle` is false. Clicking the already-active
2320
+ * item reverses it — unless another item sorts the same `value` (e.g. a "Newest"/"Oldest" pair),
2321
+ * in which case each item keeps its own fixed direction.
2322
+ */
2319
2323
  direction?: MiniSortDirection;
2320
2324
  disabled?: boolean;
2321
2325
  }
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- var I = "3.2.0", B = 461, L = "0282050", _ = "2026-10-02T16:22:52.153Z", r = "461";
1
+ var I = "3.3.0", B = 463, L = "1906cce", _ = "2026-10-02T16:48:12.321Z", r = "463";
2
2
  export {
3
3
  _ as LIB_BUILD_DATE,
4
4
  r as LIB_BUILD_ID,
package/dist/version.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "3.2.0",
3
- "buildNumber": 461,
4
- "commit": "0282050",
5
- "buildDate": "2026-10-02T16:22:52.153Z"
2
+ "version": "3.3.0",
3
+ "buildNumber": 463,
4
+ "commit": "1906cce",
5
+ "buildDate": "2026-10-02T16:48:12.321Z"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memobit/libs",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
5
5
  "keywords": [
6
6
  "react",