@dmitriikapustin/ui 0.2.0 → 0.2.1

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/dist/index.cjs CHANGED
@@ -378,15 +378,19 @@ function Divider({ className = "", label }) {
378
378
  // src/atoms/MenuItem.module.scss
379
379
  var MenuItem_module_default = {
380
380
  root: "MenuItem_module_root",
381
+ icon: "MenuItem_module_icon",
381
382
  active: "MenuItem_module_active"
382
383
  };
383
- function MenuItem({ text, active = false, onClick, className = "" }) {
384
- return /* @__PURE__ */ jsxRuntime.jsx(
384
+ function MenuItem({ text, active = false, onClick, className = "", icon }) {
385
+ return /* @__PURE__ */ jsxRuntime.jsxs(
385
386
  "button",
386
387
  {
387
388
  onClick,
388
389
  className: `${MenuItem_module_default.root}${active ? ` ${MenuItem_module_default.active}` : ""}${className ? ` ${className}` : ""}`,
389
- children: text
390
+ children: [
391
+ icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: MenuItem_module_default.icon, children: icon }),
392
+ text
393
+ ]
390
394
  }
391
395
  );
392
396
  }
@@ -1962,6 +1966,7 @@ var Sidebar_module_default = {
1962
1966
  root: "Sidebar_module_root",
1963
1967
  menu: "Sidebar_module_menu",
1964
1968
  courseSubmenu: "Sidebar_module_courseSubmenu",
1969
+ logo: "Sidebar_module_logo",
1965
1970
  nav: "Sidebar_module_nav",
1966
1971
  footer: "Sidebar_module_footer",
1967
1972
  legal: "Sidebar_module_legal"
@@ -1984,31 +1989,56 @@ var courseMenuItems = [
1984
1989
  "\u0421\u043E\u0446. \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0430",
1985
1990
  "\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u044B"
1986
1991
  ];
1987
- function Sidebar({ type = "menu", menuItems, footer, className = "" }) {
1988
- const items = menuItems || (type === "courseSubmenu" ? courseMenuItems : defaultMenuItems);
1989
- const [active, setActive] = react.useState(0);
1992
+ var DEFAULT_LEGAL = "kapustin.cc, 2026 \n\u0418\u041F \u041A\u0430\u043F\u0443\u0441\u0442\u0438\u043D \u0414.\u0412., \u0418\u041D\u041D 7721250201";
1993
+ function normaliseItems(items) {
1994
+ if (items.length === 0) return [];
1995
+ if (typeof items[0] === "string") {
1996
+ return items.map((label, i) => ({ id: String(i), label }));
1997
+ }
1998
+ return items;
1999
+ }
2000
+ function Sidebar({
2001
+ type = "menu",
2002
+ menuItems,
2003
+ footer,
2004
+ className = "",
2005
+ activeId,
2006
+ onItemClick,
2007
+ logo,
2008
+ legalText
2009
+ }) {
2010
+ const rawItems = menuItems || (type === "courseSubmenu" ? courseMenuItems : defaultMenuItems);
2011
+ const items = normaliseItems(rawItems);
2012
+ const [internalActive, setInternalActive] = react.useState(0);
2013
+ const isControlled = activeId !== void 0;
1990
2014
  const widthClass = type === "courseSubmenu" ? Sidebar_module_default.courseSubmenu : Sidebar_module_default.menu;
2015
+ const showLegal = legalText !== null;
2016
+ const legalContent = legalText === void 0 ? DEFAULT_LEGAL : legalText;
1991
2017
  return /* @__PURE__ */ jsxRuntime.jsxs(
1992
2018
  "aside",
1993
2019
  {
1994
2020
  className: `${Sidebar_module_default.root} ${widthClass}${className ? ` ${className}` : ""}`,
1995
2021
  children: [
1996
- /* @__PURE__ */ jsxRuntime.jsx("nav", { className: Sidebar_module_default.nav, children: items.map((item, i) => /* @__PURE__ */ jsxRuntime.jsx(
1997
- MenuItem,
1998
- {
1999
- text: item,
2000
- active: i === active,
2001
- onClick: () => setActive(i)
2002
- },
2003
- `${item}-${i}`
2004
- )) }),
2022
+ logo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: Sidebar_module_default.logo, children: logo }),
2023
+ /* @__PURE__ */ jsxRuntime.jsx("nav", { className: Sidebar_module_default.nav, children: items.map((item, i) => {
2024
+ const isActive = isControlled ? item.id === activeId : i === internalActive;
2025
+ return /* @__PURE__ */ jsxRuntime.jsx(
2026
+ MenuItem,
2027
+ {
2028
+ text: item.label,
2029
+ icon: item.icon,
2030
+ active: isActive,
2031
+ onClick: () => {
2032
+ if (onItemClick) onItemClick(item.id);
2033
+ if (!isControlled) setInternalActive(i);
2034
+ }
2035
+ },
2036
+ item.id
2037
+ );
2038
+ }) }),
2005
2039
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Sidebar_module_default.footer, children: [
2006
2040
  type === "menu" && footer,
2007
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: Sidebar_module_default.legal, children: [
2008
- "kapustin.cc, 2026 ",
2009
- /* @__PURE__ */ jsxRuntime.jsx("br", {}),
2010
- "\u0418\u041F \u041A\u0430\u043F\u0443\u0441\u0442\u0438\u043D \u0414.\u0412., \u0418\u041D\u041D 7721250201"
2011
- ] })
2041
+ showLegal && /* @__PURE__ */ jsxRuntime.jsx("p", { className: Sidebar_module_default.legal, children: legalContent })
2012
2042
  ] })
2013
2043
  ]
