@tonyarbor/components 0.2.1 → 0.4.0

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,42 @@
1
+ import * as React from 'react';
2
+
3
+ type AvatarSize = 'small' | 'medium' | 'large' | 'extra-large';
4
+ interface AvatarProps {
5
+ /**
6
+ * Size of the avatar
7
+ */
8
+ size?: AvatarSize;
9
+ /**
10
+ * Image source URL
11
+ */
12
+ src?: string;
13
+ /**
14
+ * Initials to display (2 characters) when no image is provided
15
+ */
16
+ initials?: string;
17
+ /**
18
+ * Alt text for the image
19
+ */
20
+ alt?: string;
21
+ /**
22
+ * Custom className
23
+ */
24
+ className?: string;
25
+ /**
26
+ * Custom style
27
+ */
28
+ style?: React.CSSProperties;
29
+ /**
30
+ * Test ID for testing
31
+ */
32
+ 'data-testid'?: string;
33
+ }
34
+ /**
35
+ * Avatar component - Arbor Design System
36
+ *
37
+ * Displays a user avatar with support for images, initials, or a placeholder icon.
38
+ * Features hover state with inner shadow effect.
39
+ */
40
+ declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
41
+
42
+ export { Avatar, type AvatarProps, type AvatarSize };
@@ -0,0 +1,42 @@
1
+ import * as React from 'react';
2
+
3
+ type AvatarSize = 'small' | 'medium' | 'large' | 'extra-large';
4
+ interface AvatarProps {
5
+ /**
6
+ * Size of the avatar
7
+ */
8
+ size?: AvatarSize;
9
+ /**
10
+ * Image source URL
11
+ */
12
+ src?: string;
13
+ /**
14
+ * Initials to display (2 characters) when no image is provided
15
+ */
16
+ initials?: string;
17
+ /**
18
+ * Alt text for the image
19
+ */
20
+ alt?: string;
21
+ /**
22
+ * Custom className
23
+ */
24
+ className?: string;
25
+ /**
26
+ * Custom style
27
+ */
28
+ style?: React.CSSProperties;
29
+ /**
30
+ * Test ID for testing
31
+ */
32
+ 'data-testid'?: string;
33
+ }
34
+ /**
35
+ * Avatar component - Arbor Design System
36
+ *
37
+ * Displays a user avatar with support for images, initials, or a placeholder icon.
38
+ * Features hover state with inner shadow effect.
39
+ */
40
+ declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
41
+
42
+ export { Avatar, type AvatarProps, type AvatarSize };
package/dist/Avatar.js ADDED
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/Avatar/index.ts
31
+ var Avatar_exports = {};
32
+ __export(Avatar_exports, {
33
+ Avatar: () => Avatar
34
+ });
35
+ module.exports = __toCommonJS(Avatar_exports);
36
+
37
+ // src/Avatar/Avatar.tsx
38
+ var React = __toESM(require("react"));
39
+ var import_lucide_react = require("lucide-react");
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ var sizeConfig = {
42
+ small: {
43
+ size: 20,
44
+ fontSize: 0,
45
+ // Too small for initials
46
+ fontWeight: 400,
47
+ iconSize: 12,
48
+ borderRadius: "99px"
49
+ },
50
+ medium: {
51
+ size: 32,
52
+ fontSize: 13,
53
+ fontWeight: 400,
54
+ iconSize: 16,
55
+ borderRadius: "99px"
56
+ },
57
+ large: {
58
+ size: 48,
59
+ fontSize: 13,
60
+ fontWeight: 400,
61
+ iconSize: 24,
62
+ borderRadius: "4px"
63
+ },
64
+ "extra-large": {
65
+ size: 96,
66
+ fontSize: 27,
67
+ fontWeight: 600,
68
+ iconSize: 48,
69
+ borderRadius: "8px"
70
+ }
71
+ };
72
+ var Avatar = React.forwardRef(
73
+ ({
74
+ size = "medium",
75
+ src,
76
+ initials,
77
+ alt = "Avatar",
78
+ className,
79
+ style,
80
+ "data-testid": dataTestId
81
+ }, ref) => {
82
+ const [isHovered, setIsHovered] = React.useState(false);
83
+ const [imageError, setImageError] = React.useState(false);
84
+ const config = sizeConfig[size];
85
+ const hasHoverState = size === "small";
86
+ const containerStyles = {
87
+ width: `${config.size}px`,
88
+ height: `${config.size}px`,
89
+ borderRadius: config.borderRadius,
90
+ border: "1px solid #efefef",
91
+ overflow: "hidden",
92
+ position: "relative",
93
+ backgroundColor: "#f8f8f8",
94
+ display: "flex",
95
+ alignItems: "center",
96
+ justifyContent: "center",
97
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
98
+ cursor: "default",
99
+ boxSizing: "border-box",
100
+ ...style
101
+ };
102
+ const hoverOverlayStyles = {
103
+ position: "absolute",
104
+ inset: 0,
105
+ pointerEvents: "none",
106
+ boxShadow: isHovered && hasHoverState ? "inset 0px 4px 100px 0px rgba(32, 32, 32, 0.3)" : "none",
107
+ borderRadius: config.borderRadius,
108
+ transition: "box-shadow 0.2s ease-in-out"
109
+ };
110
+ const imageStyles = {
111
+ width: "100%",
112
+ height: "100%",
113
+ objectFit: "cover"
114
+ };
115
+ const initialsStyles = {
116
+ fontSize: `${config.fontSize}px`,
117
+ fontWeight: config.fontWeight,
118
+ color: "#2f2f2f",
119
+ lineHeight: 1.5,
120
+ textAlign: "center",
121
+ userSelect: "none"
122
+ };
123
+ const showImage = src && !imageError;
124
+ const showInitials = !showImage && initials && size !== "small";
125
+ const showPlaceholder = !showImage && !showInitials;
126
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
127
+ "div",
128
+ {
129
+ ref,
130
+ className,
131
+ style: containerStyles,
132
+ onMouseEnter: () => setIsHovered(true),
133
+ onMouseLeave: () => setIsHovered(false),
134
+ "data-testid": dataTestId,
135
+ children: [
136
+ showImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
137
+ "img",
138
+ {
139
+ src,
140
+ alt,
141
+ style: imageStyles,
142
+ onError: () => setImageError(true)
143
+ }
144
+ ),
145
+ showInitials && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: initialsStyles, children: initials.slice(0, 2).toUpperCase() }),
146
+ showPlaceholder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.User, { size: config.iconSize, color: "#d1d1d1", strokeWidth: 2 }),
147
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: hoverOverlayStyles })
148
+ ]
149
+ }
150
+ );
151
+ }
152
+ );
153
+ Avatar.displayName = "Avatar";
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ Avatar
157
+ });
158
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Avatar/index.ts","../src/Avatar/Avatar.tsx"],"sourcesContent":["export { Avatar } from './Avatar';\nexport type { AvatarProps, AvatarSize } from './Avatar';\n","import * as React from 'react';\nimport { User } from 'lucide-react';\n\nexport type AvatarSize = 'small' | 'medium' | 'large' | 'extra-large';\n\nexport interface AvatarProps {\n /**\n * Size of the avatar\n */\n size?: AvatarSize;\n /**\n * Image source URL\n */\n src?: string;\n /**\n * Initials to display (2 characters) when no image is provided\n */\n initials?: string;\n /**\n * Alt text for the image\n */\n alt?: string;\n /**\n * Custom className\n */\n className?: string;\n /**\n * Custom style\n */\n style?: React.CSSProperties;\n /**\n * Test ID for testing\n */\n 'data-testid'?: string;\n}\n\nconst sizeConfig = {\n small: {\n size: 20,\n fontSize: 0, // Too small for initials\n fontWeight: 400,\n iconSize: 12,\n borderRadius: '99px',\n },\n medium: {\n size: 32,\n fontSize: 13,\n fontWeight: 400,\n iconSize: 16,\n borderRadius: '99px',\n },\n large: {\n size: 48,\n fontSize: 13,\n fontWeight: 400,\n iconSize: 24,\n borderRadius: '4px',\n },\n 'extra-large': {\n size: 96,\n fontSize: 27,\n fontWeight: 600,\n iconSize: 48,\n borderRadius: '8px',\n },\n};\n\n/**\n * Avatar component - Arbor Design System\n *\n * Displays a user avatar with support for images, initials, or a placeholder icon.\n * Features hover state with inner shadow effect.\n */\nexport const Avatar = React.forwardRef<HTMLDivElement, AvatarProps>(\n (\n {\n size = 'medium',\n src,\n initials,\n alt = 'Avatar',\n className,\n style,\n 'data-testid': dataTestId,\n },\n ref\n ) => {\n const [isHovered, setIsHovered] = React.useState(false);\n const [imageError, setImageError] = React.useState(false);\n const config = sizeConfig[size];\n\n // Only apply hover state for small size\n const hasHoverState = size === 'small';\n\n const containerStyles: React.CSSProperties = {\n width: `${config.size}px`,\n height: `${config.size}px`,\n borderRadius: config.borderRadius,\n border: '1px solid #efefef',\n overflow: 'hidden',\n position: 'relative',\n backgroundColor: '#f8f8f8',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n cursor: 'default',\n boxSizing: 'border-box',\n ...style,\n };\n\n const hoverOverlayStyles: React.CSSProperties = {\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n boxShadow: isHovered && hasHoverState ? 'inset 0px 4px 100px 0px rgba(32, 32, 32, 0.3)' : 'none',\n borderRadius: config.borderRadius,\n transition: 'box-shadow 0.2s ease-in-out',\n };\n\n const imageStyles: React.CSSProperties = {\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n };\n\n const initialsStyles: React.CSSProperties = {\n fontSize: `${config.fontSize}px`,\n fontWeight: config.fontWeight,\n color: '#2f2f2f',\n lineHeight: 1.5,\n textAlign: 'center',\n userSelect: 'none',\n };\n\n // Determine what to display\n const showImage = src && !imageError;\n const showInitials = !showImage && initials && size !== 'small';\n const showPlaceholder = !showImage && !showInitials;\n\n return (\n <div\n ref={ref}\n className={className}\n style={containerStyles}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n data-testid={dataTestId}\n >\n {showImage && (\n <img\n src={src}\n alt={alt}\n style={imageStyles}\n onError={() => setImageError(true)}\n />\n )}\n\n {showInitials && (\n <span style={initialsStyles}>\n {initials.slice(0, 2).toUpperCase()}\n </span>\n )}\n\n {showPlaceholder && (\n <User size={config.iconSize} color=\"#d1d1d1\" strokeWidth={2} />\n )}\n\n <div style={hoverOverlayStyles} />\n </div>\n );\n }\n);\n\nAvatar.displayName = 'Avatar';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,0BAAqB;AA2If;AAxGN,IAAM,aAAa;AAAA,EACjB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA;AAAA,IACV,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,IACL,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AAAA,EACA,eAAe;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,cAAc;AAAA,EAChB;AACF;AAQO,IAAM,SAAe;AAAA,EAC1B,CACE;AAAA,IACE,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,eAAe;AAAA,EACjB,GACA,QACG;AACH,UAAM,CAAC,WAAW,YAAY,IAAU,eAAS,KAAK;AACtD,UAAM,CAAC,YAAY,aAAa,IAAU,eAAS,KAAK;AACxD,UAAM,SAAS,WAAW,IAAI;AAG9B,UAAM,gBAAgB,SAAS;AAE/B,UAAM,kBAAuC;AAAA,MAC3C,OAAO,GAAG,OAAO,IAAI;AAAA,MACrB,QAAQ,GAAG,OAAO,IAAI;AAAA,MACtB,cAAc,OAAO;AAAA,MACrB,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,UAAU;AAAA,MACV,iBAAiB;AAAA,MACjB,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,gBAAgB;AAAA,MAChB,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,GAAG;AAAA,IACL;AAEA,UAAM,qBAA0C;AAAA,MAC9C,UAAU;AAAA,MACV,OAAO;AAAA,MACP,eAAe;AAAA,MACf,WAAW,aAAa,gBAAgB,kDAAkD;AAAA,MAC1F,cAAc,OAAO;AAAA,MACrB,YAAY;AAAA,IACd;AAEA,UAAM,cAAmC;AAAA,MACvC,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAEA,UAAM,iBAAsC;AAAA,MAC1C,UAAU,GAAG,OAAO,QAAQ;AAAA,MAC5B,YAAY,OAAO;AAAA,MACnB,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,YAAY;AAAA,IACd;AAGA,UAAM,YAAY,OAAO,CAAC;AAC1B,UAAM,eAAe,CAAC,aAAa,YAAY,SAAS;AACxD,UAAM,kBAAkB,CAAC,aAAa,CAAC;AAEvC,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,cAAc,MAAM,aAAa,IAAI;AAAA,QACrC,cAAc,MAAM,aAAa,KAAK;AAAA,QACtC,eAAa;AAAA,QAEZ;AAAA,uBACC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA,OAAO;AAAA,cACP,SAAS,MAAM,cAAc,IAAI;AAAA;AAAA,UACnC;AAAA,UAGD,gBACC,4CAAC,UAAK,OAAO,gBACV,mBAAS,MAAM,GAAG,CAAC,EAAE,YAAY,GACpC;AAAA,UAGD,mBACC,4CAAC,4BAAK,MAAM,OAAO,UAAU,OAAM,WAAU,aAAa,GAAG;AAAA,UAG/D,4CAAC,SAAI,OAAO,oBAAoB;AAAA;AAAA;AAAA,IAClC;AAAA,EAEJ;AACF;AAEA,OAAO,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ Avatar
3
+ } from "./chunk-JSG27ZZS.mjs";
4
+ export {
5
+ Avatar
6
+ };
7
+ //# sourceMappingURL=Avatar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,51 @@
1
+ import * as React from 'react';
2
+
3
+ interface BreadcrumbItem {
4
+ /**
5
+ * The label to display for this breadcrumb
6
+ */
7
+ label: string;
8
+ /**
9
+ * Optional href for the breadcrumb link
10
+ */
11
+ href?: string;
12
+ /**
13
+ * Optional click handler
14
+ */
15
+ onClick?: () => void;
16
+ /**
17
+ * Whether this breadcrumb has a dropdown menu
18
+ */
19
+ hasDropdown?: boolean;
20
+ }
21
+ interface BreadcrumbsProps {
22
+ /**
23
+ * Array of breadcrumb items
24
+ */
25
+ items: BreadcrumbItem[];
26
+ /**
27
+ * Callback when copy button is clicked
28
+ */
29
+ onCopy?: () => void;
30
+ /**
31
+ * Custom className
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Custom style
36
+ */
37
+ style?: React.CSSProperties;
38
+ /**
39
+ * Test ID for testing
40
+ */
41
+ 'data-testid'?: string;
42
+ }
43
+ /**
44
+ * Breadcrumbs component - Arbor Design System
45
+ *
46
+ * Navigation component showing the current page's location in the site hierarchy.
47
+ * Automatically truncates to show first and last breadcrumb with ellipsis when more than 6 items.
48
+ */
49
+ declare const Breadcrumbs: React.ForwardRefExoticComponent<BreadcrumbsProps & React.RefAttributes<HTMLDivElement>>;
50
+
51
+ export { type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps };
@@ -0,0 +1,51 @@
1
+ import * as React from 'react';
2
+
3
+ interface BreadcrumbItem {
4
+ /**
5
+ * The label to display for this breadcrumb
6
+ */
7
+ label: string;
8
+ /**
9
+ * Optional href for the breadcrumb link
10
+ */
11
+ href?: string;
12
+ /**
13
+ * Optional click handler
14
+ */
15
+ onClick?: () => void;
16
+ /**
17
+ * Whether this breadcrumb has a dropdown menu
18
+ */
19
+ hasDropdown?: boolean;
20
+ }
21
+ interface BreadcrumbsProps {
22
+ /**
23
+ * Array of breadcrumb items
24
+ */
25
+ items: BreadcrumbItem[];
26
+ /**
27
+ * Callback when copy button is clicked
28
+ */
29
+ onCopy?: () => void;
30
+ /**
31
+ * Custom className
32
+ */
33
+ className?: string;
34
+ /**
35
+ * Custom style
36
+ */
37
+ style?: React.CSSProperties;
38
+ /**
39
+ * Test ID for testing
40
+ */
41
+ 'data-testid'?: string;
42
+ }
43
+ /**
44
+ * Breadcrumbs component - Arbor Design System
45
+ *
46
+ * Navigation component showing the current page's location in the site hierarchy.
47
+ * Automatically truncates to show first and last breadcrumb with ellipsis when more than 6 items.
48
+ */
49
+ declare const Breadcrumbs: React.ForwardRefExoticComponent<BreadcrumbsProps & React.RefAttributes<HTMLDivElement>>;
50
+
51
+ export { type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps };
@@ -0,0 +1,276 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/Breadcrumbs/index.ts
31
+ var Breadcrumbs_exports = {};
32
+ __export(Breadcrumbs_exports, {
33
+ Breadcrumbs: () => Breadcrumbs
34
+ });
35
+ module.exports = __toCommonJS(Breadcrumbs_exports);
36
+
37
+ // src/Breadcrumbs/Breadcrumbs.tsx
38
+ var React = __toESM(require("react"));
39
+ var import_lucide_react = require("lucide-react");
40
+ var import_jsx_runtime = require("react/jsx-runtime");
41
+ var Breadcrumbs = React.forwardRef(
42
+ ({
43
+ items,
44
+ onCopy,
45
+ className,
46
+ style,
47
+ "data-testid": dataTestId
48
+ }, ref) => {
49
+ const [hoveredIndex, setHoveredIndex] = React.useState(null);
50
+ const [focusedIndex, setFocusedIndex] = React.useState(null);
51
+ const [showCopyTooltip, setShowCopyTooltip] = React.useState(false);
52
+ const [ellipsisFocused, setEllipsisFocused] = React.useState(false);
53
+ const [ellipsisHovered, setEllipsisHovered] = React.useState(false);
54
+ const displayItems = React.useMemo(() => {
55
+ if (items.length > 6) {
56
+ return [items[0], { label: "...", isEllipsis: true }, items[items.length - 1]];
57
+ }
58
+ return items;
59
+ }, [items]);
60
+ const handleCopy = () => {
61
+ onCopy?.();
62
+ const trail = items.map((item) => item.label).join(" / ");
63
+ navigator.clipboard.writeText(trail);
64
+ };
65
+ const containerStyles = {
66
+ display: "flex",
67
+ alignItems: "center",
68
+ gap: "8px",
69
+ ...style
70
+ };
71
+ const breadcrumbItemStyles = (index, isActive, isEllipsis) => {
72
+ const isFocused = focusedIndex === index;
73
+ if (isEllipsis) {
74
+ return {
75
+ display: "flex",
76
+ alignItems: "center",
77
+ gap: "4px",
78
+ height: "24px",
79
+ overflow: "hidden"
80
+ };
81
+ }
82
+ return {
83
+ display: "flex",
84
+ alignItems: "center",
85
+ gap: "4px",
86
+ height: "24px",
87
+ overflow: "hidden",
88
+ backgroundColor: isFocused ? "rgba(255, 255, 255, 0.01)" : "transparent",
89
+ borderRadius: "99px",
90
+ boxShadow: isFocused ? "0px 0px 0px 3px #3cad51" : "none",
91
+ padding: isFocused ? "0 6px" : "0 2px",
92
+ margin: isFocused ? "0" : "0 4px",
93
+ cursor: isActive ? "default" : "pointer",
94
+ textDecoration: "none"
95
+ };
96
+ };
97
+ const linkStyles = (isActive, isHovered) => ({
98
+ fontFamily: isActive ? "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif" : "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
99
+ fontSize: "13px",
100
+ fontWeight: isActive ? 600 : 400,
101
+ color: isActive ? isHovered ? "#0e8a0e" : "#2f2f2f" : isHovered ? "#0e8a0e" : "#595959",
102
+ lineHeight: "1.5",
103
+ whiteSpace: "nowrap"
104
+ });
105
+ const dividerStyles = {
106
+ fontFamily: "'PT Sans', sans-serif",
107
+ fontSize: "14px",
108
+ color: "#595959",
109
+ lineHeight: "normal",
110
+ whiteSpace: "nowrap"
111
+ };
112
+ const ellipsisButtonStyles = {
113
+ display: "flex",
114
+ alignItems: "center",
115
+ justifyContent: "center",
116
+ width: "24px",
117
+ height: "24px",
118
+ borderRadius: "99px",
119
+ border: "none",
120
+ background: "transparent",
121
+ cursor: "pointer",
122
+ backgroundColor: ellipsisFocused ? "rgba(255, 255, 255, 0.01)" : ellipsisHovered ? "#efefef" : "transparent",
123
+ boxShadow: ellipsisFocused ? "0px 0px 0px 3px #3cad51" : "none"
124
+ };
125
+ const copyButtonStyles = {
126
+ display: "flex",
127
+ alignItems: "center",
128
+ justifyContent: "center",
129
+ width: "24px",
130
+ height: "24px",
131
+ borderRadius: "99px",
132
+ border: "none",
133
+ background: showCopyTooltip ? "#efefef" : "transparent",
134
+ cursor: "pointer",
135
+ position: "relative"
136
+ };
137
+ const tooltipStyles = {
138
+ position: "absolute",
139
+ top: "100%",
140
+ left: "50%",
141
+ transform: "translateX(-50%)",
142
+ marginTop: "8px",
143
+ backgroundColor: "#2f2f2f",
144
+ color: "white",
145
+ padding: "12px",
146
+ borderRadius: "8px",
147
+ fontSize: "13px",
148
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
149
+ fontWeight: 400,
150
+ lineHeight: "1.5",
151
+ whiteSpace: "nowrap",
152
+ boxShadow: "0px 4px 12px rgba(32, 32, 32, 0.08)",
153
+ zIndex: 1e3
154
+ };
155
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
156
+ "div",
157
+ {
158
+ ref,
159
+ className,
160
+ style: containerStyles,
161
+ "data-testid": dataTestId,
162
+ children: displayItems.map((item, index) => {
163
+ const isActive = index === displayItems.length - 1;
164
+ const isEllipsis = "isEllipsis" in item && item.isEllipsis;
165
+ if (isEllipsis) {
166
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(React.Fragment, { children: [
167
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
168
+ "button",
169
+ {
170
+ style: ellipsisButtonStyles,
171
+ onFocus: () => setEllipsisFocused(true),
172
+ onBlur: () => setEllipsisFocused(false),
173
+ onMouseEnter: () => setEllipsisHovered(true),
174
+ onMouseLeave: () => setEllipsisHovered(false),
175
+ "aria-label": "More breadcrumbs",
176
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
177
+ import_lucide_react.MoreHorizontal,
178
+ {
179
+ size: 12,
180
+ color: "#2f2f2f",
181
+ strokeWidth: 2,
182
+ style: { display: "block", flexShrink: 0 }
183
+ }
184
+ )
185
+ }
186
+ ),
187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dividerStyles, children: " /" })
188
+ ] }, `ellipsis-${index}`);
189
+ }
190
+ const breadcrumbItem = item;
191
+ if (isActive) {
192
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(React.Fragment, { children: [
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
194
+ "div",
195
+ {
196
+ style: breadcrumbItemStyles(index, true),
197
+ onMouseEnter: () => setHoveredIndex(index),
198
+ onMouseLeave: () => setHoveredIndex(null),
199
+ onFocus: () => setFocusedIndex(index),
200
+ onBlur: () => setFocusedIndex(null),
201
+ tabIndex: 0,
202
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: linkStyles(true, hoveredIndex === index), children: breadcrumbItem.label })
203
+ }
204
+ ),
205
+ onCopy && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
206
+ "button",
207
+ {
208
+ style: copyButtonStyles,
209
+ onClick: handleCopy,
210
+ onMouseEnter: () => setShowCopyTooltip(true),
211
+ onMouseLeave: () => setShowCopyTooltip(false),
212
+ "aria-label": "Copy breadcrumb trail",
213
+ children: [
214
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
215
+ import_lucide_react.Link,
216
+ {
217
+ size: 12,
218
+ color: "#2f2f2f",
219
+ strokeWidth: 2,
220
+ style: { display: "block", flexShrink: 0 }
221
+ }
222
+ ),
223
+ showCopyTooltip && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: tooltipStyles, children: "Copy breadcrumb trail" })
224
+ ]
225
+ }
226
+ )
227
+ ] }, index);
228
+ }
229
+ const Element = breadcrumbItem.href ? "a" : "button";
230
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(React.Fragment, { children: [
231
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
232
+ Element,
233
+ {
234
+ ...breadcrumbItem.href ? { href: breadcrumbItem.href } : {},
235
+ style: {
236
+ ...breadcrumbItemStyles(index, false),
237
+ border: "none",
238
+ background: "transparent"
239
+ },
240
+ onClick: (e) => {
241
+ if (!breadcrumbItem.href && breadcrumbItem.onClick) {
242
+ e.preventDefault();
243
+ breadcrumbItem.onClick();
244
+ }
245
+ },
246
+ onMouseEnter: () => setHoveredIndex(index),
247
+ onMouseLeave: () => setHoveredIndex(null),
248
+ onFocus: () => setFocusedIndex(index),
249
+ onBlur: () => setFocusedIndex(null),
250
+ children: [
251
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: linkStyles(false, hoveredIndex === index), children: breadcrumbItem.label }),
252
+ breadcrumbItem.hasDropdown && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
253
+ import_lucide_react.ChevronDown,
254
+ {
255
+ size: 12,
256
+ color: hoveredIndex === index ? "#0e8a0e" : "#595959",
257
+ strokeWidth: 2,
258
+ style: { marginLeft: "2px", display: "inline-block", flexShrink: 0 }
259
+ }
260
+ )
261
+ ]
262
+ }
263
+ ),
264
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: dividerStyles, children: " /" })
265
+ ] }, index);
266
+ })
267
+ }
268
+ );
269
+ }
270
+ );
271
+ Breadcrumbs.displayName = "Breadcrumbs";
272
+ // Annotate the CommonJS export names for ESM import in node:
273
+ 0 && (module.exports = {
274
+ Breadcrumbs
275
+ });
276
+ //# sourceMappingURL=Breadcrumbs.js.map