@tonyarbor/components 0.1.0 → 0.2.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.
- package/dist/Checkbox.d.mts +48 -0
- package/dist/Checkbox.d.ts +48 -0
- package/dist/Checkbox.js +165 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/Checkbox.mjs +7 -0
- package/dist/Checkbox.mjs.map +1 -0
- package/dist/Combobox.d.mts +67 -0
- package/dist/Combobox.d.ts +67 -0
- package/dist/Combobox.js +329 -0
- package/dist/Combobox.js.map +1 -0
- package/dist/Combobox.mjs +7 -0
- package/dist/Combobox.mjs.map +1 -0
- package/dist/NumericInput.d.mts +68 -0
- package/dist/NumericInput.d.ts +68 -0
- package/dist/NumericInput.js +319 -0
- package/dist/NumericInput.js.map +1 -0
- package/dist/NumericInput.mjs +7 -0
- package/dist/NumericInput.mjs.map +1 -0
- package/dist/Radio.d.mts +48 -0
- package/dist/Radio.d.ts +48 -0
- package/dist/Radio.js +174 -0
- package/dist/Radio.js.map +1 -0
- package/dist/Radio.mjs +7 -0
- package/dist/Radio.mjs.map +1 -0
- package/dist/chunk-5BUXFTPW.mjs +283 -0
- package/dist/chunk-5BUXFTPW.mjs.map +1 -0
- package/dist/chunk-7OWLBYNM.mjs +293 -0
- package/dist/chunk-7OWLBYNM.mjs.map +1 -0
- package/dist/chunk-ARBHNHO7.mjs +138 -0
- package/dist/chunk-ARBHNHO7.mjs.map +1 -0
- package/dist/chunk-BCYJIUQX.mjs +129 -0
- package/dist/chunk-BCYJIUQX.mjs.map +1 -0
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +835 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -0
- package/package.json +24 -3
package/dist/Combobox.js
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
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/Combobox/index.ts
|
|
31
|
+
var Combobox_exports = {};
|
|
32
|
+
__export(Combobox_exports, {
|
|
33
|
+
Combobox: () => Combobox
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(Combobox_exports);
|
|
36
|
+
|
|
37
|
+
// src/Combobox/Combobox.tsx
|
|
38
|
+
var React = __toESM(require("react"));
|
|
39
|
+
var import_clsx = require("clsx");
|
|
40
|
+
var import_lucide_react = require("lucide-react");
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var comboboxStyles = {
|
|
43
|
+
base: {
|
|
44
|
+
width: "100%",
|
|
45
|
+
height: "36px",
|
|
46
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
47
|
+
backgroundColor: "#ffffff",
|
|
48
|
+
borderRadius: "8px",
|
|
49
|
+
transition: "all 0.2s ease-in-out",
|
|
50
|
+
outline: "none",
|
|
51
|
+
fontSize: "13px",
|
|
52
|
+
padding: "8px",
|
|
53
|
+
paddingRight: "32px",
|
|
54
|
+
margin: "0",
|
|
55
|
+
display: "flex",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
cursor: "pointer",
|
|
58
|
+
position: "relative"
|
|
59
|
+
},
|
|
60
|
+
states: {
|
|
61
|
+
default: {
|
|
62
|
+
border: "1px solid #d1d1d1",
|
|
63
|
+
// grey-300
|
|
64
|
+
color: "#2f2f2f"
|
|
65
|
+
// grey-900
|
|
66
|
+
},
|
|
67
|
+
defaultFocus: {
|
|
68
|
+
borderColor: "#3cad51",
|
|
69
|
+
// brand-500
|
|
70
|
+
outline: "3px solid rgba(60, 173, 81, 0.2)"
|
|
71
|
+
},
|
|
72
|
+
error: {
|
|
73
|
+
border: "1px solid #c93232",
|
|
74
|
+
// destructive-500
|
|
75
|
+
color: "#2f2f2f"
|
|
76
|
+
},
|
|
77
|
+
errorFocus: {
|
|
78
|
+
borderColor: "#c93232",
|
|
79
|
+
outline: "3px solid rgba(201, 50, 50, 0.2)"
|
|
80
|
+
},
|
|
81
|
+
success: {
|
|
82
|
+
border: "1px solid #16a33d",
|
|
83
|
+
// success-500
|
|
84
|
+
color: "#2f2f2f"
|
|
85
|
+
},
|
|
86
|
+
successFocus: {
|
|
87
|
+
borderColor: "#16a33d",
|
|
88
|
+
outline: "3px solid rgba(22, 163, 61, 0.2)"
|
|
89
|
+
},
|
|
90
|
+
disabled: {
|
|
91
|
+
backgroundColor: "#f8f8f8",
|
|
92
|
+
// grey-050
|
|
93
|
+
borderColor: "#efefef",
|
|
94
|
+
// grey-100
|
|
95
|
+
color: "#7e7e7e",
|
|
96
|
+
// grey-500
|
|
97
|
+
cursor: "not-allowed"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var labelStyles = {
|
|
102
|
+
display: "block",
|
|
103
|
+
fontSize: "13px",
|
|
104
|
+
fontWeight: "600",
|
|
105
|
+
color: "#2f2f2f",
|
|
106
|
+
marginBottom: "4px",
|
|
107
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
108
|
+
};
|
|
109
|
+
var helperTextStyles = {
|
|
110
|
+
fontSize: "13px",
|
|
111
|
+
margin: "0",
|
|
112
|
+
marginTop: "2px",
|
|
113
|
+
color: "#595959",
|
|
114
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
115
|
+
lineHeight: "1.4"
|
|
116
|
+
};
|
|
117
|
+
var errorTextStyles = {
|
|
118
|
+
...helperTextStyles,
|
|
119
|
+
color: "#a62323",
|
|
120
|
+
// destructive-600
|
|
121
|
+
display: "flex",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
gap: "4px"
|
|
124
|
+
};
|
|
125
|
+
var dropdownStyles = {
|
|
126
|
+
position: "absolute",
|
|
127
|
+
top: "calc(100% + 4px)",
|
|
128
|
+
left: "0",
|
|
129
|
+
right: "0",
|
|
130
|
+
backgroundColor: "#ffffff",
|
|
131
|
+
border: "1px solid #d1d1d1",
|
|
132
|
+
borderRadius: "8px",
|
|
133
|
+
maxHeight: "200px",
|
|
134
|
+
overflowY: "auto",
|
|
135
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
136
|
+
zIndex: 1e3
|
|
137
|
+
};
|
|
138
|
+
var optionStyles = {
|
|
139
|
+
padding: "8px 12px",
|
|
140
|
+
fontSize: "13px",
|
|
141
|
+
cursor: "pointer",
|
|
142
|
+
display: "flex",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
justifyContent: "space-between",
|
|
145
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
146
|
+
color: "#2f2f2f"
|
|
147
|
+
// grey-900
|
|
148
|
+
};
|
|
149
|
+
var Combobox = React.forwardRef(
|
|
150
|
+
({
|
|
151
|
+
label,
|
|
152
|
+
placeholder = "default-text",
|
|
153
|
+
options,
|
|
154
|
+
value,
|
|
155
|
+
onChange,
|
|
156
|
+
state = "default",
|
|
157
|
+
error,
|
|
158
|
+
helperText,
|
|
159
|
+
disabled = false,
|
|
160
|
+
className,
|
|
161
|
+
style,
|
|
162
|
+
"data-testid": dataTestId
|
|
163
|
+
}, ref) => {
|
|
164
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
165
|
+
const [searchQuery, setSearchQuery] = React.useState("");
|
|
166
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
167
|
+
const inputRef = React.useRef(null);
|
|
168
|
+
const dropdownRef = React.useRef(null);
|
|
169
|
+
const wrapperRef = React.useRef(null);
|
|
170
|
+
const comboboxId = React.useId();
|
|
171
|
+
const helperTextId = React.useId();
|
|
172
|
+
const errorId = React.useId();
|
|
173
|
+
const selectedOption = options.find((opt) => opt.value === value);
|
|
174
|
+
const filteredOptions = React.useMemo(() => {
|
|
175
|
+
if (!searchQuery) return options;
|
|
176
|
+
return options.filter(
|
|
177
|
+
(option) => option.label.toLowerCase().includes(searchQuery.toLowerCase())
|
|
178
|
+
);
|
|
179
|
+
}, [options, searchQuery]);
|
|
180
|
+
React.useEffect(() => {
|
|
181
|
+
const handleClickOutside = (event) => {
|
|
182
|
+
if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
|
|
183
|
+
setIsOpen(false);
|
|
184
|
+
setSearchQuery("");
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
188
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
189
|
+
}, []);
|
|
190
|
+
const handleInputChange = (e) => {
|
|
191
|
+
setSearchQuery(e.target.value);
|
|
192
|
+
if (!isOpen) setIsOpen(true);
|
|
193
|
+
};
|
|
194
|
+
const handleSelectOption = (optionValue) => {
|
|
195
|
+
onChange?.(optionValue);
|
|
196
|
+
setIsOpen(false);
|
|
197
|
+
setSearchQuery("");
|
|
198
|
+
inputRef.current?.blur();
|
|
199
|
+
};
|
|
200
|
+
const handleClear = (e) => {
|
|
201
|
+
e.stopPropagation();
|
|
202
|
+
onChange?.(void 0);
|
|
203
|
+
setSearchQuery("");
|
|
204
|
+
inputRef.current?.focus();
|
|
205
|
+
};
|
|
206
|
+
const handleInputFocus = () => {
|
|
207
|
+
setIsFocused(true);
|
|
208
|
+
if (!disabled) setIsOpen(true);
|
|
209
|
+
};
|
|
210
|
+
const handleInputBlur = () => {
|
|
211
|
+
setIsFocused(false);
|
|
212
|
+
setTimeout(() => {
|
|
213
|
+
if (!wrapperRef.current?.contains(document.activeElement)) {
|
|
214
|
+
setSearchQuery("");
|
|
215
|
+
}
|
|
216
|
+
}, 200);
|
|
217
|
+
};
|
|
218
|
+
const currentState = error ? "error" : state;
|
|
219
|
+
const stateStyles = comboboxStyles.states[currentState];
|
|
220
|
+
const focusStyles = currentState === "error" ? comboboxStyles.states.errorFocus : currentState === "success" ? comboboxStyles.states.successFocus : comboboxStyles.states.defaultFocus;
|
|
221
|
+
const inputWrapperStyle = {
|
|
222
|
+
...comboboxStyles.base,
|
|
223
|
+
...stateStyles,
|
|
224
|
+
...isFocused && !disabled && focusStyles,
|
|
225
|
+
...disabled && comboboxStyles.states.disabled
|
|
226
|
+
};
|
|
227
|
+
const displayValue = selectedOption ? selectedOption.label : "";
|
|
228
|
+
const showPlaceholder = !selectedOption && !searchQuery && !isFocused;
|
|
229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_clsx.clsx)("arbor-combobox-wrapper", className), style, ref: wrapperRef, "data-testid": dataTestId, children: [
|
|
230
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: comboboxId, style: labelStyles, children: label }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { position: "relative" }, ref, children: [
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: inputWrapperStyle, children: [
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
234
|
+
"input",
|
|
235
|
+
{
|
|
236
|
+
ref: inputRef,
|
|
237
|
+
id: comboboxId,
|
|
238
|
+
type: "text",
|
|
239
|
+
value: searchQuery || displayValue,
|
|
240
|
+
onChange: handleInputChange,
|
|
241
|
+
onFocus: handleInputFocus,
|
|
242
|
+
onBlur: handleInputBlur,
|
|
243
|
+
placeholder: showPlaceholder ? placeholder : "",
|
|
244
|
+
disabled,
|
|
245
|
+
"aria-invalid": error ? "true" : "false",
|
|
246
|
+
"aria-describedby": error ? errorId : helperText ? helperTextId : void 0,
|
|
247
|
+
"aria-expanded": isOpen,
|
|
248
|
+
"aria-autocomplete": "list",
|
|
249
|
+
role: "combobox",
|
|
250
|
+
style: {
|
|
251
|
+
border: "none",
|
|
252
|
+
outline: "none",
|
|
253
|
+
background: "transparent",
|
|
254
|
+
flex: 1,
|
|
255
|
+
fontSize: "13px",
|
|
256
|
+
padding: 0,
|
|
257
|
+
margin: 0,
|
|
258
|
+
color: showPlaceholder ? "#7e7e7e" : "#2f2f2f",
|
|
259
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px", position: "absolute", right: "8px" }, children: [
|
|
264
|
+
selectedOption && !disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
265
|
+
"button",
|
|
266
|
+
{
|
|
267
|
+
type: "button",
|
|
268
|
+
onClick: handleClear,
|
|
269
|
+
style: {
|
|
270
|
+
border: "none",
|
|
271
|
+
background: "transparent",
|
|
272
|
+
padding: "2px",
|
|
273
|
+
cursor: "pointer",
|
|
274
|
+
display: "flex",
|
|
275
|
+
alignItems: "center",
|
|
276
|
+
color: "#7e7e7e"
|
|
277
|
+
},
|
|
278
|
+
"aria-label": "Clear selection",
|
|
279
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { size: 16 })
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
currentState === "success" && !isOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: 16, color: "#16a33d" }),
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
284
|
+
import_lucide_react.ChevronDown,
|
|
285
|
+
{
|
|
286
|
+
size: 16,
|
|
287
|
+
color: "#7e7e7e",
|
|
288
|
+
style: {
|
|
289
|
+
transform: isOpen ? "rotate(180deg)" : "rotate(0deg)",
|
|
290
|
+
transition: "transform 0.2s"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] })
|
|
295
|
+
] }),
|
|
296
|
+
isOpen && !disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: dropdownRef, style: dropdownStyles, children: filteredOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...optionStyles, color: "#7e7e7e", cursor: "default" }, children: "No options found" }) : filteredOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
297
|
+
"div",
|
|
298
|
+
{
|
|
299
|
+
onClick: () => handleSelectOption(option.value),
|
|
300
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
301
|
+
style: {
|
|
302
|
+
...optionStyles,
|
|
303
|
+
backgroundColor: option.value === value ? "#f8f8f8" : "transparent"
|
|
304
|
+
},
|
|
305
|
+
onMouseEnter: (e) => {
|
|
306
|
+
e.currentTarget.style.backgroundColor = "#f8f8f8";
|
|
307
|
+
},
|
|
308
|
+
onMouseLeave: (e) => {
|
|
309
|
+
e.currentTarget.style.backgroundColor = option.value === value ? "#f8f8f8" : "transparent";
|
|
310
|
+
},
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: option.label }),
|
|
313
|
+
option.value === value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: 16, color: "#16a33d" })
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
option.value
|
|
317
|
+
)) })
|
|
318
|
+
] }),
|
|
319
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id: errorId, style: errorTextStyles, role: "alert", children: error }),
|
|
320
|
+
!error && helperText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id: helperTextId, style: helperTextStyles, children: helperText })
|
|
321
|
+
] });
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
Combobox.displayName = "Combobox";
|
|
325
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
326
|
+
0 && (module.exports = {
|
|
327
|
+
Combobox
|
|
328
|
+
});
|
|
329
|
+
//# sourceMappingURL=Combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Combobox/index.ts","../src/Combobox/Combobox.tsx"],"sourcesContent":["export { Combobox } from './Combobox';\nexport type { ComboboxProps, ComboboxOption, ComboboxState } from './Combobox';\n","import * as React from 'react';\nimport { clsx } from 'clsx';\nimport { X, ChevronDown, Check } from 'lucide-react';\n\nexport type ComboboxOption = {\n value: string;\n label: string;\n};\n\nexport type ComboboxState = 'default' | 'error' | 'success';\n\nexport interface ComboboxProps {\n /**\n * The label for the combobox\n */\n label?: string;\n /**\n * The placeholder text\n */\n placeholder?: string;\n /**\n * The available options\n */\n options: ComboboxOption[];\n /**\n * The selected value\n */\n value?: string;\n /**\n * Callback when value changes\n */\n onChange?: (value: string | undefined) => void;\n /**\n * The validation state\n * @default 'default'\n */\n state?: ComboboxState;\n /**\n * Optional error message\n */\n error?: string;\n /**\n * Optional helper text\n */\n helperText?: string;\n /**\n * Whether the combobox is disabled\n */\n disabled?: boolean;\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 comboboxStyles = {\n base: {\n width: '100%',\n height: '36px',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n backgroundColor: '#ffffff',\n borderRadius: '8px',\n transition: 'all 0.2s ease-in-out',\n outline: 'none',\n fontSize: '13px',\n padding: '8px',\n paddingRight: '32px',\n margin: '0',\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n position: 'relative' as const,\n },\n states: {\n default: {\n border: '1px solid #d1d1d1', // grey-300\n color: '#2f2f2f', // grey-900\n },\n defaultFocus: {\n borderColor: '#3cad51', // brand-500\n outline: '3px solid rgba(60, 173, 81, 0.2)',\n },\n error: {\n border: '1px solid #c93232', // destructive-500\n color: '#2f2f2f',\n },\n errorFocus: {\n borderColor: '#c93232',\n outline: '3px solid rgba(201, 50, 50, 0.2)',\n },\n success: {\n border: '1px solid #16a33d', // success-500\n color: '#2f2f2f',\n },\n successFocus: {\n borderColor: '#16a33d',\n outline: '3px solid rgba(22, 163, 61, 0.2)',\n },\n disabled: {\n backgroundColor: '#f8f8f8', // grey-050\n borderColor: '#efefef', // grey-100\n color: '#7e7e7e', // grey-500\n cursor: 'not-allowed',\n },\n },\n};\n\nconst labelStyles: React.CSSProperties = {\n display: 'block',\n fontSize: '13px',\n fontWeight: '600',\n color: '#2f2f2f',\n marginBottom: '4px',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n};\n\nconst helperTextStyles: React.CSSProperties = {\n fontSize: '13px',\n margin: '0',\n marginTop: '2px',\n color: '#595959',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n lineHeight: '1.4',\n};\n\nconst errorTextStyles: React.CSSProperties = {\n ...helperTextStyles,\n color: '#a62323', // destructive-600\n display: 'flex',\n alignItems: 'center',\n gap: '4px',\n};\n\nconst dropdownStyles: React.CSSProperties = {\n position: 'absolute',\n top: 'calc(100% + 4px)',\n left: '0',\n right: '0',\n backgroundColor: '#ffffff',\n border: '1px solid #d1d1d1',\n borderRadius: '8px',\n maxHeight: '200px',\n overflowY: 'auto',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',\n zIndex: 1000,\n};\n\nconst optionStyles: React.CSSProperties = {\n padding: '8px 12px',\n fontSize: '13px',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n color: '#2f2f2f', // grey-900\n};\n\n/**\n * Combobox component - Arbor Design System\n *\n * A searchable select/autocomplete component with filtering.\n * Supports labels, validation states, and helper text.\n */\nexport const Combobox = React.forwardRef<HTMLDivElement, ComboboxProps>(\n (\n {\n label,\n placeholder = 'default-text',\n options,\n value,\n onChange,\n state = 'default',\n error,\n helperText,\n disabled = false,\n className,\n style,\n 'data-testid': dataTestId,\n },\n ref\n ) => {\n const [isOpen, setIsOpen] = React.useState(false);\n const [searchQuery, setSearchQuery] = React.useState('');\n const [isFocused, setIsFocused] = React.useState(false);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const dropdownRef = React.useRef<HTMLDivElement>(null);\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n\n const comboboxId = React.useId();\n const helperTextId = React.useId();\n const errorId = React.useId();\n\n const selectedOption = options.find((opt) => opt.value === value);\n\n const filteredOptions = React.useMemo(() => {\n if (!searchQuery) return options;\n return options.filter((option) =>\n option.label.toLowerCase().includes(searchQuery.toLowerCase())\n );\n }, [options, searchQuery]);\n\n // Close dropdown when clicking outside\n React.useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n wrapperRef.current &&\n !wrapperRef.current.contains(event.target as Node)\n ) {\n setIsOpen(false);\n setSearchQuery('');\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, []);\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n setSearchQuery(e.target.value);\n if (!isOpen) setIsOpen(true);\n };\n\n const handleSelectOption = (optionValue: string) => {\n onChange?.(optionValue);\n setIsOpen(false);\n setSearchQuery('');\n inputRef.current?.blur();\n };\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation();\n onChange?.(undefined);\n setSearchQuery('');\n inputRef.current?.focus();\n };\n\n const handleInputFocus = () => {\n setIsFocused(true);\n if (!disabled) setIsOpen(true);\n };\n\n const handleInputBlur = () => {\n setIsFocused(false);\n // Delay to allow click on option\n setTimeout(() => {\n if (!wrapperRef.current?.contains(document.activeElement)) {\n setSearchQuery('');\n }\n }, 200);\n };\n\n const currentState = error ? 'error' : state;\n const stateStyles = comboboxStyles.states[currentState];\n const focusStyles =\n currentState === 'error'\n ? comboboxStyles.states.errorFocus\n : currentState === 'success'\n ? comboboxStyles.states.successFocus\n : comboboxStyles.states.defaultFocus;\n\n const inputWrapperStyle: React.CSSProperties = {\n ...comboboxStyles.base,\n ...stateStyles,\n ...(isFocused && !disabled && focusStyles),\n ...(disabled && comboboxStyles.states.disabled),\n };\n\n const displayValue = selectedOption ? selectedOption.label : '';\n const showPlaceholder = !selectedOption && !searchQuery && !isFocused;\n\n return (\n <div className={clsx('arbor-combobox-wrapper', className)} style={style} ref={wrapperRef} data-testid={dataTestId}>\n {label && (\n <label htmlFor={comboboxId} style={labelStyles}>\n {label}\n </label>\n )}\n\n <div style={{ position: 'relative' }} ref={ref}>\n <div style={inputWrapperStyle}>\n <input\n ref={inputRef}\n id={comboboxId}\n type=\"text\"\n value={searchQuery || displayValue}\n onChange={handleInputChange}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n placeholder={showPlaceholder ? placeholder : ''}\n disabled={disabled}\n aria-invalid={error ? 'true' : 'false'}\n aria-describedby={error ? errorId : helperText ? helperTextId : undefined}\n aria-expanded={isOpen}\n aria-autocomplete=\"list\"\n role=\"combobox\"\n style={{\n border: 'none',\n outline: 'none',\n background: 'transparent',\n flex: 1,\n fontSize: '13px',\n padding: 0,\n margin: 0,\n color: showPlaceholder ? '#7e7e7e' : '#2f2f2f',\n fontFamily: \"'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif\",\n }}\n />\n\n <div style={{ display: 'flex', alignItems: 'center', gap: '4px', position: 'absolute', right: '8px' }}>\n {selectedOption && !disabled && (\n <button\n type=\"button\"\n onClick={handleClear}\n style={{\n border: 'none',\n background: 'transparent',\n padding: '2px',\n cursor: 'pointer',\n display: 'flex',\n alignItems: 'center',\n color: '#7e7e7e',\n }}\n aria-label=\"Clear selection\"\n >\n <X size={16} />\n </button>\n )}\n\n {currentState === 'success' && !isOpen && (\n <Check size={16} color=\"#16a33d\" />\n )}\n\n <ChevronDown\n size={16}\n color=\"#7e7e7e\"\n style={{\n transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',\n transition: 'transform 0.2s',\n }}\n />\n </div>\n </div>\n\n {isOpen && !disabled && (\n <div ref={dropdownRef} style={dropdownStyles}>\n {filteredOptions.length === 0 ? (\n <div style={{ ...optionStyles, color: '#7e7e7e', cursor: 'default' }}>\n No options found\n </div>\n ) : (\n filteredOptions.map((option) => (\n <div\n key={option.value}\n onClick={() => handleSelectOption(option.value)}\n onMouseDown={(e) => e.preventDefault()} // Prevent blur\n style={{\n ...optionStyles,\n backgroundColor: option.value === value ? '#f8f8f8' : 'transparent',\n }}\n onMouseEnter={(e) => {\n e.currentTarget.style.backgroundColor = '#f8f8f8';\n }}\n onMouseLeave={(e) => {\n e.currentTarget.style.backgroundColor =\n option.value === value ? '#f8f8f8' : 'transparent';\n }}\n >\n <span>{option.label}</span>\n {option.value === value && <Check size={16} color=\"#16a33d\" />}\n </div>\n ))\n )}\n </div>\n )}\n </div>\n\n {error && (\n <p id={errorId} style={errorTextStyles} role=\"alert\">\n {error}\n </p>\n )}\n {!error && helperText && (\n <p id={helperTextId} style={helperTextStyles}>\n {helperText}\n </p>\n )}\n </div>\n );\n }\n);\n\nCombobox.displayName = 'Combobox';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,kBAAqB;AACrB,0BAAsC;AAwR5B;AA3NV,IAAM,iBAAiB;AAAA,EACrB,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,IACV,SAAS;AAAA,IACT,cAAc;AAAA,IACd,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAAA,EACA,QAAQ;AAAA,IACN,SAAS;AAAA,MACP,QAAQ;AAAA;AAAA,MACR,OAAO;AAAA;AAAA,IACT;AAAA,IACA,cAAc;AAAA,MACZ,aAAa;AAAA;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACL,QAAQ;AAAA;AAAA,MACR,OAAO;AAAA,IACT;AAAA,IACA,YAAY;AAAA,MACV,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,SAAS;AAAA,MACP,QAAQ;AAAA;AAAA,MACR,OAAO;AAAA,IACT;AAAA,IACA,cAAc;AAAA,MACZ,aAAa;AAAA,MACb,SAAS;AAAA,IACX;AAAA,IACA,U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,YACxD;AAAA,YACA,cAAc,CAAC,MAAM;AACnB,gBAAE,cAAc,MAAM,kBAAkB;AAAA,YAC1C;AAAA,YACA,cAAc,CAAC,MAAM;AACnB,gBAAE,cAAc,MAAM,kBACpB,OAAO,UAAU,QAAQ,YAAY;AAAA,YACzC;AAAA,YAEA;AAAA,0DAAC,UAAM,iBAAO,OAAM;AAAA,cACnB,OAAO,UAAU,SAAS,4CAAC,6BAAM,MAAM,IAAI,OAAM,WAAU;AAAA;AAAA;AAAA,UAhBvD,OAAO;AAAA,QAiBd,CACD,GAEL;AAAA,SAEJ;AAAA,MAEC,SACC,4CAAC,OAAE,IAAI,SAAS,OAAO,iBAAiB,MAAK,SAC1C,iBACH;AAAA,MAED,CAAC,SAAS,cACT,4CAAC,OAAE,IAAI,cAAc,OAAO,kBACzB,sBACH;AAAA,OAEJ;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type NumericInputState = 'default' | 'error' | 'success';
|
|
4
|
+
interface NumericInputProps {
|
|
5
|
+
/**
|
|
6
|
+
* The label for the numeric input
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The current value
|
|
11
|
+
*/
|
|
12
|
+
value?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when value changes
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (value: number | undefined) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Minimum allowed value
|
|
19
|
+
*/
|
|
20
|
+
min?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum allowed value
|
|
23
|
+
*/
|
|
24
|
+
max?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Step increment/decrement value
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
step?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The validation state
|
|
32
|
+
* @default 'default'
|
|
33
|
+
*/
|
|
34
|
+
state?: NumericInputState;
|
|
35
|
+
/**
|
|
36
|
+
* Optional error message
|
|
37
|
+
*/
|
|
38
|
+
error?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optional helper text
|
|
41
|
+
*/
|
|
42
|
+
helperText?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the input is disabled
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Custom className
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Custom style
|
|
53
|
+
*/
|
|
54
|
+
style?: React.CSSProperties;
|
|
55
|
+
/**
|
|
56
|
+
* Test ID for testing
|
|
57
|
+
*/
|
|
58
|
+
'data-testid'?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* NumericInput component - Arbor Design System
|
|
62
|
+
*
|
|
63
|
+
* A number input with increment/decrement buttons.
|
|
64
|
+
* Enforces numeric rules (min, max, step) and prevents non-numeric input.
|
|
65
|
+
*/
|
|
66
|
+
declare const NumericInput: React.ForwardRefExoticComponent<NumericInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
|
|
68
|
+
export { NumericInput, type NumericInputProps, type NumericInputState };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type NumericInputState = 'default' | 'error' | 'success';
|
|
4
|
+
interface NumericInputProps {
|
|
5
|
+
/**
|
|
6
|
+
* The label for the numeric input
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The current value
|
|
11
|
+
*/
|
|
12
|
+
value?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when value changes
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (value: number | undefined) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Minimum allowed value
|
|
19
|
+
*/
|
|
20
|
+
min?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum allowed value
|
|
23
|
+
*/
|
|
24
|
+
max?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Step increment/decrement value
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
step?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The validation state
|
|
32
|
+
* @default 'default'
|
|
33
|
+
*/
|
|
34
|
+
state?: NumericInputState;
|
|
35
|
+
/**
|
|
36
|
+
* Optional error message
|
|
37
|
+
*/
|
|
38
|
+
error?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optional helper text
|
|
41
|
+
*/
|
|
42
|
+
helperText?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the input is disabled
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Custom className
|
|
49
|
+
*/
|
|
50
|
+
className?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Custom style
|
|
53
|
+
*/
|
|
54
|
+
style?: React.CSSProperties;
|
|
55
|
+
/**
|
|
56
|
+
* Test ID for testing
|
|
57
|
+
*/
|
|
58
|
+
'data-testid'?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* NumericInput component - Arbor Design System
|
|
62
|
+
*
|
|
63
|
+
* A number input with increment/decrement buttons.
|
|
64
|
+
* Enforces numeric rules (min, max, step) and prevents non-numeric input.
|
|
65
|
+
*/
|
|
66
|
+
declare const NumericInput: React.ForwardRefExoticComponent<NumericInputProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
|
|
68
|
+
export { NumericInput, type NumericInputProps, type NumericInputState };
|