@syscore/ui-library 2.0.0-beta-publish-workflow-beta.24 → 2.0.0-beta-publish-workflow-beta.26

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,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";
@@ -1,12 +1,30 @@
1
1
  import { cn } from "@/lib/utils";
2
2
 
3
+ export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ /** Exact width: px when a number, any CSS length when a string (e.g. "60%"). Omit to fill the parent. */
5
+ width?: number | string;
6
+ /** Exact height: px when a number, any CSS length when a string. Omit for the "text" shape's 1-line default. */
7
+ height?: number | string;
8
+ /** "text" (default, a line of copy) | "circle" (avatar/icon) | "rect" (image/media block) */
9
+ shape?: "text" | "circle" | "rect";
10
+ }
11
+
3
12
  function Skeleton({
4
13
  className,
14
+ width,
15
+ height,
16
+ shape = "text",
17
+ style,
5
18
  ...props
6
- }: React.HTMLAttributes<HTMLDivElement>) {
19
+ }: SkeletonProps) {
7
20
  return (
8
21
  <div
9
- className={cn("skeleton", className)}
22
+ className={cn("skeleton", `skeleton--${shape}`, className)}
23
+ style={{
24
+ ...style,
25
+ width: typeof width === "number" ? `${width}px` : width,
26
+ height: typeof height === "number" ? `${height}px` : height,
27
+ }}
10
28
  {...props}
11
29
  />
12
30
  );
package/client/global.css CHANGED
@@ -1660,11 +1660,25 @@ body {
1660
1660
 
1661
1661
  /* Skeleton Styles */
1662
1662
  .skeleton {
1663
+ display: block;
1664
+ width: 100%;
1663
1665
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
1664
- border-radius: calc(var(--radius-md, 8px));
1665
1666
  background-color: hsl(var(--muted));
1666
1667
  }
1667
1668
 
1669
+ .skeleton--text {
1670
+ height: 1em;
1671
+ border-radius: calc(var(--radius-sm, 4px));
1672
+ }
1673
+
1674
+ .skeleton--rect {
1675
+ border-radius: calc(var(--radius-md, 8px));
1676
+ }
1677
+
1678
+ .skeleton--circle {
1679
+ border-radius: 9999px;
1680
+ }
1681
+
1668
1682
  @keyframes pulse {
1669
1683
  0%,
1670
1684
  100% {
@@ -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,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
+ };
@@ -2,12 +2,21 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../lib/utils.js";
3
3
  function Skeleton({
4
4
  className,
5
+ width,
6
+ height,
7
+ shape = "text",
8
+ style,
5
9
  ...props
6
10
  }) {
7
11
  return /* @__PURE__ */ jsx(
8
12
  "div",
9
13
  {
10
- className: cn("skeleton", className),
14
+ className: cn("skeleton", `skeleton--${shape}`, className),
15
+ style: {
16
+ ...style,
17
+ width: typeof width === "number" ? `${width}px` : width,
18
+ height: typeof height === "number" ? `${height}px` : height
19
+ },
11
20
  ...props
12
21
  }
13
22
  );