@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 @@
1
+ {"version":3,"sources":["../src/Breadcrumbs/index.ts","../src/Breadcrumbs/Breadcrumbs.tsx"],"sourcesContent":["export { Breadcrumbs } from './Breadcrumbs';\nexport type { BreadcrumbsProps, BreadcrumbItem } from './Breadcrumbs';\n","import * as React from 'react';\nimport { Link, ChevronDown, MoreHorizontal } from 'lucide-react';\n\nexport interface BreadcrumbItem {\n /**\n * The label to display for this breadcrumb\n */\n label: string;\n /**\n * Optional href for the breadcrumb link\n */\n href?: string;\n /**\n * Optional click handler\n */\n onClick?: () => void;\n /**\n * Whether this breadcrumb has a dropdown menu\n */\n hasDropdown?: boolean;\n}\n\nexport interface BreadcrumbsProps {\n /**\n * Array of breadcrumb items\n */\n items: BreadcrumbItem[];\n /**\n * Callback when copy button is clicked\n */\n onCopy?: () => void;\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\n/**\n * Breadcrumbs component - Arbor Design System\n *\n * Navigation component showing the current page's location in the site hierarchy.\n * Automatically truncates to show first and last breadcrumb with ellipsis when more than 6 items.\n */\nexport const Breadcrumbs = React.forwardRef<HTMLDivElement, BreadcrumbsProps>(\n (\n {\n items,\n onCopy,\n className,\n style,\n 'data-testid': dataTestId,\n },\n ref\n ) => {\n const [hoveredIndex, setHoveredIndex] = React.useState<number | null>(null);\n const [focusedIndex, setFocusedIndex] = React.useState<number | null>(null);\n const [showCopyTooltip, setShowCopyTooltip] = React.useState(false);\n const [ellipsisFocused, setEllipsisFocused] = React.useState(false);\n const [ellipsisHovered, setEllipsisHovered] = React.useState(false);\n\n // Truncate breadcrumbs if more than 6 items\n const displayItems = React.useMemo(() => {\n if (items.length > 6) {\n // Show first item, ellipsis, and last item\n return [items[0], { label: '...', isEllipsis: true }, items[items.length - 1]];\n }\n return items;\n }, [items]);\n\n const handleCopy = () => {\n onCopy?.();\n // Copy the breadcrumb trail to clipboard\n const trail = items.map(item => item.label).join(' / ');\n navigator.clipboard.writeText(trail);\n };\n\n const containerStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n ...style,\n };\n\n const breadcrumbItemStyles = (index: number, isActive: boolean, isEllipsis?: boolean): React.CSSProperties => {\n const isFocused = focusedIndex === index;\n\n if (isEllipsis) {\n return {\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n height: '24px',\n overflow: 'hidden',\n };\n }\n\n return {\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n height: '24px',\n overflow: 'hidden',\n backgroundColor: isFocused ? 'rgba(255, 255, 255, 0.01)' : 'transparent',\n borderRadius: '99px',\n boxShadow: isFocused ? '0px 0px 0px 3px #3cad51' : 'none',\n padding: isFocused ? '0 6px' : '0 2px',\n margin: isFocused ? '0' : '0 4px',\n cursor: isActive ? 'default' : 'pointer',\n textDecoration: 'none',\n };\n };\n\n const linkStyles = (isActive: boolean, isHovered: boolean): React.CSSProperties => ({\n fontFamily: isActive\n ? \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\"\n : \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontSize: '13px',\n fontWeight: isActive ? 600 : 400,\n color: isActive\n ? isHovered\n ? '#0e8a0e'\n : '#2f2f2f'\n : isHovered\n ? '#0e8a0e'\n : '#595959',\n lineHeight: '1.5',\n whiteSpace: 'nowrap',\n });\n\n const dividerStyles: React.CSSProperties = {\n fontFamily: \"'PT Sans', sans-serif\",\n fontSize: '14px',\n color: '#595959',\n lineHeight: 'normal',\n whiteSpace: 'nowrap',\n };\n\n const ellipsisButtonStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '24px',\n height: '24px',\n borderRadius: '99px',\n border: 'none',\n background: 'transparent',\n cursor: 'pointer',\n backgroundColor: ellipsisFocused ? 'rgba(255, 255, 255, 0.01)' : ellipsisHovered ? '#efefef' : 'transparent',\n boxShadow: ellipsisFocused ? '0px 0px 0px 3px #3cad51' : 'none',\n };\n\n const copyButtonStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n width: '24px',\n height: '24px',\n borderRadius: '99px',\n border: 'none',\n background: showCopyTooltip ? '#efefef' : 'transparent',\n cursor: 'pointer',\n position: 'relative',\n };\n\n const tooltipStyles: React.CSSProperties = {\n position: 'absolute',\n top: '100%',\n left: '50%',\n transform: 'translateX(-50%)',\n marginTop: '8px',\n backgroundColor: '#2f2f2f',\n color: 'white',\n padding: '12px',\n borderRadius: '8px',\n fontSize: '13px',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontWeight: 400,\n lineHeight: '1.5',\n whiteSpace: 'nowrap',\n boxShadow: '0px 4px 12px rgba(32, 32, 32, 0.08)',\n zIndex: 1000,\n };\n\n return (\n <div\n ref={ref}\n className={className}\n style={containerStyles}\n data-testid={dataTestId}\n >\n {displayItems.map((item, index) => {\n const isActive = index === displayItems.length - 1;\n const isEllipsis = 'isEllipsis' in item && item.isEllipsis;\n\n if (isEllipsis) {\n return (\n <React.Fragment key={`ellipsis-${index}`}>\n <button\n style={ellipsisButtonStyles}\n onFocus={() => setEllipsisFocused(true)}\n onBlur={() => setEllipsisFocused(false)}\n onMouseEnter={() => setEllipsisHovered(true)}\n onMouseLeave={() => setEllipsisHovered(false)}\n aria-label=\"More breadcrumbs\"\n >\n <MoreHorizontal\n size={12}\n color=\"#2f2f2f\"\n strokeWidth={2}\n style={{ display: 'block', flexShrink: 0 }}\n />\n </button>\n <span style={dividerStyles}> /</span>\n </React.Fragment>\n );\n }\n\n const breadcrumbItem = item as BreadcrumbItem;\n\n if (isActive) {\n // Active breadcrumb (last item) - not clickable\n return (\n <React.Fragment key={index}>\n <div\n style={breadcrumbItemStyles(index, true)}\n onMouseEnter={() => setHoveredIndex(index)}\n onMouseLeave={() => setHoveredIndex(null)}\n onFocus={() => setFocusedIndex(index)}\n onBlur={() => setFocusedIndex(null)}\n tabIndex={0}\n >\n <span style={linkStyles(true, hoveredIndex === index)}>\n {breadcrumbItem.label}\n </span>\n </div>\n {/* Copy button - appears immediately after active breadcrumb */}\n {onCopy && (\n <button\n style={copyButtonStyles}\n onClick={handleCopy}\n onMouseEnter={() => setShowCopyTooltip(true)}\n onMouseLeave={() => setShowCopyTooltip(false)}\n aria-label=\"Copy breadcrumb trail\"\n >\n <Link\n size={12}\n color=\"#2f2f2f\"\n strokeWidth={2}\n style={{ display: 'block', flexShrink: 0 }}\n />\n {showCopyTooltip && (\n <div style={tooltipStyles}>Copy breadcrumb trail</div>\n )}\n </button>\n )}\n </React.Fragment>\n );\n }\n\n // Regular breadcrumb link\n const Element = breadcrumbItem.href ? 'a' : 'button';\n return (\n <React.Fragment key={index}>\n <Element\n {...(breadcrumbItem.href ? { href: breadcrumbItem.href } : {})}\n style={{\n ...breadcrumbItemStyles(index, false),\n border: 'none',\n background: 'transparent',\n }}\n onClick={(e) => {\n if (!breadcrumbItem.href && breadcrumbItem.onClick) {\n e.preventDefault();\n breadcrumbItem.onClick();\n }\n }}\n onMouseEnter={() => setHoveredIndex(index)}\n onMouseLeave={() => setHoveredIndex(null)}\n onFocus={() => setFocusedIndex(index)}\n onBlur={() => setFocusedIndex(null)}\n >\n <span style={linkStyles(false, hoveredIndex === index)}>\n {breadcrumbItem.label}\n </span>\n {breadcrumbItem.hasDropdown && (\n <ChevronDown\n size={12}\n color={hoveredIndex === index ? '#0e8a0e' : '#595959'}\n strokeWidth={2}\n style={{ marginLeft: '2px', display: 'inline-block', flexShrink: 0 }}\n />\n )}\n </Element>\n <span style={dividerStyles}> /</span>\n </React.Fragment>\n );\n })}\n </div>\n );\n }\n);\n\nBreadcrumbs.displayName = 'Breadcrumbs';\n"],"mappings":";;;;;;;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AAAA;AAAA,sBACC,MAAM;AAAA,sBACN,OAAO,iBAAiB,QAAQ,YAAY;AAAA,sBAC5C,aAAa;AAAA,sBACb,OAAO,EAAE,YAAY,OAAO,SAAS,gBAAgB,YAAY,EAAE;AAAA;AAAA,kBACrE;AAAA;AAAA;AAAA,YAEJ;AAAA,YACA,4CAAC,UAAK,OAAO,eAAe,gBAAE;AAAA,eA/BX,KAgCrB;AAAA,QAEJ,CAAC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ Breadcrumbs
3
+ } from "./chunk-RQP6ZGD7.mjs";
4
+ export {
5
+ Breadcrumbs
6
+ };
7
+ //# sourceMappingURL=Breadcrumbs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+
3
+ interface SearchGlobalProps {
4
+ /**
5
+ * Value of the search input
6
+ */
7
+ value?: string;
8
+ /**
9
+ * Callback when value changes
10
+ */
11
+ onChange?: (value: string) => void;
12
+ /**
13
+ * Callback when search is submitted
14
+ */
15
+ onSubmit?: (value: string) => void;
16
+ /**
17
+ * Callback when clear button is clicked
18
+ */
19
+ onClear?: () => void;
20
+ /**
21
+ * Placeholder text
22
+ */
23
+ placeholder?: string;
24
+ /**
25
+ * Custom className
26
+ */
27
+ className?: string;
28
+ /**
29
+ * Custom style
30
+ */
31
+ style?: React.CSSProperties;
32
+ /**
33
+ * Test ID for testing
34
+ */
35
+ 'data-testid'?: string;
36
+ }
37
+ /**
38
+ * SearchGlobal component - Arbor Design System
39
+ *
40
+ * A search input that expands from 160px to 300px when focused.
41
+ * Shows keyboard shortcut (⌘ K) on hover and X button when focused.
42
+ */
43
+ declare const SearchGlobal: React.ForwardRefExoticComponent<SearchGlobalProps & React.RefAttributes<HTMLInputElement>>;
44
+
45
+ export { SearchGlobal, type SearchGlobalProps };
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+
3
+ interface SearchGlobalProps {
4
+ /**
5
+ * Value of the search input
6
+ */
7
+ value?: string;
8
+ /**
9
+ * Callback when value changes
10
+ */
11
+ onChange?: (value: string) => void;
12
+ /**
13
+ * Callback when search is submitted
14
+ */
15
+ onSubmit?: (value: string) => void;
16
+ /**
17
+ * Callback when clear button is clicked
18
+ */
19
+ onClear?: () => void;
20
+ /**
21
+ * Placeholder text
22
+ */
23
+ placeholder?: string;
24
+ /**
25
+ * Custom className
26
+ */
27
+ className?: string;
28
+ /**
29
+ * Custom style
30
+ */
31
+ style?: React.CSSProperties;
32
+ /**
33
+ * Test ID for testing
34
+ */
35
+ 'data-testid'?: string;
36
+ }
37
+ /**
38
+ * SearchGlobal component - Arbor Design System
39
+ *
40
+ * A search input that expands from 160px to 300px when focused.
41
+ * Shows keyboard shortcut (⌘ K) on hover and X button when focused.
42
+ */
43
+ declare const SearchGlobal: React.ForwardRefExoticComponent<SearchGlobalProps & React.RefAttributes<HTMLInputElement>>;
44
+
45
+ export { SearchGlobal, type SearchGlobalProps };
@@ -0,0 +1,209 @@
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/SearchGlobal/index.ts
31
+ var SearchGlobal_exports = {};
32
+ __export(SearchGlobal_exports, {
33
+ SearchGlobal: () => SearchGlobal
34
+ });
35
+ module.exports = __toCommonJS(SearchGlobal_exports);
36
+
37
+ // src/SearchGlobal/SearchGlobal.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 SearchGlobal = React.forwardRef(
42
+ ({
43
+ value = "",
44
+ onChange,
45
+ onSubmit,
46
+ onClear,
47
+ placeholder = "Search",
48
+ className,
49
+ style,
50
+ "data-testid": dataTestId
51
+ }, ref) => {
52
+ const [isFocused, setIsFocused] = React.useState(false);
53
+ const [isHovered, setIsHovered] = React.useState(false);
54
+ const inputRef = React.useRef(null);
55
+ React.useImperativeHandle(ref, () => inputRef.current);
56
+ const handleFocus = () => {
57
+ setIsFocused(true);
58
+ };
59
+ const handleBlur = () => {
60
+ setIsFocused(false);
61
+ };
62
+ const handleChange = (e) => {
63
+ onChange?.(e.target.value);
64
+ };
65
+ const handleKeyDown = (e) => {
66
+ if (e.key === "Enter") {
67
+ onSubmit?.(value);
68
+ }
69
+ };
70
+ const handleClear = () => {
71
+ onChange?.("");
72
+ onClear?.();
73
+ inputRef.current?.focus();
74
+ };
75
+ const containerStyles = {
76
+ position: "relative",
77
+ width: isFocused ? "300px" : "160px",
78
+ height: "32px",
79
+ backgroundColor: isFocused ? "#ffffff" : isHovered ? "#efefef" : "#f8f8f8",
80
+ borderRadius: "16px",
81
+ padding: "8px 16px",
82
+ display: "flex",
83
+ alignItems: "center",
84
+ gap: isFocused ? "8px" : "8px",
85
+ cursor: "text",
86
+ transition: "all 0.2s ease-in-out",
87
+ boxSizing: "border-box",
88
+ border: isFocused ? "1px solid #efefef" : "none",
89
+ boxShadow: isFocused ? "0px 0px 0px 3px #3cad51" : "none",
90
+ marginLeft: isFocused ? "-140px" : "0",
91
+ // Expand to the left
92
+ ...style
93
+ };
94
+ const iconContainerStyles = {
95
+ display: "flex",
96
+ alignItems: "center",
97
+ justifyContent: "center",
98
+ flexShrink: 0,
99
+ padding: "2px"
100
+ };
101
+ const inputStyles = {
102
+ border: "none",
103
+ outline: "none",
104
+ backgroundColor: "transparent",
105
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
106
+ fontSize: "13px",
107
+ fontWeight: 400,
108
+ color: "#2f2f2f",
109
+ lineHeight: "1.5",
110
+ flex: 1,
111
+ width: "100%",
112
+ minWidth: 0
113
+ };
114
+ const keyboardShortcutStyles = {
115
+ display: "flex",
116
+ alignItems: "center",
117
+ gap: "0px",
118
+ flexShrink: 0
119
+ };
120
+ const keyStyles = {
121
+ border: "1px solid #2f2f2f",
122
+ borderRadius: "5px",
123
+ padding: "0px 3px",
124
+ height: "16px",
125
+ display: "flex",
126
+ alignItems: "center",
127
+ justifyContent: "center",
128
+ fontFamily: "'Work Sans', sans-serif",
129
+ fontSize: "8px",
130
+ fontWeight: 400,
131
+ color: "#2f2f2f",
132
+ letterSpacing: "-0.08px",
133
+ lineHeight: "1.5",
134
+ minWidth: "16px"
135
+ };
136
+ const plusStyles = {
137
+ fontFamily: "'Work Sans', sans-serif",
138
+ fontSize: "8px",
139
+ fontWeight: 400,
140
+ color: "#2f2f2f",
141
+ letterSpacing: "-0.08px",
142
+ lineHeight: "1.5",
143
+ padding: "0 2px"
144
+ };
145
+ const clearButtonStyles = {
146
+ display: "flex",
147
+ alignItems: "center",
148
+ justifyContent: "center",
149
+ flexShrink: 0,
150
+ width: "16px",
151
+ height: "16px",
152
+ cursor: "pointer",
153
+ border: "none",
154
+ background: "none",
155
+ padding: 0
156
+ };
157
+ const showKeyboardShortcut = isHovered && !isFocused;
158
+ const showClearButton = isFocused;
159
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
160
+ "div",
161
+ {
162
+ className,
163
+ style: containerStyles,
164
+ onMouseEnter: () => setIsHovered(true),
165
+ onMouseLeave: () => setIsHovered(false),
166
+ onClick: () => inputRef.current?.focus(),
167
+ "data-testid": dataTestId,
168
+ children: [
169
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: iconContainerStyles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Search, { size: 12, color: "#2f2f2f", strokeWidth: 2 }) }),
170
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
171
+ "input",
172
+ {
173
+ ref: inputRef,
174
+ type: "text",
175
+ value,
176
+ onChange: handleChange,
177
+ onFocus: handleFocus,
178
+ onBlur: handleBlur,
179
+ onKeyDown: handleKeyDown,
180
+ placeholder: isFocused ? "" : placeholder,
181
+ style: inputStyles
182
+ }
183
+ ),
184
+ showKeyboardShortcut && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: keyboardShortcutStyles, children: [
185
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: keyStyles, children: "\u2318" }),
186
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { style: plusStyles, children: "+" }),
187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: keyStyles, children: "K" })
188
+ ] }),
189
+ showClearButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
190
+ "button",
191
+ {
192
+ type: "button",
193
+ onClick: handleClear,
194
+ style: clearButtonStyles,
195
+ "aria-label": "Clear search",
196
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { size: 13.333, color: "#2f2f2f", strokeWidth: 2 })
197
+ }
198
+ )
199
+ ]
200
+ }
201
+ );
202
+ }
203
+ );
204
+ SearchGlobal.displayName = "SearchGlobal";
205
+ // Annotate the CommonJS export names for ESM import in node:
206
+ 0 && (module.exports = {
207
+ SearchGlobal
208
+ });
209
+ //# sourceMappingURL=SearchGlobal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SearchGlobal/index.ts","../src/SearchGlobal/SearchGlobal.tsx"],"sourcesContent":["export { SearchGlobal } from './SearchGlobal';\nexport type { SearchGlobalProps } from './SearchGlobal';\n","import * as React from 'react';\nimport { Search, X } from 'lucide-react';\n\nexport interface SearchGlobalProps {\n /**\n * Value of the search input\n */\n value?: string;\n /**\n * Callback when value changes\n */\n onChange?: (value: string) => void;\n /**\n * Callback when search is submitted\n */\n onSubmit?: (value: string) => void;\n /**\n * Callback when clear button is clicked\n */\n onClear?: () => void;\n /**\n * Placeholder text\n */\n placeholder?: 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\n/**\n * SearchGlobal component - Arbor Design System\n *\n * A search input that expands from 160px to 300px when focused.\n * Shows keyboard shortcut (⌘ K) on hover and X button when focused.\n */\nexport const SearchGlobal = React.forwardRef<HTMLInputElement, SearchGlobalProps>(\n (\n {\n value = '',\n onChange,\n onSubmit,\n onClear,\n placeholder = 'Search',\n className,\n style,\n 'data-testid': dataTestId,\n },\n ref\n ) => {\n const [isFocused, setIsFocused] = React.useState(false);\n const [isHovered, setIsHovered] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n // Merge refs\n React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);\n\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.value);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n onSubmit?.(value);\n }\n };\n\n const handleClear = () => {\n onChange?.('');\n onClear?.();\n inputRef.current?.focus();\n };\n\n const containerStyles: React.CSSProperties = {\n position: 'relative',\n width: isFocused ? '300px' : '160px',\n height: '32px',\n backgroundColor: isFocused ? '#ffffff' : isHovered ? '#efefef' : '#f8f8f8',\n borderRadius: '16px',\n padding: '8px 16px',\n display: 'flex',\n alignItems: 'center',\n gap: isFocused ? '8px' : '8px',\n cursor: 'text',\n transition: 'all 0.2s ease-in-out',\n boxSizing: 'border-box',\n border: isFocused ? '1px solid #efefef' : 'none',\n boxShadow: isFocused ? '0px 0px 0px 3px #3cad51' : 'none',\n marginLeft: isFocused ? '-140px' : '0', // Expand to the left\n ...style,\n };\n\n const iconContainerStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n padding: '2px',\n };\n\n const inputStyles: React.CSSProperties = {\n border: 'none',\n outline: 'none',\n backgroundColor: 'transparent',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontSize: '13px',\n fontWeight: 400,\n color: '#2f2f2f',\n lineHeight: '1.5',\n flex: 1,\n width: '100%',\n minWidth: 0,\n };\n\n const keyboardShortcutStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n gap: '0px',\n flexShrink: 0,\n };\n\n const keyStyles: React.CSSProperties = {\n border: '1px solid #2f2f2f',\n borderRadius: '5px',\n padding: '0px 3px',\n height: '16px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontFamily: \"'Work Sans', sans-serif\",\n fontSize: '8px',\n fontWeight: 400,\n color: '#2f2f2f',\n letterSpacing: '-0.08px',\n lineHeight: '1.5',\n minWidth: '16px',\n };\n\n const plusStyles: React.CSSProperties = {\n fontFamily: \"'Work Sans', sans-serif\",\n fontSize: '8px',\n fontWeight: 400,\n color: '#2f2f2f',\n letterSpacing: '-0.08px',\n lineHeight: '1.5',\n padding: '0 2px',\n };\n\n const clearButtonStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n width: '16px',\n height: '16px',\n cursor: 'pointer',\n border: 'none',\n background: 'none',\n padding: 0,\n };\n\n const showKeyboardShortcut = isHovered && !isFocused;\n const showClearButton = isFocused;\n\n return (\n <div\n className={className}\n style={containerStyles}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={() => inputRef.current?.focus()}\n data-testid={dataTestId}\n >\n <div style={iconContainerStyles}>\n <Search size={12} color=\"#2f2f2f\" strokeWidth={2} />\n </div>\n\n <input\n ref={inputRef}\n type=\"text\"\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={isFocused ? '' : placeholder}\n style={inputStyles}\n />\n\n {showKeyboardShortcut && (\n <div style={keyboardShortcutStyles}>\n <div style={keyStyles}>⌘</div>\n <span style={plusStyles}>+</span>\n <div style={keyStyles}>K</div>\n </div>\n )}\n\n {showClearButton && (\n <button\n type=\"button\"\n onClick={handleClear}\n style={clearButtonStyles}\n aria-label=\"Clear search\"\n >\n <X size={13.333} color=\"#2f2f2f\" strokeWidth={2} />\n </button>\n )}\n </div>\n );\n }\n);\n\nSearchGlobal.displayName = 'SearchGlobal';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,0BAA0B;AA6LhB;AAlJH,IAAM,eAAqB;AAAA,EAChC,CACE;AAAA,IACE,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,eAAe;AAAA,EACjB,GACA,QACG;AACH,UAAM,CAAC,WAAW,YAAY,IAAU,eAAS,KAAK;AACtD,UAAM,CAAC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AA,cACT,QAAQ;AAAA,cACR,WAAW;AAAA,cACX,aAAa,YAAY,KAAK;AAAA,cAC9B,OAAO;AAAA;AAAA,UACT;AAAA,UAEC,wBACC,6CAAC,SAAI,OAAO,wBACV;AAAA,wDAAC,SAAI,OAAO,WAAW,oBAAC;AAAA,YACxB,4CAAC,UAAK,OAAO,YAAY,eAAC;AAAA,YAC1B,4CAAC,SAAI,OAAO,WAAW,eAAC;AAAA,aAC1B;AAAA,UAGD,mBACC;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS;AAAA,cACT,OAAO;AAAA,cACP,cAAW;AAAA,cAEX,sDAAC,yBAAE,MAAM,QAAQ,OAAM,WAAU,aAAa,GAAG;AAAA;AAAA,UACnD;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;","names":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ SearchGlobal
3
+ } from "./chunk-UPBHDBAK.mjs";
4
+ export {
5
+ SearchGlobal
6
+ };
7
+ //# sourceMappingURL=SearchGlobal.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+
3
+ interface SearchOnPageProps {
4
+ /**
5
+ * Value of the search input
6
+ */
7
+ value?: string;
8
+ /**
9
+ * Callback when value changes
10
+ */
11
+ onChange?: (value: string) => void;
12
+ /**
13
+ * Callback when search is submitted
14
+ */
15
+ onSubmit?: (value: string) => void;
16
+ /**
17
+ * Callback when clear button is clicked
18
+ */
19
+ onClear?: () => void;
20
+ /**
21
+ * Placeholder text
22
+ */
23
+ placeholder?: string;
24
+ /**
25
+ * Custom className
26
+ */
27
+ className?: string;
28
+ /**
29
+ * Custom style
30
+ */
31
+ style?: React.CSSProperties;
32
+ /**
33
+ * Test ID for testing
34
+ */
35
+ 'data-testid'?: string;
36
+ }
37
+ /**
38
+ * SearchOnPage component - Arbor Design System
39
+ *
40
+ * A search input with fixed 200px width for filtering content on the current page.
41
+ * Shows green focus ring when active and X button to clear.
42
+ */
43
+ declare const SearchOnPage: React.ForwardRefExoticComponent<SearchOnPageProps & React.RefAttributes<HTMLInputElement>>;
44
+
45
+ export { SearchOnPage, type SearchOnPageProps };
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+
3
+ interface SearchOnPageProps {
4
+ /**
5
+ * Value of the search input
6
+ */
7
+ value?: string;
8
+ /**
9
+ * Callback when value changes
10
+ */
11
+ onChange?: (value: string) => void;
12
+ /**
13
+ * Callback when search is submitted
14
+ */
15
+ onSubmit?: (value: string) => void;
16
+ /**
17
+ * Callback when clear button is clicked
18
+ */
19
+ onClear?: () => void;
20
+ /**
21
+ * Placeholder text
22
+ */
23
+ placeholder?: string;
24
+ /**
25
+ * Custom className
26
+ */
27
+ className?: string;
28
+ /**
29
+ * Custom style
30
+ */
31
+ style?: React.CSSProperties;
32
+ /**
33
+ * Test ID for testing
34
+ */
35
+ 'data-testid'?: string;
36
+ }
37
+ /**
38
+ * SearchOnPage component - Arbor Design System
39
+ *
40
+ * A search input with fixed 200px width for filtering content on the current page.
41
+ * Shows green focus ring when active and X button to clear.
42
+ */
43
+ declare const SearchOnPage: React.ForwardRefExoticComponent<SearchOnPageProps & React.RefAttributes<HTMLInputElement>>;
44
+
45
+ export { SearchOnPage, type SearchOnPageProps };
@@ -0,0 +1,171 @@
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/SearchOnPage/index.ts
31
+ var SearchOnPage_exports = {};
32
+ __export(SearchOnPage_exports, {
33
+ SearchOnPage: () => SearchOnPage
34
+ });
35
+ module.exports = __toCommonJS(SearchOnPage_exports);
36
+
37
+ // src/SearchOnPage/SearchOnPage.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 SearchOnPage = React.forwardRef(
42
+ ({
43
+ value = "",
44
+ onChange,
45
+ onSubmit,
46
+ onClear,
47
+ placeholder = "Search Reports",
48
+ className,
49
+ style,
50
+ "data-testid": dataTestId
51
+ }, ref) => {
52
+ const [isFocused, setIsFocused] = React.useState(false);
53
+ const [isHovered, setIsHovered] = React.useState(false);
54
+ const inputRef = React.useRef(null);
55
+ React.useImperativeHandle(ref, () => inputRef.current);
56
+ const handleFocus = () => {
57
+ setIsFocused(true);
58
+ };
59
+ const handleBlur = () => {
60
+ setIsFocused(false);
61
+ };
62
+ const handleChange = (e) => {
63
+ onChange?.(e.target.value);
64
+ };
65
+ const handleKeyDown = (e) => {
66
+ if (e.key === "Enter") {
67
+ onSubmit?.(value);
68
+ }
69
+ };
70
+ const handleClear = () => {
71
+ onChange?.("");
72
+ onClear?.();
73
+ inputRef.current?.focus();
74
+ };
75
+ const containerStyles = {
76
+ position: "relative",
77
+ width: "200px",
78
+ height: "32px",
79
+ backgroundColor: isFocused ? "#ffffff" : isHovered ? "#efefef" : "#ffffff",
80
+ borderRadius: "16px",
81
+ padding: "8px 16px",
82
+ display: "flex",
83
+ alignItems: "center",
84
+ gap: "8px",
85
+ cursor: "text",
86
+ transition: "all 0.2s ease-in-out",
87
+ boxSizing: "border-box",
88
+ border: isFocused ? "1px solid #efefef" : "none",
89
+ boxShadow: isFocused ? "0px 0px 0px 3px #3cad51" : "none",
90
+ ...style
91
+ };
92
+ const iconContainerStyles = {
93
+ display: "flex",
94
+ alignItems: "center",
95
+ justifyContent: "center",
96
+ flexShrink: 0,
97
+ padding: "2px"
98
+ };
99
+ const inputStyles = {
100
+ border: "none",
101
+ outline: "none",
102
+ backgroundColor: "transparent",
103
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
104
+ fontSize: "13px",
105
+ fontWeight: 400,
106
+ color: "#2f2f2f",
107
+ lineHeight: "1.5",
108
+ flex: 1,
109
+ width: "100%",
110
+ minWidth: 0
111
+ };
112
+ const clearButtonStyles = {
113
+ display: "flex",
114
+ alignItems: "center",
115
+ justifyContent: "center",
116
+ flexShrink: 0,
117
+ width: "16px",
118
+ height: "16px",
119
+ cursor: "pointer",
120
+ border: "none",
121
+ background: "none",
122
+ padding: 0
123
+ };
124
+ const showClearButton = isFocused && value.length > 0;
125
+ const iconColor = isFocused || isHovered ? "#2f2f2f" : "#595959";
126
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
127
+ "div",
128
+ {
129
+ className,
130
+ style: containerStyles,
131
+ onMouseEnter: () => setIsHovered(true),
132
+ onMouseLeave: () => setIsHovered(false),
133
+ onClick: () => inputRef.current?.focus(),
134
+ "data-testid": dataTestId,
135
+ children: [
136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: iconContainerStyles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Search, { size: 12, color: iconColor, strokeWidth: 2 }) }),
137
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
+ "input",
139
+ {
140
+ ref: inputRef,
141
+ type: "text",
142
+ value,
143
+ onChange: handleChange,
144
+ onFocus: handleFocus,
145
+ onBlur: handleBlur,
146
+ onKeyDown: handleKeyDown,
147
+ placeholder: isFocused ? "" : placeholder,
148
+ style: inputStyles
149
+ }
150
+ ),
151
+ showClearButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
152
+ "button",
153
+ {
154
+ type: "button",
155
+ onClick: handleClear,
156
+ style: clearButtonStyles,
157
+ "aria-label": "Clear search",
158
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { size: 13.333, color: "#2f2f2f", strokeWidth: 2 })
159
+ }
160
+ )
161
+ ]
162
+ }
163
+ );
164
+ }
165
+ );
166
+ SearchOnPage.displayName = "SearchOnPage";
167
+ // Annotate the CommonJS export names for ESM import in node:
168
+ 0 && (module.exports = {
169
+ SearchOnPage
170
+ });
171
+ //# sourceMappingURL=SearchOnPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SearchOnPage/index.ts","../src/SearchOnPage/SearchOnPage.tsx"],"sourcesContent":["export { SearchOnPage } from './SearchOnPage';\nexport type { SearchOnPageProps } from './SearchOnPage';\n","import * as React from 'react';\nimport { Search, X } from 'lucide-react';\n\nexport interface SearchOnPageProps {\n /**\n * Value of the search input\n */\n value?: string;\n /**\n * Callback when value changes\n */\n onChange?: (value: string) => void;\n /**\n * Callback when search is submitted\n */\n onSubmit?: (value: string) => void;\n /**\n * Callback when clear button is clicked\n */\n onClear?: () => void;\n /**\n * Placeholder text\n */\n placeholder?: 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\n/**\n * SearchOnPage component - Arbor Design System\n *\n * A search input with fixed 200px width for filtering content on the current page.\n * Shows green focus ring when active and X button to clear.\n */\nexport const SearchOnPage = React.forwardRef<HTMLInputElement, SearchOnPageProps>(\n (\n {\n value = '',\n onChange,\n onSubmit,\n onClear,\n placeholder = 'Search Reports',\n className,\n style,\n 'data-testid': dataTestId,\n },\n ref\n ) => {\n const [isFocused, setIsFocused] = React.useState(false);\n const [isHovered, setIsHovered] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n // Merge refs\n React.useImperativeHandle(ref, () => inputRef.current as HTMLInputElement);\n\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n const handleBlur = () => {\n setIsFocused(false);\n };\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange?.(e.target.value);\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (e.key === 'Enter') {\n onSubmit?.(value);\n }\n };\n\n const handleClear = () => {\n onChange?.('');\n onClear?.();\n inputRef.current?.focus();\n };\n\n const containerStyles: React.CSSProperties = {\n position: 'relative',\n width: '200px',\n height: '32px',\n backgroundColor: isFocused ? '#ffffff' : isHovered ? '#efefef' : '#ffffff',\n borderRadius: '16px',\n padding: '8px 16px',\n display: 'flex',\n alignItems: 'center',\n gap: '8px',\n cursor: 'text',\n transition: 'all 0.2s ease-in-out',\n boxSizing: 'border-box',\n border: isFocused ? '1px solid #efefef' : 'none',\n boxShadow: isFocused ? '0px 0px 0px 3px #3cad51' : 'none',\n ...style,\n };\n\n const iconContainerStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n padding: '2px',\n };\n\n const inputStyles: React.CSSProperties = {\n border: 'none',\n outline: 'none',\n backgroundColor: 'transparent',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n fontSize: '13px',\n fontWeight: 400,\n color: '#2f2f2f',\n lineHeight: '1.5',\n flex: 1,\n width: '100%',\n minWidth: 0,\n };\n\n const clearButtonStyles: React.CSSProperties = {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n width: '16px',\n height: '16px',\n cursor: 'pointer',\n border: 'none',\n background: 'none',\n padding: 0,\n };\n\n const showClearButton = isFocused && value.length > 0;\n const iconColor = isFocused || isHovered ? '#2f2f2f' : '#595959';\n\n return (\n <div\n className={className}\n style={containerStyles}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n onClick={() => inputRef.current?.focus()}\n data-testid={dataTestId}\n >\n <div style={iconContainerStyles}>\n <Search size={12} color={iconColor} strokeWidth={2} />\n </div>\n\n <input\n ref={inputRef}\n type=\"text\"\n value={value}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder={isFocused ? '' : placeholder}\n style={inputStyles}\n />\n\n {showClearButton && (\n <button\n type=\"button\"\n onClick={handleClear}\n style={clearButtonStyles}\n aria-label=\"Clear search\"\n >\n <X size={13.333} color=\"#2f2f2f\" strokeWidth={2} />\n </button>\n )}\n </div>\n );\n }\n);\n\nSearchOnPage.displayName = 'SearchOnPage';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,0BAA0B;AAiJpB;AAtGC,IAAM,eAAqB;AAAA,EAChC,CACE;AAAA,IACE,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA,eAAe;AAAA,EACjB,GACA,QACG;AACH,UAAM,CAAC,WAAW,YAAY,IAAU,eAAS,KAAK;AACtD,UAAM,CAAC,WAAW,YAAY,IAAU,eAAS,KAAK;AACtD,UAAM,WAAiB,aAAyB,IAAI;AAGpD,IAAM,0BAAoB,KAAK,MAAM,SAAS,OAA2B;AAEzE,UAAM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