@pattern-stack/frontend-patterns 0.2.0-alpha.15 → 0.2.0-alpha.16
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/CHANGELOG.md +8 -0
- package/dist/atoms/types/navigation.d.ts +9 -2
- package/dist/atoms/types/navigation.d.ts.map +1 -1
- package/dist/index.es.js +33 -13
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/dist/molecules/layout/Sidebar.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.0-alpha.16]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **`Sidebar` renders `navigation.logo`**: the previously unused `NavigationConfig.logo` field now appears at the top of the sidebar when expanded. Strings render in a small semibold label (`text-sm font-semibold text-foreground truncate`); `ReactNode` values render as-is so consumers can pass an `<img>`, SVG, or composed branding element. The collapse toggle moves to the right of the logo when expanded; when collapsed, the toggle remains centered alone (unchanged behavior).
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **`NavigationConfig.logo` widened to `string | ReactNode | undefined`** so consumers can pass arbitrary branding nodes, not just strings.
|
|
17
|
+
|
|
10
18
|
## [0.2.0-alpha.15]
|
|
11
19
|
|
|
12
20
|
### Fixed
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
1
2
|
export type IconName = "Palette" | "Menu" | "X" | "Shield" | "Users" | "BarChart" | "BarChart2" | "BarChart3" | "BarChart4" | "LineChart" | "AreaChart" | "PieChart" | "Database" | "TrendingUp" | "TrendingDown" | "Activity" | "Layout" | "Home" | "Settings" | "Bell" | "Search" | "Plus" | "Edit" | "Trash2" | "Eye" | "Download" | "Upload" | "Share" | "Lock" | "Unlock" | "Mail" | "Phone" | "Calendar" | "Clock" | "MapPin" | "Map" | "Star" | "Heart" | "Bookmark" | "Tag" | "Flag" | "File" | "Folder" | "Image" | "Video" | "Music" | "ChevronRight" | "ChevronDown" | "ChevronLeft" | "ChevronUp" | "ArrowRight" | "ArrowLeft" | "ArrowUp" | "ArrowDown" | "Check" | "AlertCircle" | "Info" | "HelpCircle" | "Building" | "Truck" | "Handshake" | "User" | "Brain" | "Calculator" | "ShoppingCart" | "Utensils" | "Car" | "Zap" | "Film" | "ShoppingBag" | "Wrench" | "CreditCard" | "Wallet" | "PiggyBank" | "Receipt" | "DollarSign" | "Percent" | "Gift" | "Package" | "Coffee" | "Plane" | "Bus" | "Fuel" | "Sparkles" | "Scissors" | "Dumbbell" | "Pill" | "Stethoscope" | "GraduationCap" | "Book" | "BookOpen" | "Gamepad2" | "Tv" | "Wifi" | "Droplets" | "Flame" | "TreePine" | "Dog" | "Baby" | "Shirt" | "Sofa" | "Hammer" | "Paintbrush" | "Lightbulb";
|
|
2
3
|
export interface NavigationItem {
|
|
3
4
|
/** Unique identifier for the navigation item */
|
|
@@ -22,8 +23,14 @@ export interface NavigationConfig {
|
|
|
22
23
|
items: NavigationItem[];
|
|
23
24
|
/** Whether to show the default showcase navigation as fallback */
|
|
24
25
|
showDefaultNavigation?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Custom logo or title for the sidebar header. Renders at the top of the
|
|
28
|
+
* Sidebar (left of the collapse toggle) when the sidebar is expanded; hidden
|
|
29
|
+
* when collapsed. A `string` is rendered inside a small semibold label;
|
|
30
|
+
* a `ReactNode` is rendered as-is so consumers can pass an `<img>`, SVG,
|
|
31
|
+
* or composed branding element.
|
|
32
|
+
*/
|
|
33
|
+
logo?: string | ReactNode;
|
|
27
34
|
/** Whether the sidebar starts expanded */
|
|
28
35
|
defaultExpanded?: boolean;
|
|
29
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/atoms/types/navigation.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,MAAM,GACN,GAAG,GACH,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,UAAU,GACV,UAAU,GACV,YAAY,GACZ,cAAc,GACd,UAAU,GACV,QAAQ,GACR,MAAM,GACN,UAAU,GACV,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,QAAQ,GACR,KAAK,GACL,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,MAAM,GACN,OAAO,GACP,UAAU,GACV,KAAK,GACL,MAAM,GACN,MAAM,GACN,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,cAAc,GACd,aAAa,GACb,aAAa,GACb,WAAW,GACX,YAAY,GACZ,WAAW,GACX,SAAS,GACT,WAAW,GACX,OAAO,GACP,aAAa,GACb,MAAM,GACN,YAAY,GACZ,UAAU,GACV,OAAO,GACP,WAAW,GACX,MAAM,GACN,OAAO,GACP,YAAY,GAEZ,cAAc,GACd,UAAU,GACV,KAAK,GACL,KAAK,GACL,MAAM,GACN,aAAa,GACb,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,WAAW,GACX,SAAS,GACT,YAAY,GACZ,SAAS,GACT,MAAM,GACN,SAAS,GACT,QAAQ,GACR,OAAO,GACP,KAAK,GACL,MAAM,GACN,UAAU,GACV,UAAU,GACV,UAAU,GACV,MAAM,GACN,aAAa,GACb,eAAe,GACf,MAAM,GACN,UAAU,GACV,UAAU,GACV,IAAI,GACJ,MAAM,GACN,UAAU,GACV,OAAO,GACP,UAAU,GACV,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,WAAW,CAAC;AAEhB,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,gDAAgD;IAChD,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,kEAAkE;IAClE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/atoms/types/navigation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,MAAM,GACN,GAAG,GACH,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,WAAW,GACX,UAAU,GACV,UAAU,GACV,YAAY,GACZ,cAAc,GACd,UAAU,GACV,QAAQ,GACR,MAAM,GACN,UAAU,GACV,MAAM,GACN,QAAQ,GACR,MAAM,GACN,MAAM,GACN,QAAQ,GACR,KAAK,GACL,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,MAAM,GACN,OAAO,GACP,UAAU,GACV,OA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CAAC;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,kEAAkE;IAClE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
|
package/dist/index.es.js
CHANGED
|
@@ -10684,23 +10684,43 @@ const Sidebar = ({
|
|
|
10684
10684
|
"data-component-name": "Sidebar",
|
|
10685
10685
|
"data-collapsed": !isExpanded,
|
|
10686
10686
|
children: [
|
|
10687
|
-
/* @__PURE__ */
|
|
10688
|
-
"
|
|
10687
|
+
/* @__PURE__ */ jsxs(
|
|
10688
|
+
"div",
|
|
10689
10689
|
{
|
|
10690
|
-
onClick: toggleSidebar,
|
|
10691
10690
|
className: cn(
|
|
10692
|
-
"
|
|
10693
|
-
"
|
|
10694
|
-
"flex items-center justify-center",
|
|
10695
|
-
"hover:bg-muted hover:text-foreground",
|
|
10696
|
-
"active:scale-95",
|
|
10697
|
-
"transition-all duration-150 ease-out"
|
|
10691
|
+
"flex items-center p-3 pt-4",
|
|
10692
|
+
isExpanded ? "justify-between gap-2" : "justify-center"
|
|
10698
10693
|
),
|
|
10699
|
-
"data-component-name": "
|
|
10700
|
-
|
|
10701
|
-
|
|
10694
|
+
"data-component-name": "SidebarHeader",
|
|
10695
|
+
children: [
|
|
10696
|
+
isExpanded && (navigation == null ? void 0 : navigation.logo) != null && /* @__PURE__ */ jsx(
|
|
10697
|
+
"div",
|
|
10698
|
+
{
|
|
10699
|
+
className: "flex-1 min-w-0 flex items-center",
|
|
10700
|
+
"data-component-name": "SidebarLogo",
|
|
10701
|
+
children: typeof navigation.logo === "string" ? /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-foreground truncate", children: navigation.logo }) : navigation.logo
|
|
10702
|
+
}
|
|
10703
|
+
),
|
|
10704
|
+
/* @__PURE__ */ jsx(
|
|
10705
|
+
"button",
|
|
10706
|
+
{
|
|
10707
|
+
onClick: toggleSidebar,
|
|
10708
|
+
className: cn(
|
|
10709
|
+
"w-7 h-7 rounded-md shrink-0",
|
|
10710
|
+
"bg-muted/50 text-muted-foreground",
|
|
10711
|
+
"flex items-center justify-center",
|
|
10712
|
+
"hover:bg-muted hover:text-foreground",
|
|
10713
|
+
"active:scale-95",
|
|
10714
|
+
"transition-all duration-150 ease-out"
|
|
10715
|
+
),
|
|
10716
|
+
"data-component-name": "SidebarToggle",
|
|
10717
|
+
title: !isExpanded ? "Expand sidebar" : "Collapse sidebar",
|
|
10718
|
+
children: !isExpanded ? /* @__PURE__ */ jsx(Menu, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ jsx(X, { className: "w-3.5 h-3.5" })
|
|
10719
|
+
}
|
|
10720
|
+
)
|
|
10721
|
+
]
|
|
10702
10722
|
}
|
|
10703
|
-
)
|
|
10723
|
+
),
|
|
10704
10724
|
/* @__PURE__ */ jsx("nav", { className: "flex-1 p-3 space-y-2", "data-component-name": "SidebarNav", children: items.map((item) => {
|
|
10705
10725
|
const [itemBasePath, itemQuery] = item.path.split("?");
|
|
10706
10726
|
const currentPath = location.pathname;
|