2014
2044
  }
package/dist/index.css CHANGED
@@ -366,6 +366,7 @@
366
366
  .MenuItem_module_root {
367
367
  display: inline-flex;
368
368
  align-items: center;
369
+ gap: 6px;
369
370
  padding-inline: 4px;
370
371
  padding-block: 2px;
371
372
  font-size: 13px;
@@ -382,6 +383,18 @@
382
383
  .MenuItem_module_root:hover {
383
384
  color: var(--fg-secondary);
384
385
  }
386
+ .MenuItem_module_icon {
387
+ display: inline-flex;
388
+ align-items: center;
389
+ justify-content: center;
390
+ flex-shrink: 0;
391
+ width: 16px;
392
+ height: 16px;
393
+ }
394
+ .MenuItem_module_icon svg {
395
+ width: 100%;
396
+ height: 100%;
397
+ }
385
398
  .MenuItem_module_active {
386
399
  background: var(--bg-secondary);
387
400
  color: var(--fg);
@@ -1915,6 +1928,9 @@
1915
1928
  .Sidebar_module_courseSubmenu {
1916
1929
  width: 340px;
1917
1930
  }
1931
+ .Sidebar_module_logo {
1932
+ margin-bottom: 1.5rem;
1933
+ }
1918
1934
  .Sidebar_module_nav {
1919
1935
  display: flex;
1920
1936
  flex-direction: column;
@@ -1931,6 +1947,7 @@
1931
1947
  font-size: 10px;
1932
1948
  color: var(--fg-muted);
1933
1949
  letter-spacing: -0.2px;
1950
+ white-space: pre-line;
1934
1951
  }
1935
1952
 
1936
1953
  /* src/organisms/AppCard.module.scss */
package/dist/index.d.cts CHANGED
@@ -76,8 +76,10 @@ interface MenuItemProps {
76
76
  active?: boolean;
77
77
  onClick?: () => void;
78
78
  className?: string;
79
+ /** Optional icon rendered before the text label */
80
+ icon?: React.ReactNode;
79
81
  }
80
- declare function MenuItem({ text, active, onClick, className }: MenuItemProps): react_jsx_runtime.JSX.Element;
82
+ declare function MenuItem({ text, active, onClick, className, icon }: MenuItemProps): react_jsx_runtime.JSX.Element;
81
83
 
82
84
  type IconButtonVariant = 'primary' | 'secondary' | 'clear' | 'disabled' | 'contrast';
83
85
  interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -464,13 +466,33 @@ interface FeatureGridProps {
464
466
  declare function FeatureGrid({ features, columns, className }: FeatureGridProps): react_jsx_runtime.JSX.Element;
465
467
 
466
468
  type SidebarType = 'menu' | 'courseSubmenu';
469
+ /** Rich menu item with string ID, label, and optional icon. */
470
+ interface SidebarItem {
471
+ id: string;
472
+ label: string;
473
+ icon?: ReactNode;
474
+ }
467
475
  interface SidebarProps {
468
476
  type?: SidebarType;
469
- menuItems?: string[];
470
- footer?: React.ReactNode;
477
+ /** Plain strings (backward-compat) or rich SidebarItem objects. */
478
+ menuItems?: string[] | SidebarItem[];
479
+ footer?: ReactNode;
471
480
  className?: string;
472
- }
473
- declare function Sidebar({ type, menuItems, footer, className }: SidebarProps): react_jsx_runtime.JSX.Element;
481
+ /** Externally-controlled active item id. When provided, bypasses internal useState. */
482
+ activeId?: string;
483
+ /** Callback when a menu item is clicked. Receives the item id (or index-string for plain strings). */
484
+ onItemClick?: (id: string) => void;
485
+ /** Custom logo rendered above the nav area. */
486
+ logo?: ReactNode;
487
+ /**
488
+ * Legal text at the bottom.
489
+ * - `undefined` → shows default Russian legal text
490
+ * - `null` → hides legal text entirely
491
+ * - `string` → shows the provided text
492
+ */
493
+ legalText?: string | null;
494
+ }
495
+ declare function Sidebar({ type, menuItems, footer, className, activeId, onItemClick, logo, legalText, }: SidebarProps): react_jsx_runtime.JSX.Element;
474
496
 
475
497
  type AppCardVariant = 'default' | 'stamp' | 'stamp-padded';
476
498
  interface AppCardProps {
@@ -938,4 +960,4 @@ interface LandingLayoutProps {
938
960
  }
939
961
  declare function LandingLayout({ mode, nav, children, className, }: LandingLayoutProps): react_jsx_runtime.JSX.Element;
940
962
 
941
- export { Alert, AppCard, AppTopLine, ArticleBarChart, type ArticleBarChartProps, ArticleBody, type ArticleBodyProps, ArticleChatBlock, type ArticleChatBlockProps, ArticleFigure, type ArticleFigureProps, ArticleFooter, type ArticleFooterProps, ArticleHeading, type ArticleHeadingProps, ArticleHero, type ArticleHeroProps, ArticleLayout, type ArticleLayoutProps, ArticleLineChart, type ArticleLineChartProps, ArticleLinkButton, type ArticleLinkButtonProps, ArticleList, type ArticleListProps, ArticleNarrow, ArticleNote, type ArticleNoteProps, ArticleScatterChart, type ArticleScatterChartProps, ArticleTable, type ArticleTableColumn, type ArticleTableProps, type ArticleTableRow, ArticleWide, Avatar, Badge, BentoGrid, Breadcrumbs, Button, CTASection, Card, type ChartSeries, ChatInput, ChatMessage, Checkbox, CodeInput, ComparisonTable, Divider, DropdownMenu, EmptyState, FAQSection, FeatureGrid, Footer, FormField, Header, HeroSection, IconButton, IconWithText, IconlyActivity, IconlyAttach, IconlyBook, IconlyCheck, IconlyChevronDown, IconlyChevronLeft, IconlyChevronRight, IconlyClose, IconlyError, IconlyEye, IconlyEyeOff, IconlyHeart, IconlyInfo, IconlyInfoCircle, IconlyLink, IconlyLock, IconlyMail, IconlyMenu, IconlyMoon, IconlyQuote, IconlyRoadmap, IconlySandbox, IconlySearch, IconlySend, IconlySmile, IconlyStar, IconlySuccess, IconlySun, IconlyWarning, Input, LandingLayout, Logo, LogoCloud, MenuItem, Modal, Pagination, PasswordInput, PricingCard, ProfileNav, PromoActionCards, PromoBento, PromoDevicesCTA, PromoHero, PromoPricing, PromoShowcase, PromoSplit, PromoTestimonials, PromoTrustGrid, Radio, type ScatterPoint, SearchBar, Select, Sidebar, Skeleton, Spinner, StampCard, Stat, StatBadge, StatsBar, Link as StyledLink, Tabs, Tag, TestimonialCard, Textarea, TicketButton, Toast, Toggle, Tooltip, TopPromo };
963
+ export { Alert, AppCard, AppTopLine, ArticleBarChart, type ArticleBarChartProps, ArticleBody, type ArticleBodyProps, ArticleChatBlock, type ArticleChatBlockProps, ArticleFigure, type ArticleFigureProps, ArticleFooter, type ArticleFooterProps, ArticleHeading, type ArticleHeadingProps, ArticleHero, type ArticleHeroProps, ArticleLayout, type ArticleLayoutProps, ArticleLineChart, type ArticleLineChartProps, ArticleLinkButton, type ArticleLinkButtonProps, ArticleList, type ArticleListProps, ArticleNarrow, ArticleNote, type ArticleNoteProps, ArticleScatterChart, type ArticleScatterChartProps, ArticleTable, type ArticleTableColumn, type ArticleTableProps, type ArticleTableRow, ArticleWide, Avatar, Badge, BentoGrid, Breadcrumbs, Button, CTASection, Card, type ChartSeries, ChatInput, ChatMessage, Checkbox, CodeInput, ComparisonTable, Divider, DropdownMenu, EmptyState, FAQSection, FeatureGrid, Footer, FormField, Header, HeroSection, IconButton, IconWithText, IconlyActivity, IconlyAttach, IconlyBook, IconlyCheck, IconlyChevronDown, IconlyChevronLeft, IconlyChevronRight, IconlyClose, IconlyError, IconlyEye, IconlyEyeOff, IconlyHeart, IconlyInfo, IconlyInfoCircle, IconlyLink, IconlyLock, IconlyMail, IconlyMenu, IconlyMoon, IconlyQuote, IconlyRoadmap, IconlySandbox, IconlySearch, IconlySend, IconlySmile, IconlyStar, IconlySuccess, IconlySun, IconlyWarning, Input, LandingLayout, Logo, LogoCloud, MenuItem, Modal, Pagination, PasswordInput, PricingCard, ProfileNav, PromoActionCards, PromoBento, PromoDevicesCTA, PromoHero, PromoPricing, PromoShowcase, PromoSplit, PromoTestimonials, PromoTrustGrid, Radio, type ScatterPoint, SearchBar, Select, Sidebar, type SidebarItem, Skeleton, Spinner, StampCard, Stat, StatBadge, StatsBar, Link as StyledLink, Tabs, Tag, TestimonialCard, Textarea, TicketButton, Toast, Toggle, Tooltip, TopPromo };
package/dist/index.d.ts CHANGED
@@ -76,8 +76,10 @@ interface MenuItemProps {
76
76
  active?: boolean;
77
77
  onClick?: () => void;
78
78
  className?: string;
79
+ /** Optional icon rendered before the text label */
80
+ icon?: React.ReactNode;
79
81
  }
80
- declare function MenuItem({ text, active, onClick, className }: MenuItemProps): react_jsx_runtime.JSX.Element;
82
+ declare function MenuItem({ text, active, onClick, className, icon }: MenuItemProps): react_jsx_runtime.JSX.Element;
81
83
 
82
84
  type IconButtonVariant = 'primary' | 'secondary' | 'clear' | 'disabled' | 'contrast';
83
85
  interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -464,13 +466,33 @@ interface FeatureGridProps {
464
466
  declare function FeatureGrid({ features, columns, className }: FeatureGridProps): react_jsx_runtime.JSX.Element;
465
467
 
466
468
  type SidebarType = 'menu' | 'courseSubmenu';
469
+ /** Rich menu item with string ID, label, and optional icon. */
470
+ interface SidebarItem {
471
+ id: string;
472
+ label: string;
473
+ icon?: ReactNode;
474
+ }
467
475
  interface SidebarProps {
468
476
  type?: SidebarType;
469
- menuItems?: string[];
470
- footer?: React.ReactNode;
477
+ /** Plain strings (backward-compat) or rich SidebarItem objects. */
478
+ menuItems?: string[] | SidebarItem[];
479
+ footer?: ReactNode;
471
480
  className?: string;
472
- }
473
- declare function Sidebar({ type, menuItems, footer, className }: SidebarProps): react_jsx_runtime.JSX.Element;
481
+ /** Externally-controlled active item id. When provided, bypasses internal useState. */
482
+ activeId?: string;
483
+ /** Callback when a menu item is clicked. Receives the item id (or index-string for plain strings). */
484
+ onItemClick?: (id: string) => void;
485
+ /** Custom logo rendered above the nav area. */
486
+ logo?: ReactNode;
487
+ /**
488
+ * Legal text at the bottom.
489
+ * - `undefined` → shows default Russian legal text
490
+ * - `null` → hides legal text entirely
491
+ * - `string` → shows the provided text
492
+ */
493
+ legalText?: string | null;
494
+ }
495
+ declare function Sidebar({ type, menuItems, footer, className, activeId, onItemClick, logo, legalText, }: SidebarProps): react_jsx_runtime.JSX.Element;
474
496
 
475
497
  type AppCardVariant = 'default' | 'stamp' | 'stamp-padded';
476
498
  interface AppCardProps {
@@ -938,4 +960,4 @@ interface LandingLayoutProps {
938
960
  }
939
961
  declare function LandingLayout({ mode, nav, children, className, }: LandingLayoutProps): react_jsx_runtime.JSX.Element;
940
962
 
941
- export { Alert, AppCard, AppTopLine, ArticleBarChart, type ArticleBarChartProps, ArticleBody, type ArticleBodyProps, ArticleChatBlock, type ArticleChatBlockProps, ArticleFigure, type ArticleFigureProps, ArticleFooter, type ArticleFooterProps, ArticleHeading, type ArticleHeadingProps, ArticleHero, type ArticleHeroProps, ArticleLayout, type ArticleLayoutProps, ArticleLineChart, type ArticleLineChartProps, ArticleLinkButton, type ArticleLinkButtonProps, ArticleList, type ArticleListProps, ArticleNarrow, ArticleNote, type ArticleNoteProps, ArticleScatterChart, type ArticleScatterChartProps, ArticleTable, type ArticleTableColumn, type ArticleTableProps, type ArticleTableRow, ArticleWide, Avatar, Badge, BentoGrid, Breadcrumbs, Button, CTASection, Card, type ChartSeries, ChatInput, ChatMessage, Checkbox, CodeInput, ComparisonTable, Divider, DropdownMenu, EmptyState, FAQSection, FeatureGrid, Footer, FormField, Header, HeroSection, IconButton, IconWithText, IconlyActivity, IconlyAttach, IconlyBook, IconlyCheck, IconlyChevronDown, IconlyChevronLeft, IconlyChevronRight, IconlyClose, IconlyError, IconlyEye, IconlyEyeOff, IconlyHeart, IconlyInfo, IconlyInfoCircle, IconlyLink, IconlyLock, IconlyMail, IconlyMenu, IconlyMoon, IconlyQuote, IconlyRoadmap, IconlySandbox, IconlySearch, IconlySend, IconlySmile, IconlyStar, IconlySuccess, IconlySun, IconlyWarning, Input, LandingLayout, Logo, LogoCloud, MenuItem, Modal, Pagination, PasswordInput, PricingCard, ProfileNav, PromoActionCards, PromoBento, PromoDevicesCTA, PromoHero, PromoPricing, PromoShowcase, PromoSplit, PromoTestimonials, PromoTrustGrid, Radio, type ScatterPoint, SearchBar, Select, Sidebar, Skeleton, Spinner, StampCard, Stat, StatBadge, StatsBar, Link as StyledLink, Tabs, Tag, TestimonialCard, Textarea, TicketButton, Toast, Toggle, Tooltip, TopPromo };
963
+ export { Alert, AppCard, AppTopLine, ArticleBarChart, type ArticleBarChartProps, ArticleBody, type ArticleBodyProps, ArticleChatBlock, type ArticleChatBlockProps, ArticleFigure, type ArticleFigureProps, ArticleFooter, type ArticleFooterProps, ArticleHeading, type ArticleHeadingProps, ArticleHero, type ArticleHeroProps, ArticleLayout, type ArticleLayoutProps, ArticleLineChart, type ArticleLineChartProps, ArticleLinkButton, type ArticleLinkButtonProps, ArticleList, type ArticleListProps, ArticleNarrow, ArticleNote, type ArticleNoteProps, ArticleScatterChart, type ArticleScatterChartProps, ArticleTable, type ArticleTableColumn, type ArticleTableProps, type ArticleTableRow, ArticleWide, Avatar, Badge, BentoGrid, Breadcrumbs, Button, CTASection, Card, type ChartSeries, ChatInput, ChatMessage, Checkbox, CodeInput, ComparisonTable, Divider, DropdownMenu, EmptyState, FAQSection, FeatureGrid, Footer, FormField, Header, HeroSection, IconButton, IconWithText, IconlyActivity, IconlyAttach, IconlyBook, IconlyCheck, IconlyChevronDown, IconlyChevronLeft, IconlyChevronRight, IconlyClose, IconlyError, IconlyEye, IconlyEyeOff, IconlyHeart, IconlyInfo, IconlyInfoCircle, IconlyLink, IconlyLock, IconlyMail, IconlyMenu, IconlyMoon, IconlyQuote, IconlyRoadmap, IconlySandbox, IconlySearch, IconlySend, IconlySmile, IconlyStar, IconlySuccess, IconlySun, IconlyWarning, Input, LandingLayout, Logo, LogoCloud, MenuItem, Modal, Pagination, PasswordInput, PricingCard, ProfileNav, PromoActionCards, PromoBento, PromoDevicesCTA, PromoHero, PromoPricing, PromoShowcase, PromoSplit, PromoTestimonials, PromoTrustGrid, Radio, type ScatterPoint, SearchBar, Select, Sidebar, type SidebarItem, Skeleton, Spinner, StampCard, Stat, StatBadge, StatsBar, Link as StyledLink, Tabs, Tag, TestimonialCard, Textarea, TicketButton, Toast, Toggle, Tooltip, TopPromo };
package/dist/index.js CHANGED
@@ -372,15 +372,19 @@ function Divider({ className = "", label }) {
372
372
  // src/atoms/MenuItem.module.scss
373
373
  var MenuItem_module_default = {
374
374
  root: "MenuItem_module_root",
375
+ icon: "MenuItem_module_icon",
375
376
  active: "MenuItem_module_active"
376
377
  };
377
- function MenuItem({ text, active = false, onClick, className = "" }) {
378
- return /* @__PURE__ */ jsx(
378
+ function MenuItem({ text, active = false, onClick, className = "", icon }) {
379
+ return /* @__PURE__ */ jsxs(
379
380
  "button",
380
381
  {
381
382
  onClick,
382
383
  className: `${MenuItem_module_default.root}${active ? ` ${MenuItem_module_default.active}` : ""}${className ? ` ${className}` : ""}`,
383
- children: text
384
+ children: [
385
+ icon && /* @__PURE__ */ jsx("span", { className: MenuItem_module_default.icon, children: icon }),
386
+ text
387
+ ]
384
388
  }
385
389
  );
386
390
  }
@@ -1956,6 +1960,7 @@ var Sidebar_module_default = {
1956
1960
  root: "Sidebar_module_root",
1957
1961
  menu: "Sidebar_module_menu",
1958
1962
  courseSubmenu: "Sidebar_module_courseSubmenu",
1963
+ logo: "Sidebar_module_logo",
1959
1964
  nav: "Sidebar_module_nav",
1960
1965
  footer: "Sidebar_module_footer",
1961
1966
  legal: "Sidebar_module_legal"
@@ -1978,31 +1983,56 @@ var courseMenuItems = [
1978
1983
  "\u0421\u043E\u0446. \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0430",
1979
1984
  "\u041A\u043E\u043D\u0442\u0430\u043A\u0442\u044B"
1980
1985
  ];
1981
- function Sidebar({ type = "menu", menuItems, footer, className = "" }) {
1982
- const items = menuItems || (type === "courseSubmenu" ? courseMenuItems : defaultMenuItems);
1983
- const [active, setActive] = useState(0);
1986
+ var DEFAULT_LEGAL = "kapustin.cc, 2026 \n\u0418\u041F \u041A\u0430\u043F\u0443\u0441\u0442\u0438\u043D \u0414.\u0412., \u0418\u041D\u041D 7721250201";
1987
+ function normaliseItems(items) {
1988
+ if (items.length === 0) return [];
1989
+ if (typeof items[0] === "string") {
1990
+ return items.map((label, i) => ({ id: String(i), label }));
1991
+ }
1992
+ return items;
1993
+ }
1994
+ function Sidebar({
1995
+ type = "menu",
1996
+ menuItems,
1997
+ footer,
1998
+ className = "",
1999
+ activeId,
2000
+ onItemClick,
2001
+ logo,
2002
+ legalText
2003
+ }) {
2004
+ const rawItems = menuItems || (type === "courseSubmenu" ? courseMenuItems : defaultMenuItems);
2005
+ const items = normaliseItems(rawItems);
2006
+ const [internalActive, setInternalActive] = useState(0);
2007
+ const isControlled = activeId !== void 0;
1984
2008
  const widthClass = type === "courseSubmenu" ? Sidebar_module_default.courseSubmenu : Sidebar_module_default.menu;
2009
+ const showLegal = legalText !== null;
2010
+ const legalContent = legalText === void 0 ? DEFAULT_LEGAL : legalText;
1985
2011
  return /* @__PURE__ */ jsxs(
1986
2012
  "aside",
1987
2013
  {
1988
2014
  className: `${Sidebar_module_default.root} ${widthClass}${className ? ` ${className}` : ""}`,
1989
2015
  children: [
1990
- /* @__PURE__ */ jsx("nav", { className: Sidebar_module_default.nav, children: items.map((item, i) => /* @__PURE__ */ jsx(
1991
- MenuItem,
1992
- {
1993
- text: item,
1994
- active: i === active,
1995
- onClick: () => setActive(i)
1996
- },
1997
- `${item}-${i}`
1998
- )) }),
2016
+ logo && /* @__PURE__ */ jsx("div", { className: Sidebar_module_default.logo, children: logo }),
2017
+ /* @__PURE__ */ jsx("nav", { className: Sidebar_module_default.nav, children: items.map((item, i) => {
2018
+ const isActive = isControlled ? item.id === activeId : i === internalActive;
2019
+ return /* @__PURE__ */ jsx(
2020
+ MenuItem,
2021
+ {
2022
+ text: item.label,
2023
+ icon: item.icon,
2024
+ active: isActive,
2025
+ onClick: () => {
2026
+ if (onItemClick) onItemClick(item.id);
2027
+ if (!isControlled) setInternalActive(i);
2028
+ }
2029
+ },
2030
+ item.id
2031
+ );
2032
+ }) }),
1999
2033
  /* @__PURE__ */ jsxs("div", { className: Sidebar_module_default.footer, children: [
2000
2034
  type === "menu" && footer,
2001
- /* @__PURE__ */ jsxs("p", { className: Sidebar_module_default.legal, children: [
2002
- "kapustin.cc, 2026 ",
2003
- /* @__PURE__ */ jsx("br", {}),
2004
- "\u0418\u041F \u041A\u0430\u043F\u0443\u0441\u0442\u0438\u043D \u0414.\u0412., \u0418\u041D\u041D 7721250201"
2005
- ] })
2035
+ showLegal && /* @__PURE__ */ jsx("p", { className: Sidebar_module_default.legal, children: legalContent })
2006
2036
  ] })
2007
2037
  ]
2008
2038
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dmitriikapustin/ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Universal UI/UX Kit — React 19 component library with Atomic Design, CSS custom properties, and Tailwind CSS 4",
5
5
  "author": "Kapustin Team",
6
6
  "license": "MIT",