@matheusrizzati/ui 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { clsx } from 'clsx';
2
2
  import { twMerge } from 'tailwind-merge';
3
- import React26, { createContext, forwardRef, useRef, useEffect, useState, useMemo, useCallback, useContext } from 'react';
3
+ import React39, { createContext, forwardRef, useRef, useEffect, useState, useMemo, useCallback, useContext } from 'react';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
6
  import * as PopoverPrimitive3 from '@radix-ui/react-popover';
@@ -8,6 +8,7 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
8
8
  import * as DialogPrimitive from '@radix-ui/react-dialog';
9
9
  import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
10
10
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
11
+ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
11
12
 
12
13
  // src/utils/cn.ts
13
14
  function cn(...inputs) {
@@ -74,7 +75,7 @@ function ThemeProvider({
74
75
  () => ({ theme, resolvedTheme, setTheme, toggleTheme }),
75
76
  [theme, resolvedTheme, setTheme, toggleTheme]
76
77
  );
77
- return React26.createElement(ThemeContext.Provider, { value }, children);
78
+ return React39.createElement(ThemeContext.Provider, { value }, children);
78
79
  }
79
80
  function useTheme() {
80
81
  const context = useContext(ThemeContext);
@@ -2189,8 +2190,8 @@ var breadcrumbItemActiveStyles = "text-[var(--color-text-primary)] pointer-event
2189
2190
  var breadcrumbSeparatorStyles = "text-[var(--color-text-muted)]/50 select-none";
2190
2191
  var Breadcrumb = forwardRef(
2191
2192
  ({ className, separator = "/", children, ...props }, ref) => {
2192
- const items = React26.Children.toArray(children);
2193
- return /* @__PURE__ */ jsx("nav", { ref, "aria-label": "Breadcrumb", className: cn(breadcrumbStyles, className), ...props, children: items.map((child, i) => /* @__PURE__ */ jsxs(React26.Fragment, { children: [
2193
+ const items = React39.Children.toArray(children);
2194
+ return /* @__PURE__ */ jsx("nav", { ref, "aria-label": "Breadcrumb", className: cn(breadcrumbStyles, className), ...props, children: items.map((child, i) => /* @__PURE__ */ jsxs(React39.Fragment, { children: [
2194
2195
  child,
2195
2196
  i < items.length - 1 && /* @__PURE__ */ jsx("span", { className: breadcrumbSeparatorStyles, "aria-hidden": "true", children: separator })
2196
2197
  ] }, i)) });
@@ -2612,7 +2613,7 @@ var Steps = forwardRef(
2612
2613
  const status = i < current ? "complete" : i === current ? "current" : "upcoming";
2613
2614
  const isLast = i === steps.length - 1;
2614
2615
  if (isHorizontal) {
2615
- return /* @__PURE__ */ jsxs(React26.Fragment, { children: [
2616
+ return /* @__PURE__ */ jsxs(React39.Fragment, { children: [
2616
2617
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 min-w-0", children: [
2617
2618
  /* @__PURE__ */ jsx(
2618
2619
  "div",
@@ -2638,7 +2639,7 @@ var Steps = forwardRef(
2638
2639
  ) })
2639
2640
  ] }, i);
2640
2641
  }
2641
- return /* @__PURE__ */ jsxs(React26.Fragment, { children: [
2642
+ return /* @__PURE__ */ jsxs(React39.Fragment, { children: [
2642
2643
  /* @__PURE__ */ jsxs("div", { className: stepWrapperVerticalStyles, children: [
2643
2644
  /* @__PURE__ */ jsx(
2644
2645
  "div",
@@ -3056,7 +3057,7 @@ var sizeMap = {
3056
3057
  xl: { dimension: "h-16 w-16", text: "text-[var(--text-base)]", overlap: "-ml-4" }
3057
3058
  };
3058
3059
  function AvatarGroup({ children, max = 5, size = "md", className }) {
3059
- const childArray = React26.Children.toArray(children);
3060
+ const childArray = React39.Children.toArray(children);
3060
3061
  const visible = childArray.slice(0, max);
3061
3062
  const overflow = childArray.length - max;
3062
3063
  const s = sizeMap[size] || sizeMap.md;
@@ -3186,7 +3187,466 @@ function ConfirmDialog({
3186
3187
  ] });
3187
3188
  }
3188
3189
  ConfirmDialog.displayName = "ConfirmDialog";
3190
+ var toggleVariants = cva(
3191
+ [
3192
+ "inline-flex items-center justify-center gap-2",
3193
+ "font-medium text-[var(--color-text-secondary)]",
3194
+ "rounded-[var(--radius)]",
3195
+ "transition-colors duration-[var(--transition-fast)]",
3196
+ "hover:bg-[var(--color-surface-hover)] hover:text-[var(--color-text-primary)]",
3197
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring-color)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg)]",
3198
+ "disabled:opacity-50 disabled:pointer-events-none",
3199
+ "cursor-pointer select-none",
3200
+ "data-[state=on]:bg-[var(--color-surface-raised)] data-[state=on]:text-[var(--color-text-primary)]"
3201
+ ],
3202
+ {
3203
+ variants: {
3204
+ variant: {
3205
+ default: "bg-transparent",
3206
+ outline: "border border-[var(--color-border)] bg-transparent data-[state=on]:bg-[var(--color-surface-hover)]"
3207
+ },
3208
+ size: {
3209
+ sm: "h-8 px-2 text-[var(--text-xs)]",
3210
+ md: "h-9 px-3 text-[var(--text-sm)]",
3211
+ lg: "h-10 px-4 text-[var(--text-sm)]"
3212
+ }
3213
+ },
3214
+ defaultVariants: {
3215
+ variant: "default",
3216
+ size: "md"
3217
+ }
3218
+ }
3219
+ );
3220
+ var toggleGroupStyles = "inline-flex items-center gap-1 rounded-[var(--radius)] bg-[var(--color-surface)] border border-[var(--color-border)] p-1";
3221
+ var Toggle = forwardRef(
3222
+ ({ className, variant, size, pressed, onPressedChange, children, ...props }, ref) => /* @__PURE__ */ jsx(
3223
+ "button",
3224
+ {
3225
+ ref,
3226
+ type: "button",
3227
+ role: "switch",
3228
+ "aria-checked": pressed,
3229
+ "data-state": pressed ? "on" : "off",
3230
+ onClick: () => onPressedChange?.(!pressed),
3231
+ className: cn(toggleVariants({ variant, size }), className),
3232
+ ...props,
3233
+ children
3234
+ }
3235
+ )
3236
+ );
3237
+ Toggle.displayName = "Toggle";
3238
+ function ToggleGroup({
3239
+ type = "single",
3240
+ value,
3241
+ onValueChange,
3242
+ variant,
3243
+ size,
3244
+ children,
3245
+ className
3246
+ }) {
3247
+ const selected = Array.isArray(value) ? value : value ? [value] : [];
3248
+ const handleToggle = (itemValue) => {
3249
+ if (type === "single") {
3250
+ onValueChange?.(itemValue === value ? "" : itemValue);
3251
+ } else {
3252
+ const next = selected.includes(itemValue) ? selected.filter((v) => v !== itemValue) : [...selected, itemValue];
3253
+ onValueChange?.(next);
3254
+ }
3255
+ };
3256
+ return /* @__PURE__ */ jsx("div", { role: "group", className: cn(toggleGroupStyles, className), children: React39.Children.map(children, (child) => {
3257
+ if (!React39.isValidElement(child)) return child;
3258
+ const itemValue = child.props.value;
3259
+ const isPressed = selected.includes(itemValue);
3260
+ return React39.cloneElement(child, {
3261
+ ...child.props,
3262
+ variant: child.props.variant ?? variant,
3263
+ size: child.props.size ?? size,
3264
+ "data-state": isPressed ? "on" : "off",
3265
+ "aria-checked": isPressed,
3266
+ onClick: () => handleToggle(itemValue)
3267
+ });
3268
+ }) });
3269
+ }
3270
+ var ToggleGroupItem = forwardRef(
3271
+ ({ className, variant, size, children, ...props }, ref) => /* @__PURE__ */ jsx(
3272
+ "button",
3273
+ {
3274
+ ref,
3275
+ type: "button",
3276
+ className: cn(toggleVariants({ variant, size }), className),
3277
+ ...props,
3278
+ children
3279
+ }
3280
+ )
3281
+ );
3282
+ ToggleGroupItem.displayName = "ToggleGroupItem";
3283
+ var sizeMap2 = {
3284
+ xs: "h-3 w-3",
3285
+ sm: "h-4 w-4",
3286
+ md: "h-6 w-6",
3287
+ lg: "h-8 w-8",
3288
+ xl: "h-12 w-12"
3289
+ };
3290
+ function Spinner2({ size = "md", className }) {
3291
+ return /* @__PURE__ */ jsxs(
3292
+ "svg",
3293
+ {
3294
+ className: cn("animate-spin text-[var(--color-primary)]", sizeMap2[size], className),
3295
+ xmlns: "http://www.w3.org/2000/svg",
3296
+ fill: "none",
3297
+ viewBox: "0 0 24 24",
3298
+ role: "status",
3299
+ "aria-label": "Loading",
3300
+ children: [
3301
+ /* @__PURE__ */ jsx(
3302
+ "circle",
3303
+ {
3304
+ className: "opacity-25",
3305
+ cx: "12",
3306
+ cy: "12",
3307
+ r: "10",
3308
+ stroke: "currentColor",
3309
+ strokeWidth: "4"
3310
+ }
3311
+ ),
3312
+ /* @__PURE__ */ jsx(
3313
+ "path",
3314
+ {
3315
+ className: "opacity-75",
3316
+ fill: "currentColor",
3317
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
3318
+ }
3319
+ )
3320
+ ]
3321
+ }
3322
+ );
3323
+ }
3324
+ Spinner2.displayName = "Spinner";
3325
+ function Collapsible({
3326
+ open: controlledOpen,
3327
+ defaultOpen = false,
3328
+ onOpenChange,
3329
+ className,
3330
+ children
3331
+ }) {
3332
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
3333
+ const isControlled = controlledOpen !== void 0;
3334
+ const isOpen = isControlled ? controlledOpen : internalOpen;
3335
+ const toggle = () => {
3336
+ const next = !isOpen;
3337
+ if (!isControlled) setInternalOpen(next);
3338
+ onOpenChange?.(next);
3339
+ };
3340
+ return /* @__PURE__ */ jsx("div", { className, "data-state": isOpen ? "open" : "closed", children: React39.Children.map(children, (child) => {
3341
+ if (!React39.isValidElement(child)) return child;
3342
+ if (child.type.displayName === "CollapsibleTrigger") {
3343
+ return React39.cloneElement(child, { onClick: toggle });
3344
+ }
3345
+ if (child.type.displayName === "CollapsibleContent") {
3346
+ return React39.cloneElement(child, { "data-open": isOpen });
3347
+ }
3348
+ return child;
3349
+ }) });
3350
+ }
3351
+ Collapsible.displayName = "Collapsible";
3352
+ function CollapsibleTrigger({ children, className, onClick, ...props }) {
3353
+ return /* @__PURE__ */ jsx(
3354
+ "button",
3355
+ {
3356
+ type: "button",
3357
+ onClick,
3358
+ className: cn("cursor-pointer", className),
3359
+ ...props,
3360
+ children
3361
+ }
3362
+ );
3363
+ }
3364
+ CollapsibleTrigger.displayName = "CollapsibleTrigger";
3365
+ function CollapsibleContent({ children, className, ...props }) {
3366
+ const isOpen = props["data-open"];
3367
+ return /* @__PURE__ */ jsx(
3368
+ "div",
3369
+ {
3370
+ className: cn(
3371
+ "overflow-hidden transition-all duration-200",
3372
+ className
3373
+ ),
3374
+ style: {
3375
+ maxHeight: isOpen ? "2000px" : "0px",
3376
+ opacity: isOpen ? 1 : 0
3377
+ },
3378
+ children
3379
+ }
3380
+ );
3381
+ }
3382
+ CollapsibleContent.displayName = "CollapsibleContent";
3383
+ var contentStyles4 = [
3384
+ "z-[var(--z-popover)]",
3385
+ "w-64 rounded-[var(--radius-lg)] p-4",
3386
+ "bg-[var(--color-surface)] text-[var(--color-text-primary)]",
3387
+ "border border-[var(--color-border)]",
3388
+ "shadow-lg",
3389
+ "animate-in fade-in-0 zoom-in-95",
3390
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
3391
+ "data-[side=bottom]:slide-in-from-top-2",
3392
+ "data-[side=left]:slide-in-from-right-2",
3393
+ "data-[side=right]:slide-in-from-left-2",
3394
+ "data-[side=top]:slide-in-from-bottom-2"
3395
+ ].join(" ");
3396
+ var HoverCard = ({ children, openDelay = 200, closeDelay = 100 }) => /* @__PURE__ */ jsx(HoverCardPrimitive.Root, { openDelay, closeDelay, children });
3397
+ var HoverCardTrigger = HoverCardPrimitive.Trigger;
3398
+ var HoverCardContent = ({
3399
+ children,
3400
+ className,
3401
+ side = "bottom",
3402
+ align = "center",
3403
+ sideOffset = 4
3404
+ }) => /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { children: /* @__PURE__ */ jsx(
3405
+ HoverCardPrimitive.Content,
3406
+ {
3407
+ side,
3408
+ align,
3409
+ sideOffset,
3410
+ className: cn(contentStyles4, className),
3411
+ children
3412
+ }
3413
+ ) });
3414
+ HoverCard.displayName = "HoverCard";
3415
+ HoverCardContent.displayName = "HoverCardContent";
3416
+
3417
+ // src/components/calendar/calendar.styles.ts
3418
+ var calendarStyles = [
3419
+ "inline-block p-3",
3420
+ "bg-[var(--color-surface)] border border-[var(--color-border)]",
3421
+ "rounded-[var(--radius-lg)]"
3422
+ ].join(" ");
3423
+ var calendarHeaderStyles = "flex items-center justify-between mb-2";
3424
+ var calendarNavBtnStyles = [
3425
+ "inline-flex items-center justify-center h-7 w-7",
3426
+ "rounded-[var(--radius)]",
3427
+ "text-[var(--color-text-muted)]",
3428
+ "hover:bg-[var(--color-surface-hover)] hover:text-[var(--color-text-primary)]",
3429
+ "transition-colors duration-[var(--transition-fast)]",
3430
+ "cursor-pointer"
3431
+ ].join(" ");
3432
+ var calendarTitleStyles = "text-[var(--text-sm)] font-semibold text-[var(--color-text-primary)]";
3433
+ var calendarGridStyles = "w-full border-collapse";
3434
+ var calendarWeekdayStyles = "h-8 w-8 text-center text-[var(--text-xs)] font-medium text-[var(--color-text-muted)]";
3435
+ var calendarDayBaseStyles = [
3436
+ "h-8 w-8 text-center text-[var(--text-sm)]",
3437
+ "rounded-[var(--radius)]",
3438
+ "transition-colors duration-[var(--transition-fast)]",
3439
+ "cursor-pointer select-none"
3440
+ ].join(" ");
3441
+ var calendarDayDefaultStyles = "text-[var(--color-text-secondary)] hover:bg-[var(--color-surface-hover)] hover:text-[var(--color-text-primary)]";
3442
+ var calendarDaySelectedStyles = "bg-[var(--color-primary)] text-white hover:bg-[var(--color-primary-hover)]";
3443
+ var calendarDayTodayStyles = "font-bold text-[var(--color-primary)]";
3444
+ var calendarDayOutsideStyles = "text-[var(--color-text-muted)] opacity-50";
3445
+ var calendarDayDisabledStyles = "text-[var(--color-text-muted)] opacity-30 pointer-events-none";
3446
+ var WEEKDAYS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
3447
+ function getDaysInMonth(year, month) {
3448
+ return new Date(year, month + 1, 0).getDate();
3449
+ }
3450
+ function getFirstDayOfMonth(year, month) {
3451
+ return new Date(year, month, 1).getDay();
3452
+ }
3453
+ function isSameDay(a, b) {
3454
+ return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
3455
+ }
3456
+ function Calendar({
3457
+ value,
3458
+ onChange,
3459
+ minDate,
3460
+ maxDate,
3461
+ locale = "en-US",
3462
+ className
3463
+ }) {
3464
+ const today = /* @__PURE__ */ new Date();
3465
+ const [viewYear, setViewYear] = useState(value?.getFullYear() ?? today.getFullYear());
3466
+ const [viewMonth, setViewMonth] = useState(value?.getMonth() ?? today.getMonth());
3467
+ const monthLabel = useMemo(() => {
3468
+ const date = new Date(viewYear, viewMonth);
3469
+ return date.toLocaleDateString(locale, { month: "long", year: "numeric" });
3470
+ }, [viewYear, viewMonth, locale]);
3471
+ const prevMonth = useCallback(() => {
3472
+ if (viewMonth === 0) {
3473
+ setViewMonth(11);
3474
+ setViewYear((y) => y - 1);
3475
+ } else {
3476
+ setViewMonth((m) => m - 1);
3477
+ }
3478
+ }, [viewMonth]);
3479
+ const nextMonth = useCallback(() => {
3480
+ if (viewMonth === 11) {
3481
+ setViewMonth(0);
3482
+ setViewYear((y) => y + 1);
3483
+ } else {
3484
+ setViewMonth((m) => m + 1);
3485
+ }
3486
+ }, [viewMonth]);
3487
+ const days = useMemo(() => {
3488
+ const daysInMonth = getDaysInMonth(viewYear, viewMonth);
3489
+ const firstDay = getFirstDayOfMonth(viewYear, viewMonth);
3490
+ const daysInPrevMonth = getDaysInMonth(viewYear, viewMonth - 1);
3491
+ const cells = [];
3492
+ for (let i = firstDay - 1; i >= 0; i--) {
3493
+ cells.push({
3494
+ date: new Date(viewYear, viewMonth - 1, daysInPrevMonth - i),
3495
+ isOutside: true
3496
+ });
3497
+ }
3498
+ for (let d = 1; d <= daysInMonth; d++) {
3499
+ cells.push({
3500
+ date: new Date(viewYear, viewMonth, d),
3501
+ isOutside: false
3502
+ });
3503
+ }
3504
+ const remaining = 42 - cells.length;
3505
+ for (let d = 1; d <= remaining; d++) {
3506
+ cells.push({
3507
+ date: new Date(viewYear, viewMonth + 1, d),
3508
+ isOutside: true
3509
+ });
3510
+ }
3511
+ return cells;
3512
+ }, [viewYear, viewMonth]);
3513
+ const isDisabled = (date) => {
3514
+ if (minDate && date < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
3515
+ if (maxDate && date > new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())) return true;
3516
+ return false;
3517
+ };
3518
+ const weeks = [];
3519
+ for (let i = 0; i < days.length; i += 7) {
3520
+ weeks.push(days.slice(i, i + 7));
3521
+ }
3522
+ return /* @__PURE__ */ jsxs("div", { className: cn(calendarStyles, className), children: [
3523
+ /* @__PURE__ */ jsxs("div", { className: calendarHeaderStyles, children: [
3524
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: prevMonth, className: calendarNavBtnStyles, children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "15 18 9 12 15 6" }) }) }),
3525
+ /* @__PURE__ */ jsx("span", { className: calendarTitleStyles, children: monthLabel }),
3526
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: nextMonth, className: calendarNavBtnStyles, children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" }) }) })
3527
+ ] }),
3528
+ /* @__PURE__ */ jsxs("table", { className: calendarGridStyles, children: [
3529
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: WEEKDAYS.map((d) => /* @__PURE__ */ jsx("th", { className: calendarWeekdayStyles, children: d }, d)) }) }),
3530
+ /* @__PURE__ */ jsx("tbody", { children: weeks.map((week, wi) => /* @__PURE__ */ jsx("tr", { children: week.map(({ date, isOutside }, di) => {
3531
+ const selected = value && isSameDay(date, value);
3532
+ const isToday = isSameDay(date, today);
3533
+ const disabled = isDisabled(date);
3534
+ return /* @__PURE__ */ jsx(
3535
+ "td",
3536
+ {
3537
+ onClick: () => !disabled && !isOutside && onChange?.(date),
3538
+ className: cn(
3539
+ calendarDayBaseStyles,
3540
+ isOutside && calendarDayOutsideStyles,
3541
+ disabled && calendarDayDisabledStyles,
3542
+ !isOutside && !disabled && !selected && calendarDayDefaultStyles,
3543
+ selected && calendarDaySelectedStyles,
3544
+ isToday && !selected && calendarDayTodayStyles
3545
+ ),
3546
+ children: date.getDate()
3547
+ },
3548
+ di
3549
+ );
3550
+ }) }, wi)) })
3551
+ ] })
3552
+ ] });
3553
+ }
3554
+ Calendar.displayName = "Calendar";
3555
+ var triggerStyles = [
3556
+ "flex items-center justify-between w-full",
3557
+ "h-10 px-3 text-[var(--text-sm)]",
3558
+ "bg-[var(--color-surface)] text-[var(--color-text-primary)]",
3559
+ "border border-[var(--color-border)]",
3560
+ "rounded-[var(--radius)]",
3561
+ "transition-all duration-[var(--transition-fast)]",
3562
+ "hover:border-[var(--color-border-hover)]",
3563
+ "focus:outline-none focus:border-[var(--color-primary)] focus:ring-1 focus:ring-[var(--color-primary)]",
3564
+ "disabled:opacity-50 disabled:cursor-not-allowed",
3565
+ "cursor-pointer"
3566
+ ].join(" ");
3567
+ var placeholderStyles = "text-[var(--color-text-muted)]";
3568
+ var labelStyles3 = "block text-[var(--text-sm)] font-medium text-[var(--color-text-secondary)] mb-1.5";
3569
+ var errorTextStyles = "mt-1.5 text-[var(--text-xs)] text-[var(--color-danger)]";
3570
+ var clearBtnStyles = [
3571
+ "shrink-0 p-0.5 rounded-[var(--radius-sm)]",
3572
+ "text-[var(--color-text-muted)]",
3573
+ "hover:text-[var(--color-text-primary)] hover:bg-[var(--color-surface-hover)]",
3574
+ "transition-colors duration-[var(--transition-fast)]"
3575
+ ].join(" ");
3576
+ var defaultFormat = (date) => date.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
3577
+ function DatePicker({
3578
+ value,
3579
+ onChange,
3580
+ placeholder = "Pick a date...",
3581
+ formatDate = defaultFormat,
3582
+ label,
3583
+ error,
3584
+ clearable = false,
3585
+ disabled = false,
3586
+ minDate,
3587
+ maxDate,
3588
+ locale,
3589
+ className
3590
+ }) {
3591
+ const [open, setOpen] = useState(false);
3592
+ const handleSelect = (date) => {
3593
+ onChange?.(date);
3594
+ setOpen(false);
3595
+ };
3596
+ const handleClear = (e) => {
3597
+ e.stopPropagation();
3598
+ onChange?.(void 0);
3599
+ };
3600
+ return /* @__PURE__ */ jsxs("div", { className: cn("w-full", className), children: [
3601
+ label && /* @__PURE__ */ jsx("label", { className: labelStyles3, children: label }),
3602
+ /* @__PURE__ */ jsxs(PopoverPrimitive3.Root, { open, onOpenChange: setOpen, children: [
3603
+ /* @__PURE__ */ jsx(PopoverPrimitive3.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
3604
+ "button",
3605
+ {
3606
+ type: "button",
3607
+ disabled,
3608
+ className: cn(triggerStyles, error && "border-[var(--color-danger)] focus:ring-[var(--color-danger)]"),
3609
+ children: [
3610
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
3611
+ /* @__PURE__ */ jsxs("svg", { className: "shrink-0 text-[var(--color-text-muted)]", width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3612
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
3613
+ /* @__PURE__ */ jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
3614
+ /* @__PURE__ */ jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
3615
+ /* @__PURE__ */ jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
3616
+ ] }),
3617
+ value ? /* @__PURE__ */ jsx("span", { children: formatDate(value) }) : /* @__PURE__ */ jsx("span", { className: placeholderStyles, children: placeholder })
3618
+ ] }),
3619
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 shrink-0", children: clearable && value && /* @__PURE__ */ jsx("span", { role: "button", tabIndex: -1, onClick: handleClear, className: clearBtnStyles, children: /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3620
+ /* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
3621
+ /* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
3622
+ ] }) }) })
3623
+ ]
3624
+ }
3625
+ ) }),
3626
+ /* @__PURE__ */ jsx(PopoverPrimitive3.Portal, { children: /* @__PURE__ */ jsx(
3627
+ PopoverPrimitive3.Content,
3628
+ {
3629
+ sideOffset: 4,
3630
+ className: "z-[var(--z-popover)] animate-in fade-in-0 zoom-in-95",
3631
+ onOpenAutoFocus: (e) => e.preventDefault(),
3632
+ children: /* @__PURE__ */ jsx(
3633
+ Calendar,
3634
+ {
3635
+ value,
3636
+ onChange: handleSelect,
3637
+ minDate,
3638
+ maxDate,
3639
+ locale
3640
+ }
3641
+ )
3642
+ }
3643
+ ) })
3644
+ ] }),
3645
+ error && /* @__PURE__ */ jsx("p", { className: errorTextStyles, children: error })
3646
+ ] });
3647
+ }
3648
+ DatePicker.displayName = "DatePicker";
3189
3649
 
3190
- export { Accordion, Alert, AppShell, Avatar, AvatarGroup, Badge, Breadcrumb, BreadcrumbItem, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Combobox, CommandPalette, ConfirmDialog, DataTable, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, Dropdown, DropdownContent, DropdownGroup, DropdownItem, DropdownLabel, DropdownSeparator, DropdownTrigger, EmptyState, Input, Modal, ModalContent, ModalDescription, ModalFooter, ModalTitle, ModalTrigger, Navbar, PageHeader, Pagination, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, Select, Separator, Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarSection, SidebarToggle, Skeleton, Slider, StatCard, Steps, Switch, Table, TableWrapper, Tabs, TabsContent, TabsList, TabsTrigger, Tbody, Td, Textarea, Th, Thead, ThemeProvider, ToastProvider, Tooltip, TooltipProvider, Tr, badgeVariants, buttonVariants, cardVariants, cn, inputVariants, textareaVariants, useSidebar, useTheme, useToast };
3650
+ export { Accordion, Alert, AppShell, Avatar, AvatarGroup, Badge, Breadcrumb, BreadcrumbItem, Button, Calendar, Card, CardBody, CardFooter, CardHeader, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, CommandPalette, ConfirmDialog, DataTable, DatePicker, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, Dropdown, DropdownContent, DropdownGroup, DropdownItem, DropdownLabel, DropdownSeparator, DropdownTrigger, EmptyState, HoverCard, HoverCardContent, HoverCardTrigger, Input, Modal, ModalContent, ModalDescription, ModalFooter, ModalTitle, ModalTrigger, Navbar, PageHeader, Pagination, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, Select, Separator, Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarItem, SidebarSection, SidebarToggle, Skeleton, Slider, Spinner2 as Spinner, StatCard, Steps, Switch, Table, TableWrapper, Tabs, TabsContent, TabsList, TabsTrigger, Tbody, Td, Textarea, Th, Thead, ThemeProvider, ToastProvider, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipProvider, Tr, badgeVariants, buttonVariants, cardVariants, cn, inputVariants, textareaVariants, toggleVariants, useSidebar, useTheme, useToast };
3191
3651
  //# sourceMappingURL=index.js.map
3192
3652
  //# sourceMappingURL=index.js.map