@makolabs/ripple 1.2.22 → 1.2.23

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/index.d.ts CHANGED
@@ -306,6 +306,12 @@ export interface Activatable {
306
306
  export interface LinkItem extends BaseNavigationItem, WithIcon, Activatable {
307
307
  href: string;
308
308
  meta?: string;
309
+ /**
310
+ * When true, the link will be active if the current route starts with this href.
311
+ * Example: href="/tushar" will be active for "/tushar/overview" and "/tushar/profile"
312
+ * @default false
313
+ */
314
+ matchPartial?: boolean;
309
315
  }
310
316
  export interface ParentItem extends BaseNavigationItem, Activatable {
311
317
  children: LinkItem[];
@@ -3,7 +3,6 @@
3
3
  import type { MenuBar, NavigationItem, SidebarProps, ParentItem, LinkItem } from '../../index.js';
4
4
  import clsx from 'clsx';
5
5
  import { isRouteActive } from '../../helper/nav.svelte.js';
6
- import { goto } from '$app/navigation';
7
6
  import { resolve } from '$app/paths';
8
7
 
9
8
  let { items = [], logo }: SidebarProps = $props();
@@ -47,7 +46,9 @@
47
46
  let anyChildActive = parentItem.active;
48
47
 
49
48
  const updatedChildren = parentItem.children.map((child) => {
50
- const childActive = isRouteActive(child.href, true);
49
+ // Use exact matching for child items by default, unless matchPartial is set
50
+ const exact = !child.matchPartial;
51
+ const childActive = isRouteActive(child.href, exact);
51
52
  if (childActive) {
52
53
  anyChildActive = true;
53
54
  }
@@ -58,7 +59,9 @@
58
59
 
59
60
  if ('href' in item) {
60
61
  const linkItem = item as LinkItem;
61
- return { ...linkItem, active: isRouteActive(linkItem.href) };
62
+ // Use exact matching by default, unless matchPartial is set
63
+ const exact = !linkItem.matchPartial;
64
+ return { ...linkItem, active: isRouteActive(linkItem.href, exact) };
62
65
  }
63
66
 
64
67
  return item;
@@ -115,7 +118,7 @@
115
118
  <nav class="flex-1 space-y-6 px-2 py-4">
116
119
  {#each navigationItems as item, index (index)}
117
120
  {#if 'type' in item && item.type === 'horizontal-divider'}
118
- <li class="my-2 border-t border-white/10"></li>
121
+ <div class="border-t border-white/10"></div>
119
122
  {:else if 'children' in item}
120
123
  <div>
121
124
  {#if !menubar.collapsed}
@@ -125,13 +128,13 @@
125
128
  {/if}
126
129
  <div class={menubar.collapsed ? '' : 'mt-2 space-y-1'}>
127
130
  {#each item.children as child (child.label)}
128
- <button
131
+ <a
132
+ href={resolve(child.href as `/`)}
129
133
  class="group hover:bg-default-500/10 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm font-medium transition-all duration-150 ease-in-out hover:text-white {child.active
130
134
  ? 'bg-default-500/20'
131
135
  : ''} {menubar.collapsed ? 'justify-center' : ''}"
132
136
  class:text-white={child.active}
133
137
  class:text-default-300={!child.active}
134
- onclick={() => goto(resolve(child.href as `/`))}
135
138
  title={menubar.collapsed ? child.label : ''}
136
139
  >
137
140
  {#if child.Icon}
@@ -145,18 +148,18 @@
145
148
  {#if !menubar.collapsed}
146
149
  <span class="truncate">{child.label}</span>
147
150
  {/if}
148
- </button>
151
+ </a>
149
152
  {/each}
150
153
  </div>
151
154
  </div>
152
155
  {:else if 'href' in item}
153
- <button
156
+ <a
157
+ href={resolve(item.href as `/`)}
154
158
  class="group hover:bg-default-500/10 flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-sm font-medium transition-all duration-150 ease-in-out hover:text-white {item.active
155
159
  ? 'bg-default-500/20'
156
160
  : ''} {menubar.collapsed ? 'justify-center' : ''}"
157
161
  class:text-white={item.active}
158
162
  class:text-default-300={!item.active}
159
- onclick={() => (window.location.href = item.href)}
160
163
  title={menubar.collapsed ? item.label : ''}
161
164
  >
162
165
  {#if item.Icon}
@@ -170,7 +173,7 @@
170
173
  {#if !menubar.collapsed}
171
174
  <span class="truncate">{item.label}</span>
172
175
  {/if}
173
- </button>
176
+ </a>
174
177
  {/if}
175
178
  {/each}
176
179
  </nav>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makolabs/ripple",
3
- "version": "1.2.22",
3
+ "version": "1.2.23",
4
4
  "description": "Simple Svelte 5 powered component library ✨",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -1,23 +0,0 @@
1
- /**
2
- * User Management Types
3
- *
4
- * Shared types for user management remote functions.
5
- */
6
- import type { User } from '../index.js';
7
- /**
8
- * Options for fetching users
9
- */
10
- export interface GetUsersOptions {
11
- page: number;
12
- pageSize: number;
13
- sortBy?: string;
14
- sortOrder?: 'asc' | 'desc';
15
- query?: string;
16
- }
17
- /**
18
- * Result of fetching users
19
- */
20
- export interface GetUsersResult {
21
- users: User[];
22
- totalUsers: number;
23
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * User Management Types
3
- *
4
- * Shared types for user management remote functions.
5
- */
6
- export {};