@bricks-toolkit/toolkit 0.1.18 → 0.1.20

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,567 @@
1
+ 'use strict';
2
+
3
+ var chunkJ53N2LAE_cjs = require('./chunk-J53N2LAE.cjs');
4
+ var chunkL5VQZZVR_cjs = require('./chunk-L5VQZZVR.cjs');
5
+ var react = require('react');
6
+ var outline = require('@heroicons/react/24/outline');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ var sizeClasses = {
10
+ xs: "h-6 px-2 text-xs",
11
+ sm: "h-8 px-3 text-sm",
12
+ md: "h-10 px-3 text-sm",
13
+ lg: "h-11 px-4 text-base",
14
+ xl: "h-12 px-4 text-lg"
15
+ };
16
+ var labelSizeClasses = {
17
+ xs: "text-xs",
18
+ sm: "text-xs",
19
+ md: "text-sm",
20
+ lg: "text-sm",
21
+ xl: "text-base"
22
+ };
23
+ var variantClasses = {
24
+ default: "rounded-md border border-border bg-surface shadow-sm focus-within:outline-none focus-within:ring-2 focus-within:ring-primary/40 transition-all duration-200",
25
+ filled: "rounded-md border border-transparent bg-surface-secondary focus-within:bg-surface focus-within:ring-2 focus-within:ring-primary/40 transition-all duration-200",
26
+ flushed: "rounded-none border-0 border-b border-border bg-transparent",
27
+ unstyled: "border-0 bg-transparent p-0"
28
+ };
29
+ var stateVariantClasses = {
30
+ default: {
31
+ default: "border-border focus-within:border-primary",
32
+ filled: "focus-within:border-primary",
33
+ flushed: "border-border focus-within:border-primary",
34
+ unstyled: ""
35
+ },
36
+ error: {
37
+ default: "border-error focus-within:border-error focus-within:ring-error/20",
38
+ filled: "bg-error/5 focus-within:border-error focus-within:ring-error/20",
39
+ flushed: "border-error",
40
+ unstyled: ""
41
+ },
42
+ success: {
43
+ default: "border-success focus-within:border-success focus-within:ring-success/20",
44
+ filled: "bg-success/5 focus-within:border-success focus-within:ring-success/20",
45
+ flushed: "border-success",
46
+ unstyled: ""
47
+ },
48
+ warning: {
49
+ default: "border-warning focus-within:border-warning focus-within:ring-warning/20",
50
+ filled: "bg-warning/5 focus-within:border-warning focus-within:ring-warning/20",
51
+ flushed: "border-warning",
52
+ unstyled: ""
53
+ }
54
+ };
55
+ var stateMessageClasses = {
56
+ default: "text-text-muted",
57
+ error: "text-error font-medium",
58
+ success: "text-success font-medium",
59
+ warning: "text-warning font-medium"
60
+ };
61
+ function AddonIcon({ children, side, size, onClick, asButton = false, ariaLabel }) {
62
+ const iconSize = {
63
+ xs: "w-3.5 h-3.5",
64
+ sm: "w-4 h-4",
65
+ md: "w-4 h-4",
66
+ lg: "w-5 h-5",
67
+ xl: "w-5 h-5"
68
+ };
69
+ const base = chunkL5VQZZVR_cjs.cn(
70
+ "absolute top-1/2 -translate-y-1/2 text-text-secondary flex items-center justify-center",
71
+ side === "left" ? "left-3" : "right-3",
72
+ iconSize[size]
73
+ );
74
+ if (asButton && onClick) {
75
+ return /* @__PURE__ */ jsxRuntime.jsx(
76
+ "button",
77
+ {
78
+ type: "button",
79
+ onClick,
80
+ className: chunkL5VQZZVR_cjs.cn(base, "cursor-pointer hover:text-text transition-colors"),
81
+ tabIndex: -1,
82
+ "aria-label": ariaLabel,
83
+ children
84
+ }
85
+ );
86
+ }
87
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: chunkL5VQZZVR_cjs.cn(base, "pointer-events-none"), "aria-label": ariaLabel, children });
88
+ }
89
+ function Addon({ children, side }) {
90
+ return /* @__PURE__ */ jsxRuntime.jsx(
91
+ "span",
92
+ {
93
+ "aria-hidden": "true",
94
+ className: chunkL5VQZZVR_cjs.cn(
95
+ "inline-flex items-center border border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none",
96
+ side === "left" ? "rounded-l-md border-r-0" : "rounded-r-md border-l-0"
97
+ ),
98
+ children
99
+ }
100
+ );
101
+ }
102
+ function DatePicker({
103
+ label,
104
+ required = false,
105
+ helperText,
106
+ errorMessage,
107
+ successMessage,
108
+ warningMessage,
109
+ variant = "default",
110
+ size = "md",
111
+ state = "default",
112
+ fullWidth = true,
113
+ leftElement,
114
+ rightElement,
115
+ prefix,
116
+ suffix,
117
+ wrapperClassName,
118
+ inputGroupClassName,
119
+ inputClassName,
120
+ labelClassName,
121
+ helperClassName,
122
+ id: idProp,
123
+ disabled,
124
+ className,
125
+ clearable,
126
+ isLoading,
127
+ value,
128
+ defaultValue,
129
+ onChange,
130
+ onDateChange,
131
+ placeholder = "Select date",
132
+ minDate,
133
+ maxDate,
134
+ disabledDates,
135
+ locale = "en-US",
136
+ name,
137
+ "aria-label": ariaLabel,
138
+ "aria-describedby": ariaDescribedby
139
+ }) {
140
+ const generatedId = react.useId();
141
+ const inputId = idProp ?? generatedId;
142
+ const helperId = `${inputId}-helper`;
143
+ const stateMessageId = `${inputId}-state`;
144
+ const popoverId = `${inputId}-popover`;
145
+ const isControlled = value !== void 0;
146
+ const [internalValue, setInternalValue] = react.useState(defaultValue ?? "");
147
+ const displayValue = isControlled ? value : internalValue;
148
+ const selectedDate = chunkJ53N2LAE_cjs.parseISODate(displayValue);
149
+ const today = react.useMemo(() => /* @__PURE__ */ new Date(), []);
150
+ const [isOpen, setIsOpen] = react.useState(false);
151
+ const [viewYear, setViewYear] = react.useState(selectedDate?.getFullYear() ?? today.getFullYear());
152
+ const [viewMonth, setViewMonth] = react.useState(selectedDate?.getMonth() ?? today.getMonth());
153
+ const [viewMode, setViewMode] = react.useState("day");
154
+ const wrapperRef = react.useRef(null);
155
+ const popoverRef = react.useRef(null);
156
+ const [prevDisplay, setPrevDisplay] = react.useState(displayValue);
157
+ if (displayValue !== prevDisplay) {
158
+ setPrevDisplay(displayValue);
159
+ if (selectedDate) {
160
+ setViewYear(selectedDate.getFullYear());
161
+ setViewMonth(selectedDate.getMonth());
162
+ }
163
+ }
164
+ react.useEffect(() => {
165
+ if (!isOpen) return;
166
+ function handleClick(e) {
167
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
168
+ setIsOpen(false);
169
+ setViewMode("day");
170
+ }
171
+ }
172
+ document.addEventListener("mousedown", handleClick);
173
+ return () => {
174
+ document.removeEventListener("mousedown", handleClick);
175
+ };
176
+ }, [isOpen]);
177
+ const handleSelect = (date) => {
178
+ if (chunkJ53N2LAE_cjs.isDisabledDate(date, minDate, maxDate, disabledDates)) return;
179
+ const iso = chunkJ53N2LAE_cjs.toISODateString(date);
180
+ if (!isControlled) setInternalValue(iso);
181
+ onChange?.(iso);
182
+ onDateChange?.(date);
183
+ setIsOpen(false);
184
+ setViewMode("day");
185
+ };
186
+ const handleClear = () => {
187
+ if (!isControlled) setInternalValue("");
188
+ onChange?.("");
189
+ onDateChange?.(null);
190
+ };
191
+ const toggleOpen = () => {
192
+ if (disabled || isLoading) return;
193
+ setIsOpen((prev) => !prev);
194
+ setViewMode("day");
195
+ if (!isOpen && selectedDate) {
196
+ setViewYear(selectedDate.getFullYear());
197
+ setViewMonth(selectedDate.getMonth());
198
+ }
199
+ };
200
+ const prevMonth = () => {
201
+ if (viewMonth === 0) {
202
+ setViewMonth(11);
203
+ setViewYear((y) => y - 1);
204
+ } else setViewMonth((m) => m - 1);
205
+ };
206
+ const nextMonth = () => {
207
+ if (viewMonth === 11) {
208
+ setViewMonth(0);
209
+ setViewYear((y) => y + 1);
210
+ } else setViewMonth((m) => m + 1);
211
+ };
212
+ const showClear = clearable && displayValue.length > 0 && !disabled && !isLoading;
213
+ const hasLeftElement = leftElement !== void 0;
214
+ const hasRightElement = rightElement !== void 0 || Boolean(showClear) || Boolean(isLoading);
215
+ const stateMessage = state === "error" ? errorMessage : state === "success" ? successMessage : state === "warning" ? warningMessage : void 0;
216
+ const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null, ariaDescribedby ?? null].filter(Boolean).join(" ") || void 0;
217
+ const calendarGrid = chunkJ53N2LAE_cjs.buildCalendarGrid(viewYear, viewMonth);
218
+ const yearRange = chunkJ53N2LAE_cjs.getYearRange(viewYear);
219
+ const leftPad = {
220
+ xs: "pl-6",
221
+ sm: "pl-8",
222
+ md: "pl-9",
223
+ lg: "pl-10",
224
+ xl: "pl-11"
225
+ };
226
+ const rightPad = {
227
+ xs: "pr-6",
228
+ sm: "pr-8",
229
+ md: "pr-9",
230
+ lg: "pr-10",
231
+ xl: "pr-11"
232
+ };
233
+ const paddingClasses = chunkL5VQZZVR_cjs.cn(
234
+ hasLeftElement && leftPad[size],
235
+ (hasRightElement || showClear) && rightPad[size]
236
+ );
237
+ return /* @__PURE__ */ jsxRuntime.jsxs(
238
+ "div",
239
+ {
240
+ ref: wrapperRef,
241
+ className: chunkL5VQZZVR_cjs.cn(
242
+ "flex flex-col gap-1 relative",
243
+ fullWidth ? "w-full" : "w-fit",
244
+ wrapperClassName,
245
+ className
246
+ ),
247
+ children: [
248
+ label !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(
249
+ "label",
250
+ {
251
+ htmlFor: inputId,
252
+ className: chunkL5VQZZVR_cjs.cn(
253
+ "font-black leading-none text-text uppercase tracking-widest",
254
+ labelSizeClasses[size],
255
+ labelClassName
256
+ ),
257
+ children: [
258
+ label,
259
+ required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
260
+ ]
261
+ }
262
+ ),
263
+ /* @__PURE__ */ jsxRuntime.jsxs(
264
+ "div",
265
+ {
266
+ className: chunkL5VQZZVR_cjs.cn("flex items-stretch", fullWidth ? "w-full" : "w-fit", inputGroupClassName),
267
+ children: [
268
+ prefix !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(Addon, { side: "left", children: prefix }),
269
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-1 items-center", children: [
270
+ /* @__PURE__ */ jsxRuntime.jsx(AddonIcon, { side: "left", size, children: leftElement ?? /* @__PURE__ */ jsxRuntime.jsx(outline.CalendarIcon, { className: "w-full h-full" }) }),
271
+ /* @__PURE__ */ jsxRuntime.jsx(
272
+ "button",
273
+ {
274
+ id: inputId,
275
+ type: "button",
276
+ role: "combobox",
277
+ "aria-expanded": isOpen,
278
+ "aria-haspopup": "dialog",
279
+ "aria-controls": popoverId,
280
+ "aria-label": ariaLabel ?? label ?? "Date picker",
281
+ "aria-describedby": describedBy,
282
+ "aria-required": required,
283
+ "aria-invalid": state === "error" ? true : void 0,
284
+ disabled: Boolean(disabled) || Boolean(isLoading),
285
+ onClick: toggleOpen,
286
+ name,
287
+ className: chunkL5VQZZVR_cjs.cn(
288
+ "w-full flex items-center text-left transition-colors duration-150 cursor-pointer",
289
+ "disabled:cursor-not-allowed disabled:opacity-50",
290
+ sizeClasses[size],
291
+ variantClasses[variant],
292
+ stateVariantClasses[state][variant],
293
+ "pl-9",
294
+ hasRightElement || showClear ? rightPad[size] : "",
295
+ paddingClasses,
296
+ inputClassName,
297
+ prefix !== void 0 && suffix !== void 0 ? "rounded-none" : prefix !== void 0 ? "rounded-l-none" : suffix !== void 0 ? "rounded-r-none" : ""
298
+ ),
299
+ children: displayValue && selectedDate ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text truncate", children: chunkJ53N2LAE_cjs.formatDate(selectedDate, locale) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: placeholder })
300
+ }
301
+ ),
302
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx(AddonIcon, { side: "right", size, children: /* @__PURE__ */ jsxRuntime.jsxs(
303
+ "svg",
304
+ {
305
+ className: "animate-spin h-full w-full text-text-muted",
306
+ xmlns: "http://www.w3.org/2000/svg",
307
+ fill: "none",
308
+ viewBox: "0 0 24 24",
309
+ children: [
310
+ /* @__PURE__ */ jsxRuntime.jsx(
311
+ "circle",
312
+ {
313
+ className: "opacity-25",
314
+ cx: "12",
315
+ cy: "12",
316
+ r: "10",
317
+ stroke: "currentColor",
318
+ strokeWidth: "4"
319
+ }
320
+ ),
321
+ /* @__PURE__ */ jsxRuntime.jsx(
322
+ "path",
323
+ {
324
+ className: "opacity-75",
325
+ fill: "currentColor",
326
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
327
+ }
328
+ )
329
+ ]
330
+ }
331
+ ) }) : showClear ? /* @__PURE__ */ jsxRuntime.jsx(
332
+ AddonIcon,
333
+ {
334
+ side: "right",
335
+ size,
336
+ asButton: true,
337
+ onClick: handleClear,
338
+ ariaLabel: "Clear date",
339
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.XMarkIcon, { className: "w-full h-full", strokeWidth: 2.5 })
340
+ }
341
+ ) : rightElement ? /* @__PURE__ */ jsxRuntime.jsx(AddonIcon, { side: "right", size, children: rightElement }) : null
342
+ ] }),
343
+ suffix !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(Addon, { side: "right", children: suffix })
344
+ ]
345
+ }
346
+ ),
347
+ helperText !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
348
+ "p",
349
+ {
350
+ id: helperId,
351
+ className: chunkL5VQZZVR_cjs.cn("text-xs leading-tight text-text-muted font-medium", helperClassName),
352
+ children: helperText
353
+ }
354
+ ),
355
+ stateMessage !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
356
+ "p",
357
+ {
358
+ id: stateMessageId,
359
+ role: state === "error" ? "alert" : void 0,
360
+ className: chunkL5VQZZVR_cjs.cn(
361
+ "text-xs leading-tight mt-0.5 font-medium",
362
+ stateMessageClasses[state],
363
+ helperClassName
364
+ ),
365
+ children: stateMessage
366
+ }
367
+ ),
368
+ /* @__PURE__ */ jsxRuntime.jsx(
369
+ "div",
370
+ {
371
+ id: popoverId,
372
+ ref: popoverRef,
373
+ role: "dialog",
374
+ "aria-label": "Date picker calendar",
375
+ "aria-modal": "true",
376
+ className: chunkL5VQZZVR_cjs.cn(
377
+ "absolute top-full left-0 z-50 mt-1 w-72",
378
+ "bg-surface border border-border rounded-xl shadow-xl",
379
+ "transition-all duration-200 origin-top",
380
+ isOpen ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-95 pointer-events-none"
381
+ ),
382
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-3", children: [
383
+ viewMode === "day" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
384
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
385
+ /* @__PURE__ */ jsxRuntime.jsx(
386
+ "button",
387
+ {
388
+ type: "button",
389
+ onClick: prevMonth,
390
+ className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
391
+ "aria-label": "Previous month",
392
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronLeftIcon, { className: "w-4 h-4" })
393
+ }
394
+ ),
395
+ /* @__PURE__ */ jsxRuntime.jsxs(
396
+ "button",
397
+ {
398
+ type: "button",
399
+ onClick: () => {
400
+ setViewMode("month");
401
+ },
402
+ className: "text-sm font-bold text-text hover:text-primary transition-colors px-2 py-1 rounded-lg hover:bg-hover",
403
+ children: [
404
+ chunkJ53N2LAE_cjs.MONTH_NAMES[viewMonth],
405
+ " ",
406
+ viewYear
407
+ ]
408
+ }
409
+ ),
410
+ /* @__PURE__ */ jsxRuntime.jsx(
411
+ "button",
412
+ {
413
+ type: "button",
414
+ onClick: nextMonth,
415
+ className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
416
+ "aria-label": "Next month",
417
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronRightIcon, { className: "w-4 h-4" })
418
+ }
419
+ )
420
+ ] }),
421
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 mb-1", children: chunkJ53N2LAE_cjs.DAY_NAMES_SHORT.map((d) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center text-xs font-semibold text-text-muted py-1", children: d }, d)) }),
422
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 gap-y-0.5", children: calendarGrid.flat().map((date, idx) => {
423
+ if (!date) return /* @__PURE__ */ jsxRuntime.jsx("div", {}, idx);
424
+ const isSelected = selectedDate ? chunkJ53N2LAE_cjs.isSameDay(date, selectedDate) : false;
425
+ const isToday = chunkJ53N2LAE_cjs.isSameDay(date, today);
426
+ const isDisabled = chunkJ53N2LAE_cjs.isDisabledDate(date, minDate, maxDate, disabledDates);
427
+ return /* @__PURE__ */ jsxRuntime.jsx(
428
+ "button",
429
+ {
430
+ type: "button",
431
+ onClick: () => {
432
+ handleSelect(date);
433
+ },
434
+ disabled: isDisabled,
435
+ "aria-label": date.toDateString(),
436
+ "aria-pressed": isSelected,
437
+ className: chunkL5VQZZVR_cjs.cn(
438
+ "mx-auto flex h-8 w-8 items-center justify-center rounded-full text-sm transition-colors duration-150 font-medium",
439
+ isSelected ? "bg-primary text-white font-bold shadow-sm" : isToday ? "ring-2 ring-primary text-primary" : "text-text hover:bg-hover",
440
+ isDisabled && "opacity-30 cursor-not-allowed"
441
+ ),
442
+ children: date.getDate()
443
+ },
444
+ idx
445
+ );
446
+ }) })
447
+ ] }),
448
+ viewMode === "month" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
449
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
450
+ /* @__PURE__ */ jsxRuntime.jsx(
451
+ "button",
452
+ {
453
+ type: "button",
454
+ onClick: () => {
455
+ setViewYear((y) => y - 1);
456
+ },
457
+ className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
458
+ "aria-label": "Previous year",
459
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronLeftIcon, { className: "w-4 h-4" })
460
+ }
461
+ ),
462
+ /* @__PURE__ */ jsxRuntime.jsx(
463
+ "button",
464
+ {
465
+ type: "button",
466
+ onClick: () => {
467
+ setViewMode("year");
468
+ },
469
+ className: "text-sm font-bold text-text hover:text-primary transition-colors px-2 py-1 rounded-lg hover:bg-hover",
470
+ children: viewYear
471
+ }
472
+ ),
473
+ /* @__PURE__ */ jsxRuntime.jsx(
474
+ "button",
475
+ {
476
+ type: "button",
477
+ onClick: () => {
478
+ setViewYear((y) => y + 1);
479
+ },
480
+ className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
481
+ "aria-label": "Next year",
482
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronRightIcon, { className: "w-4 h-4" })
483
+ }
484
+ )
485
+ ] }),
486
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1", children: chunkJ53N2LAE_cjs.MONTH_NAMES_SHORT.map((m, i) => {
487
+ const isActive = i === viewMonth && viewYear === (selectedDate?.getFullYear() ?? -1);
488
+ return /* @__PURE__ */ jsxRuntime.jsx(
489
+ "button",
490
+ {
491
+ type: "button",
492
+ onClick: () => {
493
+ setViewMonth(i);
494
+ setViewMode("day");
495
+ },
496
+ className: chunkL5VQZZVR_cjs.cn(
497
+ "py-2 rounded-lg text-sm font-medium transition-colors",
498
+ isActive ? "bg-primary text-white" : "text-text hover:bg-hover"
499
+ ),
500
+ children: m
501
+ },
502
+ m
503
+ );
504
+ }) })
505
+ ] }),
506
+ viewMode === "year" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
507
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
508
+ /* @__PURE__ */ jsxRuntime.jsx(
509
+ "button",
510
+ {
511
+ type: "button",
512
+ onClick: () => {
513
+ setViewYear((y) => y - 12);
514
+ },
515
+ className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
516
+ "aria-label": "Previous decade",
517
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronLeftIcon, { className: "w-4 h-4" })
518
+ }
519
+ ),
520
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm font-bold text-text", children: [
521
+ yearRange[0],
522
+ " \u2013 ",
523
+ yearRange[yearRange.length - 1]
524
+ ] }),
525
+ /* @__PURE__ */ jsxRuntime.jsx(
526
+ "button",
527
+ {
528
+ type: "button",
529
+ onClick: () => {
530
+ setViewYear((y) => y + 12);
531
+ },
532
+ className: "p-1.5 rounded-lg hover:bg-hover text-text-secondary hover:text-text transition-colors",
533
+ "aria-label": "Next decade",
534
+ children: /* @__PURE__ */ jsxRuntime.jsx(outline.ChevronRightIcon, { className: "w-4 h-4" })
535
+ }
536
+ )
537
+ ] }),
538
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-3 gap-1", children: yearRange.map((yr) => {
539
+ const isActive = yr === (selectedDate?.getFullYear() ?? -1);
540
+ return /* @__PURE__ */ jsxRuntime.jsx(
541
+ "button",
542
+ {
543
+ type: "button",
544
+ onClick: () => {
545
+ setViewYear(yr);
546
+ setViewMode("month");
547
+ },
548
+ className: chunkL5VQZZVR_cjs.cn(
549
+ "py-2 rounded-lg text-sm font-medium transition-colors",
550
+ isActive ? "bg-primary text-white" : "text-text hover:bg-hover",
551
+ yr === today.getFullYear() && !isActive ? "ring-1 ring-primary text-primary" : ""
552
+ ),
553
+ children: yr
554
+ },
555
+ yr
556
+ );
557
+ }) })
558
+ ] })
559
+ ] })
560
+ }
561
+ )
562
+ ]
563
+ }
564
+ );
565
+ }
566
+
567
+ exports.DatePicker = DatePicker;
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkW2ZAPLQH_cjs = require('../chunk-W2ZAPLQH.cjs');
3
+ var chunkWVRXSANT_cjs = require('../chunk-WVRXSANT.cjs');
4
+ require('../chunk-J53N2LAE.cjs');
4
5
  require('../chunk-L5VQZZVR.cjs');
