@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.
- package/dist/components/MiniSort/MiniSort2.js +30 -25
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -1,52 +1,57 @@
|
|
|
1
1
|
import './MiniSort.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { Button as
|
|
4
|
-
import { Tooltip as
|
|
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
|
|
8
|
-
var
|
|
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-${
|
|
12
|
-
|
|
11
|
+
`mini-sort--align-${_}`,
|
|
12
|
+
$
|
|
13
13
|
].filter(Boolean).join(" "),
|
|
14
|
-
children: [
|
|
15
|
-
const c = a.direction ?? "asc",
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
title: `Sort by ${
|
|
18
|
-
children: /* @__PURE__ */
|
|
19
|
-
className: `mini-sort__button${
|
|
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__ */
|
|
21
|
+
icon: a.icon ? /* @__PURE__ */ s(u, {
|
|
22
22
|
className: "mini-sort__icon",
|
|
23
23
|
name: a.icon,
|
|
24
24
|
size: "sm",
|
|
25
|
-
variant:
|
|
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: () =>
|
|
34
|
+
onClick: () => v(a.value, N),
|
|
30
35
|
children: a.label ?? a.value
|
|
31
36
|
})
|
|
32
|
-
}, `${a.value}-${
|
|
33
|
-
}),
|
|
34
|
-
title: `Direction: ${
|
|
35
|
-
children: /* @__PURE__ */
|
|
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:
|
|
38
|
-
icon: /* @__PURE__ */
|
|
42
|
+
disabled: i === null,
|
|
43
|
+
icon: /* @__PURE__ */ s(u, {
|
|
39
44
|
className: "mini-sort__icon",
|
|
40
|
-
name:
|
|
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: () =>
|
|
51
|
+
onClick: () => i !== null && v(i, n === "asc" ? "desc" : "asc")
|
|
47
52
|
})
|
|
48
53
|
})]
|
|
49
54
|
});
|
|
50
55
|
export {
|
|
51
|
-
|
|
56
|
+
B as MiniSort
|
|
52
57
|
};
|
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
|
-
/**
|
|
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
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "3.
|
|
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",
|