@gsa-tts/graymatter-ui 0.3.1 → 0.3.3
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/README.md +173 -74
- package/assets/images/chat-hero-image-mobile.webp +0 -0
- package/dist/graymatter-ui.js +2172 -2073
- package/dist/graymatter-ui.umd.cjs +21 -21
- package/package.json +5 -4
- package/src/astro-config/index.ts +10 -0
- package/src/components/Button.svelte +4 -0
- package/src/components/DesktopSideNav.svelte +41 -1
- package/src/components/Head.astro +2 -1
- package/src/components/MobileBottomNav.svelte +5 -1
- package/src/components/MobileSideMenu.svelte +2 -2
- package/src/components/MobileSideMenu.webcomponent.svelte +2 -4
- package/src/components/MobileTopNav.svelte +9 -2
- package/src/components/MobileTopNav.webcomponent.svelte +2 -2
- package/src/components/{UsaBanner.astro → UsaBanner.svelte} +33 -31
- package/src/components/index.ts +1 -1
- package/src/index.ts +3 -0
- package/src/layouts/GlobalAppLayout.astro +6 -127
- package/src/styles/base/typography.css +8 -1
- package/src/styles/components/heroCards.css +1 -7
- package/src/utils/navigationControl.ts +78 -0
- package/src/utils/setupMocks.ts +10 -2
- package/static/uswds/styles/styles.css +1 -1
- package/static/uswds/styles/styles.css.map +1 -1
- package/assets/images/api-hero-image.png +0 -0
- package/assets/images/chat-hero-image.png +0 -0
- package/assets/images/console-hero-image.png +0 -0
|
@@ -65,16 +65,10 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.ai-hero-card__title {
|
|
68
|
-
font-size: var(--ai-size-
|
|
68
|
+
font-size: var(--ai-size-32);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
.ai-hero-card__content {
|
|
72
72
|
order: 1;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
@media (--ai-size-breakpoint-desktop-lg) {
|
|
77
|
-
.ai-hero-card__title {
|
|
78
|
-
font-size: var(--ai-size-32);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for controlling the DesktopSideNav component externally
|
|
3
|
+
* This allows external apps to control the desktop navigation state without direct prop access
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface DesktopNavControlEventDetail {
|
|
7
|
+
action: 'toggle' | 'open' | 'close' | 'set';
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Dispatches a custom event to control the DesktopSideNav component
|
|
13
|
+
* @param action - The action to perform ('toggle', 'open', 'close', or 'set')
|
|
14
|
+
* @param isOpen - Required when action is 'set', specifies the desired state
|
|
15
|
+
*/
|
|
16
|
+
export function controlDesktopNavigation(
|
|
17
|
+
action: 'toggle' | 'open' | 'close',
|
|
18
|
+
isOpen?: never
|
|
19
|
+
): void;
|
|
20
|
+
export function controlDesktopNavigation(action: 'set', isOpen: boolean): void;
|
|
21
|
+
export function controlDesktopNavigation(
|
|
22
|
+
action: DesktopNavControlEventDetail['action'],
|
|
23
|
+
isOpen?: boolean
|
|
24
|
+
): void {
|
|
25
|
+
if (typeof window === 'undefined') {
|
|
26
|
+
console.warn(
|
|
27
|
+
'[DesktopNavControl] Cannot control desktop navigation on server side'
|
|
28
|
+
);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (action === 'set' && typeof isOpen !== 'boolean') {
|
|
33
|
+
console.error(
|
|
34
|
+
'[DesktopNavControl] isOpen parameter is required when action is "set"'
|
|
35
|
+
);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const event = new CustomEvent<DesktopNavControlEventDetail>(
|
|
40
|
+
'graymatter-desktop-nav-control',
|
|
41
|
+
{
|
|
42
|
+
detail: { action, isOpen },
|
|
43
|
+
bubbles: true,
|
|
44
|
+
cancelable: false,
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
window.dispatchEvent(event);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Toggle the desktop navigation state
|
|
53
|
+
*/
|
|
54
|
+
export function toggleNavigation(): void {
|
|
55
|
+
controlDesktopNavigation('toggle');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Open the desktop navigation
|
|
60
|
+
*/
|
|
61
|
+
export function openNavigation(): void {
|
|
62
|
+
controlDesktopNavigation('open');
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Close the desktop navigation
|
|
67
|
+
*/
|
|
68
|
+
export function closeNavigation(): void {
|
|
69
|
+
controlDesktopNavigation('close');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Set the desktop navigation to a specific state
|
|
74
|
+
* @param isOpen - The desired desktop navigation state
|
|
75
|
+
*/
|
|
76
|
+
export function setNavigationState(isOpen: boolean): void {
|
|
77
|
+
controlDesktopNavigation('set', isOpen);
|
|
78
|
+
}
|
package/src/utils/setupMocks.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { vi } from 'vitest';
|
|
2
|
-
import { writable } from 'svelte/store';
|
|
2
|
+
import { writable, derived } from 'svelte/store';
|
|
3
3
|
|
|
4
4
|
export function setupCommonMocks() {
|
|
5
5
|
// navigationStore.js mock
|
|
6
6
|
vi.mock('../stores/navigationStore.js', () => {
|
|
7
7
|
const isExpanded = writable(true);
|
|
8
8
|
const selectedItem = writable('console');
|
|
9
|
-
const isMenuButtonDisabled = writable(false);
|
|
10
9
|
const selectedSubNavItemTitle = writable('');
|
|
10
|
+
|
|
11
|
+
const isMenuButtonDisabled = derived(
|
|
12
|
+
selectedItem,
|
|
13
|
+
$selectedItem => $selectedItem === 'discover'
|
|
14
|
+
);
|
|
15
|
+
|
|
11
16
|
return {
|
|
12
17
|
isExpanded,
|
|
13
18
|
selectedItem,
|
|
@@ -16,6 +21,9 @@ export function setupCommonMocks() {
|
|
|
16
21
|
navigationStore: {
|
|
17
22
|
setSelectedItem: vi.fn(),
|
|
18
23
|
setExpanded: (val: boolean) => isExpanded.set(val),
|
|
24
|
+
toggleExpanded: () =>
|
|
25
|
+
isExpanded.update((expanded: boolean) => !expanded),
|
|
26
|
+
handleLayoutTransition: vi.fn(),
|
|
19
27
|
},
|
|
20
28
|
};
|
|
21
29
|
});
|