@gsa-tts/graymatter-ui 0.2.4 → 0.2.6
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/graymatter-ui.js +1098 -1090
- package/dist/graymatter-ui.umd.cjs +6 -6
- package/package.json +3 -3
- package/src/components/DesktopSideNav.svelte +4 -4
- package/src/components/MobileBottomNav.svelte +1 -1
- package/src/components/ProfileMenu.svelte +21 -3
- package/src/layouts/GlobalAppLayout.astro +2 -3
- package/src/utils/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gsa-tts/graymatter-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"vitest": "^3.0.7",
|
|
57
57
|
"vite": "^6.3.5",
|
|
58
58
|
"@gsa-tts/graymatter-eslint": "0.0.1",
|
|
59
|
-
"@gsa-tts/graymatter-
|
|
60
|
-
"@gsa-tts/graymatter-
|
|
59
|
+
"@gsa-tts/graymatter-typescript-config": "0.0.1",
|
|
60
|
+
"@gsa-tts/graymatter-vitest-config": "0.0.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@fontsource-variable/archivo": "^5.2.6",
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
part="discover-item"
|
|
275
275
|
bind:this={discoverNavRef}
|
|
276
276
|
>
|
|
277
|
-
<div class="icon-container">
|
|
277
|
+
<div class="icon-container" part="discover-icon-container">
|
|
278
278
|
<div class="icon-wrapper">
|
|
279
279
|
<DiscoverIcon isSelected={isNavSelected('discover')} />
|
|
280
280
|
</div>
|
|
@@ -294,7 +294,7 @@
|
|
|
294
294
|
part="chat-item"
|
|
295
295
|
bind:this={chatNavRef}
|
|
296
296
|
>
|
|
297
|
-
<div class="icon-container">
|
|
297
|
+
<div class="icon-container" part="chat-icon-container">
|
|
298
298
|
<div class="icon-wrapper">
|
|
299
299
|
<ChatIcon isSelected={isNavSelected('chat') as boolean} />
|
|
300
300
|
</div>
|
|
@@ -315,7 +315,7 @@
|
|
|
315
315
|
part="console-item"
|
|
316
316
|
bind:this={consoleNavRef}
|
|
317
317
|
>
|
|
318
|
-
<div class="icon-container">
|
|
318
|
+
<div class="icon-container" part="console-icon-container">
|
|
319
319
|
<div class="icon-wrapper">
|
|
320
320
|
<ConsoleIcon isSelected={isNavSelected('console') as boolean} />
|
|
321
321
|
</div>
|
|
@@ -336,7 +336,7 @@
|
|
|
336
336
|
part="api-item"
|
|
337
337
|
bind:this={apiNavRef}
|
|
338
338
|
>
|
|
339
|
-
<div class="icon-container">
|
|
339
|
+
<div class="icon-container" part="api-icon-container">
|
|
340
340
|
<div class="icon-wrapper">
|
|
341
341
|
<ApiIcon isSelected={isNavSelected('api')} />
|
|
342
342
|
</div>
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
{#each navItems as navItem}
|
|
92
92
|
<a
|
|
93
93
|
href={navItem.href}
|
|
94
|
-
class=
|
|
94
|
+
class={`nav-item ${slugify(navItem.id)}-item`}
|
|
95
95
|
class:active={$selectedItem === navItem.id}
|
|
96
96
|
onclick={() => handleNavItemClick(navItem.id)}
|
|
97
97
|
part={`${slugify(navItem.id)}-item`}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
/**
|
|
4
4
|
* Array of menu items to render in the profile menu.
|
|
5
|
-
* Each item: { label: string, icon: string, onClick: () => void }
|
|
5
|
+
* Each item: { label: string, icon: string, onClick: string | (() => void) }
|
|
6
6
|
*/
|
|
7
|
-
export let menuItems: Array<{ label: string; icon: string; onClick: () => void }> = [];
|
|
7
|
+
export let menuItems: Array<{ label: string; icon: string; onClick: string | (() => void) }> = [];
|
|
8
8
|
export let userMeta: { initials: string};
|
|
9
9
|
export let ariaLabel: string = 'Open profile menu';
|
|
10
10
|
export let menuAlign: 'desktop' | 'mobile' = 'desktop';
|
|
@@ -14,6 +14,24 @@
|
|
|
14
14
|
function toggleMenu() { menuOpen = !menuOpen; }
|
|
15
15
|
function closeMenu() { menuOpen = false; }
|
|
16
16
|
|
|
17
|
+
// Execute the onClick function - handles both string and function types
|
|
18
|
+
function executeOnClick(onClick: string | (() => void)) {
|
|
19
|
+
try {
|
|
20
|
+
if (typeof onClick === 'string') {
|
|
21
|
+
// Handle string-based function (for Astro apps)
|
|
22
|
+
const onClickFunction = new Function('return ' + onClick)();
|
|
23
|
+
onClickFunction();
|
|
24
|
+
} else if (typeof onClick === 'function') {
|
|
25
|
+
// Handle actual function (for Svelte apps)
|
|
26
|
+
onClick();
|
|
27
|
+
} else {
|
|
28
|
+
console.error('Invalid onClick type:', typeof onClick);
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Error executing onClick function:', error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
// Optional: close menu on outside click
|
|
18
36
|
function handleBlur(event: FocusEvent) {
|
|
19
37
|
const related = event.relatedTarget as HTMLElement | null;
|
|
@@ -91,7 +109,7 @@
|
|
|
91
109
|
<button
|
|
92
110
|
type="button"
|
|
93
111
|
class="menu-item"
|
|
94
|
-
on:click={() => { item.onClick
|
|
112
|
+
on:click={() => { executeOnClick(item.onClick); closeMenu(); }}
|
|
95
113
|
bind:this={btns[idx]}
|
|
96
114
|
on:keydown={(e) => handleMenuKeydown(e, idx)}
|
|
97
115
|
role="menuitem"
|
|
@@ -18,12 +18,11 @@ const {
|
|
|
18
18
|
profileMenuData = undefined,
|
|
19
19
|
logoLinkUrl,
|
|
20
20
|
logoLinkLabel,
|
|
21
|
+
title: pageTitle,
|
|
21
22
|
} = Astro.props;
|
|
22
|
-
|
|
23
|
-
const title = getPageTitle(Astro);
|
|
24
23
|
---
|
|
25
24
|
|
|
26
|
-
<BaseLayout title={
|
|
25
|
+
<BaseLayout title={pageTitle} gtmID={gtmID}>
|
|
27
26
|
<div class="app">
|
|
28
27
|
<!-- Desktop Navigation -->
|
|
29
28
|
<div class="layout-container">
|
package/src/utils/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './getAppUrls';
|
|
1
|
+
export * from './getAppUrls.js';
|