@syscore/ui-library 2.0.0-beta-publish-workflow-beta.25 → 2.0.0-beta-publish-workflow-beta.27

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,37 @@
1
+ import * as LucideIcons from "lucide-react";
2
+ import type { LucideIcon, LucideProps } from "lucide-react";
3
+
4
+ import {
5
+ SYSTEM_ICON_COLOR,
6
+ SYSTEM_ICON_NAMES,
7
+ SYSTEM_ICON_SIZE,
8
+ SYSTEM_ICON_STROKE_WIDTH,
9
+ toLucideName,
10
+ } from "../../lib/system-icons";
11
+
12
+ export type SystemIconName = (typeof SYSTEM_ICON_NAMES)[number];
13
+
14
+ export interface SystemIconProps extends Omit<LucideProps, "ref"> {
15
+ name: SystemIconName;
16
+ }
17
+
18
+ const icons = LucideIcons as unknown as Record<string, LucideIcon | undefined>;
19
+
20
+ /**
21
+ * Any Figma system icon (`system-icons.ts`'s own Lucide-backed set) by name, without the
22
+ * consumer importing `lucide-react` directly — previously only assembled ad hoc in
23
+ * `Icons.stories.tsx` for the Storybook gallery; this is the same lookup as a real component.
24
+ */
25
+ export function SystemIcon({
26
+ name,
27
+ size = SYSTEM_ICON_SIZE,
28
+ strokeWidth = SYSTEM_ICON_STROKE_WIDTH,
29
+ color = SYSTEM_ICON_COLOR,
30
+ ...props
31
+ }: SystemIconProps) {
32
+ const Icon = icons[toLucideName(name)];
33
+
34
+ if (!Icon) return null;
35
+
36
+ return <Icon size={size} strokeWidth={strokeWidth} color={color} {...props} />;
37
+ }
@@ -0,0 +1,75 @@
1
+ import * as React from "react";
2
+ import { cn } from "@/lib/utils";
3
+
4
+ /**
5
+ * LinkButton — the published `Button`'s look on a real link element.
6
+ *
7
+ * `Button` has no `asChild`/Slot support in this DS, so it cannot render as an
8
+ * anchor or a router `Link` without losing real link semantics (right-click,
9
+ * ctrl/cmd-click, screen-reader "link" role). This applies the exact same
10
+ * `.button*` classes `Button`'s own cva map emits, so it stays pixel-identical.
11
+ * Renders as `<a>` by default — pass `as={Link}` (react-router) for in-app nav.
12
+ *
13
+ * Only the variants/sizes this app currently needs are mapped. Extend this
14
+ * alongside Button's own cva map in
15
+ * IWBI-DESIGN-SYSTEM/client/components/ui/button.tsx if a third is needed,
16
+ * so the two never drift apart.
17
+ */
18
+ const LINK_BUTTON_VARIANT_CLASSES = {
19
+ "primary-gradient": "button--primary-gradient",
20
+ "general-secondary": "button--general-secondary",
21
+ } as const;
22
+
23
+ const LINK_BUTTON_SIZE_CLASSES = {
24
+ large: "button--large",
25
+ utility: "button--utility",
26
+ } as const;
27
+
28
+ const LINK_BUTTON_TEXT_CLASSES = {
29
+ large: "body-base",
30
+ utility: "body-small",
31
+ } as const;
32
+
33
+ type LinkButtonVariant = keyof typeof LINK_BUTTON_VARIANT_CLASSES;
34
+ type LinkButtonSize = keyof typeof LINK_BUTTON_SIZE_CLASSES;
35
+
36
+ export interface LinkButtonProps extends React.HTMLAttributes<HTMLElement> {
37
+ as?: React.ElementType;
38
+ variant?: LinkButtonVariant;
39
+ size?: LinkButtonSize;
40
+ href?: string;
41
+ to?: string;
42
+ }
43
+
44
+ const LinkButton = React.forwardRef<HTMLElement, LinkButtonProps>(
45
+ (
46
+ {
47
+ as: Component = "a",
48
+ variant = "primary-gradient",
49
+ size = "large",
50
+ className,
51
+ children,
52
+ ...props
53
+ },
54
+ ref,
55
+ ) => (
56
+ <Component
57
+ ref={ref}
58
+ className={cn(
59
+ "button",
60
+ LINK_BUTTON_VARIANT_CLASSES[variant],
61
+ LINK_BUTTON_SIZE_CLASSES[size],
62
+ className,
63
+ )}
64
+ {...props}
65
+ >
66
+ <span className="button-text">
67
+ <span className={LINK_BUTTON_TEXT_CLASSES[size]}>{children}</span>
68
+ </span>
69
+ </Component>
70
+ ),
71
+ );
72
+ LinkButton.displayName = "LinkButton";
73
+
74
+ export { LinkButton };
75
+ export type { LinkButtonVariant, LinkButtonSize };
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "@/lib/utils";
4
+ import { SystemIcon, type SystemIconName } from "@/components/icons/SystemIcon";
5
+
6
+ /**
7
+ * A flat icon + label nav list for a page-local tab rail (e.g. a dashboard sidebar) —
8
+ * reuses the `.sidebar-menu*` classes `Sidebar`/`SidebarMenuButton` already ship, but
9
+ * without `SidebarProvider`: that wrapper's `.sidebar-wrapper` forces `min-height: 100svh`,
10
+ * meant for an app-shell-level sidebar, which would stretch an inline content column to
11
+ * the full viewport height. `NavRail` has no such wrapper, so it drops into page content
12
+ * directly (e.g. inside a `Columns preset="sidebar"` cell).
13
+ */
14
+ export interface NavRailItem {
15
+ key: string;
16
+ label: string;
17
+ icon?: SystemIconName;
18
+ }
19
+
20
+ export interface NavRailProps extends React.ComponentProps<"nav"> {
21
+ items: NavRailItem[];
22
+ activeKey: string;
23
+ onSelect: (key: string) => void;
24
+ }
25
+
26
+ export const NavRail = React.forwardRef<HTMLElement, NavRailProps>(
27
+ ({ items, activeKey, onSelect, className, ...props }, ref) => {
28
+ return (
29
+ <nav ref={ref} className={cn("sidebar", "nav-rail", className)} {...props}>
30
+ <ul className="sidebar-menu">
31
+ {items.map((item) => {
32
+ const isActive = activeKey === item.key;
33
+
34
+ return (
35
+ <li key={item.key} className="sidebar-menu-item">
36
+ <button
37
+ type="button"
38
+ className="sidebar-menu-button"
39
+ data-active={isActive}
40
+ aria-current={isActive ? "page" : undefined}
41
+ onClick={() => onSelect(item.key)}
42
+ >
43
+ {item.icon ? <SystemIcon name={item.icon} size={16} /> : null}
44
+ <span>{item.label}</span>
45
+ </button>
46
+ </li>
47
+ );
48
+ })}
49
+ </ul>
50
+ </nav>
51
+ );
52
+ },
53
+ );
54
+ NavRail.displayName = "NavRail";
@@ -0,0 +1,18 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as LucideIcons from "lucide-react";
3
+ import { toLucideName, SYSTEM_ICON_COLOR, SYSTEM_ICON_STROKE_WIDTH, SYSTEM_ICON_SIZE } from "../../lib/system-icons.js";
4
+ const icons = LucideIcons;
5
+ function SystemIcon({
6
+ name,
7
+ size = SYSTEM_ICON_SIZE,
8
+ strokeWidth = SYSTEM_ICON_STROKE_WIDTH,
9
+ color = SYSTEM_ICON_COLOR,
10
+ ...props
11
+ }) {
12
+ const Icon = icons[toLucideName(name)];
13
+ if (!Icon) return null;
14
+ return /* @__PURE__ */ jsx(Icon, { size, strokeWidth, color, ...props });
15
+ }
16
+ export {
17
+ SystemIcon
18
+ };
@@ -0,0 +1,42 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/utils.js";
4
+ const LINK_BUTTON_VARIANT_CLASSES = {
5
+ "primary-gradient": "button--primary-gradient",
6
+ "general-secondary": "button--general-secondary"
7
+ };
8
+ const LINK_BUTTON_SIZE_CLASSES = {
9
+ large: "button--large",
10
+ utility: "button--utility"
11
+ };
12
+ const LINK_BUTTON_TEXT_CLASSES = {
13
+ large: "body-base",
14
+ utility: "body-small"
15
+ };
16
+ const LinkButton = React.forwardRef(
17
+ ({
18
+ as: Component = "a",
19
+ variant = "primary-gradient",
20
+ size = "large",
21
+ className,
22
+ children,
23
+ ...props
24
+ }, ref) => /* @__PURE__ */ jsx(
25
+ Component,
26
+ {
27
+ ref,
28
+ className: cn(
29
+ "button",
30
+ LINK_BUTTON_VARIANT_CLASSES[variant],
31
+ LINK_BUTTON_SIZE_CLASSES[size],
32
+ className
33
+ ),
34
+ ...props,
35
+ children: /* @__PURE__ */ jsx("span", { className: "button-text", children: /* @__PURE__ */ jsx("span", { className: LINK_BUTTON_TEXT_CLASSES[size], children }) })
36
+ }
37
+ )
38
+ );
39
+ LinkButton.displayName = "LinkButton";
40
+ export {
41
+ LinkButton
42
+ };
@@ -0,0 +1,29 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/utils.js";
4
+ import { SystemIcon } from "../icons/SystemIcon.js";
5
+ const NavRail = React.forwardRef(
6
+ ({ items, activeKey, onSelect, className, ...props }, ref) => {
7
+ return /* @__PURE__ */ jsx("nav", { ref, className: cn("sidebar", "nav-rail", className), ...props, children: /* @__PURE__ */ jsx("ul", { className: "sidebar-menu", children: items.map((item) => {
8
+ const isActive = activeKey === item.key;
9
+ return /* @__PURE__ */ jsx("li", { className: "sidebar-menu-item", children: /* @__PURE__ */ jsxs(
10
+ "button",
11
+ {
12
+ type: "button",
13
+ className: "sidebar-menu-button",
14
+ "data-active": isActive,
15
+ "aria-current": isActive ? "page" : void 0,
16
+ onClick: () => onSelect(item.key),
17
+ children: [
18
+ item.icon ? /* @__PURE__ */ jsx(SystemIcon, { name: item.icon, size: 16 }) : null,
19
+ /* @__PURE__ */ jsx("span", { children: item.label })
20
+ ]
21
+ }
22
+ ) }, item.key);
23
+ }) }) });
24
+ }
25
+ );
26
+ NavRail.displayName = "NavRail";
27
+ export {
28
+ NavRail
29
+ };