@herdingbits/trailhead-cloudscape 0.0.16 → 0.0.18

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.
@@ -1 +1 @@
1
- {"version":3,"file":"shell-app.d.ts","sourceRoot":"","sources":["../src/shell-app.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,6BAA6B,CAAC;AAEtE,UAAU,aAAa;IACrB,KAAK,EAAE,SAAS,CAAC;CAClB;AAiBD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,aAAa,2CAkNhD"}
1
+ {"version":3,"file":"shell-app.d.ts","sourceRoot":"","sources":["../src/shell-app.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,6BAA6B,CAAC;AAEtE,UAAU,aAAa;IACrB,KAAK,EAAE,SAAS,CAAC;CAClB;AAiBD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,aAAa,2CAiNhD"}
package/dist/shell-app.js CHANGED
@@ -147,5 +147,5 @@ export function ShellApp({ shell }) {
147
147
  padding: '24px',
148
148
  borderRadius: '8px',
149
149
  textAlign: 'center',
150
- }, children: [_jsx(Spinner, { size: "large" }), _jsx("div", { style: { marginTop: '16px' }, children: busyMessage })] }) })), _jsx(Modal, { visible: dialogState.visible, onDismiss: handleDialogDismiss, header: dialogState.title, footer: _jsx(Box, { float: "right", children: _jsx(SpaceBetween, { direction: "horizontal", size: "xs", children: dialogState.buttons.map((btn, idx) => (_jsx(Button, { variant: btn.variant === 'primary' ? 'primary' : 'normal', onClick: () => handleDialogButton(btn.value), children: btn.label }, idx))) }) }), children: dialogState.message }), _jsx(ShellLayout, { navigation: navigation, currentPath: currentPath, basePath: shell.appBasePath, onNavigate: handleNavigate, children: _jsx("div", { id: "shell-content", ref: contentRef }) })] }));
150
+ }, children: [_jsx(Spinner, { size: "large" }), _jsx("div", { style: { marginTop: '16px' }, children: busyMessage })] }) })), _jsx(Modal, { visible: dialogState.visible, onDismiss: handleDialogDismiss, header: dialogState.title, footer: _jsx(Box, { float: "right", children: _jsx(SpaceBetween, { direction: "horizontal", size: "xs", children: dialogState.buttons.map((btn, idx) => (_jsx(Button, { variant: btn.variant === 'primary' ? 'primary' : 'normal', onClick: () => handleDialogButton(btn.value), children: btn.label }, idx))) }) }), children: dialogState.message }), _jsx(ShellLayout, { navigation: navigation, currentPath: currentPath, onNavigate: handleNavigate, children: _jsx("div", { id: "shell-content", ref: contentRef }) })] }));
151
151
  }
@@ -3,10 +3,9 @@ import type { NavItem } from '@herdingbits/trailhead-core';
3
3
  interface ShellLayoutProps {
4
4
  navigation: NavItem[];
5
5
  currentPath: string;
6
- basePath: string;
7
6
  onNavigate: (path: string) => void;
8
7
  children: React.ReactNode;
9
8
  }
10
- export declare function ShellLayout({ navigation, currentPath, basePath, onNavigate, children }: ShellLayoutProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function ShellLayout({ navigation, currentPath, onNavigate, children }: ShellLayoutProps): import("react/jsx-runtime").JSX.Element;
11
10
  export {};
12
11
  //# sourceMappingURL=shell-layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shell-layout.d.ts","sourceRoot":"","sources":["../src/shell-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,6BAA6B,CAAC;AAEpE,UAAU,gBAAgB;IACxB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CA+CxG"}
1
+ {"version":3,"file":"shell-layout.d.ts","sourceRoot":"","sources":["../src/shell-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,OAAO,EAAW,MAAM,6BAA6B,CAAC;AAEpE,UAAU,gBAAgB;IACxB,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CA4C9F"}
@@ -2,14 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import AppLayout from '@cloudscape-design/components/app-layout';
4
4
  import SideNavigation from '@cloudscape-design/components/side-navigation';
5
- export function ShellLayout({ navigation, currentPath, basePath, onNavigate, children }) {
5
+ export function ShellLayout({ navigation, currentPath, onNavigate, children }) {
6
6
  const [navigationOpen, setNavigationOpen] = useState(true);
7
- const isExternal = (href) => /^https?:\/\/|^\/\//.test(href);
8
- const resolveHref = (href) => isExternal(href) ? href : basePath + href + '/';
9
7
  const mapLink = (item) => ({
10
8
  type: 'link',
11
9
  text: item.label,
12
- href: resolveHref(item.href),
10
+ href: item.href,
13
11
  });
14
12
  const navItems = [...navigation]
15
13
  .sort((a, b) => a.order - b.order)
@@ -27,7 +25,7 @@ export function ShellLayout({ navigation, currentPath, basePath, onNavigate, chi
27
25
  return { type: 'divider' };
28
26
  }
29
27
  });
30
- return (_jsx(AppLayout, { navigationOpen: navigationOpen, onNavigationChange: ({ detail }) => setNavigationOpen(detail.open), navigation: _jsx(SideNavigation, { activeHref: basePath + currentPath + (currentPath.endsWith('/') ? '' : '/'), items: navItems, onFollow: (event) => {
28
+ return (_jsx(AppLayout, { navigationOpen: navigationOpen, onNavigationChange: ({ detail }) => setNavigationOpen(detail.open), navigation: _jsx(SideNavigation, { activeHref: window.location.pathname.replace(/\/$/, '') || '/', items: navItems, onFollow: (event) => {
31
29
  event.preventDefault();
32
30
  onNavigate(event.detail.href);
33
31
  } }), content: children, toolsHide: true }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herdingbits/trailhead-cloudscape",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "AWS CloudScape adapter for Trailhead. React-based shell with CloudScape components. Supports React 19.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "peerDependencies": {
24
24
  "@cloudscape-design/components": "^3.0.0",
25
25
  "@cloudscape-design/global-styles": "^1.0.0",
26
- "@herdingbits/trailhead-core": "^0.0.16",
26
+ "@herdingbits/trailhead-core": "^0.0.18",
27
27
  "react": "^19.0.0",
28
28
  "react-dom": "^19.0.0"
29
29
  },