@syscore/ui-library 1.3.6 → 1.3.7

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.d.ts CHANGED
@@ -236,6 +236,7 @@ import { Skeleton } from '../client/components/ui/skeleton';
236
236
  import { Slider } from '../client/components/ui/slider';
237
237
  import { Toaster as Sonner } from '../client/components/ui/sonner';
238
238
  import { StandardLogo } from '../client/components/icons/StandardLogo';
239
+ import { StandardNavigation } from '../client/components/ui/standard-navigation';
239
240
  import { Switch } from '../client/components/ui/switch';
240
241
  import { Tab } from '../client/hooks/use-tabs';
241
242
  import { Table } from '../client/components/ui/table';
@@ -778,6 +779,8 @@ export { Sonner }
778
779
 
779
780
  export { StandardLogo }
780
781
 
782
+ export { StandardNavigation }
783
+
781
784
  export { Switch }
782
785
 
783
786
  export { Tab }
package/dist/index.es.js CHANGED
@@ -8859,6 +8859,427 @@ const StandardLogo = ({ className = "" }) => {
8859
8859
  }
8860
8860
  );
8861
8861
  };
8862
+ const ALPHA_PATH = "M5.3387 0.0229882C5.37971 0.0229882 5.45295 0.0199228 5.5584 0.0137925C5.66386 0.00459714 5.74442 0 5.80007 0C6.72867 0 7.49908 0.269732 8.11131 0.809196C8.72354 1.34559 9.14097 2.09195 9.3636 3.04828C9.44855 3.47433 9.49835 3.96628 9.513 4.52414V5.16782C10.2014 4.07663 10.7287 2.85517 11.0948 1.50345C11.1505 1.29808 11.1959 1.17701 11.2311 1.14023C11.2662 1.10345 11.3761 1.08506 11.5606 1.08506C11.8535 1.08506 12 1.13563 12 1.23678C12 1.25211 11.9722 1.37778 11.9165 1.61379C11.5093 3.24751 10.7931 4.77701 9.76785 6.2023L9.53497 6.51034L9.55694 7.04368C9.59795 8.23295 9.72391 8.9318 9.93482 9.14023C9.97583 9.16782 10.0388 9.18161 10.1238 9.18161C10.32 9.15402 10.5031 9.06973 10.673 8.92874C10.8429 8.78774 10.963 8.62222 11.0333 8.43218C11.0597 8.32797 11.0948 8.26513 11.1388 8.24368C11.1798 8.22222 11.2852 8.21149 11.4551 8.21149C11.7364 8.21149 11.877 8.27739 11.877 8.40919C11.877 8.49808 11.8345 8.63142 11.7495 8.8092C11.5943 9.13103 11.3687 9.4069 11.0729 9.63678C10.777 9.8636 10.4475 9.97701 10.0842 9.97701H9.93482C8.97986 9.97701 8.3398 9.44674 8.01465 8.38621L7.95313 8.23448C7.20615 8.74942 6.79165 9.02835 6.70963 9.07126C5.66679 9.69042 4.61809 10 3.56353 10C2.56756 10 1.76346 9.70575 1.15123 9.11724C0.538997 8.52874 0.162578 7.75632 0.02197 6.8C0.0073233 6.71111 0 6.54866 0 6.31264C0 5.9295 0.02197 5.62146 0.0659099 5.38851C0.276822 4.06437 0.887587 2.8751 1.89821 1.82069C2.91175 0.769348 4.05859 0.170115 5.3387 0.0229882ZM1.83669 7.10805C1.83669 7.73946 1.9978 8.24368 2.32003 8.62069C2.64518 8.99464 3.09484 9.18161 3.66899 9.18161C4.03515 9.18161 4.44379 9.12337 4.89491 9.0069C5.6829 8.80153 6.44892 8.4046 7.19297 7.81609C7.29257 7.74253 7.38777 7.66437 7.47858 7.58161C7.56939 7.50192 7.64262 7.43295 7.69828 7.37471L7.78176 7.28276L7.76419 7.08506C7.76419 6.95326 7.75979 6.75862 7.75101 6.50115C7.74515 6.24368 7.74222 5.98927 7.74222 5.73793C7.72757 5.18008 7.71732 4.74636 7.71146 4.43678C7.70267 4.1272 7.67338 3.74866 7.62358 3.30115C7.57671 2.85364 7.5108 2.50728 7.42585 2.26207C7.3409 2.01992 7.22519 1.77471 7.07873 1.52644C6.92933 1.2751 6.73892 1.09425 6.50751 0.983908C6.27609 0.873563 6.00513 0.81839 5.69462 0.81839C4.72501 0.81839 3.87404 1.35479 3.14171 2.42759C2.79019 2.97318 2.49579 3.71647 2.25851 4.65747C1.9773 5.73333 1.83669 6.55019 1.83669 7.10805Z";
8863
+ const PATH_LENGTH = 60;
8864
+ const AlphaIcon = ({ dark }) => {
8865
+ if (dark) {
8866
+ return /* @__PURE__ */ jsx(
8867
+ "svg",
8868
+ {
8869
+ xmlns: "http://www.w3.org/2000/svg",
8870
+ width: "12",
8871
+ height: "10",
8872
+ viewBox: "0 0 12 10",
8873
+ fill: "none",
8874
+ className: "mt-1.5",
8875
+ style: { overflow: "visible" },
8876
+ children: /* @__PURE__ */ jsx("path", { d: ALPHA_PATH, fill: "currentColor" })
8877
+ }
8878
+ );
8879
+ }
8880
+ return /* @__PURE__ */ jsxs(
8881
+ "svg",
8882
+ {
8883
+ xmlns: "http://www.w3.org/2000/svg",
8884
+ width: "12",
8885
+ height: "10",
8886
+ viewBox: "0 0 12 10",
8887
+ fill: "none",
8888
+ className: "mt-1.5",
8889
+ style: { overflow: "visible" },
8890
+ children: [
8891
+ /* @__PURE__ */ jsx(
8892
+ "path",
8893
+ {
8894
+ d: ALPHA_PATH,
8895
+ fill: "url(#paint0_linear_10081_30848)",
8896
+ opacity: "0.4"
8897
+ }
8898
+ ),
8899
+ /* @__PURE__ */ jsx(
8900
+ motion.path,
8901
+ {
8902
+ d: ALPHA_PATH,
8903
+ fill: "none",
8904
+ stroke: "url(#stroke_gradient)",
8905
+ strokeWidth: "0.4",
8906
+ strokeLinecap: "round",
8907
+ strokeLinejoin: "round",
8908
+ initial: { strokeDashoffset: PATH_LENGTH },
8909
+ animate: { strokeDashoffset: -PATH_LENGTH },
8910
+ style: { strokeDasharray: `8 ${PATH_LENGTH - 8}` },
8911
+ transition: {
8912
+ duration: 2,
8913
+ repeat: Infinity,
8914
+ repeatDelay: 8,
8915
+ ease: "linear"
8916
+ }
8917
+ }
8918
+ ),
8919
+ /* @__PURE__ */ jsxs("defs", { children: [
8920
+ /* @__PURE__ */ jsxs(
8921
+ "linearGradient",
8922
+ {
8923
+ id: "paint0_linear_10081_30848",
8924
+ x1: "-3.27254",
8925
+ y1: "4.99923",
8926
+ x2: "6.36738",
8927
+ y2: "-2.36962",
8928
+ gradientUnits: "userSpaceOnUse",
8929
+ children: [
8930
+ /* @__PURE__ */ jsx("stop", { stopColor: "#8AEFDB" }),
8931
+ /* @__PURE__ */ jsx("stop", { offset: "0.5", stopColor: "#D4BACE" }),
8932
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#CBE0F1" })
8933
+ ]
8934
+ }
8935
+ ),
8936
+ /* @__PURE__ */ jsxs(
8937
+ "linearGradient",
8938
+ {
8939
+ id: "stroke_gradient",
8940
+ x1: "0",
8941
+ y1: "0",
8942
+ x2: "12",
8943
+ y2: "10",
8944
+ gradientUnits: "userSpaceOnUse",
8945
+ children: [
8946
+ /* @__PURE__ */ jsx("stop", { stopColor: "#8AEFDB" }),
8947
+ /* @__PURE__ */ jsx("stop", { offset: "0.5", stopColor: "#D4BACE" }),
8948
+ /* @__PURE__ */ jsx("stop", { offset: "1", stopColor: "#CBE0F1" })
8949
+ ]
8950
+ }
8951
+ )
8952
+ ] })
8953
+ ]
8954
+ }
8955
+ );
8956
+ };
8957
+ const StandardNavigation = ({
8958
+ navLinks = [],
8959
+ logo: Logo,
8960
+ userIcon: UserIcon,
8961
+ beforeActions,
8962
+ userDropdown,
8963
+ isStrategy = false,
8964
+ Link: LinkComponent,
8965
+ onLinkClick,
8966
+ onClose
8967
+ }) => {
8968
+ const [isOpen, setIsOpen] = React.useState(false);
8969
+ const [activeItem, setActiveItem] = React.useState(null);
8970
+ const [isUserDropdownOpen, setIsUserDropdownOpen] = React.useState(false);
8971
+ const containerRef = React.useRef(null);
8972
+ const menuRef = React.useRef(null);
8973
+ const menuItemsRef = React.useRef(null);
8974
+ const overlayRef = React.useRef(null);
8975
+ const userDropdownRef = React.useRef(null);
8976
+ const handleMouseLeave = () => {
8977
+ setIsOpen(false);
8978
+ setActiveItem(null);
8979
+ };
8980
+ const handleNavItemMouseEnter = (index) => {
8981
+ const item = navLinks[index];
8982
+ if (item == null ? void 0 : item.section) {
8983
+ setIsOpen(true);
8984
+ setActiveItem(index + 1);
8985
+ }
8986
+ };
8987
+ const handleUserIconClick = (e) => {
8988
+ e.preventDefault();
8989
+ if (userDropdown) {
8990
+ setIsUserDropdownOpen(!isUserDropdownOpen);
8991
+ }
8992
+ };
8993
+ React.useEffect(() => {
8994
+ const handleClickOutside = (event) => {
8995
+ const target = event.target;
8996
+ if (userDropdownRef.current && !userDropdownRef.current.contains(target)) {
8997
+ setIsUserDropdownOpen(false);
8998
+ }
8999
+ };
9000
+ if (isUserDropdownOpen) {
9001
+ setTimeout(() => {
9002
+ document.addEventListener("mousedown", handleClickOutside);
9003
+ }, 0);
9004
+ return () => {
9005
+ document.removeEventListener("mousedown", handleClickOutside);
9006
+ };
9007
+ }
9008
+ }, [isUserDropdownOpen]);
9009
+ const NavLink = ({ href, className, "aria-label": ariaLabel, children }) => {
9010
+ if (LinkComponent) {
9011
+ return /* @__PURE__ */ jsx(LinkComponent, { href, className, "aria-label": ariaLabel, children });
9012
+ }
9013
+ if (onLinkClick) {
9014
+ return /* @__PURE__ */ jsx(
9015
+ "a",
9016
+ {
9017
+ href,
9018
+ className,
9019
+ "aria-label": ariaLabel,
9020
+ onClick: (e) => {
9021
+ e.preventDefault();
9022
+ onLinkClick(href);
9023
+ },
9024
+ children
9025
+ }
9026
+ );
9027
+ }
9028
+ return /* @__PURE__ */ jsx("a", { href, className, "aria-label": ariaLabel, children });
9029
+ };
9030
+ const renderNavLinkItem = (link) => {
9031
+ const href = link.href || "#";
9032
+ const hasBullet = link.bulletColor !== void 0;
9033
+ const hasBadge = !!link.badge;
9034
+ const isSmall = hasBullet || link.children;
9035
+ if (hasBullet) {
9036
+ return /* @__PURE__ */ jsxs("div", { className: "navigation-tray-bullet-item", children: [
9037
+ link.bulletColor && link.bulletColor !== "" ? /* @__PURE__ */ jsx(NavBullet, { color: link.bulletColor }) : /* @__PURE__ */ jsx("div", { className: "navigation-tray-bullet" }),
9038
+ /* @__PURE__ */ jsx(
9039
+ NavLink,
9040
+ {
9041
+ href,
9042
+ className: "navigation-tray-link-small",
9043
+ children: link.label
9044
+ }
9045
+ )
9046
+ ] });
9047
+ }
9048
+ if (hasBadge) {
9049
+ return /* @__PURE__ */ jsxs(
9050
+ NavLink,
9051
+ {
9052
+ href,
9053
+ className: "navigation-tray-link navigation-tray-link--with-badge",
9054
+ children: [
9055
+ link.label,
9056
+ /* @__PURE__ */ jsx("span", { className: "navigation-tray-badge", children: link.badge })
9057
+ ]
9058
+ }
9059
+ );
9060
+ }
9061
+ return /* @__PURE__ */ jsx(
9062
+ NavLink,
9063
+ {
9064
+ href,
9065
+ className: isSmall ? "navigation-tray-link-small" : "navigation-tray-link",
9066
+ children: link.label
9067
+ }
9068
+ );
9069
+ };
9070
+ const renderNavColumn = (column) => {
9071
+ if (!column.links || column.links.length === 0) return null;
9072
+ const hasSpacing = column.links.some(
9073
+ (link) => !link.bulletColor && !link.children
9074
+ );
9075
+ return /* @__PURE__ */ jsxs("div", { className: "navigation-tray-column", children: [
9076
+ column.title && /* @__PURE__ */ jsx("h3", { className: "navigation-tray-column-title", children: column.title }),
9077
+ /* @__PURE__ */ jsx(
9078
+ "ul",
9079
+ {
9080
+ className: cn(
9081
+ "navigation-tray-column-list",
9082
+ hasSpacing && "navigation-tray-column-list--spacing-5"
9083
+ ),
9084
+ children: column.links.map((link, idx) => /* @__PURE__ */ jsx("li", { children: renderNavLinkItem(link) }, idx))
9085
+ }
9086
+ )
9087
+ ] }, column.title || "column");
9088
+ };
9089
+ const renderTraySection = () => {
9090
+ if (!activeItem) return null;
9091
+ const activeNavItem = navLinks[activeItem - 1];
9092
+ if (!(activeNavItem == null ? void 0 : activeNavItem.section)) return null;
9093
+ const section = activeNavItem.section;
9094
+ return /* @__PURE__ */ jsxs("div", { className: "navigation-tray-section", children: [
9095
+ section.heading && /* @__PURE__ */ jsx(
9096
+ "h2",
9097
+ {
9098
+ className: "navigation-tray-heading",
9099
+ style: section.headingGradient ? {
9100
+ background: section.headingGradient,
9101
+ WebkitBackgroundClip: "text",
9102
+ WebkitTextFillColor: "transparent",
9103
+ backgroundClip: "text"
9104
+ } : void 0,
9105
+ children: section.heading
9106
+ }
9107
+ ),
9108
+ section.columns && section.columns.length > 0 && /* @__PURE__ */ jsx("div", { className: "navigation-tray-columns", children: section.columns.map((column, idx) => renderNavColumn(column)) })
9109
+ ] });
9110
+ };
9111
+ return /* @__PURE__ */ jsxs(
9112
+ "nav",
9113
+ {
9114
+ ref: containerRef,
9115
+ className: cn("navigation", isStrategy && "navigation--strategy"),
9116
+ "data-strategy": isStrategy,
9117
+ onMouseLeave: handleMouseLeave,
9118
+ children: [
9119
+ !isStrategy && /* @__PURE__ */ jsx(
9120
+ "div",
9121
+ {
9122
+ ref: overlayRef,
9123
+ className: "navigation-overlay",
9124
+ "data-open": isOpen
9125
+ }
9126
+ ),
9127
+ /* @__PURE__ */ jsxs("div", { className: "navigation-container", children: [
9128
+ /* @__PURE__ */ jsxs("div", { className: "navigation-logo-container", children: [
9129
+ isStrategy ? /* @__PURE__ */ jsx(
9130
+ Button,
9131
+ {
9132
+ className: "navigation-close-button",
9133
+ size: "icon",
9134
+ onClick: (e) => {
9135
+ e.preventDefault();
9136
+ if (onClose) {
9137
+ onClose();
9138
+ } else if (onLinkClick) {
9139
+ onLinkClick("/");
9140
+ }
9141
+ },
9142
+ children: /* @__PURE__ */ jsx(UtilityClose, { className: "navigation-close-icon" })
9143
+ }
9144
+ ) : null,
9145
+ /* @__PURE__ */ jsx(
9146
+ NavLink,
9147
+ {
9148
+ href: "/",
9149
+ className: cn(
9150
+ "navigation-logo-link",
9151
+ isStrategy && "navigation-logo-link--strategy"
9152
+ ),
9153
+ "data-strategy": isStrategy,
9154
+ "aria-label": "Home",
9155
+ children: Logo ? /* @__PURE__ */ jsxs(Fragment, { children: [
9156
+ /* @__PURE__ */ jsx(NavLogo, { dark: isStrategy }),
9157
+ /* @__PURE__ */ jsx(StandardLogo, { className: cn(!isStrategy ? "text-white" : "text-black") }),
9158
+ /* @__PURE__ */ jsx(AlphaIcon, { dark: isStrategy })
9159
+ ] }) : null
9160
+ }
9161
+ )
9162
+ ] }),
9163
+ !isStrategy ? /* @__PURE__ */ jsx("div", { className: "navigation-nav-container", children: /* @__PURE__ */ jsx("ul", { className: "navigation-nav-list", children: navLinks.map((item, index) => /* @__PURE__ */ jsxs(
9164
+ "li",
9165
+ {
9166
+ className: "navigation-nav-item",
9167
+ onMouseEnter: () => handleNavItemMouseEnter(index),
9168
+ children: [
9169
+ item.href ? /* @__PURE__ */ jsx(NavLink, { href: item.href, className: "navigation-nav-link", children: item.label }) : /* @__PURE__ */ jsx("span", { className: "navigation-nav-link", children: item.label }),
9170
+ activeItem === index + 1 && /* @__PURE__ */ jsx(
9171
+ motion.div,
9172
+ {
9173
+ id: "underline",
9174
+ className: "navigation-underline",
9175
+ layoutId: "underline",
9176
+ transition: { duration: 0.2, ease: "easeOut" },
9177
+ children: /* @__PURE__ */ jsx(
9178
+ "div",
9179
+ {
9180
+ className: "navigation-underline-circle navigation-underline-circle--gradient",
9181
+ style: {
9182
+ width: "10px",
9183
+ height: "5px",
9184
+ borderBottomLeftRadius: "100px",
9185
+ borderBottomRightRadius: "100px",
9186
+ borderBottom: "0",
9187
+ boxSizing: "border-box"
9188
+ }
9189
+ }
9190
+ )
9191
+ }
9192
+ ),
9193
+ index === 0 && /* @__PURE__ */ jsx(
9194
+ "div",
9195
+ {
9196
+ className: "navigation-underline navigation-underline--static",
9197
+ style: { transition: "all 0.2s ease-out" },
9198
+ children: /* @__PURE__ */ jsx(
9199
+ "div",
9200
+ {
9201
+ className: "navigation-underline-circle navigation-underline-circle--white",
9202
+ style: {
9203
+ width: "10px",
9204
+ height: "5px",
9205
+ borderTopLeftRadius: "100px",
9206
+ borderTopRightRadius: "100px",
9207
+ borderBottom: "0",
9208
+ boxSizing: "border-box"
9209
+ }
9210
+ }
9211
+ )
9212
+ }
9213
+ )
9214
+ ]
9215
+ },
9216
+ index
9217
+ )) }) }) : null,
9218
+ /* @__PURE__ */ jsxs("div", { className: "navigation-actions", children: [
9219
+ beforeActions && /* @__PURE__ */ jsx("div", { className: "navigation-actions-before", children: beforeActions }),
9220
+ /* @__PURE__ */ jsxs("div", { className: "navigation-account-wrapper", ref: userDropdownRef, children: [
9221
+ userDropdown ? /* @__PURE__ */ jsx(
9222
+ "button",
9223
+ {
9224
+ type: "button",
9225
+ "aria-label": "Account menu",
9226
+ "aria-expanded": isUserDropdownOpen,
9227
+ className: cn(
9228
+ "navigation-account-link",
9229
+ isUserDropdownOpen && "navigation-account-link--open"
9230
+ ),
9231
+ "data-open": isOpen,
9232
+ "data-strategy": isStrategy,
9233
+ onClick: handleUserIconClick,
9234
+ children: UserIcon ? /* @__PURE__ */ jsx(
9235
+ UserIcon,
9236
+ {
9237
+ className: cn(
9238
+ "navigation-account-icon",
9239
+ isStrategy ? "navigation-account-icon--strategy" : "navigation-account-icon--default"
9240
+ )
9241
+ }
9242
+ ) : /* @__PURE__ */ jsx("div", { className: "navigation-account-icon-placeholder", children: "User" })
9243
+ }
9244
+ ) : /* @__PURE__ */ jsx(
9245
+ NavLink,
9246
+ {
9247
+ href: "/",
9248
+ "aria-label": "Account link",
9249
+ className: "navigation-account-link",
9250
+ "data-open": isOpen,
9251
+ "data-strategy": isStrategy,
9252
+ children: UserIcon ? /* @__PURE__ */ jsx(
9253
+ UserIcon,
9254
+ {
9255
+ className: cn(
9256
+ "navigation-account-icon",
9257
+ isStrategy ? "navigation-account-icon--strategy" : "navigation-account-icon--default"
9258
+ )
9259
+ }
9260
+ ) : /* @__PURE__ */ jsx("div", { className: "navigation-account-icon-placeholder", children: "User" })
9261
+ }
9262
+ ),
9263
+ isUserDropdownOpen && userDropdown && /* @__PURE__ */ jsx("div", { className: "navigation-user-dropdown", children: userDropdown })
9264
+ ] })
9265
+ ] })
9266
+ ] }),
9267
+ isOpen && /* @__PURE__ */ jsx("div", { className: "navigation-divider" }),
9268
+ /* @__PURE__ */ jsx("div", { ref: menuRef, className: "navigation-tray", "data-open": isOpen, children: /* @__PURE__ */ jsx("div", { className: "navigation-tray-content", children: /* @__PURE__ */ jsx("div", { ref: menuItemsRef, className: "navigation-tray-grid", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(
9269
+ motion.div,
9270
+ {
9271
+ initial: { y: 10, opacity: 0 },
9272
+ animate: { y: 0, opacity: 1 },
9273
+ exit: { y: -10, opacity: 0 },
9274
+ transition: { duration: 0.2 },
9275
+ children: renderTraySection()
9276
+ },
9277
+ activeItem ? activeItem : "empty"
9278
+ ) }) }) }) })
9279
+ ]
9280
+ }
9281
+ );
9282
+ };
8862
9283
  export {
8863
9284
  Accordion,
8864
9285
  AccordionContent,
@@ -9090,6 +9511,7 @@ export {
9090
9511
  Slider,
9091
9512
  Toaster as Sonner,
9092
9513
  StandardLogo,
9514
+ StandardNavigation,
9093
9515
  Switch,
9094
9516
  Table,
9095
9517
  TableBody,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syscore/ui-library",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "A comprehensive React component library built with Radix UI, Tailwind CSS, and TypeScript",
5
5
  "private": false,
6
6
  "type": "module",