@kopexa/sidebar 17.2.1 → 17.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/{chunk-YW3JMPRU.mjs → chunk-5VE25P3M.mjs} +61 -21
- package/dist/{chunk-LCCZNS2E.mjs → chunk-6H2EH7LL.mjs} +3 -3
- package/dist/chunk-BFZFZSUC.mjs +27 -0
- package/dist/{chunk-KLYPP6QE.mjs → chunk-G2J7EJQ6.mjs} +24 -15
- package/dist/{chunk-YVQVW5EP.mjs → chunk-WIP5GNGJ.mjs} +1 -1
- package/dist/{chunk-AIRHHM7Z.mjs → chunk-XBTONQ3L.mjs} +5 -1
- package/dist/index.js +88 -35
- package/dist/index.mjs +6 -6
- package/dist/v2/app-shell.mjs +3 -2
- package/dist/v2/components.d.mts +7 -1
- package/dist/v2/components.d.ts +7 -1
- package/dist/v2/components.js +69 -21
- package/dist/v2/components.mjs +3 -3
- package/dist/v2/context.js +16 -1
- package/dist/v2/context.mjs +2 -1
- package/dist/v2/from-config.js +85 -30
- package/dist/v2/from-config.mjs +4 -4
- package/dist/v2/index.js +88 -35
- package/dist/v2/index.mjs +6 -6
- package/dist/v2/types.d.mts +20 -1
- package/dist/v2/types.d.ts +20 -1
- package/dist/v2/types.js +17 -2
- package/dist/v2/types.mjs +7 -3
- package/package.json +11 -11
- package/dist/chunk-SDMGFB6V.mjs +0 -14
package/dist/v2/types.d.mts
CHANGED
|
@@ -32,7 +32,10 @@ type SidebarV2PanelItem = {
|
|
|
32
32
|
label: string;
|
|
33
33
|
href: string;
|
|
34
34
|
icon?: SidebarV2Icon;
|
|
35
|
+
/** Count pill after the label (e.g. number of open items). */
|
|
35
36
|
badge?: number | string;
|
|
37
|
+
/** Status chip after the label, e.g. "Preview", "Beta", "Neu". */
|
|
38
|
+
tag?: string;
|
|
36
39
|
/** Stable key; defaults to href. */
|
|
37
40
|
value?: string;
|
|
38
41
|
} | {
|
|
@@ -72,9 +75,25 @@ type SidebarV2RailEntry = {
|
|
|
72
75
|
slot?: "top" | "bottom";
|
|
73
76
|
};
|
|
74
77
|
type SidebarV2Nav = SidebarV2RailEntry[];
|
|
78
|
+
/**
|
|
79
|
+
* A route's identity is its pathname — query (`?`) and hash (`#`) are transient
|
|
80
|
+
* (filters, tabs-by-query, scroll anchors) and never part of nav identity. Strip
|
|
81
|
+
* them (and any trailing slash) before comparing, so a nav href that carries an
|
|
82
|
+
* incidental `?param` still matches the bare route. `/` is preserved.
|
|
83
|
+
*/
|
|
84
|
+
declare function normalizePath(href: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Length of the match between an already-normalized `currentPath` and a target
|
|
87
|
+
* `href`, or `-1` when it doesn't match. Exact and ancestor-prefix matches both
|
|
88
|
+
* return the target's length; callers keep the longest (most specific) one so the
|
|
89
|
+
* panel/item that owns the deepest matching route wins — never a shorter prefix
|
|
90
|
+
* from an unrelated entry. The boundary is `/`, so `/risks` never matches
|
|
91
|
+
* `/risks-archive`.
|
|
92
|
+
*/
|
|
93
|
+
declare function pathMatchLength(currentPath: string, href: string): number;
|
|
75
94
|
declare function panelItemHasChildren(item: SidebarV2PanelItem): item is Extract<SidebarV2PanelItem, {
|
|
76
95
|
children: SidebarV2SubItem[];
|
|
77
96
|
}>;
|
|
78
97
|
declare function panelItemIsSection(item: SidebarV2PanelItem): item is SidebarV2PanelSection;
|
|
79
98
|
|
|
80
|
-
export { type SidebarV2Icon, type SidebarV2LinkProps, type SidebarV2Nav, type SidebarV2PanelItem, type SidebarV2PanelSection, type SidebarV2RailEntry, type SidebarV2SubItem, panelItemHasChildren, panelItemIsSection };
|
|
99
|
+
export { type SidebarV2Icon, type SidebarV2LinkProps, type SidebarV2Nav, type SidebarV2PanelItem, type SidebarV2PanelSection, type SidebarV2RailEntry, type SidebarV2SubItem, normalizePath, panelItemHasChildren, panelItemIsSection, pathMatchLength };
|
package/dist/v2/types.d.ts
CHANGED
|
@@ -32,7 +32,10 @@ type SidebarV2PanelItem = {
|
|
|
32
32
|
label: string;
|
|
33
33
|
href: string;
|
|
34
34
|
icon?: SidebarV2Icon;
|
|
35
|
+
/** Count pill after the label (e.g. number of open items). */
|
|
35
36
|
badge?: number | string;
|
|
37
|
+
/** Status chip after the label, e.g. "Preview", "Beta", "Neu". */
|
|
38
|
+
tag?: string;
|
|
36
39
|
/** Stable key; defaults to href. */
|
|
37
40
|
value?: string;
|
|
38
41
|
} | {
|
|
@@ -72,9 +75,25 @@ type SidebarV2RailEntry = {
|
|
|
72
75
|
slot?: "top" | "bottom";
|
|
73
76
|
};
|
|
74
77
|
type SidebarV2Nav = SidebarV2RailEntry[];
|
|
78
|
+
/**
|
|
79
|
+
* A route's identity is its pathname — query (`?`) and hash (`#`) are transient
|
|
80
|
+
* (filters, tabs-by-query, scroll anchors) and never part of nav identity. Strip
|
|
81
|
+
* them (and any trailing slash) before comparing, so a nav href that carries an
|
|
82
|
+
* incidental `?param` still matches the bare route. `/` is preserved.
|
|
83
|
+
*/
|
|
84
|
+
declare function normalizePath(href: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Length of the match between an already-normalized `currentPath` and a target
|
|
87
|
+
* `href`, or `-1` when it doesn't match. Exact and ancestor-prefix matches both
|
|
88
|
+
* return the target's length; callers keep the longest (most specific) one so the
|
|
89
|
+
* panel/item that owns the deepest matching route wins — never a shorter prefix
|
|
90
|
+
* from an unrelated entry. The boundary is `/`, so `/risks` never matches
|
|
91
|
+
* `/risks-archive`.
|
|
92
|
+
*/
|
|
93
|
+
declare function pathMatchLength(currentPath: string, href: string): number;
|
|
75
94
|
declare function panelItemHasChildren(item: SidebarV2PanelItem): item is Extract<SidebarV2PanelItem, {
|
|
76
95
|
children: SidebarV2SubItem[];
|
|
77
96
|
}>;
|
|
78
97
|
declare function panelItemIsSection(item: SidebarV2PanelItem): item is SidebarV2PanelSection;
|
|
79
98
|
|
|
80
|
-
export { type SidebarV2Icon, type SidebarV2LinkProps, type SidebarV2Nav, type SidebarV2PanelItem, type SidebarV2PanelSection, type SidebarV2RailEntry, type SidebarV2SubItem, panelItemHasChildren, panelItemIsSection };
|
|
99
|
+
export { type SidebarV2Icon, type SidebarV2LinkProps, type SidebarV2Nav, type SidebarV2PanelItem, type SidebarV2PanelSection, type SidebarV2RailEntry, type SidebarV2SubItem, normalizePath, panelItemHasChildren, panelItemIsSection, pathMatchLength };
|
package/dist/v2/types.js
CHANGED
|
@@ -21,10 +21,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/v2/types.ts
|
|
22
22
|
var types_exports = {};
|
|
23
23
|
__export(types_exports, {
|
|
24
|
+
normalizePath: () => normalizePath,
|
|
24
25
|
panelItemHasChildren: () => panelItemHasChildren,
|
|
25
|
-
panelItemIsSection: () => panelItemIsSection
|
|
26
|
+
panelItemIsSection: () => panelItemIsSection,
|
|
27
|
+
pathMatchLength: () => pathMatchLength
|
|
26
28
|
});
|
|
27
29
|
module.exports = __toCommonJS(types_exports);
|
|
30
|
+
function normalizePath(href) {
|
|
31
|
+
const path = href.split("#")[0].split("?")[0].replace(/\/+$/, "");
|
|
32
|
+
return path === "" ? "/" : path;
|
|
33
|
+
}
|
|
34
|
+
function pathMatchLength(currentPath, href) {
|
|
35
|
+
const target = normalizePath(href);
|
|
36
|
+
if (currentPath === target) return target.length;
|
|
37
|
+
if (target !== "/" && currentPath.startsWith(`${target}/`))
|
|
38
|
+
return target.length;
|
|
39
|
+
return -1;
|
|
40
|
+
}
|
|
28
41
|
function panelItemHasChildren(item) {
|
|
29
42
|
return "children" in item && Array.isArray(item.children);
|
|
30
43
|
}
|
|
@@ -33,6 +46,8 @@ function panelItemIsSection(item) {
|
|
|
33
46
|
}
|
|
34
47
|
// Annotate the CommonJS export names for ESM import in node:
|
|
35
48
|
0 && (module.exports = {
|
|
49
|
+
normalizePath,
|
|
36
50
|
panelItemHasChildren,
|
|
37
|
-
panelItemIsSection
|
|
51
|
+
panelItemIsSection,
|
|
52
|
+
pathMatchLength
|
|
38
53
|
});
|
package/dist/v2/types.mjs
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
normalizePath,
|
|
3
4
|
panelItemHasChildren,
|
|
4
|
-
panelItemIsSection
|
|
5
|
-
|
|
5
|
+
panelItemIsSection,
|
|
6
|
+
pathMatchLength
|
|
7
|
+
} from "../chunk-BFZFZSUC.mjs";
|
|
6
8
|
export {
|
|
9
|
+
normalizePath,
|
|
7
10
|
panelItemHasChildren,
|
|
8
|
-
panelItemIsSection
|
|
11
|
+
panelItemIsSection,
|
|
12
|
+
pathMatchLength
|
|
9
13
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kopexa/sidebar",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sidebar"
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"motion": ">=12.23.6",
|
|
29
29
|
"react": ">=19.0.0-rc.0",
|
|
30
30
|
"react-dom": ">=19.0.0-rc.0",
|
|
31
|
-
"@kopexa/theme": "17.
|
|
31
|
+
"@kopexa/theme": "17.34.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@radix-ui/react-slot": "^1.2.4",
|
|
35
|
-
"@kopexa/
|
|
36
|
-
"@kopexa/
|
|
37
|
-
"@kopexa/
|
|
38
|
-
"@kopexa/
|
|
39
|
-
"@kopexa/
|
|
40
|
-
"@kopexa/
|
|
41
|
-
"@kopexa/
|
|
42
|
-
"@kopexa/
|
|
43
|
-
"@kopexa/
|
|
35
|
+
"@kopexa/drawer": "17.2.58",
|
|
36
|
+
"@kopexa/icons": "17.10.22",
|
|
37
|
+
"@kopexa/input": "17.0.93",
|
|
38
|
+
"@kopexa/use-is-mobile": "17.0.93",
|
|
39
|
+
"@kopexa/react-utils": "17.1.35",
|
|
40
|
+
"@kopexa/tooltip": "17.2.58",
|
|
41
|
+
"@kopexa/button": "17.0.93",
|
|
42
|
+
"@kopexa/shared-utils": "17.0.93",
|
|
43
|
+
"@kopexa/separator": "17.0.93"
|
|
44
44
|
},
|
|
45
45
|
"clean-package": "../../../clean-package.config.json",
|
|
46
46
|
"module": "dist/index.mjs",
|
package/dist/chunk-SDMGFB6V.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/v2/types.ts
|
|
4
|
-
function panelItemHasChildren(item) {
|
|
5
|
-
return "children" in item && Array.isArray(item.children);
|
|
6
|
-
}
|
|
7
|
-
function panelItemIsSection(item) {
|
|
8
|
-
return "section" in item;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
panelItemHasChildren,
|
|
13
|
-
panelItemIsSection
|
|
14
|
-
};
|