@s3pweb/shell-ui 0.1.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.
@@ -0,0 +1,51 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Realtime / MQTT status indicator. Composes a `Radio` glyph with a small
4
+ * coloured presence dot at the icon's bottom-right corner — same shape the
5
+ * Stencil app's `mqttErrorStatus` widget used, ported to React.
6
+ *
7
+ * Plug it into a pinnable `ShellAction`'s `icon` slot so it renders the
8
+ * same way the framework renders mobile / fullscreen / support — a 38 px
9
+ * ghost icon button when pinned, a 16 px row icon when listed in the
10
+ * puzzle / "Plus" menus, a 32 px chip in the collapsed sidebar fallback.
11
+ *
12
+ * Pair with `<RealtimePulseHoverContent>` on the action's `hoverContent`
13
+ * so every surface (top-bar, compact "Plus" rows, puzzle menu, collapsed
14
+ * sidebar) shows the status detail on hover.
15
+ */
16
+ export type RealtimeStatus = 'connected' | 'connecting' | 'error' | 'closed' | 'offline';
17
+ export interface RealtimePulseStrings {
18
+ connected: string;
19
+ connecting: string;
20
+ error: string;
21
+ closed: string;
22
+ offline: string;
23
+ lastUpdate: string;
24
+ }
25
+ /**
26
+ * French strings — built on top of the Stencil app's `mqttErrorStatusOk` /
27
+ * `mqttErrorStatus` wording (`assets/i18n/fr.json`) but specialized per
28
+ * state. The legacy SaaS only had two messages because its MQTT class
29
+ * exposed binary OK/error; the React port keeps the full five-state
30
+ * lifecycle so users see what's actually happening (in-flight reconnect
31
+ * vs. broker error vs. clean close vs. no network).
32
+ */
33
+ export declare const DEFAULT_REALTIME_STRINGS_FR: RealtimePulseStrings;
34
+ /**
35
+ * English equivalents.
36
+ */
37
+ export declare const DEFAULT_REALTIME_STRINGS_EN: RealtimePulseStrings;
38
+ export declare function RealtimePulseIcon({ status, className }: {
39
+ status: RealtimeStatus;
40
+ className?: string;
41
+ }): import("react/jsx-runtime").JSX.Element;
42
+ /**
43
+ * Hover-info content rendered in a HoverCard. Pair with the icon via
44
+ * `ShellAction.hoverContent` so the framework wraps every surface in a
45
+ * HoverCard automatically.
46
+ */
47
+ export declare function RealtimePulseHoverContent({ status, lastUpdate, strings, }: {
48
+ status: RealtimeStatus;
49
+ lastUpdate?: string;
50
+ strings?: RealtimePulseStrings;
51
+ }): ReactNode;
@@ -0,0 +1,14 @@
1
+ import { Tooltip as TooltipPrimitive } from 'radix-ui';
2
+ import * as React from 'react';
3
+ /**
4
+ * Tooltip — shadcn/ui (added via `npx shadcn@latest add tooltip`),
5
+ * customized for the s3pweb shell to match the SaaS app's tooltip:
6
+ * - light popover surface (bg-popover / text-popover-foreground / border)
7
+ * instead of shadcn's default dark inverted tooltip
8
+ * - no arrow
9
+ */
10
+ declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
11
+ declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
12
+ declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
13
+ declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
14
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,36 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * UserMenu — list-of-items menu intended to live inside the click-Popover
4
+ * anchored on the avatar (via `Shell.userMenu`). Each row uses
5
+ * `<PopoverClose asChild>` so a click both dismisses the menu AND runs the
6
+ * row's action (or follows its `href`).
7
+ *
8
+ * Items adopt the brand theme automatically via `text-muted-foreground
9
+ * hover:bg-primary/10 hover:text-primary` — the same palette the collapsed-
10
+ * group fly-out items use, so the UserMenu reads as part of the same family.
11
+ *
12
+ * Items with `tone: 'danger'` paint in the destructive palette
13
+ * (`text-destructive hover:bg-destructive/10`). Items with `dividerBefore`
14
+ * render a 1px separator above them — handy to set off the logout row.
15
+ */
16
+ export interface UserMenuItem {
17
+ id: string;
18
+ label: string;
19
+ icon?: ReactNode;
20
+ /** Click handler. Fires alongside any `href` navigation. */
21
+ onClick?: () => void;
22
+ /** When set, the row renders as `<a target='_blank' href>` so the link opens in a new tab. */
23
+ href?: string;
24
+ /** Visual tone: 'default' (muted-foreground + primary hover) | 'danger' (destructive). Default 'default'. */
25
+ tone?: 'default' | 'danger';
26
+ /** Draw a 1px separator above this row. */
27
+ dividerBefore?: boolean;
28
+ /** Disable the row (cursor:not-allowed, no hover, onClick ignored). */
29
+ disabled?: boolean;
30
+ }
31
+ export interface UserMenuProps {
32
+ items: UserMenuItem[];
33
+ /** Extra Tailwind classes on the menu root — override width/padding as needed. */
34
+ className?: string;
35
+ }
36
+ export declare function UserMenu({ items, className }: UserMenuProps): import("react/jsx-runtime").JSX.Element;
package/dist/i18n.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Built-in translations for shell-ui's chrome (sidebar collapse, theme toggle,
3
+ * nav-mode toggle, logout). Consumers pass a `locale` prop to <Shell> and the
4
+ * component picks the right strings — no need to wire up an external i18n
5
+ * library just to label four buttons.
6
+ */
7
+ export type ShellLocale = 'fr' | 'en';
8
+ export interface ShellStrings {
9
+ collapse: string;
10
+ expand: string;
11
+ logout: string;
12
+ themeDarkMode: string;
13
+ themeLightMode: string;
14
+ navUseTop: string;
15
+ navUseSidebar: string;
16
+ moreLabel: string;
17
+ }
18
+ export declare function getShellStrings(locale?: ShellLocale): ShellStrings;
@@ -0,0 +1,14 @@
1
+ export { Shell, type ShellProps } from './shell';
2
+ export { Sidebar, SidebarItems, type SidebarProps, type SidebarItemsProps, type SidebarUser, type RenderCollapsedTooltip } from './sidebar';
3
+ export { type ShellLocale, type ShellStrings } from './i18n';
4
+ export { isNavGroup, type NavItem, type NavGroup, type NavEntry, type ShellAction } from './types';
5
+ export { HoverCard, HoverCardTrigger, HoverCardContent } from './components/hover-card';
6
+ export { Popover, PopoverTrigger, PopoverAnchor, PopoverClose, PopoverContent } from './components/popover';
7
+ export { PartnerCluster, PartnerTile, tintColor, svgMark, type Partner, type PartnerClusterProps, type PartnerTileProps } from './components/partner-cluster';
8
+ export { EcosystemMegaPanel, type EcosystemMegaPanelProps } from './components/ecosystem-mega-panel';
9
+ export { UserMenu, type UserMenuItem, type UserMenuProps } from './components/user-menu';
10
+ export { LayoutSwitcher, LayoutNumberIcon, type LayoutSwitcherProps } from './components/layout-switcher';
11
+ export { useActionsMenu, ActionsMenuPanel, type UseActionsMenuOptions, type UseActionsMenuReturn, type ActionsMenuPanelProps } from './components/actions-menu';
12
+ export { RealtimePulseIcon, RealtimePulseHoverContent, DEFAULT_REALTIME_STRINGS_FR, DEFAULT_REALTIME_STRINGS_EN, type RealtimeStatus, type RealtimePulseStrings, } from './components/realtime-pulse';
13
+ export { POPOVER_GAP, SIDEBAR_OFFSET, TOPBAR_OFFSET } from './lib/popover-offsets';
14
+ export { useMediaQuery } from './lib/use-media-query';