5
6
 
6
7
 
7
8
 
8
9
  Object.defineProperty(exports, "DatePicker", {
9
10
  enumerable: true,
10
- get: function () { return chunkW2ZAPLQH_cjs.DatePicker; }
11
+ get: function () { return chunkWVRXSANT_cjs.DatePicker; }
11
12
  });
@@ -1,15 +1,26 @@
1
- import { InputHTMLAttributes, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  type DatePickerVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
4
4
  type DatePickerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
5
5
  type DatePickerState = 'default' | 'error' | 'success' | 'warning';
6
- interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
6
+ interface DatePickerProps {
7
+ /** Controlled value — ISO string 'YYYY-MM-DD' */
8
+ value?: string;
9
+ /** Uncontrolled default */
10
+ defaultValue?: string;
11
+ /** Fires with ISO string 'YYYY-MM-DD' */
12
+ onChange?: (value: string) => void;
13
+ /** Fires with native Date or null */
14
+ onDateChange?: (date: Date | null) => void;
7
15
  label?: string;
8
16
  required?: boolean;
9
17
  helperText?: string;
10
18
  errorMessage?: string;
11
19
  successMessage?: string;
12
20
  warningMessage?: string;
21
+ placeholder?: string;
22
+ /** BCP-47 locale passed to Intl.DateTimeFormat, default 'en-US' */
23
+ locale?: string;
13
24
  variant?: DatePickerVariant;
14
25
  size?: DatePickerSize;
15
26
  state?: DatePickerState;
@@ -23,10 +34,19 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 's
23
34
  inputClassName?: string;
24
35
  labelClassName?: string;
25
36
  helperClassName?: string;
37
+ className?: string;
26
38
  clearable?: boolean;
27
39
  isLoading?: boolean;
40
+ disabled?: boolean;
41
+ id?: string;
42
+ name?: string;
43
+ minDate?: Date;
44
+ maxDate?: Date;
45
+ disabledDates?: Date[];
46
+ 'aria-label'?: string;
47
+ 'aria-describedby'?: string;
28
48
  }
29
49
 
30
- declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
50
+ declare function DatePicker({ label, required, helperText, errorMessage, successMessage, warningMessage, variant, size, state, fullWidth, leftElement, rightElement, prefix, suffix, wrapperClassName, inputGroupClassName, inputClassName, labelClassName, helperClassName, id: idProp, disabled, className, clearable, isLoading, value, defaultValue, onChange, onDateChange, placeholder, minDate, maxDate, disabledDates, locale, name, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedby, }: DatePickerProps): React.JSX.Element;
31
51
 
32
52
  export { DatePicker, type DatePickerProps, type DatePickerSize, type DatePickerState, type DatePickerVariant };
@@ -1,15 +1,26 @@
1
- import { InputHTMLAttributes, ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
 
3
3
  type DatePickerVariant = 'default' | 'filled' | 'flushed' | 'unstyled';
4
4
  type DatePickerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
5
5
  type DatePickerState = 'default' | 'error' | 'success' | 'warning';
6
- interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
6
+ interface DatePickerProps {
7
+ /** Controlled value — ISO string 'YYYY-MM-DD' */
8
+ value?: string;
9
+ /** Uncontrolled default */
10
+ defaultValue?: string;
11
+ /** Fires with ISO string 'YYYY-MM-DD' */
12
+ onChange?: (value: string) => void;
13
+ /** Fires with native Date or null */
14
+ onDateChange?: (date: Date | null) => void;
7
15
  label?: string;
8
16
  required?: boolean;
9
17
  helperText?: string;
10
18
  errorMessage?: string;
11
19
  successMessage?: string;
12
20
  warningMessage?: string;
21
+ placeholder?: string;
22
+ /** BCP-47 locale passed to Intl.DateTimeFormat, default 'en-US' */
23
+ locale?: string;
13
24
  variant?: DatePickerVariant;
14
25
  size?: DatePickerSize;
15
26
  state?: DatePickerState;
@@ -23,10 +34,19 @@ interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 's
23
34
  inputClassName?: string;
24
35
  labelClassName?: string;
25
36
  helperClassName?: string;
37
+ className?: string;
26
38
  clearable?: boolean;
27
39
  isLoading?: boolean;
40
+ disabled?: boolean;
41
+ id?: string;
42
+ name?: string;
43
+ minDate?: Date;
44
+ maxDate?: Date;
45
+ disabledDates?: Date[];
46
+ 'aria-label'?: string;
47
+ 'aria-describedby'?: string;
28
48
  }
29
49
 
30
- declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
50
+ declare function DatePicker({ label, required, helperText, errorMessage, successMessage, warningMessage, variant, size, state, fullWidth, leftElement, rightElement, prefix, suffix, wrapperClassName, inputGroupClassName, inputClassName, labelClassName, helperClassName, id: idProp, disabled, className, clearable, isLoading, value, defaultValue, onChange, onDateChange, placeholder, minDate, maxDate, disabledDates, locale, name, 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedby, }: DatePickerProps): React.JSX.Element;
31
51
 
32
52
  export { DatePicker, type DatePickerProps, type DatePickerSize, type DatePickerState, type DatePickerVariant };