@uselets/ui 1.18.6 → 1.18.8

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.
Files changed (108) hide show
  1. package/README.md +2 -2
  2. package/dist/components/accordion.d.ts +5 -5
  3. package/dist/components/alert-dialog.d.ts +13 -13
  4. package/dist/components/alert.d.ts +5 -5
  5. package/dist/components/anchor.d.ts +2 -2
  6. package/dist/components/area-chart.d.ts +6 -6
  7. package/dist/components/avatar.d.ts +7 -7
  8. package/dist/components/badge.d.ts +2 -2
  9. package/dist/components/bar-chart.d.ts +7 -7
  10. package/dist/components/breadcrumb.d.ts +8 -8
  11. package/dist/components/button-group.d.ts +4 -4
  12. package/dist/components/button.d.ts +2 -2
  13. package/dist/components/calendar.d.ts +3 -3
  14. package/dist/components/card.d.ts +8 -8
  15. package/dist/components/carousel.d.ts +8 -8
  16. package/dist/components/carousel.js +1 -1
  17. package/dist/components/carousel.js.map +1 -1
  18. package/dist/components/center.d.ts +2 -2
  19. package/dist/components/checkbox.d.ts +2 -2
  20. package/dist/components/code.d.ts +2 -2
  21. package/dist/components/collapsible.d.ts +4 -4
  22. package/dist/components/combobox.d.ts +17 -17
  23. package/dist/components/command.d.ts +10 -10
  24. package/dist/components/container.d.ts +2 -2
  25. package/dist/components/date-range-picker.d.ts +13 -13
  26. package/dist/components/date-range-picker.js +1 -1
  27. package/dist/components/date-range-picker.js.map +1 -1
  28. package/dist/components/dialog.d.ts +13 -13
  29. package/dist/components/dialog.js +1 -1
  30. package/dist/components/dialog.js.map +1 -1
  31. package/dist/components/donut-chart.d.ts +2 -2
  32. package/dist/components/drawer.d.ts +13 -13
  33. package/dist/components/drawer.js +1 -1
  34. package/dist/components/drawer.js.map +1 -1
  35. package/dist/components/dropdown-menu.d.ts +16 -16
  36. package/dist/components/dropzone.d.ts +18 -18
  37. package/dist/components/empty.d.ts +7 -7
  38. package/dist/components/field.d.ts +11 -11
  39. package/dist/components/flex.d.ts +2 -2
  40. package/dist/components/grid.d.ts +3 -3
  41. package/dist/components/group.d.ts +2 -2
  42. package/dist/components/heading.d.ts +2 -2
  43. package/dist/components/hover-card.d.ts +4 -4
  44. package/dist/components/input-group.d.ts +7 -7
  45. package/dist/components/input-otp.d.ts +5 -5
  46. package/dist/components/input.d.ts +2 -2
  47. package/dist/components/kbd.d.ts +3 -3
  48. package/dist/components/label.d.ts +2 -2
  49. package/dist/components/list.d.ts +4 -4
  50. package/dist/components/logo.d.ts +10 -10
  51. package/dist/components/marker.d.ts +4 -4
  52. package/dist/components/mask-input.d.ts +2 -2
  53. package/dist/components/native-select.d.ts +4 -4
  54. package/dist/components/navigation-menu.d.ts +9 -9
  55. package/dist/components/number-field.d.ts +7 -7
  56. package/dist/components/pagination.d.ts +8 -8
  57. package/dist/components/phone-input.d.ts +2 -2
  58. package/dist/components/pie-chart.d.ts +5 -5
  59. package/dist/components/popover.d.ts +8 -8
  60. package/dist/components/progress.d.ts +2 -2
  61. package/dist/components/radio-group.d.ts +3 -3
  62. package/dist/components/resizable.d.ts +4 -4
  63. package/dist/components/ring-progress.d.ts +3 -3
  64. package/dist/components/scroll-area.d.ts +3 -3
  65. package/dist/components/select.d.ts +11 -11
  66. package/dist/components/separator.d.ts +2 -2
  67. package/dist/components/sidebar.d.ts +24 -24
  68. package/dist/components/simple-grid.d.ts +2 -2
  69. package/dist/components/skeleton.d.ts +2 -2
  70. package/dist/components/slider.d.ts +2 -2
  71. package/dist/components/sonner.d.ts +2 -2
  72. package/dist/components/spinner.d.ts +2 -2
  73. package/dist/components/stack.d.ts +2 -2
  74. package/dist/components/stepper.d.ts +7 -7
  75. package/dist/components/switch.d.ts +2 -2
  76. package/dist/components/table.d.ts +10 -10
  77. package/dist/components/tabs.d.ts +5 -5
  78. package/dist/components/text.d.ts +2 -2
  79. package/dist/components/textarea.d.ts +2 -2
  80. package/dist/components/theme.d.ts +7 -8
  81. package/dist/components/timeline.d.ts +15 -15
  82. package/dist/components/toggle-group.d.ts +3 -3
  83. package/dist/components/toggle.d.ts +2 -2
  84. package/dist/components/tooltip.d.ts +6 -6
  85. package/dist/components/unstyled-button.d.ts +2 -2
  86. package/dist/components/visibility.d.ts +3 -3
  87. package/dist/hooks/use-breakpoint-value.d.ts +2 -3
  88. package/dist/hooks/use-breakpoint.d.ts +3 -4
  89. package/dist/hooks/use-disclosure.d.ts +5 -6
  90. package/dist/hooks/use-document-visibility.d.ts +1 -2
  91. package/dist/hooks/use-idle.d.ts +3 -4
  92. package/dist/hooks/use-interval.d.ts +4 -5
  93. package/dist/hooks/use-local-storage.d.ts +4 -5
  94. package/dist/hooks/use-mask.d.ts +3 -3
  95. package/dist/hooks/use-mobile.d.ts +1 -2
  96. package/dist/index.d.ts +2 -2
  97. package/dist/index.js +1 -1
  98. package/dist/lib/badge.d.ts +2 -3
  99. package/dist/lib/button.d.ts +2 -3
  100. package/dist/lib/color.d.ts +3 -4
  101. package/dist/lib/compose-refs.d.ts +2 -3
  102. package/dist/lib/progress.d.ts +2 -3
  103. package/dist/lib/utils.d.ts +4 -2
  104. package/dist/lib/utils.js +1 -1
  105. package/dist/lib/utils.js.map +1 -1
  106. package/dist/skills/uselets-ui/references/component-catalog.md +2 -2
  107. package/package.json +15 -15
  108. package/skills/uselets-ui/references/component-catalog.md +2 -2
@@ -3,20 +3,20 @@ import { Dialog } from "./dialog.js";
3
3
  import * as React from "react";
4
4
  import { Command as Command$1 } from "cmdk";
5
5
  //#region src/components/command.d.ts
6
- type CommandProps = React.ComponentProps<typeof Command$1>;
7
- type CommandDialogProps = React.ComponentProps<typeof Dialog> & {
6
+ export type CommandProps = React.ComponentProps<typeof Command$1>;
7
+ export type CommandDialogProps = React.ComponentProps<typeof Dialog> & {
8
8
  title?: string;
9
9
  description?: string;
10
10
  className?: string;
11
11
  showCloseButton?: boolean;
12
12
  };
13
- type CommandInputProps = React.ComponentProps<typeof Command$1.Input>;
14
- type CommandListProps = React.ComponentProps<typeof Command$1.List>;
15
- type CommandEmptyProps = React.ComponentProps<typeof Command$1.Empty>;
16
- type CommandGroupProps = React.ComponentProps<typeof Command$1.Group>;
17
- type CommandSeparatorProps = React.ComponentProps<typeof Command$1.Separator>;
18
- type CommandItemProps = React.ComponentProps<typeof Command$1.Item>;
19
- type CommandShortcutProps = React.ComponentProps<'span'>;
13
+ export type CommandInputProps = React.ComponentProps<typeof Command$1.Input>;
14
+ export type CommandListProps = React.ComponentProps<typeof Command$1.List>;
15
+ export type CommandEmptyProps = React.ComponentProps<typeof Command$1.Empty>;
16
+ export type CommandGroupProps = React.ComponentProps<typeof Command$1.Group>;
17
+ export type CommandSeparatorProps = React.ComponentProps<typeof Command$1.Separator>;
18
+ export type CommandItemProps = React.ComponentProps<typeof Command$1.Item>;
19
+ export type CommandShortcutProps = React.ComponentProps<'span'>;
20
20
  declare function Command({ className, ...props }: CommandProps): React.JSX.Element;
21
21
  declare function CommandDialog({ title, description, children, className, showCloseButton, ...props }: CommandDialogProps): React.JSX.Element;
22
22
  declare function CommandInput({ className, id, ...props }: CommandInputProps): React.JSX.Element;
@@ -27,5 +27,5 @@ declare function CommandSeparator({ className, ...props }: CommandSeparatorProps
27
27
  declare function CommandItem({ className, children, ...props }: CommandItemProps): React.JSX.Element;
28
28
  declare function CommandShortcut({ className, ...props }: CommandShortcutProps): React.JSX.Element;
29
29
  //#endregion
30
- export { Command, CommandDialog, CommandDialogProps, CommandEmpty, CommandEmptyProps, CommandGroup, CommandGroupProps, CommandInput, CommandInputProps, CommandItem, CommandItemProps, CommandList, CommandListProps, CommandProps, CommandSeparator, CommandSeparatorProps, CommandShortcut, CommandShortcutProps };
30
+ export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut };
31
31
  //# sourceMappingURL=command.d.ts.map
@@ -5,8 +5,8 @@ import * as React from "react";
5
5
  declare const containerVariants: (props?: ({
6
6
  size?: "full" | "lg" | "md" | "sm" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
- type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants>;
8
+ export type ContainerProps = React.ComponentProps<'div'> & VariantProps<typeof containerVariants>;
9
9
  declare function Container({ className, size, ...props }: ContainerProps): React.JSX.Element;
10
10
  //#endregion
11
- export { Container, ContainerProps, containerVariants };
11
+ export { Container, containerVariants };
12
12
  //# sourceMappingURL=container.d.ts.map
@@ -5,11 +5,11 @@ import { Popover, PopoverContent } from "./popover.js";
5
5
  import * as React from "react";
6
6
  import { Locale } from "react-day-picker";
7
7
  //#region src/components/date-range-picker.d.ts
8
- type DateRangePickerPresetOption = {
8
+ export type DateRangePickerPresetOption = {
9
9
  label: string;
10
10
  getRange: () => DateRange;
11
11
  };
12
- type DateRangePickerProps = Omit<React.ComponentProps<typeof Popover>, 'open' | 'defaultOpen' | 'onOpenChange'> & {
12
+ export type DateRangePickerProps = Omit<React.ComponentProps<typeof Popover>, 'open' | 'defaultOpen' | 'onOpenChange'> & {
13
13
  value?: DateRange | null;
14
14
  defaultValue?: DateRange | null;
15
15
  onValueChange?: (range: DateRange | null) => void;
@@ -21,24 +21,24 @@ type DateRangePickerProps = Omit<React.ComponentProps<typeof Popover>, 'open' |
21
21
  locale?: Partial<Locale>;
22
22
  placeholder?: string;
23
23
  };
24
- type DateRangePickerTriggerProps = React.ComponentProps<typeof Button> & {
24
+ export type DateRangePickerTriggerProps = React.ComponentProps<typeof Button> & {
25
25
  asChild?: boolean;
26
26
  };
27
- type DateRangePickerValueProps = React.ComponentProps<'span'> & {
27
+ export type DateRangePickerValueProps = React.ComponentProps<'span'> & {
28
28
  placeholder?: string;
29
29
  };
30
- type DateRangePickerContentProps = React.ComponentProps<typeof PopoverContent>;
31
- type DateRangePickerPresetsProps = React.ComponentProps<'div'> & {
30
+ export type DateRangePickerContentProps = React.ComponentProps<typeof PopoverContent>;
31
+ export type DateRangePickerPresetsProps = React.ComponentProps<'div'> & {
32
32
  presets?: DateRangePickerPresetOption[];
33
33
  };
34
- type DateRangePickerPresetProps = React.ComponentProps<'button'> & {
34
+ export type DateRangePickerPresetProps = React.ComponentProps<'button'> & {
35
35
  selected?: boolean;
36
36
  };
37
- type DateRangePickerCalendarProps = Omit<React.ComponentProps<typeof Calendar>, 'mode' | 'numberOfMonths' | 'selected' | 'onSelect' | 'month' | 'defaultMonth'>;
38
- type DateRangePickerDateFieldsProps = React.ComponentProps<'div'>;
39
- type DateRangePickerActionsProps = React.ComponentProps<'div'>;
40
- type DateRangePickerApplyProps = React.ComponentProps<typeof Button>;
41
- type DateRangePickerResetProps = React.ComponentProps<typeof Button>;
37
+ export type DateRangePickerCalendarProps = Omit<React.ComponentProps<typeof Calendar>, 'mode' | 'numberOfMonths' | 'selected' | 'onSelect' | 'month' | 'defaultMonth'>;
38
+ export type DateRangePickerDateFieldsProps = React.ComponentProps<'div'>;
39
+ export type DateRangePickerActionsProps = React.ComponentProps<'div'>;
40
+ export type DateRangePickerApplyProps = React.ComponentProps<typeof Button>;
41
+ export type DateRangePickerResetProps = React.ComponentProps<typeof Button>;
42
42
  declare function DateRangePicker({ value: valueProp, defaultValue, onValueChange, onApply, onReset, open: openProp, defaultOpen, onOpenChange, locale, placeholder, children, ...props }: DateRangePickerProps): React.JSX.Element;
43
43
  declare function DateRangePickerTrigger({ className, children, asChild, variant, color, type, ...props }: DateRangePickerTriggerProps): React.JSX.Element;
44
44
  declare function DateRangePickerValue({ className, placeholder, ...props }: DateRangePickerValueProps): React.JSX.Element;
@@ -51,5 +51,5 @@ declare function DateRangePickerActions({ className, children, ...props }: DateR
51
51
  declare function DateRangePickerApply({ children, onClick, className, ...props }: DateRangePickerApplyProps): React.JSX.Element;
52
52
  declare function DateRangePickerReset({ children, onClick, variant, color, className, ...props }: DateRangePickerResetProps): React.JSX.Element;
53
53
  //#endregion
54
- export { type DateRange, DateRangePicker, DateRangePickerActions, DateRangePickerActionsProps, DateRangePickerApply, DateRangePickerApplyProps, DateRangePickerCalendar, DateRangePickerCalendarProps, DateRangePickerContent, DateRangePickerContentProps, DateRangePickerDateFields, DateRangePickerDateFieldsProps, DateRangePickerPreset, DateRangePickerPresetOption, DateRangePickerPresetProps, DateRangePickerPresets, DateRangePickerPresetsProps, DateRangePickerProps, DateRangePickerReset, DateRangePickerResetProps, DateRangePickerTrigger, DateRangePickerTriggerProps, DateRangePickerValue, DateRangePickerValueProps };
54
+ export { type DateRange, DateRangePicker, DateRangePickerActions, DateRangePickerApply, DateRangePickerCalendar, DateRangePickerContent, DateRangePickerDateFields, DateRangePickerPreset, DateRangePickerPresets, DateRangePickerReset, DateRangePickerTrigger, DateRangePickerValue };
55
55
  //# sourceMappingURL=date-range-picker.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{Calendar as n}from"./calendar.js";import{Input as r}from"./input.js";import{Popover as i,PopoverContent as a,PopoverTrigger as o}from"./popover.js";import{IconArrowRight as s,IconCalendar as c,IconChevronDown as l}from"@tabler/icons-react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import*as p from"react";const m=p.createContext(null),h=[{label:`Hoje`,getRange:()=>{let e=startOfDay(new Date);return{from:e,to:e}}},{label:`Ontem`,getRange:()=>{let e=addDays(startOfDay(new Date),-1);return{from:e,to:e}}},{label:`Últimos 7 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-7),to:e}}},{label:`Últimos 15 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-15),to:e}}},{label:`Últimos 30 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-30),to:e}}},{label:`Últimos 60 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-60),to:e}}},{label:`Últimos 90 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-90),to:e}}},{label:`Semana passada`,getRange:()=>{let e=addDays(startOfWeek(new Date),-7);return{from:e,to:addDays(e,6)}}},{label:`Este mês`,getRange:()=>{let e=startOfDay(new Date);return{from:startOfMonth(e),to:e}}},{label:`Mês passado`,getRange:()=>{let e=new Date(new Date().getFullYear(),new Date().getMonth()-1,1);return{from:startOfMonth(e),to:endOfMonth(e)}}}];function DateRangePicker({value:e,defaultValue:t=null,onValueChange:n,onApply:r,onReset:a,open:o,defaultOpen:s=!1,onOpenChange:c,locale:l,placeholder:h=`Selecione um período`,children:g,..._}){let[v,y]=p.useState(t),[b,x]=p.useState(s),S=e!==void 0,C=o!==void 0,w=S?e??null:v,T=C?o:b,[E,D]=p.useState(()=>toDraft(w)),[O,k]=p.useState(()=>getRangeMonth(toDraft(w))),A=p.useCallback(e=>{let t=normalizeDraft(e);D(t);let n=getRangeMonth(t);n&&k(n)},[]),j=p.useCallback(e=>{S||y(e),n?.(e)},[S,n]),M=p.useCallback(e=>{if(e){let e=toDraft(w);D(e),k(getRangeMonth(e))}C||x(e),c?.(e)},[C,c,w]),N=p.useCallback(()=>{let e=toValue(E);j(e),r?.(e),M(!1)},[j,E,r,M]),P=p.useCallback(()=>{D(void 0),j(null),a?.(),M(!1)},[j,a,M]),F=p.useMemo(()=>({value:w,draft:E,month:O,locale:l,placeholder:h,setDraft:A,setMonth:k,apply:N,reset:P}),[N,E,l,O,h,P,A,w]);return d(m.Provider,{value:F,children:d(i,{open:T,onOpenChange:M,..._,children:g??f(u,{children:[d(DateRangePickerTrigger,{}),f(DateRangePickerContent,{children:[d(DateRangePickerPresets,{}),d(DateRangePickerDateFields,{}),d(DateRangePickerCalendar,{}),d(DateRangePickerActions,{})]})]})})})}function DateRangePickerTrigger({className:n,children:r,asChild:i=!1,variant:a=`outline`,color:s=`zinc`,type:p=`button`,...m}){return i?d(o,{asChild:!0,children:r}):d(o,{asChild:!0,children:d(t,{type:p,variant:a,color:s,className:e(`min-w-64 justify-between font-normal`,n),...m,children:r??f(u,{children:[d(c,{"data-icon":`inline-start`,className:`size-4 text-muted-foreground`}),d(DateRangePickerValue,{className:`flex-1 text-left`}),d(l,{"data-icon":`inline-end`,className:`size-4 text-muted-foreground`})]})})})}function DateRangePickerValue({className:t,placeholder:n,...r}){let{value:i,locale:a,placeholder:o}=useDateRangePicker();return d(`span`,{"data-slot":`date-range-picker-value`,className:e(`truncate`,t),...r,children:formatRange(i,a,n??o)})}function DateRangePickerContent({className:t,align:n=`start`,sideOffset:r=8,children:i,...o}){let s=p.Children.toArray(i),c=s.filter(isDateRangePickerPresetsElement),l=s.filter(e=>!isDateRangePickerPresetsElement(e));return d(a,{align:n,sideOffset:r,className:e(`w-[calc(100vw-(--spacing(4)))] max-w-2xl p-2`,t),...o,children:f(`div`,{"data-slot":`date-range-picker-content`,className:`grid gap-3 md:grid-cols-[10rem_minmax(0,1fr)]`,children:[c,d(`div`,{className:`flex min-w-0 flex-col gap-3`,children:l})]})})}function DateRangePickerPresets({className:t,presets:n=h,...r}){let{draft:i,setDraft:a}=useDateRangePicker(),o=getRelativeDaysValue(i,`today`),s=getRelativeDaysValue(i,`yesterday`);return f(`div`,{"data-slot":`date-range-picker-presets`,className:e(`hidden flex-col border-border pr-3 md:flex md:border-r`,t),...r,children:[n.map(e=>{let t=e.getRange(),n=isSameRange(i,t);return d(DateRangePickerPreset,{type:`button`,selected:n,onClick:()=>a(t),children:e.label},e.label)}),f(`div`,{className:`my-3 flex flex-col gap-2`,children:[d(DateRangePickerRelativeField,{label:`Dias até hoje`,value:o,onValueChange:e=>a(getRelativeDaysRange(e,`today`))}),d(DateRangePickerRelativeField,{label:`Dias até ontem`,value:s,onValueChange:e=>a(getRelativeDaysRange(e,`yesterday`))})]})]})}function DateRangePickerPreset({className:t,selected:n=!1,...r}){return d(`button`,{"data-slot":`date-range-picker-preset`,"data-selected":n,className:e(`flex h-8.5 w-full items-center border-l-3 border-border bg-transparent px-2 text-left text-sm text-foreground transition-colors outline-none`,`hover:border-primary hover:bg-primary-50 hover:text-primary-700 dark:hover:bg-primary-950 dark:hover:text-primary-300`,`focus-visible:border-primary focus-visible:ring-3 focus-visible:ring-ring/50`,`data-[selected=true]:border-primary data-[selected=true]:bg-primary-50 data-[selected=true]:text-primary-700 dark:data-[selected=true]:bg-primary-950 dark:data-[selected=true]:text-primary-300`,t),"aria-pressed":n,...r})}function DateRangePickerRelativeField({label:e,value:t,onValueChange:n}){let i=p.useId(),[a,o]=p.useState(()=>formatRelativeInputValue(t));return p.useEffect(()=>{o(formatRelativeInputValue(t))},[t]),f(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[d(r,{id:i,type:`number`,name:e,min:1,step:1,value:a,className:`h-7 w-9 rounded-md px-1 text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`,"aria-label":e,onChange:e=>{let t=e.target.value;if(o(t),t===``)return;let r=parsePositiveInteger(t);r&&n(r)}}),d(`label`,{htmlFor:i,children:e})]})}function DateRangePickerCalendar({className:t,showOutsideDays:r=!1,onMonthChange:i,...a}){let{draft:o,locale:s,month:c,setDraft:l,setMonth:u}=useDateRangePicker();return d(n,{mode:`range`,numberOfMonths:2,showOutsideDays:r,month:c,onMonthChange:e=>{u(e),i?.(e)},selected:o,onSelect:l,locale:s,className:e(`mx-auto bg-transparent p-0`,t),...a})}function DateRangePickerDateFields({className:t,...n}){let{draft:i,setDraft:a}=useDateRangePicker();return f(`div`,{"data-slot":`date-range-picker-date-fields`,className:e(`pb-2 border-b flex justify-between gap-2 flex-wrap flex-col sm:flex-row sm:items-center`,t),...n,children:[d(r,{type:`date`,value:formatInputDate(i?.from),className:`sm:w-max`,onChange:e=>{if(e.target.value===``){a(void 0);return}let t=parseInputDate(e.target.value);t&&a(normalizeDraft({from:t,to:i?.to}))}}),d(s,{className:`size-4 text-primary hidden sm:block`}),d(r,{type:`date`,value:formatInputDate(i?.to),className:`sm:w-max`,onChange:e=>{if(e.target.value===``){a(void 0);return}let t=parseInputDate(e.target.value);t&&a(normalizeDraft({from:i?.from,to:t}))}})]})}function DateRangePickerActions({className:t,children:n,...r}){return d(`div`,{"data-slot":`date-range-picker-actions`,className:e(`flex items-center gap-2 mt-auto`,t),...r,children:n??f(u,{children:[d(DateRangePickerReset,{}),d(DateRangePickerApply,{})]})})}function DateRangePickerApply({children:n=`Aplicar`,onClick:r,className:i,...a}){let{apply:o}=useDateRangePicker();return d(t,{size:`sm`,className:e(`flex-1`,i),onClick:e=>{r?.(e),e.defaultPrevented||o()},...a,children:n})}function DateRangePickerReset({children:n=`Resetar`,onClick:r,variant:i=`outline`,color:a=`zinc`,className:o,...s}){let{reset:c}=useDateRangePicker();return d(t,{size:`sm`,className:e(`flex-1`,o),variant:i,color:a,onClick:e=>{r?.(e),e.defaultPrevented||c()},...s,children:n})}function useDateRangePicker(){let e=p.useContext(m);if(!e)throw Error(`DateRangePicker components must be used within DateRangePicker.`);return e}function isDateRangePickerPresetsElement(e){return p.isValidElement(e)&&e.type===DateRangePickerPresets}function toDraft(e){return normalizeDraft(e??void 0)}function toValue(e){return normalizeDraft(e)??null}function getRangeMonth(e){return startOfDay(e?.from??e?.to??new Date)}function normalizeDraft(e){if(!(!e?.from&&!e?.to))return e.from&&e.to&&e.from>e.to?{from:startOfDay(e.to),to:startOfDay(e.from)}:{from:e.from?startOfDay(e.from):void 0,to:e.to?startOfDay(e.to):void 0}}function formatRange(e,t,n){return!e?.from&&!e?.to?n:e.from&&e.to?`${formatDisplayDate(e.from,t)} - ${formatDisplayDate(e.to,t)}`:formatDisplayDate(e.from??e.to,t)}function formatDisplayDate(e,t){return e?new Intl.DateTimeFormat(t?.code??`pt-BR`,{day:`2-digit`,month:`2-digit`,year:`numeric`}).format(e):``}function formatInputDate(e){return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:``}function parseInputDate(e){if(!e)return;let t=/^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})$/.exec(e);if(!t?.groups)return;let n=Number(t.groups.year),r=Number(t.groups.month),i=Number(t.groups.day),a=new Date(n,r-1,i);if(a.getFullYear()===n&&a.getMonth()===r-1&&a.getDate()===i)return a}function parsePositiveInteger(e){if(!e)return;let t=Number(e);if(!(!Number.isInteger(t)||t<1))return t}function formatRelativeInputValue(e){return e?String(e):``}function getRelativeDaysRange(e,t){let n=startOfDay(new Date),r=t===`today`?addDays(n,-1):addDays(n,-2);return{from:addDays(r,-e+1),to:r}}function getRelativeDaysValue(e,t){if(!e?.from||!e.to)return;let n=startOfDay(new Date),r=t===`today`?addDays(n,-1):addDays(n,-2);if(!isSameDay(e.to,r))return;let i=differenceInCalendarDays(r,startOfDay(e.from))+1;return i>0?i:void 0}function isSameRange(e,t){return isSameDay(e?.from,t?.from)&&isSameDay(e?.to,t?.to)}function isSameDay(e,t){return!e||!t?e===t:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function startOfDay(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function startOfWeek(e){let t=startOfDay(e);return addDays(t,-t.getDay())}function startOfMonth(e){return new Date(e.getFullYear(),e.getMonth(),1)}function endOfMonth(e){return new Date(e.getFullYear(),e.getMonth()+1,0)}function differenceInCalendarDays(e,t){return Math.round((startOfDay(e).getTime()-startOfDay(t).getTime())/864e5)}function addDays(e,t){let n=startOfDay(e);return n.setDate(n.getDate()+t),n}export{DateRangePicker,DateRangePickerActions,DateRangePickerApply,DateRangePickerCalendar,DateRangePickerContent,DateRangePickerDateFields,DateRangePickerPreset,DateRangePickerPresets,DateRangePickerReset,DateRangePickerTrigger,DateRangePickerValue};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{Calendar as n}from"./calendar.js";import{Input as r}from"./input.js";import{Popover as i,PopoverContent as a,PopoverTrigger as o}from"./popover.js";import{IconArrowRight as s,IconCalendar as c,IconChevronDown as l}from"@tabler/icons-react";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";import*as p from"react";const m=p.createContext(null),h=[{label:`Hoje`,getRange:()=>{let e=startOfDay(new Date);return{from:e,to:e}}},{label:`Ontem`,getRange:()=>{let e=addDays(startOfDay(new Date),-1);return{from:e,to:e}}},{label:`Últimos 7 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-7),to:e}}},{label:`Últimos 15 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-15),to:e}}},{label:`Últimos 30 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-30),to:e}}},{label:`Últimos 60 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-60),to:e}}},{label:`Últimos 90 dias`,getRange:()=>{let e=startOfDay(new Date);return{from:addDays(e,-90),to:e}}},{label:`Semana passada`,getRange:()=>{let e=addDays(startOfWeek(new Date),-7);return{from:e,to:addDays(e,6)}}},{label:`Este mês`,getRange:()=>{let e=startOfDay(new Date);return{from:startOfMonth(e),to:e}}},{label:`Mês passado`,getRange:()=>{let e=new Date(new Date().getFullYear(),new Date().getMonth()-1,1);return{from:startOfMonth(e),to:endOfMonth(e)}}}];function DateRangePicker({value:e,defaultValue:t=null,onValueChange:n,onApply:r,onReset:a,open:o,defaultOpen:s=!1,onOpenChange:c,locale:l,placeholder:h=`Selecione um período`,children:g,..._}){let[v,y]=p.useState(t),[b,x]=p.useState(s),S=e!==void 0,C=o!==void 0,w=S?e??null:v,T=C?o:b,[E,D]=p.useState(()=>toDraft(w)),[O,k]=p.useState(()=>getRangeMonth(toDraft(w))),A=p.useCallback(e=>{let t=normalizeDraft(e);D(t);let n=getRangeMonth(t);n&&k(n)},[]),j=p.useCallback(e=>{S||y(e),n?.(e)},[S,n]),M=p.useCallback(e=>{if(e){let e=toDraft(w);D(e),k(getRangeMonth(e))}C||x(e),c?.(e)},[C,c,w]),N=p.useCallback(()=>{let e=toValue(E);j(e),r?.(e),M(!1)},[j,E,r,M]),P=p.useCallback(()=>{D(void 0),j(null),a?.(),M(!1)},[j,a,M]),F=p.useMemo(()=>({value:w,draft:E,month:O,locale:l,placeholder:h,setDraft:A,setMonth:k,apply:N,reset:P}),[N,E,l,O,h,P,A,w]);return d(m.Provider,{value:F,children:d(i,{open:T,onOpenChange:M,..._,children:g??f(u,{children:[d(DateRangePickerTrigger,{}),f(DateRangePickerContent,{children:[d(DateRangePickerPresets,{}),d(DateRangePickerDateFields,{}),d(DateRangePickerCalendar,{}),d(DateRangePickerActions,{})]})]})})})}function DateRangePickerTrigger({className:n,children:r,asChild:i=!1,variant:a=`outline`,color:s=`zinc`,type:p=`button`,...m}){return i?d(o,{asChild:!0,children:r}):d(o,{asChild:!0,children:d(t,{type:p,variant:a,color:s,className:e(`min-w-64 justify-between font-normal`,n),...m,children:r??f(u,{children:[d(c,{"data-icon":`inline-start`,className:`size-4 text-muted-foreground`}),d(DateRangePickerValue,{className:`flex-1 text-left`}),d(l,{"data-icon":`inline-end`,className:`size-4 text-muted-foreground`})]})})})}function DateRangePickerValue({className:t,placeholder:n,...r}){let{value:i,locale:a,placeholder:o}=useDateRangePicker();return d(`span`,{"data-slot":`date-range-picker-value`,className:e(`truncate`,t),...r,children:formatRange(i,a,n??o)})}function DateRangePickerContent({className:t,align:n=`start`,sideOffset:r=8,children:i,...o}){let s=p.Children.toArray(i),c=s.filter(isDateRangePickerPresetsElement),l=s.filter(e=>!isDateRangePickerPresetsElement(e));return d(a,{align:n,sideOffset:r,className:e(`w-[calc(100vw-(--spacing(4)))] max-w-2xl p-2`,t),...o,children:f(`div`,{"data-slot":`date-range-picker-content`,className:`grid gap-3 md:grid-cols-[10rem_minmax(0,1fr)]`,children:[c,d(`div`,{className:`flex min-w-0 flex-col gap-3`,children:l})]})})}function DateRangePickerPresets({className:t,presets:n=h,...r}){let{draft:i,setDraft:a}=useDateRangePicker(),o=getRelativeDaysValue(i,`today`),s=getRelativeDaysValue(i,`yesterday`);return f(`div`,{"data-slot":`date-range-picker-presets`,className:e(`hidden flex-col border-border pr-3 md:flex md:border-r`,t),...r,children:[n.map(e=>{let t=e.getRange(),n=isSameRange(i,t);return d(DateRangePickerPreset,{type:`button`,selected:n,onClick:()=>a(t),children:e.label},e.label)}),f(`div`,{className:`my-3 flex flex-col gap-2`,children:[d(DateRangePickerRelativeField,{label:`Dias até hoje`,value:o,onValueChange:e=>a(getRelativeDaysRange(e,`today`))}),d(DateRangePickerRelativeField,{label:`Dias até ontem`,value:s,onValueChange:e=>a(getRelativeDaysRange(e,`yesterday`))})]})]})}function DateRangePickerPreset({className:t,selected:n=!1,...r}){return d(`button`,{"data-slot":`date-range-picker-preset`,"data-selected":n,className:e(`flex h-8.5 w-full items-center border-l-3 border-border bg-transparent px-2 text-left text-sm text-foreground transition-colors outline-none`,`hover:border-primary hover:bg-primary-50 hover:text-primary-700 dark:hover:bg-primary-950 dark:hover:text-primary-300`,`focus-visible:border-primary focus-visible:ring-3 focus-visible:ring-ring/50`,`data-[selected=true]:border-primary data-[selected=true]:bg-primary-50 data-[selected=true]:text-primary-700 dark:data-[selected=true]:bg-primary-950 dark:data-[selected=true]:text-primary-300`,t),"aria-pressed":n,...r})}function DateRangePickerRelativeField({label:e,value:t,onValueChange:n}){let i=p.useId(),[a,o]=p.useState(()=>formatRelativeInputValue(t));return p.useEffect(()=>{o(formatRelativeInputValue(t))},[t]),f(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[d(r,{id:i,type:`number`,name:e,min:1,step:1,value:a,className:`h-7 w-9 rounded-md px-1 text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`,"aria-label":e,onChange:e=>{let t=e.target.value;if(o(t),t===``)return;let r=parsePositiveInteger(t);r&&n(r)}}),d(`label`,{htmlFor:i,children:e})]})}function DateRangePickerCalendar({className:t,showOutsideDays:r=!1,onMonthChange:i,...a}){let{draft:o,locale:s,month:c,setDraft:l,setMonth:u}=useDateRangePicker();return d(n,{mode:`range`,numberOfMonths:2,showOutsideDays:r,month:c,onMonthChange:e=>{u(e),i?.(e)},selected:o,onSelect:l,locale:s,className:e(`mx-auto bg-transparent p-0`,t),...a})}function DateRangePickerDateFields({className:t,...n}){let{draft:i,setDraft:a}=useDateRangePicker();return f(`div`,{"data-slot":`date-range-picker-date-fields`,className:e(`pb-2 border-b flex justify-between gap-2 flex-wrap flex-col sm:flex-row sm:items-center`,t),...n,children:[d(r,{type:`date`,value:formatInputDate(i?.from),className:`sm:w-max`,onChange:e=>{if(e.target.value===``){a(void 0);return}let t=parseInputDate(e.target.value);t&&a(normalizeDraft({from:t,to:i?.to}))}}),d(s,{className:`size-4 text-primary hidden sm:block`}),d(r,{type:`date`,value:formatInputDate(i?.to),className:`sm:w-max`,onChange:e=>{if(e.target.value===``){a(void 0);return}let t=parseInputDate(e.target.value);t&&a(normalizeDraft({from:i?.from,to:t}))}})]})}function DateRangePickerActions({className:t,children:n,...r}){return d(`div`,{"data-slot":`date-range-picker-actions`,className:e(`flex items-center gap-2 mt-auto`,t),...r,children:n??f(u,{children:[d(DateRangePickerReset,{}),d(DateRangePickerApply,{})]})})}function DateRangePickerApply({children:n=`Aplicar`,onClick:r,className:i,...a}){let{apply:o}=useDateRangePicker();return d(t,{size:`sm`,className:e(`flex-1`,i),onClick:e=>{r?.(e),e.defaultPrevented||o()},...a,children:n})}function DateRangePickerReset({children:n=`Resetar`,onClick:r,variant:i=`outline`,color:a=`zinc`,className:o,...s}){let{reset:c}=useDateRangePicker();return d(t,{size:`sm`,className:e(`flex-1`,o),variant:i,color:a,onClick:e=>{r?.(e),e.defaultPrevented||c()},...s,children:n})}function useDateRangePicker(){let e=p.useContext(m);if(!e)throw Error(`DateRangePicker components must be used within DateRangePicker.`);return e}function isDateRangePickerPresetsElement(e){return p.isValidElement(e)&&e.type===DateRangePickerPresets}function toDraft(e){return normalizeDraft(e??void 0)}function toValue(e){return normalizeDraft(e)??null}function getRangeMonth(e){return startOfDay(e?.from??e?.to??new Date)}function normalizeDraft(e){if(e?.from||e?.to)return e.from&&e.to&&e.from>e.to?{from:startOfDay(e.to),to:startOfDay(e.from)}:{from:e.from?startOfDay(e.from):void 0,to:e.to?startOfDay(e.to):void 0}}function formatRange(e,t,n){return!e?.from&&!e?.to?n:e.from&&e.to?`${formatDisplayDate(e.from,t)} - ${formatDisplayDate(e.to,t)}`:formatDisplayDate(e.from??e.to,t)}function formatDisplayDate(e,t){return e?new Intl.DateTimeFormat(t?.code??`pt-BR`,{day:`2-digit`,month:`2-digit`,year:`numeric`}).format(e):``}function formatInputDate(e){return e?`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`:``}function parseInputDate(e){if(!e)return;let t=/^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})$/.exec(e);if(!t?.groups)return;let n=Number(t.groups.year),r=Number(t.groups.month),i=Number(t.groups.day),a=new Date(n,r-1,i);if(a.getFullYear()===n&&a.getMonth()===r-1&&a.getDate()===i)return a}function parsePositiveInteger(e){if(!e)return;let t=Number(e);if(!(!Number.isInteger(t)||t<1))return t}function formatRelativeInputValue(e){return e?String(e):``}function getRelativeDaysRange(e,t){let n=startOfDay(new Date),r=t===`today`?addDays(n,-1):addDays(n,-2);return{from:addDays(r,-e+1),to:r}}function getRelativeDaysValue(e,t){if(!e?.from||!e.to)return;let n=startOfDay(new Date),r=t===`today`?addDays(n,-1):addDays(n,-2);if(!isSameDay(e.to,r))return;let i=differenceInCalendarDays(r,startOfDay(e.from))+1;return i>0?i:void 0}function isSameRange(e,t){return isSameDay(e?.from,t?.from)&&isSameDay(e?.to,t?.to)}function isSameDay(e,t){return!e||!t?e===t:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function startOfDay(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function startOfWeek(e){let t=startOfDay(e);return addDays(t,-t.getDay())}function startOfMonth(e){return new Date(e.getFullYear(),e.getMonth(),1)}function endOfMonth(e){return new Date(e.getFullYear(),e.getMonth()+1,0)}function differenceInCalendarDays(e,t){return Math.round((startOfDay(e).getTime()-startOfDay(t).getTime())/864e5)}function addDays(e,t){let n=startOfDay(e);return n.setDate(n.getDate()+t),n}export{DateRangePicker,DateRangePickerActions,DateRangePickerApply,DateRangePickerCalendar,DateRangePickerContent,DateRangePickerDateFields,DateRangePickerPreset,DateRangePickerPresets,DateRangePickerReset,DateRangePickerTrigger,DateRangePickerValue};
2
2
  //# sourceMappingURL=date-range-picker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-range-picker.js","names":[],"sources":["../../src/components/date-range-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { Locale } from 'react-day-picker'\n\nimport { IconArrowRight, IconCalendar, IconChevronDown } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { Calendar, type DateRange } from './calendar'\nimport { Input } from './input'\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\n\ntype DateRangePickerContextValue = {\n value: DateRange | null\n draft: DateRange | undefined\n month: Date\n locale?: Partial<Locale>\n placeholder: string\n setDraft: (range: DateRange | undefined) => void\n setMonth: (month: Date) => void\n apply: () => void\n reset: () => void\n}\n\nconst DateRangePickerContext = React.createContext<DateRangePickerContextValue | null>(null)\n\nconst defaultPlaceholder = 'Selecione um período'\n\nconst defaultPresetDefinitions = [\n {\n label: 'Hoje',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: today, to: today }\n }\n },\n {\n label: 'Ontem',\n getRange: () => {\n const yesterday = addDays(startOfDay(new Date()), -1)\n return { from: yesterday, to: yesterday }\n }\n },\n {\n label: 'Últimos 7 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -7), to: today }\n }\n },\n {\n label: 'Últimos 15 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -15), to: today }\n }\n },\n {\n label: 'Últimos 30 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -30), to: today }\n }\n },\n {\n label: 'Últimos 60 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -60), to: today }\n }\n },\n {\n label: 'Últimos 90 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -90), to: today }\n }\n },\n {\n label: 'Semana passada',\n getRange: () => {\n const previousWeekStart = addDays(startOfWeek(new Date()), -7)\n return { from: previousWeekStart, to: addDays(previousWeekStart, 6) }\n }\n },\n {\n label: 'Este mês',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: startOfMonth(today), to: today }\n }\n },\n {\n label: 'Mês passado',\n getRange: () => {\n const previousMonth = new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1)\n return { from: startOfMonth(previousMonth), to: endOfMonth(previousMonth) }\n }\n }\n] satisfies DateRangePickerPresetOption[]\n\nexport type DateRangePickerPresetOption = {\n label: string\n getRange: () => DateRange\n}\n\nexport type DateRangePickerProps = Omit<\n React.ComponentProps<typeof Popover>,\n 'open' | 'defaultOpen' | 'onOpenChange'\n> & {\n value?: DateRange | null\n defaultValue?: DateRange | null\n onValueChange?: (range: DateRange | null) => void\n onApply?: (range: DateRange | null) => void\n onReset?: () => void\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n locale?: Partial<Locale>\n placeholder?: string\n}\n\nexport type DateRangePickerTriggerProps = React.ComponentProps<typeof Button> & {\n asChild?: boolean\n}\n\nexport type DateRangePickerValueProps = React.ComponentProps<'span'> & {\n placeholder?: string\n}\n\nexport type DateRangePickerContentProps = React.ComponentProps<typeof PopoverContent>\n\nexport type DateRangePickerPresetsProps = React.ComponentProps<'div'> & {\n presets?: DateRangePickerPresetOption[]\n}\n\nexport type DateRangePickerPresetProps = React.ComponentProps<'button'> & {\n selected?: boolean\n}\n\nexport type DateRangePickerCalendarProps = Omit<\n React.ComponentProps<typeof Calendar>,\n 'mode' | 'numberOfMonths' | 'selected' | 'onSelect' | 'month' | 'defaultMonth'\n>\n\nexport type DateRangePickerDateFieldsProps = React.ComponentProps<'div'>\n\nexport type DateRangePickerActionsProps = React.ComponentProps<'div'>\n\nexport type DateRangePickerApplyProps = React.ComponentProps<typeof Button>\n\nexport type DateRangePickerResetProps = React.ComponentProps<typeof Button>\n\nfunction DateRangePicker({\n value: valueProp,\n defaultValue = null,\n onValueChange,\n onApply,\n onReset,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n locale,\n placeholder = defaultPlaceholder,\n children,\n ...props\n}: DateRangePickerProps) {\n const [uncontrolledValue, setUncontrolledValue] = React.useState<DateRange | null>(defaultValue)\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n\n const isValueControlled = valueProp !== undefined\n const isOpenControlled = openProp !== undefined\n const value = isValueControlled ? (valueProp ?? null) : uncontrolledValue\n const open = isOpenControlled ? openProp : uncontrolledOpen\n\n const [draft, setDraft] = React.useState<DateRange | undefined>(() => toDraft(value))\n const [month, setMonth] = React.useState<Date>(() => getRangeMonth(toDraft(value)))\n\n const updateDraft = React.useCallback((nextDraft: DateRange | undefined) => {\n const normalizedDraft = normalizeDraft(nextDraft)\n setDraft(normalizedDraft)\n\n const nextMonth = getRangeMonth(normalizedDraft)\n if (nextMonth) {\n setMonth(nextMonth)\n }\n }, [])\n\n const commitValue = React.useCallback(\n (nextValue: DateRange | null) => {\n if (!isValueControlled) {\n setUncontrolledValue(nextValue)\n }\n\n onValueChange?.(nextValue)\n },\n [isValueControlled, onValueChange]\n )\n\n const setOpen = React.useCallback(\n (nextOpen: boolean) => {\n if (nextOpen) {\n const nextDraft = toDraft(value)\n setDraft(nextDraft)\n setMonth(getRangeMonth(nextDraft))\n }\n\n if (!isOpenControlled) {\n setUncontrolledOpen(nextOpen)\n }\n\n onOpenChange?.(nextOpen)\n },\n [isOpenControlled, onOpenChange, value]\n )\n\n const apply = React.useCallback(() => {\n const nextValue = toValue(draft)\n commitValue(nextValue)\n onApply?.(nextValue)\n setOpen(false)\n }, [commitValue, draft, onApply, setOpen])\n\n const reset = React.useCallback(() => {\n setDraft(undefined)\n commitValue(null)\n onReset?.()\n setOpen(false)\n }, [commitValue, onReset, setOpen])\n\n const context = React.useMemo<DateRangePickerContextValue>(\n () => ({\n value,\n draft,\n month,\n locale,\n placeholder,\n setDraft: updateDraft,\n setMonth,\n apply,\n reset\n }),\n [apply, draft, locale, month, placeholder, reset, updateDraft, value]\n )\n\n return (\n <DateRangePickerContext.Provider value={context}>\n <Popover open={open} onOpenChange={setOpen} {...props}>\n {children ?? (\n <>\n <DateRangePickerTrigger />\n <DateRangePickerContent>\n <DateRangePickerPresets />\n <DateRangePickerDateFields />\n <DateRangePickerCalendar />\n <DateRangePickerActions />\n </DateRangePickerContent>\n </>\n )}\n </Popover>\n </DateRangePickerContext.Provider>\n )\n}\n\nfunction DateRangePickerTrigger({\n className,\n children,\n asChild = false,\n variant = 'outline',\n color = 'zinc',\n type = 'button',\n ...props\n}: DateRangePickerTriggerProps) {\n if (asChild) {\n return <PopoverTrigger asChild>{children}</PopoverTrigger>\n }\n\n return (\n <PopoverTrigger asChild>\n <Button\n type={type}\n variant={variant}\n color={color}\n className={cn('min-w-64 justify-between font-normal', className)}\n {...props}\n >\n {children ?? (\n <>\n <IconCalendar data-icon=\"inline-start\" className=\"size-4 text-muted-foreground\" />\n <DateRangePickerValue className=\"flex-1 text-left\" />\n <IconChevronDown data-icon=\"inline-end\" className=\"size-4 text-muted-foreground\" />\n </>\n )}\n </Button>\n </PopoverTrigger>\n )\n}\n\nfunction DateRangePickerValue({ className, placeholder, ...props }: DateRangePickerValueProps) {\n const { value, locale, placeholder: contextPlaceholder } = useDateRangePicker()\n\n return (\n <span data-slot=\"date-range-picker-value\" className={cn('truncate', className)} {...props}>\n {formatRange(value, locale, placeholder ?? contextPlaceholder)}\n </span>\n )\n}\n\nfunction DateRangePickerContent({\n className,\n align = 'start',\n sideOffset = 8,\n children,\n ...props\n}: DateRangePickerContentProps) {\n const childArray = React.Children.toArray(children)\n const presets = childArray.filter(isDateRangePickerPresetsElement)\n const content = childArray.filter((child) => !isDateRangePickerPresetsElement(child))\n\n return (\n <PopoverContent\n align={align}\n sideOffset={sideOffset}\n className={cn('w-[calc(100vw-(--spacing(4)))] max-w-2xl p-2', className)}\n {...props}\n >\n <div data-slot=\"date-range-picker-content\" className=\"grid gap-3 md:grid-cols-[10rem_minmax(0,1fr)]\">\n {presets}\n <div className=\"flex min-w-0 flex-col gap-3\">{content}</div>\n </div>\n </PopoverContent>\n )\n}\n\nfunction DateRangePickerPresets({\n className,\n presets = defaultPresetDefinitions,\n ...props\n}: DateRangePickerPresetsProps) {\n const { draft, setDraft } = useDateRangePicker()\n const todayRelativeValue = getRelativeDaysValue(draft, 'today')\n const yesterdayRelativeValue = getRelativeDaysValue(draft, 'yesterday')\n\n return (\n <div\n data-slot=\"date-range-picker-presets\"\n className={cn('hidden flex-col border-border pr-3 md:flex md:border-r', className)}\n {...props}\n >\n {presets.map((preset) => {\n const range = preset.getRange()\n const selected = isSameRange(draft, range)\n\n return (\n <DateRangePickerPreset key={preset.label} type=\"button\" selected={selected} onClick={() => setDraft(range)}>\n {preset.label}\n </DateRangePickerPreset>\n )\n })}\n\n <div className=\"my-3 flex flex-col gap-2\">\n <DateRangePickerRelativeField\n label=\"Dias até hoje\"\n value={todayRelativeValue}\n onValueChange={(days) => setDraft(getRelativeDaysRange(days, 'today'))}\n />\n <DateRangePickerRelativeField\n label=\"Dias até ontem\"\n value={yesterdayRelativeValue}\n onValueChange={(days) => setDraft(getRelativeDaysRange(days, 'yesterday'))}\n />\n </div>\n </div>\n )\n}\n\nfunction DateRangePickerPreset({ className, selected = false, ...props }: DateRangePickerPresetProps) {\n return (\n <button\n data-slot=\"date-range-picker-preset\"\n data-selected={selected}\n className={cn(\n 'flex h-8.5 w-full items-center border-l-3 border-border bg-transparent px-2 text-left text-sm text-foreground transition-colors outline-none',\n 'hover:border-primary hover:bg-primary-50 hover:text-primary-700 dark:hover:bg-primary-950 dark:hover:text-primary-300',\n 'focus-visible:border-primary focus-visible:ring-3 focus-visible:ring-ring/50',\n 'data-[selected=true]:border-primary data-[selected=true]:bg-primary-50 data-[selected=true]:text-primary-700 dark:data-[selected=true]:bg-primary-950 dark:data-[selected=true]:text-primary-300',\n className\n )}\n aria-pressed={selected}\n {...props}\n />\n )\n}\n\nfunction DateRangePickerRelativeField({\n label,\n value,\n onValueChange\n}: {\n label: string\n value: number | undefined\n onValueChange: (days: number) => void\n}) {\n const id = React.useId()\n const [inputValue, setInputValue] = React.useState(() => formatRelativeInputValue(value))\n\n React.useEffect(() => {\n setInputValue(formatRelativeInputValue(value))\n }, [value])\n\n return (\n <div className=\"flex items-center gap-2 text-sm text-foreground\">\n <Input\n id={id}\n type=\"number\"\n name={label}\n min={1}\n step={1}\n value={inputValue}\n className=\"h-7 w-9 rounded-md px-1 text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\"\n aria-label={label}\n onChange={(event) => {\n const nextValue = event.target.value\n setInputValue(nextValue)\n\n if (nextValue === '') return\n\n const days = parsePositiveInteger(nextValue)\n if (!days) return\n onValueChange(days)\n }}\n />\n <label htmlFor={id}>{label}</label>\n </div>\n )\n}\n\nfunction DateRangePickerCalendar({\n className,\n showOutsideDays = false,\n onMonthChange,\n ...props\n}: DateRangePickerCalendarProps) {\n const { draft, locale, month, setDraft, setMonth } = useDateRangePicker()\n\n return (\n <Calendar\n mode=\"range\"\n numberOfMonths={2}\n showOutsideDays={showOutsideDays}\n month={month}\n onMonthChange={(nextMonth) => {\n setMonth(nextMonth)\n onMonthChange?.(nextMonth)\n }}\n selected={draft}\n onSelect={setDraft}\n locale={locale}\n className={cn('mx-auto bg-transparent p-0', className)}\n {...props}\n />\n )\n}\n\nfunction DateRangePickerDateFields({ className, ...props }: DateRangePickerDateFieldsProps) {\n const { draft, setDraft } = useDateRangePicker()\n\n return (\n <div\n data-slot=\"date-range-picker-date-fields\"\n className={cn(\n 'pb-2 border-b flex justify-between gap-2 flex-wrap flex-col sm:flex-row sm:items-center',\n className\n )}\n {...props}\n >\n <Input\n type=\"date\"\n value={formatInputDate(draft?.from)}\n className=\"sm:w-max\"\n onChange={(event) => {\n if (event.target.value === '') {\n setDraft(undefined)\n return\n }\n\n const date = parseInputDate(event.target.value)\n if (!date) return\n setDraft(normalizeDraft({ from: date, to: draft?.to }))\n }}\n />\n <IconArrowRight className=\"size-4 text-primary hidden sm:block\" />\n <Input\n type=\"date\"\n value={formatInputDate(draft?.to)}\n className=\"sm:w-max\"\n onChange={(event) => {\n if (event.target.value === '') {\n setDraft(undefined)\n return\n }\n\n const date = parseInputDate(event.target.value)\n if (!date) return\n setDraft(normalizeDraft({ from: draft?.from, to: date }))\n }}\n />\n </div>\n )\n}\n\nfunction DateRangePickerActions({ className, children, ...props }: DateRangePickerActionsProps) {\n return (\n <div data-slot=\"date-range-picker-actions\" className={cn('flex items-center gap-2 mt-auto', className)} {...props}>\n {children ?? (\n <>\n <DateRangePickerReset />\n <DateRangePickerApply />\n </>\n )}\n </div>\n )\n}\n\nfunction DateRangePickerApply({ children = 'Aplicar', onClick, className, ...props }: DateRangePickerApplyProps) {\n const { apply } = useDateRangePicker()\n\n return (\n <Button\n size=\"sm\"\n className={cn('flex-1', className)}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented) {\n apply()\n }\n }}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nfunction DateRangePickerReset({\n children = 'Resetar',\n onClick,\n variant = 'outline',\n color = 'zinc',\n className,\n ...props\n}: DateRangePickerResetProps) {\n const { reset } = useDateRangePicker()\n\n return (\n <Button\n size=\"sm\"\n className={cn('flex-1', className)}\n variant={variant}\n color={color}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented) {\n reset()\n }\n }}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nfunction useDateRangePicker() {\n const context = React.useContext(DateRangePickerContext)\n\n if (!context) {\n throw new Error('DateRangePicker components must be used within DateRangePicker.')\n }\n\n return context\n}\n\nfunction isDateRangePickerPresetsElement(child: React.ReactNode) {\n return React.isValidElement(child) && child.type === DateRangePickerPresets\n}\n\nfunction toDraft(range: DateRange | null | undefined) {\n return normalizeDraft(range ?? undefined)\n}\n\nfunction toValue(range: DateRange | undefined): DateRange | null {\n return normalizeDraft(range) ?? null\n}\n\nfunction getRangeMonth(range: DateRange | undefined) {\n return startOfDay(range?.from ?? range?.to ?? new Date())\n}\n\nfunction normalizeDraft(range: DateRange | undefined): DateRange | undefined {\n if (!range?.from && !range?.to) return undefined\n\n if (range.from && range.to && range.from > range.to) {\n return { from: startOfDay(range.to), to: startOfDay(range.from) }\n }\n\n return {\n from: range.from ? startOfDay(range.from) : undefined,\n to: range.to ? startOfDay(range.to) : undefined\n }\n}\n\nfunction formatRange(range: DateRange | null | undefined, locale: Partial<Locale> | undefined, placeholder: string) {\n if (!range?.from && !range?.to) return placeholder\n\n if (range.from && range.to) {\n return `${formatDisplayDate(range.from, locale)} - ${formatDisplayDate(range.to, locale)}`\n }\n\n return formatDisplayDate(range.from ?? range.to, locale)\n}\n\nfunction formatDisplayDate(date: Date | undefined, locale: Partial<Locale> | undefined) {\n if (!date) return ''\n\n return new Intl.DateTimeFormat(locale?.code ?? 'pt-BR', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric'\n }).format(date)\n}\n\nfunction formatInputDate(date: Date | undefined) {\n if (!date) return ''\n\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const day = String(date.getDate()).padStart(2, '0')\n\n return `${year}-${month}-${day}`\n}\n\nfunction parseInputDate(value: string) {\n if (!value) return undefined\n\n const match = /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/.exec(value)\n if (!match?.groups) return undefined\n\n const year = Number(match.groups.year)\n const month = Number(match.groups.month)\n const day = Number(match.groups.day)\n const date = new Date(year, month - 1, day)\n\n if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {\n return undefined\n }\n\n return date\n}\n\nfunction parsePositiveInteger(value: string) {\n if (!value) return undefined\n\n const days = Number(value)\n if (!Number.isInteger(days) || days < 1) return undefined\n\n return days\n}\n\nfunction formatRelativeInputValue(value: number | undefined) {\n return value ? String(value) : ''\n}\n\nfunction getRelativeDaysRange(days: number, target: 'today' | 'yesterday'): DateRange {\n const today = startOfDay(new Date())\n const targetDate = target === 'today' ? addDays(today, -1) : addDays(today, -2)\n\n return {\n from: addDays(targetDate, -days + 1),\n to: targetDate\n }\n}\n\nfunction getRelativeDaysValue(range: DateRange | undefined, target: 'today' | 'yesterday') {\n if (!range?.from || !range.to) return undefined\n\n const today = startOfDay(new Date())\n const targetDate = target === 'today' ? addDays(today, -1) : addDays(today, -2)\n if (!isSameDay(range.to, targetDate)) return undefined\n\n const days = differenceInCalendarDays(targetDate, startOfDay(range.from)) + 1\n return days > 0 ? days : undefined\n}\n\nfunction isSameRange(left: DateRange | undefined, right: DateRange | undefined) {\n return isSameDay(left?.from, right?.from) && isSameDay(left?.to, right?.to)\n}\n\nfunction isSameDay(left: Date | undefined, right: Date | undefined) {\n if (!left || !right) return left === right\n\n return (\n left.getFullYear() === right.getFullYear() &&\n left.getMonth() === right.getMonth() &&\n left.getDate() === right.getDate()\n )\n}\n\nfunction startOfDay(date: Date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nfunction startOfWeek(date: Date) {\n const day = startOfDay(date)\n return addDays(day, -day.getDay())\n}\n\nfunction startOfMonth(date: Date) {\n return new Date(date.getFullYear(), date.getMonth(), 1)\n}\n\nfunction endOfMonth(date: Date) {\n return new Date(date.getFullYear(), date.getMonth() + 1, 0)\n}\n\nfunction differenceInCalendarDays(left: Date, right: Date) {\n const millisecondsPerDay = 24 * 60 * 60 * 1000\n return Math.round((startOfDay(left).getTime() - startOfDay(right).getTime()) / millisecondsPerDay)\n}\n\nfunction addDays(date: Date, amount: number) {\n const nextDate = startOfDay(date)\n nextDate.setDate(nextDate.getDate() + amount)\n return nextDate\n}\n\nexport {\n type DateRange,\n DateRangePicker,\n DateRangePickerActions,\n DateRangePickerApply,\n DateRangePickerCalendar,\n DateRangePickerContent,\n DateRangePickerDateFields,\n DateRangePickerPreset,\n DateRangePickerPresets,\n DateRangePickerReset,\n DateRangePickerTrigger,\n DateRangePickerValue\n}\n"],"mappings":"icAuBA,MAAM,EAAyB,EAAM,cAAkD,IAAI,EAIrF,EAA2B,CAC/B,CACE,MAAO,OACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,EAAO,GAAI,CAAM,CAClC,CACF,EACA,CACE,MAAO,QACP,aAAgB,CACd,IAAM,EAAY,QAAQ,WAAW,IAAI,IAAM,EAAG,EAAE,EACpD,MAAO,CAAE,KAAM,EAAW,GAAI,CAAU,CAC1C,CACF,EACA,CACE,MAAO,iBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,EAAE,EAAG,GAAI,CAAM,CAC/C,CACF,EACA,CACE,MAAO,kBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,GAAG,EAAG,GAAI,CAAM,CAChD,CACF,EACA,CACE,MAAO,kBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,GAAG,EAAG,GAAI,CAAM,CAChD,CACF,EACA,CACE,MAAO,kBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,GAAG,EAAG,GAAI,CAAM,CAChD,CACF,EACA,CACE,MAAO,kBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,GAAG,EAAG,GAAI,CAAM,CAChD,CACF,EACA,CACE,MAAO,iBACP,aAAgB,CACd,IAAM,EAAoB,QAAQ,YAAY,IAAI,IAAM,EAAG,EAAE,EAC7D,MAAO,CAAE,KAAM,EA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,EAAK,QAAQ,CAAC,CACrE,CAEA,SAAS,YAAY,EAAY,CAC/B,IAAM,EAAM,WAAW,CAAI,EAC3B,OAAO,QAAQ,EAAK,CAAC,EAAI,OAAO,CAAC,CACnC,CAEA,SAAS,aAAa,EAAY,CAChC,OAAO,IAAI,KAAK,EAAK,YAAY,EAAG,EAAK,SAAS,EAAG,CAAC,CACxD,CAEA,SAAS,WAAW,EAAY,CAC9B,OAAO,IAAI,KAAK,EAAK,YAAY,EAAG,EAAK,SAAS,EAAI,EAAG,CAAC,CAC5D,CAEA,SAAS,yBAAyB,EAAY,EAAa,CAEzD,OAAO,KAAK,OAAO,WAAW,CAAI,CAAC,CAAC,QAAQ,EAAI,WAAW,CAAK,CAAC,CAAC,QAAQ,GAAK,KAAkB,CACnG,CAEA,SAAS,QAAQ,EAAY,EAAgB,CAC3C,IAAM,EAAW,WAAW,CAAI,EAEhC,OADA,EAAS,QAAQ,EAAS,QAAQ,EAAI,CAAM,EACrC,CACT"}
1
+ {"version":3,"file":"date-range-picker.js","names":[],"sources":["../../src/components/date-range-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport type { Locale } from 'react-day-picker'\n\nimport { IconArrowRight, IconCalendar, IconChevronDown } from '@tabler/icons-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { Calendar, type DateRange } from './calendar'\nimport { Input } from './input'\nimport { Popover, PopoverContent, PopoverTrigger } from './popover'\n\ntype DateRangePickerContextValue = {\n value: DateRange | null\n draft: DateRange | undefined\n month: Date\n locale?: Partial<Locale>\n placeholder: string\n setDraft: (range: DateRange | undefined) => void\n setMonth: (month: Date) => void\n apply: () => void\n reset: () => void\n}\n\nconst DateRangePickerContext = React.createContext<DateRangePickerContextValue | null>(null)\n\nconst defaultPlaceholder = 'Selecione um período'\n\nconst defaultPresetDefinitions = [\n {\n label: 'Hoje',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: today, to: today }\n }\n },\n {\n label: 'Ontem',\n getRange: () => {\n const yesterday = addDays(startOfDay(new Date()), -1)\n return { from: yesterday, to: yesterday }\n }\n },\n {\n label: 'Últimos 7 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -7), to: today }\n }\n },\n {\n label: 'Últimos 15 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -15), to: today }\n }\n },\n {\n label: 'Últimos 30 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -30), to: today }\n }\n },\n {\n label: 'Últimos 60 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -60), to: today }\n }\n },\n {\n label: 'Últimos 90 dias',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: addDays(today, -90), to: today }\n }\n },\n {\n label: 'Semana passada',\n getRange: () => {\n const previousWeekStart = addDays(startOfWeek(new Date()), -7)\n return { from: previousWeekStart, to: addDays(previousWeekStart, 6) }\n }\n },\n {\n label: 'Este mês',\n getRange: () => {\n const today = startOfDay(new Date())\n return { from: startOfMonth(today), to: today }\n }\n },\n {\n label: 'Mês passado',\n getRange: () => {\n const previousMonth = new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1)\n return { from: startOfMonth(previousMonth), to: endOfMonth(previousMonth) }\n }\n }\n] satisfies DateRangePickerPresetOption[]\n\nexport type DateRangePickerPresetOption = {\n label: string\n getRange: () => DateRange\n}\n\nexport type DateRangePickerProps = Omit<\n React.ComponentProps<typeof Popover>,\n 'open' | 'defaultOpen' | 'onOpenChange'\n> & {\n value?: DateRange | null\n defaultValue?: DateRange | null\n onValueChange?: (range: DateRange | null) => void\n onApply?: (range: DateRange | null) => void\n onReset?: () => void\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n locale?: Partial<Locale>\n placeholder?: string\n}\n\nexport type DateRangePickerTriggerProps = React.ComponentProps<typeof Button> & {\n asChild?: boolean\n}\n\nexport type DateRangePickerValueProps = React.ComponentProps<'span'> & {\n placeholder?: string\n}\n\nexport type DateRangePickerContentProps = React.ComponentProps<typeof PopoverContent>\n\nexport type DateRangePickerPresetsProps = React.ComponentProps<'div'> & {\n presets?: DateRangePickerPresetOption[]\n}\n\nexport type DateRangePickerPresetProps = React.ComponentProps<'button'> & {\n selected?: boolean\n}\n\nexport type DateRangePickerCalendarProps = Omit<\n React.ComponentProps<typeof Calendar>,\n 'mode' | 'numberOfMonths' | 'selected' | 'onSelect' | 'month' | 'defaultMonth'\n>\n\nexport type DateRangePickerDateFieldsProps = React.ComponentProps<'div'>\n\nexport type DateRangePickerActionsProps = React.ComponentProps<'div'>\n\nexport type DateRangePickerApplyProps = React.ComponentProps<typeof Button>\n\nexport type DateRangePickerResetProps = React.ComponentProps<typeof Button>\n\nfunction DateRangePicker({\n value: valueProp,\n defaultValue = null,\n onValueChange,\n onApply,\n onReset,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n locale,\n placeholder = defaultPlaceholder,\n children,\n ...props\n}: DateRangePickerProps) {\n const [uncontrolledValue, setUncontrolledValue] = React.useState<DateRange | null>(defaultValue)\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen)\n\n const isValueControlled = valueProp !== undefined\n const isOpenControlled = openProp !== undefined\n const value = isValueControlled ? (valueProp ?? null) : uncontrolledValue\n const open = isOpenControlled ? openProp : uncontrolledOpen\n\n const [draft, setDraft] = React.useState<DateRange | undefined>(() => toDraft(value))\n const [month, setMonth] = React.useState<Date>(() => getRangeMonth(toDraft(value)))\n\n const updateDraft = React.useCallback((nextDraft: DateRange | undefined) => {\n const normalizedDraft = normalizeDraft(nextDraft)\n setDraft(normalizedDraft)\n\n const nextMonth = getRangeMonth(normalizedDraft)\n if (nextMonth) {\n setMonth(nextMonth)\n }\n }, [])\n\n const commitValue = React.useCallback(\n (nextValue: DateRange | null) => {\n if (!isValueControlled) {\n setUncontrolledValue(nextValue)\n }\n\n onValueChange?.(nextValue)\n },\n [isValueControlled, onValueChange]\n )\n\n const setOpen = React.useCallback(\n (nextOpen: boolean) => {\n if (nextOpen) {\n const nextDraft = toDraft(value)\n setDraft(nextDraft)\n setMonth(getRangeMonth(nextDraft))\n }\n\n if (!isOpenControlled) {\n setUncontrolledOpen(nextOpen)\n }\n\n onOpenChange?.(nextOpen)\n },\n [isOpenControlled, onOpenChange, value]\n )\n\n const apply = React.useCallback(() => {\n const nextValue = toValue(draft)\n commitValue(nextValue)\n onApply?.(nextValue)\n setOpen(false)\n }, [commitValue, draft, onApply, setOpen])\n\n const reset = React.useCallback(() => {\n setDraft(undefined)\n commitValue(null)\n onReset?.()\n setOpen(false)\n }, [commitValue, onReset, setOpen])\n\n const context = React.useMemo<DateRangePickerContextValue>(\n () => ({\n value,\n draft,\n month,\n locale,\n placeholder,\n setDraft: updateDraft,\n setMonth,\n apply,\n reset\n }),\n [apply, draft, locale, month, placeholder, reset, updateDraft, value]\n )\n\n return (\n <DateRangePickerContext.Provider value={context}>\n <Popover open={open} onOpenChange={setOpen} {...props}>\n {children ?? (\n <>\n <DateRangePickerTrigger />\n <DateRangePickerContent>\n <DateRangePickerPresets />\n <DateRangePickerDateFields />\n <DateRangePickerCalendar />\n <DateRangePickerActions />\n </DateRangePickerContent>\n </>\n )}\n </Popover>\n </DateRangePickerContext.Provider>\n )\n}\n\nfunction DateRangePickerTrigger({\n className,\n children,\n asChild = false,\n variant = 'outline',\n color = 'zinc',\n type = 'button',\n ...props\n}: DateRangePickerTriggerProps) {\n if (asChild) {\n return <PopoverTrigger asChild>{children}</PopoverTrigger>\n }\n\n return (\n <PopoverTrigger asChild>\n <Button\n type={type}\n variant={variant}\n color={color}\n className={cn('min-w-64 justify-between font-normal', className)}\n {...props}\n >\n {children ?? (\n <>\n <IconCalendar data-icon=\"inline-start\" className=\"size-4 text-muted-foreground\" />\n <DateRangePickerValue className=\"flex-1 text-left\" />\n <IconChevronDown data-icon=\"inline-end\" className=\"size-4 text-muted-foreground\" />\n </>\n )}\n </Button>\n </PopoverTrigger>\n )\n}\n\nfunction DateRangePickerValue({ className, placeholder, ...props }: DateRangePickerValueProps) {\n const { value, locale, placeholder: contextPlaceholder } = useDateRangePicker()\n\n return (\n <span data-slot=\"date-range-picker-value\" className={cn('truncate', className)} {...props}>\n {formatRange(value, locale, placeholder ?? contextPlaceholder)}\n </span>\n )\n}\n\nfunction DateRangePickerContent({\n className,\n align = 'start',\n sideOffset = 8,\n children,\n ...props\n}: DateRangePickerContentProps) {\n const childArray = React.Children.toArray(children)\n const presets = childArray.filter(isDateRangePickerPresetsElement)\n const content = childArray.filter((child) => !isDateRangePickerPresetsElement(child))\n\n return (\n <PopoverContent\n align={align}\n sideOffset={sideOffset}\n className={cn('w-[calc(100vw-(--spacing(4)))] max-w-2xl p-2', className)}\n {...props}\n >\n <div data-slot=\"date-range-picker-content\" className=\"grid gap-3 md:grid-cols-[10rem_minmax(0,1fr)]\">\n {presets}\n <div className=\"flex min-w-0 flex-col gap-3\">{content}</div>\n </div>\n </PopoverContent>\n )\n}\n\nfunction DateRangePickerPresets({\n className,\n presets = defaultPresetDefinitions,\n ...props\n}: DateRangePickerPresetsProps) {\n const { draft, setDraft } = useDateRangePicker()\n const todayRelativeValue = getRelativeDaysValue(draft, 'today')\n const yesterdayRelativeValue = getRelativeDaysValue(draft, 'yesterday')\n\n return (\n <div\n data-slot=\"date-range-picker-presets\"\n className={cn('hidden flex-col border-border pr-3 md:flex md:border-r', className)}\n {...props}\n >\n {presets.map((preset) => {\n const range = preset.getRange()\n const selected = isSameRange(draft, range)\n\n return (\n <DateRangePickerPreset key={preset.label} type=\"button\" selected={selected} onClick={() => setDraft(range)}>\n {preset.label}\n </DateRangePickerPreset>\n )\n })}\n\n <div className=\"my-3 flex flex-col gap-2\">\n <DateRangePickerRelativeField\n label=\"Dias até hoje\"\n value={todayRelativeValue}\n onValueChange={(days) => setDraft(getRelativeDaysRange(days, 'today'))}\n />\n <DateRangePickerRelativeField\n label=\"Dias até ontem\"\n value={yesterdayRelativeValue}\n onValueChange={(days) => setDraft(getRelativeDaysRange(days, 'yesterday'))}\n />\n </div>\n </div>\n )\n}\n\nfunction DateRangePickerPreset({ className, selected = false, ...props }: DateRangePickerPresetProps) {\n return (\n <button\n data-slot=\"date-range-picker-preset\"\n data-selected={selected}\n className={cn(\n 'flex h-8.5 w-full items-center border-l-3 border-border bg-transparent px-2 text-left text-sm text-foreground transition-colors outline-none',\n 'hover:border-primary hover:bg-primary-50 hover:text-primary-700 dark:hover:bg-primary-950 dark:hover:text-primary-300',\n 'focus-visible:border-primary focus-visible:ring-3 focus-visible:ring-ring/50',\n 'data-[selected=true]:border-primary data-[selected=true]:bg-primary-50 data-[selected=true]:text-primary-700 dark:data-[selected=true]:bg-primary-950 dark:data-[selected=true]:text-primary-300',\n className\n )}\n aria-pressed={selected}\n {...props}\n />\n )\n}\n\nfunction DateRangePickerRelativeField({\n label,\n value,\n onValueChange\n}: {\n label: string\n value: number | undefined\n onValueChange: (days: number) => void\n}) {\n const id = React.useId()\n const [inputValue, setInputValue] = React.useState(() => formatRelativeInputValue(value))\n\n React.useEffect(() => {\n setInputValue(formatRelativeInputValue(value))\n }, [value])\n\n return (\n <div className=\"flex items-center gap-2 text-sm text-foreground\">\n <Input\n id={id}\n type=\"number\"\n name={label}\n min={1}\n step={1}\n value={inputValue}\n className=\"h-7 w-9 rounded-md px-1 text-center [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\"\n aria-label={label}\n onChange={(event) => {\n const nextValue = event.target.value\n setInputValue(nextValue)\n\n if (nextValue === '') return\n\n const days = parsePositiveInteger(nextValue)\n if (!days) return\n onValueChange(days)\n }}\n />\n <label htmlFor={id}>{label}</label>\n </div>\n )\n}\n\nfunction DateRangePickerCalendar({\n className,\n showOutsideDays = false,\n onMonthChange,\n ...props\n}: DateRangePickerCalendarProps) {\n const { draft, locale, month, setDraft, setMonth } = useDateRangePicker()\n\n return (\n <Calendar\n mode=\"range\"\n numberOfMonths={2}\n showOutsideDays={showOutsideDays}\n month={month}\n onMonthChange={(nextMonth) => {\n setMonth(nextMonth)\n onMonthChange?.(nextMonth)\n }}\n selected={draft}\n onSelect={setDraft}\n locale={locale}\n className={cn('mx-auto bg-transparent p-0', className)}\n {...props}\n />\n )\n}\n\nfunction DateRangePickerDateFields({ className, ...props }: DateRangePickerDateFieldsProps) {\n const { draft, setDraft } = useDateRangePicker()\n\n return (\n <div\n data-slot=\"date-range-picker-date-fields\"\n className={cn(\n 'pb-2 border-b flex justify-between gap-2 flex-wrap flex-col sm:flex-row sm:items-center',\n className\n )}\n {...props}\n >\n <Input\n type=\"date\"\n value={formatInputDate(draft?.from)}\n className=\"sm:w-max\"\n onChange={(event) => {\n if (event.target.value === '') {\n setDraft(undefined)\n return\n }\n\n const date = parseInputDate(event.target.value)\n if (!date) return\n setDraft(normalizeDraft({ from: date, to: draft?.to }))\n }}\n />\n <IconArrowRight className=\"size-4 text-primary hidden sm:block\" />\n <Input\n type=\"date\"\n value={formatInputDate(draft?.to)}\n className=\"sm:w-max\"\n onChange={(event) => {\n if (event.target.value === '') {\n setDraft(undefined)\n return\n }\n\n const date = parseInputDate(event.target.value)\n if (!date) return\n setDraft(normalizeDraft({ from: draft?.from, to: date }))\n }}\n />\n </div>\n )\n}\n\nfunction DateRangePickerActions({ className, children, ...props }: DateRangePickerActionsProps) {\n return (\n <div data-slot=\"date-range-picker-actions\" className={cn('flex items-center gap-2 mt-auto', className)} {...props}>\n {children ?? (\n <>\n <DateRangePickerReset />\n <DateRangePickerApply />\n </>\n )}\n </div>\n )\n}\n\nfunction DateRangePickerApply({ children = 'Aplicar', onClick, className, ...props }: DateRangePickerApplyProps) {\n const { apply } = useDateRangePicker()\n\n return (\n <Button\n size=\"sm\"\n className={cn('flex-1', className)}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented) {\n apply()\n }\n }}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nfunction DateRangePickerReset({\n children = 'Resetar',\n onClick,\n variant = 'outline',\n color = 'zinc',\n className,\n ...props\n}: DateRangePickerResetProps) {\n const { reset } = useDateRangePicker()\n\n return (\n <Button\n size=\"sm\"\n className={cn('flex-1', className)}\n variant={variant}\n color={color}\n onClick={(event) => {\n onClick?.(event)\n if (!event.defaultPrevented) {\n reset()\n }\n }}\n {...props}\n >\n {children}\n </Button>\n )\n}\n\nfunction useDateRangePicker() {\n const context = React.useContext(DateRangePickerContext)\n\n if (!context) {\n throw new Error('DateRangePicker components must be used within DateRangePicker.')\n }\n\n return context\n}\n\nfunction isDateRangePickerPresetsElement(child: React.ReactNode) {\n return React.isValidElement(child) && child.type === DateRangePickerPresets\n}\n\nfunction toDraft(range: DateRange | null | undefined) {\n return normalizeDraft(range ?? undefined)\n}\n\nfunction toValue(range: DateRange | undefined): DateRange | null {\n return normalizeDraft(range) ?? null\n}\n\nfunction getRangeMonth(range: DateRange | undefined) {\n return startOfDay(range?.from ?? range?.to ?? new Date())\n}\n\nfunction normalizeDraft(range: DateRange | undefined): DateRange | undefined {\n if (!range?.from && !range?.to) return undefined\n\n if (range.from && range.to && range.from > range.to) {\n return { from: startOfDay(range.to), to: startOfDay(range.from) }\n }\n\n return {\n from: range.from ? startOfDay(range.from) : undefined,\n to: range.to ? startOfDay(range.to) : undefined\n }\n}\n\nfunction formatRange(range: DateRange | null | undefined, locale: Partial<Locale> | undefined, placeholder: string) {\n if (!range?.from && !range?.to) return placeholder\n\n if (range.from && range.to) {\n return `${formatDisplayDate(range.from, locale)} - ${formatDisplayDate(range.to, locale)}`\n }\n\n return formatDisplayDate(range.from ?? range.to, locale)\n}\n\nfunction formatDisplayDate(date: Date | undefined, locale: Partial<Locale> | undefined) {\n if (!date) return ''\n\n return new Intl.DateTimeFormat(locale?.code ?? 'pt-BR', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric'\n }).format(date)\n}\n\nfunction formatInputDate(date: Date | undefined) {\n if (!date) return ''\n\n const year = date.getFullYear()\n const month = String(date.getMonth() + 1).padStart(2, '0')\n const day = String(date.getDate()).padStart(2, '0')\n\n return `${year}-${month}-${day}`\n}\n\nfunction parseInputDate(value: string) {\n if (!value) return undefined\n\n const match = /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/.exec(value)\n if (!match?.groups) return undefined\n\n const year = Number(match.groups.year)\n const month = Number(match.groups.month)\n const day = Number(match.groups.day)\n const date = new Date(year, month - 1, day)\n\n if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {\n return undefined\n }\n\n return date\n}\n\nfunction parsePositiveInteger(value: string) {\n if (!value) return undefined\n\n const days = Number(value)\n if (!Number.isInteger(days) || days < 1) return undefined\n\n return days\n}\n\nfunction formatRelativeInputValue(value: number | undefined) {\n return value ? String(value) : ''\n}\n\nfunction getRelativeDaysRange(days: number, target: 'today' | 'yesterday'): DateRange {\n const today = startOfDay(new Date())\n const targetDate = target === 'today' ? addDays(today, -1) : addDays(today, -2)\n\n return {\n from: addDays(targetDate, -days + 1),\n to: targetDate\n }\n}\n\nfunction getRelativeDaysValue(range: DateRange | undefined, target: 'today' | 'yesterday') {\n if (!range?.from || !range.to) return undefined\n\n const today = startOfDay(new Date())\n const targetDate = target === 'today' ? addDays(today, -1) : addDays(today, -2)\n if (!isSameDay(range.to, targetDate)) return undefined\n\n const days = differenceInCalendarDays(targetDate, startOfDay(range.from)) + 1\n return days > 0 ? days : undefined\n}\n\nfunction isSameRange(left: DateRange | undefined, right: DateRange | undefined) {\n return isSameDay(left?.from, right?.from) && isSameDay(left?.to, right?.to)\n}\n\nfunction isSameDay(left: Date | undefined, right: Date | undefined) {\n if (!left || !right) return left === right\n\n return (\n left.getFullYear() === right.getFullYear() &&\n left.getMonth() === right.getMonth() &&\n left.getDate() === right.getDate()\n )\n}\n\nfunction startOfDay(date: Date) {\n return new Date(date.getFullYear(), date.getMonth(), date.getDate())\n}\n\nfunction startOfWeek(date: Date) {\n const day = startOfDay(date)\n return addDays(day, -day.getDay())\n}\n\nfunction startOfMonth(date: Date) {\n return new Date(date.getFullYear(), date.getMonth(), 1)\n}\n\nfunction endOfMonth(date: Date) {\n return new Date(date.getFullYear(), date.getMonth() + 1, 0)\n}\n\nfunction differenceInCalendarDays(left: Date, right: Date) {\n const millisecondsPerDay = 24 * 60 * 60 * 1000\n return Math.round((startOfDay(left).getTime() - startOfDay(right).getTime()) / millisecondsPerDay)\n}\n\nfunction addDays(date: Date, amount: number) {\n const nextDate = startOfDay(date)\n nextDate.setDate(nextDate.getDate() + amount)\n return nextDate\n}\n\nexport {\n type DateRange,\n DateRangePicker,\n DateRangePickerActions,\n DateRangePickerApply,\n DateRangePickerCalendar,\n DateRangePickerContent,\n DateRangePickerDateFields,\n DateRangePickerPreset,\n DateRangePickerPresets,\n DateRangePickerReset,\n DateRangePickerTrigger,\n DateRangePickerValue\n}\n"],"mappings":"icAuBA,MAAM,EAAyB,EAAM,cAAkD,IAAI,EAIrF,EAA2B,CAC/B,CACE,MAAO,OACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,EAAO,GAAI,CAAM,CAClC,CACF,EACA,CACE,MAAO,QACP,aAAgB,CACd,IAAM,EAAY,QAAQ,WAAW,IAAI,IAAM,EAAG,EAAE,EACpD,MAAO,CAAE,KAAM,EAAW,GAAI,CAAU,CAC1C,CACF,EACA,CACE,MAAO,iBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,EAAE,EAAG,GAAI,CAAM,CAC/C,CACF,EACA,CACE,MAAO,kBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,GAAG,EAAG,GAAI,CAAM,CAChD,CACF,EACA,CACE,MAAO,kBACP,aAAgB,CACd,IAAM,EAAQ,WAAW,IAAI,IAAM,EACnC,MAAO,CAAE,KAAM,QAAQ,EAAO,GAAG,EAAG,GAAI,CAAM,CAChD,CACF,EACA,CACE,MAAO,kBACP,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AAO,UAAU,GAAM,KAAM,GAAO,IAAI,GAAK,UAAU,GAAM,GAAI,GAAO,EAAE,CAC5E,CAEA,SAAS,UAAU,EAAwB,EAAyB,CAGlE,MAFI,CAAC,GAAQ,CAAC,EAAc,IAAS,EAGnC,EAAK,YAAY,IAAM,EAAM,YAAY,GACzC,EAAK,SAAS,IAAM,EAAM,SAAS,GACnC,EAAK,QAAQ,IAAM,EAAM,QAAQ,CAErC,CAEA,SAAS,WAAW,EAAY,CAC9B,OAAO,IAAI,KAAK,EAAK,YAAY,EAAG,EAAK,SAAS,EAAG,EAAK,QAAQ,CAAC,CACrE,CAEA,SAAS,YAAY,EAAY,CAC/B,IAAM,EAAM,WAAW,CAAI,EAC3B,OAAO,QAAQ,EAAK,CAAC,EAAI,OAAO,CAAC,CACnC,CAEA,SAAS,aAAa,EAAY,CAChC,OAAO,IAAI,KAAK,EAAK,YAAY,EAAG,EAAK,SAAS,EAAG,CAAC,CACxD,CAEA,SAAS,WAAW,EAAY,CAC9B,OAAO,IAAI,KAAK,EAAK,YAAY,EAAG,EAAK,SAAS,EAAI,EAAG,CAAC,CAC5D,CAEA,SAAS,yBAAyB,EAAY,EAAa,CAEzD,OAAO,KAAK,OAAO,WAAW,CAAI,CAAC,CAAC,QAAQ,EAAI,WAAW,CAAK,CAAC,CAAC,QAAQ,GAAK,KAAkB,CACnG,CAEA,SAAS,QAAQ,EAAY,EAAgB,CAC3C,IAAM,EAAW,WAAW,CAAI,EAEhC,OADA,EAAS,QAAQ,EAAS,QAAQ,EAAI,CAAM,EACrC,CACT"}
@@ -7,30 +7,30 @@ declare const dialogContentVariants: (props?: ({
7
7
  size?: "2xl" | "3xl" | "full" | "lg" | "md" | "sm" | "xl" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  type DialogSize = NonNullable<VariantProps<typeof dialogContentVariants>['size']>;
10
- type DialogProps = React.ComponentProps<typeof Dialog$1.Root> & {
10
+ export type DialogProps = React.ComponentProps<typeof Dialog$1.Root> & {
11
11
  size?: DialogSize;
12
12
  dismissible?: boolean;
13
13
  };
14
- type DialogTriggerProps = React.ComponentProps<typeof Dialog$1.Trigger>;
15
- type DialogPortalProps = React.ComponentProps<typeof Dialog$1.Portal>;
16
- type DialogCloseProps = React.ComponentProps<typeof Dialog$1.Close>;
17
- type DialogOverlayProps = React.ComponentProps<typeof Dialog$1.Overlay>;
18
- type DialogContentProps = React.ComponentProps<typeof Dialog$1.Content> & {
14
+ export type DialogTriggerProps = React.ComponentProps<typeof Dialog$1.Trigger>;
15
+ export type DialogPortalProps = React.ComponentProps<typeof Dialog$1.Portal>;
16
+ export type DialogCloseProps = React.ComponentProps<typeof Dialog$1.Close>;
17
+ export type DialogOverlayProps = React.ComponentProps<typeof Dialog$1.Overlay>;
18
+ export type DialogContentProps = React.ComponentProps<typeof Dialog$1.Content> & {
19
19
  showCloseButton?: boolean;
20
20
  overlayRef?: React.Ref<HTMLDivElement>;
21
21
  };
22
- type DialogHeaderProps = React.ComponentProps<'div'>;
23
- type DialogBodyProps = React.ComponentProps<'div'>;
24
- type DialogFooterProps = React.ComponentProps<'div'> & {
22
+ export type DialogHeaderProps = React.ComponentProps<'div'>;
23
+ export type DialogBodyProps = React.ComponentProps<'div'>;
24
+ export type DialogFooterProps = React.ComponentProps<'div'> & {
25
25
  showCloseButton?: boolean;
26
26
  };
27
- type DialogTitleProps = React.ComponentProps<typeof Dialog$1.Title>;
28
- type DialogDescriptionProps = React.ComponentProps<typeof Dialog$1.Description>;
27
+ export type DialogTitleProps = React.ComponentProps<typeof Dialog$1.Title>;
28
+ export type DialogDescriptionProps = React.ComponentProps<typeof Dialog$1.Description>;
29
29
  declare function Dialog({ size, dismissible, ...props }: DialogProps): React.JSX.Element;
30
30
  declare function DialogTrigger({ ...props }: React.ComponentProps<typeof Dialog$1.Trigger>): React.JSX.Element;
31
31
  declare function DialogPortal({ ...props }: DialogPortalProps): React.JSX.Element;
32
32
  declare function DialogClose({ ...props }: React.ComponentProps<typeof Dialog$1.Close>): React.JSX.Element;
33
- declare function DialogOverlay({ className, ...props }: DialogOverlayProps): React.JSX.Element;
33
+ declare function DialogOverlay({ className, onClick, ...props }: DialogOverlayProps): React.JSX.Element;
34
34
  declare function DialogContent({ className, children, showCloseButton, overlayRef, ...props }: DialogContentProps): React.JSX.Element;
35
35
  declare function DialogHeader({ className, ...props }: DialogHeaderProps): React.JSX.Element;
36
36
  declare function DialogBody({ className, ...props }: DialogBodyProps): React.JSX.Element;
@@ -38,5 +38,5 @@ declare function DialogFooter({ className, showCloseButton, children, ...props }
38
38
  declare function DialogTitle({ className, ...props }: DialogTitleProps): React.JSX.Element;
39
39
  declare function DialogDescription({ className, ...props }: DialogDescriptionProps): React.JSX.Element;
40
40
  //#endregion
41
- export { Dialog, DialogBody, DialogBodyProps, DialogClose, DialogCloseProps, DialogContent, DialogContentProps, DialogDescription, DialogDescriptionProps, DialogFooter, DialogFooterProps, DialogHeader, DialogHeaderProps, DialogOverlay, DialogOverlayProps, DialogPortal, DialogPortalProps, DialogProps, DialogTitle, DialogTitleProps, DialogTrigger, DialogTriggerProps };
41
+ export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
42
42
  //# sourceMappingURL=dialog.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{IconX as n}from"@tabler/icons-react";import{Dialog as r}from"radix-ui";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{cva as o}from"class-variance-authority";import*as s from"react";const c=o([`bg-background ring-foreground/10 fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,`flex flex-col gap-4 rounded-xl p-4 text-sm ring-1 duration-100`,`max-w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] overflow-hidden`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95`],{variants:{size:{sm:`sm:max-w-sm`,md:`sm:max-w-md`,lg:`sm:max-w-lg`,xl:`sm:max-w-xl`,"2xl":`sm:max-w-2xl`,"3xl":`sm:max-w-3xl`,full:`w-screen h-screen max-w-none max-h-screen rounded-none sm:max-w-none`}},defaultVariants:{size:`md`}}),l=s.createContext({size:`sm`,dismissible:!0});function Dialog({size:e=`sm`,dismissible:t=!0,...n}){let a=s.useMemo(()=>({size:e,dismissible:t}),[e,t]);return i(l.Provider,{value:a,children:i(r.Root,{"data-slot":`dialog`,...n})})}function DialogTrigger({...e}){return i(r.Trigger,{"data-slot":`dialog-trigger`,...e})}function DialogPortal({...e}){return i(r.Portal,{"data-slot":`dialog-portal`,...e})}function DialogClose({...e}){return i(r.Close,{"data-slot":`dialog-close`,...e})}function DialogOverlay({className:t,...n}){return i(r.Overlay,{"data-slot":`dialog-overlay`,className:e(`bg-black/10 fixed inset-0 isolate z-50`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0`,`duration-100 supports-backdrop-filter:backdrop-blur-xs`,t),...n})}function DialogContent({className:o,children:u,showCloseButton:d=!0,overlayRef:f,...p}){let{size:m,dismissible:h}=s.useContext(l);return a(DialogPortal,{children:[i(DialogOverlay,{ref:f}),a(r.Content,{"data-slot":`dialog-content`,className:e(c({size:m}),o),...p,onEscapeKeyDown:e=>{h||e.preventDefault(),p.onEscapeKeyDown?.(e)},onInteractOutside:e=>{h||e.preventDefault(),p.onInteractOutside?.(e)},children:[u,d&&i(r.Close,{"data-slot":`dialog-close`,asChild:!0,children:a(t,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[i(n,{}),i(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function DialogHeader({className:t,...n}){return i(`div`,{"data-slot":`dialog-header`,className:e(`gap-2 flex flex-col shrink-0`,t),...n})}function DialogBody({className:t,...n}){return i(`div`,{"data-slot":`dialog-body`,className:e(`-mx-4 px-4 flex-1 overflow-y-auto`,t),...n})}function DialogFooter({className:n,showCloseButton:o=!1,children:s,...c}){return a(`div`,{"data-slot":`dialog-footer`,className:e(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 shrink-0`,`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n),...c,children:[s,o&&i(r.Close,{asChild:!0,children:i(t,{variant:`outline`,children:`Close`})})]})}function DialogTitle({className:t,...n}){return i(r.Title,{"data-slot":`dialog-title`,className:e(`text-base leading-none font-medium`,t),...n})}function DialogDescription({className:t,...n}){return i(r.Description,{"data-slot":`dialog-description`,className:e(`text-muted-foreground text-sm`,`*:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,t),...n})}export{Dialog,DialogBody,DialogClose,DialogContent,DialogDescription,DialogFooter,DialogHeader,DialogOverlay,DialogPortal,DialogTitle,DialogTrigger};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{cn as e,stopPropagationHandler as t}from"../lib/utils.js";import{Button as n}from"./button.js";import{IconX as r}from"@tabler/icons-react";import{Dialog as i}from"radix-ui";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{cva as s}from"class-variance-authority";import*as c from"react";const l=s([`bg-background ring-foreground/10 fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none`,`flex flex-col gap-4 rounded-xl p-4 text-sm ring-1 duration-100`,`max-w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] overflow-hidden`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95`],{variants:{size:{sm:`sm:max-w-sm`,md:`sm:max-w-md`,lg:`sm:max-w-lg`,xl:`sm:max-w-xl`,"2xl":`sm:max-w-2xl`,"3xl":`sm:max-w-3xl`,full:`w-screen h-screen max-w-none max-h-screen rounded-none sm:max-w-none`}},defaultVariants:{size:`md`}}),u=c.createContext({size:`sm`,dismissible:!0});function Dialog({size:e=`sm`,dismissible:t=!0,...n}){let r=c.useMemo(()=>({size:e,dismissible:t}),[e,t]);return a(u.Provider,{value:r,children:a(i.Root,{"data-slot":`dialog`,...n})})}function DialogTrigger({...e}){return a(i.Trigger,{"data-slot":`dialog-trigger`,...e})}function DialogPortal({...e}){return a(i.Portal,{"data-slot":`dialog-portal`,...e})}function DialogClose({...e}){return a(i.Close,{"data-slot":`dialog-close`,...e})}function DialogOverlay({className:n,onClick:r,...o}){return a(i.Overlay,{"data-slot":`dialog-overlay`,className:e(`bg-black/10 fixed inset-0 isolate z-50`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0`,`duration-100 supports-backdrop-filter:backdrop-blur-xs`,n),onClick:t(r),...o})}function DialogContent({className:s,children:d,showCloseButton:f=!0,overlayRef:p,...m}){let{size:h,dismissible:g}=c.useContext(u);return o(DialogPortal,{children:[a(DialogOverlay,{ref:p}),o(i.Content,{"data-slot":`dialog-content`,className:e(l({size:h}),s),...m,onEscapeKeyDown:e=>{g||e.preventDefault(),m.onEscapeKeyDown?.(e)},onInteractOutside:e=>{g||e.preventDefault(),m.onInteractOutside?.(e)},onClick:t(m.onClick),onSubmit:t(m.onSubmit),children:[d,f&&a(i.Close,{"data-slot":`dialog-close`,asChild:!0,children:o(n,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[a(r,{}),a(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function DialogHeader({className:t,...n}){return a(`div`,{"data-slot":`dialog-header`,className:e(`gap-2 flex flex-col shrink-0`,t),...n})}function DialogBody({className:t,...n}){return a(`div`,{"data-slot":`dialog-body`,className:e(`-mx-4 px-4 flex-1 overflow-y-auto`,t),...n})}function DialogFooter({className:t,showCloseButton:r=!1,children:s,...c}){return o(`div`,{"data-slot":`dialog-footer`,className:e(`bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 shrink-0`,`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,t),...c,children:[s,r&&a(i.Close,{asChild:!0,children:a(n,{variant:`outline`,children:`Close`})})]})}function DialogTitle({className:t,...n}){return a(i.Title,{"data-slot":`dialog-title`,className:e(`text-base leading-none font-medium`,t),...n})}function DialogDescription({className:t,...n}){return a(i.Description,{"data-slot":`dialog-description`,className:e(`text-muted-foreground text-sm`,`*:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,t),...n})}export{Dialog,DialogBody,DialogClose,DialogContent,DialogDescription,DialogFooter,DialogHeader,DialogOverlay,DialogPortal,DialogTitle,DialogTrigger};
2
2
  //# sourceMappingURL=dialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","names":["DialogPrimitive"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Dialog as DialogPrimitive } from 'radix-ui'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\n\nconst dialogContentVariants = cva(\n [\n 'bg-background ring-foreground/10 fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none',\n 'flex flex-col gap-4 rounded-xl p-4 text-sm ring-1 duration-100',\n 'max-w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] overflow-hidden',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95'\n ],\n {\n variants: {\n size: {\n sm: 'sm:max-w-sm',\n md: 'sm:max-w-md',\n lg: 'sm:max-w-lg',\n xl: 'sm:max-w-xl',\n '2xl': 'sm:max-w-2xl',\n '3xl': 'sm:max-w-3xl',\n full: 'w-screen h-screen max-w-none max-h-screen rounded-none sm:max-w-none'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\ntype DialogSize = NonNullable<VariantProps<typeof dialogContentVariants>['size']>\ntype DialogContextValue = { size: DialogSize; dismissible: boolean }\nconst DialogContext = React.createContext<DialogContextValue>({ size: 'sm', dismissible: true })\n\nexport type DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n size?: DialogSize\n dismissible?: boolean\n}\nexport type DialogTriggerProps = React.ComponentProps<typeof DialogPrimitive.Trigger>\nexport type DialogPortalProps = React.ComponentProps<typeof DialogPrimitive.Portal>\nexport type DialogCloseProps = React.ComponentProps<typeof DialogPrimitive.Close>\nexport type DialogOverlayProps = React.ComponentProps<typeof DialogPrimitive.Overlay>\nexport type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n overlayRef?: React.Ref<HTMLDivElement>\n}\nexport type DialogHeaderProps = React.ComponentProps<'div'>\nexport type DialogBodyProps = React.ComponentProps<'div'>\nexport type DialogFooterProps = React.ComponentProps<'div'> & { showCloseButton?: boolean }\nexport type DialogTitleProps = React.ComponentProps<typeof DialogPrimitive.Title>\nexport type DialogDescriptionProps = React.ComponentProps<typeof DialogPrimitive.Description>\n\nfunction Dialog({ size = 'sm', dismissible = true, ...props }: DialogProps) {\n const contextValue = React.useMemo<DialogContextValue>(() => ({ size, dismissible }), [size, dismissible])\n\n return (\n <DialogContext.Provider value={contextValue}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n </DialogContext.Provider>\n )\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({ ...props }: DialogPortalProps) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({ className, ...props }: DialogOverlayProps) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'bg-black/10 fixed inset-0 isolate z-50',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0',\n 'duration-100 supports-backdrop-filter:backdrop-blur-xs',\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent({ className, children, showCloseButton = true, overlayRef, ...props }: DialogContentProps) {\n const { size, dismissible } = React.useContext(DialogContext)\n\n return (\n <DialogPortal>\n <DialogOverlay ref={overlayRef} />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(dialogContentVariants({ size }), className)}\n {...props}\n onEscapeKeyDown={(event) => {\n if (!dismissible) event.preventDefault()\n props.onEscapeKeyDown?.(event)\n }}\n onInteractOutside={(event) => {\n if (!dismissible) event.preventDefault()\n props.onInteractOutside?.(event)\n }}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button variant=\"ghost\" className=\"absolute top-2 right-2\" size=\"icon-sm\">\n <IconX />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: DialogHeaderProps) {\n return <div data-slot=\"dialog-header\" className={cn('gap-2 flex flex-col shrink-0', className)} {...props} />\n}\n\nfunction DialogBody({ className, ...props }: DialogBodyProps) {\n return <div data-slot=\"dialog-body\" className={cn('-mx-4 px-4 flex-1 overflow-y-auto', className)} {...props} />\n}\n\nfunction DialogFooter({ className, showCloseButton = false, children, ...props }: DialogFooterProps) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 shrink-0',\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-base leading-none font-medium', className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n 'text-muted-foreground text-sm',\n '*:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger\n}\n"],"mappings":"yTASA,MAAM,EAAwB,EAC5B,CACE,qHACA,iEACA,oEACA,sIACF,EACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,cACJ,GAAI,cACJ,GAAI,cACJ,GAAI,cACJ,MAAO,eACP,MAAO,eACP,KAAM,sEACR,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CACF,EAIM,EAAgB,EAAM,cAAkC,CAAE,KAAM,KAAM,YAAa,EAAK,CAAC,EAoB/F,SAAS,OAAO,CAAE,OAAO,KAAM,cAAc,GAAM,GAAG,GAAsB,CAC1E,IAAM,EAAe,EAAM,aAAmC,CAAE,OAAM,aAAY,GAAI,CAAC,EAAM,CAAW,CAAC,EAEzG,OACE,EAAC,EAAc,SAAf,CAAwB,MAAO,EAC7B,SAAA,EAACA,EAAgB,KAAjB,CAAsB,YAAU,SAAS,GAAI,CAAQ,CAAA,CAC/B,CAAA,CAE5B,CAEA,SAAS,cAAc,CAAE,GAAG,GAA+D,CACzF,OAAO,EAACA,EAAgB,QAAjB,CAAyB,YAAU,iBAAiB,GAAI,CAAQ,CAAA,CACzE,CAEA,SAAS,aAAa,CAAE,GAAG,GAA4B,CACrD,OAAO,EAACA,EAAgB,OAAjB,CAAwB,YAAU,gBAAgB,GAAI,CAAQ,CAAA,CACvE,CAEA,SAAS,YAAY,CAAE,GAAG,GAA6D,CACrF,OAAO,EAACA,EAAgB,MAAj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AA,CACjH,CAEA,SAAS,aAAa,CAAE,YAAW,kBAAkB,GAAO,WAAU,GAAG,GAA4B,CACnG,OACE,EAAC,MAAD,CACE,YAAU,gBACV,UAAW,EACT,6DACA,yDACA,CACF,EACA,GAAI,EAPN,SAAA,CASG,EACA,GACC,EAACA,EAAgB,MAAjB,CAAuB,QAAA,GACrB,SAAA,EAAC,EAAD,CAAQ,QAAQ,UAAU,SAAA,OAAa,CAAA,CAClB,CAAA,CAEtB,GAET,CAEA,SAAS,YAAY,CAAE,YAAW,GAAG,GAA2B,CAC9D,OACE,EAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAW,EAAG,qCAAsC,CAAS,EAC7D,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,kBAAkB,CAAE,YAAW,GAAG,GAAiC,CAC1E,OACE,EAACA,EAAgB,YAAjB,CACE,YAAU,qBACV,UAAW,EACT,gCACA,uEACA,CACF,EACA,GAAI,CACL,CAAA,CAEL"}
1
+ {"version":3,"file":"dialog.js","names":["DialogPrimitive"],"sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { Dialog as DialogPrimitive } from 'radix-ui'\n\nimport { cn, stopPropagationHandler } from '../lib/utils'\nimport { Button } from './button'\n\nconst dialogContentVariants = cva(\n [\n 'bg-background ring-foreground/10 fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none',\n 'flex flex-col gap-4 rounded-xl p-4 text-sm ring-1 duration-100',\n 'max-w-[calc(100%-2rem)] max-h-[calc(100dvh-2rem)] overflow-hidden',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95'\n ],\n {\n variants: {\n size: {\n sm: 'sm:max-w-sm',\n md: 'sm:max-w-md',\n lg: 'sm:max-w-lg',\n xl: 'sm:max-w-xl',\n '2xl': 'sm:max-w-2xl',\n '3xl': 'sm:max-w-3xl',\n full: 'w-screen h-screen max-w-none max-h-screen rounded-none sm:max-w-none'\n }\n },\n defaultVariants: {\n size: 'md'\n }\n }\n)\n\ntype DialogSize = NonNullable<VariantProps<typeof dialogContentVariants>['size']>\ntype DialogContextValue = { size: DialogSize; dismissible: boolean }\nconst DialogContext = React.createContext<DialogContextValue>({ size: 'sm', dismissible: true })\n\nexport type DialogProps = React.ComponentProps<typeof DialogPrimitive.Root> & {\n size?: DialogSize\n dismissible?: boolean\n}\nexport type DialogTriggerProps = React.ComponentProps<typeof DialogPrimitive.Trigger>\nexport type DialogPortalProps = React.ComponentProps<typeof DialogPrimitive.Portal>\nexport type DialogCloseProps = React.ComponentProps<typeof DialogPrimitive.Close>\nexport type DialogOverlayProps = React.ComponentProps<typeof DialogPrimitive.Overlay>\nexport type DialogContentProps = React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n overlayRef?: React.Ref<HTMLDivElement>\n}\nexport type DialogHeaderProps = React.ComponentProps<'div'>\nexport type DialogBodyProps = React.ComponentProps<'div'>\nexport type DialogFooterProps = React.ComponentProps<'div'> & { showCloseButton?: boolean }\nexport type DialogTitleProps = React.ComponentProps<typeof DialogPrimitive.Title>\nexport type DialogDescriptionProps = React.ComponentProps<typeof DialogPrimitive.Description>\n\nfunction Dialog({ size = 'sm', dismissible = true, ...props }: DialogProps) {\n const contextValue = React.useMemo<DialogContextValue>(() => ({ size, dismissible }), [size, dismissible])\n\n return (\n <DialogContext.Provider value={contextValue}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n </DialogContext.Provider>\n )\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({ ...props }: DialogPortalProps) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({ className, onClick, ...props }: DialogOverlayProps) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'bg-black/10 fixed inset-0 isolate z-50',\n 'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0',\n 'duration-100 supports-backdrop-filter:backdrop-blur-xs',\n className\n )}\n onClick={stopPropagationHandler(onClick)}\n {...props}\n />\n )\n}\n\nfunction DialogContent({ className, children, showCloseButton = true, overlayRef, ...props }: DialogContentProps) {\n const { size, dismissible } = React.useContext(DialogContext)\n\n return (\n <DialogPortal>\n <DialogOverlay ref={overlayRef} />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(dialogContentVariants({ size }), className)}\n {...props}\n onEscapeKeyDown={(event) => {\n if (!dismissible) event.preventDefault()\n props.onEscapeKeyDown?.(event)\n }}\n onInteractOutside={(event) => {\n if (!dismissible) event.preventDefault()\n props.onInteractOutside?.(event)\n }}\n // React events bubble through the fiber tree, not the DOM, so a portaled Radix Content still\n // reaches any ancestor's onClick/onSubmit even though it renders outside it in the DOM.\n onClick={stopPropagationHandler(props.onClick)}\n onSubmit={stopPropagationHandler(props.onSubmit)}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close data-slot=\"dialog-close\" asChild>\n <Button variant=\"ghost\" className=\"absolute top-2 right-2\" size=\"icon-sm\">\n <IconX />\n <span className=\"sr-only\">Close</span>\n </Button>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: DialogHeaderProps) {\n return <div data-slot=\"dialog-header\" className={cn('gap-2 flex flex-col shrink-0', className)} {...props} />\n}\n\nfunction DialogBody({ className, ...props }: DialogBodyProps) {\n return <div data-slot=\"dialog-body\" className={cn('-mx-4 px-4 flex-1 overflow-y-auto', className)} {...props} />\n}\n\nfunction DialogFooter({ className, showCloseButton = false, children, ...props }: DialogFooterProps) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 shrink-0',\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outline\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n )\n}\n\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-base leading-none font-medium', className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\n 'text-muted-foreground text-sm',\n '*:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground',\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogBody,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger\n}\n"],"mappings":"qVASA,MAAM,EAAwB,EAC5B,CACE,qHACA,iEACA,oEACA,sIACF,EACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,cACJ,GAAI,cACJ,GAAI,cACJ,GAAI,cACJ,MAAO,eACP,MAAO,eACP,KAAM,sEACR,CACF,EACA,gBAAiB,CACf,KAAM,IACR,CACF,CACF,EAIM,EAAgB,EAAM,cAAkC,CAAE,KAAM,KAAM,YAAa,EAAK,CAAC,EAoB/F,SAAS,OAAO,CAAE,OAAO,KAAM,cAAc,GAAM,GAAG,GAAsB,CAC1E,IAAM,EAAe,EAAM,aAAmC,CAAE,OAAM,aAAY,GAAI,CAAC,EAAM,CAAW,CAAC,EAEzG,OACE,EAAC,EAAc,SAAf,CAAwB,MAAO,EAC7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AC,EAAD,CAAQ,QAAQ,QAAQ,UAAU,yBAAyB,KAAK,UAAhE,SAAA,CACE,EAAC,EAAD,CAAQ,CAAA,EACR,EAAC,OAAD,CAAM,UAAU,UAAU,SAAA,OAAW,CAAA,CAC/B,GACa,CAAA,CAEF,CACb,CAAA,CAAA,CAAA,CAAA,CAElB,CAEA,SAAS,aAAa,CAAE,YAAW,GAAG,GAA4B,CAChE,OAAO,EAAC,MAAD,CAAK,YAAU,gBAAgB,UAAW,EAAG,+BAAgC,CAAS,EAAG,GAAI,CAAQ,CAAA,CAC9G,CAEA,SAAS,WAAW,CAAE,YAAW,GAAG,GAA0B,CAC5D,OAAO,EAAC,MAAD,CAAK,YAAU,cAAc,UAAW,EAAG,oCAAqC,CAAS,EAAG,GAAI,CAAQ,CAAA,CACjH,CAEA,SAAS,aAAa,CAAE,YAAW,kBAAkB,GAAO,WAAU,GAAG,GAA4B,CACnG,OACE,EAAC,MAAD,CACE,YAAU,gBACV,UAAW,EACT,6DACA,yDACA,CACF,EACA,GAAI,EAPN,SAAA,CASG,EACA,GACC,EAACA,EAAgB,MAAjB,CAAuB,QAAA,GACrB,SAAA,EAAC,EAAD,CAAQ,QAAQ,UAAU,SAAA,OAAa,CAAA,CAClB,CAAA,CAEtB,GAET,CAEA,SAAS,YAAY,CAAE,YAAW,GAAG,GAA2B,CAC9D,OACE,EAACA,EAAgB,MAAjB,CACE,YAAU,eACV,UAAW,EAAG,qCAAsC,CAAS,EAC7D,GAAI,CACL,CAAA,CAEL,CAEA,SAAS,kBAAkB,CAAE,YAAW,GAAG,GAAiC,CAC1E,OACE,EAACA,EAAgB,YAAjB,CACE,YAAU,qBACV,UAAW,EACT,gCACA,uEACA,CACF,EACA,GAAI,CACL,CAAA,CAEL"}
@@ -2,12 +2,12 @@ import { t as __name } from "../rolldown-runtime-BhWHdk3m.js";
2
2
  import { PieChartProps } from "./pie-chart.js";
3
3
  import * as React from "react";
4
4
  //#region src/components/donut-chart.d.ts
5
- type DonutChartProps = PieChartProps & {
5
+ export type DonutChartProps = PieChartProps & {
6
6
  thickness?: number;
7
7
  withTotal?: boolean;
8
8
  totalLabel?: React.ReactNode;
9
9
  };
10
10
  declare function DonutChart({ className, thickness, outerRadius, withTotal, totalLabel, data, ...props }: DonutChartProps): React.JSX.Element;
11
11
  //#endregion
12
- export { DonutChart, DonutChartProps };
12
+ export { DonutChart };
13
13
  //# sourceMappingURL=donut-chart.d.ts.map
@@ -9,29 +9,29 @@ declare const drawerContentVariants: (props?: ({
9
9
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
10
  type DrawerDirection = NonNullable<VariantProps<typeof drawerContentVariants>['direction']>;
11
11
  type DrawerSize = NonNullable<VariantProps<typeof drawerContentVariants>['size']>;
12
- type DrawerProps = React.ComponentProps<typeof Dialog.Root> & {
12
+ export type DrawerProps = React.ComponentProps<typeof Dialog.Root> & {
13
13
  size?: DrawerSize;
14
14
  direction?: DrawerDirection;
15
15
  dismissible?: boolean;
16
16
  };
17
- type DrawerTriggerProps = React.ComponentProps<typeof Dialog.Trigger>;
18
- type DrawerPortalProps = React.ComponentProps<typeof Dialog.Portal>;
19
- type DrawerCloseProps = React.ComponentProps<typeof Dialog.Close>;
20
- type DrawerOverlayProps = React.ComponentProps<typeof Dialog.Overlay>;
21
- type DrawerContentProps = React.ComponentProps<typeof Dialog.Content> & {
17
+ export type DrawerTriggerProps = React.ComponentProps<typeof Dialog.Trigger>;
18
+ export type DrawerPortalProps = React.ComponentProps<typeof Dialog.Portal>;
19
+ export type DrawerCloseProps = React.ComponentProps<typeof Dialog.Close>;
20
+ export type DrawerOverlayProps = React.ComponentProps<typeof Dialog.Overlay>;
21
+ export type DrawerContentProps = React.ComponentProps<typeof Dialog.Content> & {
22
22
  showCloseButton?: boolean;
23
23
  overlayProps?: DrawerOverlayProps;
24
24
  };
25
- type DrawerHeaderProps = React.ComponentProps<'div'>;
26
- type DrawerBodyProps = React.ComponentProps<'div'>;
27
- type DrawerFooterProps = React.ComponentProps<'div'>;
28
- type DrawerTitleProps = React.ComponentProps<typeof Dialog.Title>;
29
- type DrawerDescriptionProps = React.ComponentProps<typeof Dialog.Description>;
25
+ export type DrawerHeaderProps = React.ComponentProps<'div'>;
26
+ export type DrawerBodyProps = React.ComponentProps<'div'>;
27
+ export type DrawerFooterProps = React.ComponentProps<'div'>;
28
+ export type DrawerTitleProps = React.ComponentProps<typeof Dialog.Title>;
29
+ export type DrawerDescriptionProps = React.ComponentProps<typeof Dialog.Description>;
30
30
  declare function Drawer({ size, direction, dismissible, ...props }: DrawerProps): React.JSX.Element;
31
31
  declare function DrawerTrigger({ ...props }: DrawerTriggerProps): React.JSX.Element;
32
32
  declare function DrawerPortal({ ...props }: DrawerPortalProps): React.JSX.Element;
33
33
  declare function DrawerClose({ ...props }: DrawerCloseProps): React.JSX.Element;
34
- declare function DrawerOverlay({ className, ...props }: DrawerOverlayProps): React.JSX.Element;
34
+ declare function DrawerOverlay({ className, onClick, ...props }: DrawerOverlayProps): React.JSX.Element;
35
35
  declare function DrawerContent({ className, children, showCloseButton, overlayProps, ...props }: DrawerContentProps): React.JSX.Element;
36
36
  declare function DrawerHeader({ className, ...props }: DrawerHeaderProps): React.JSX.Element;
37
37
  declare function DrawerBody({ className, ...props }: DrawerBodyProps): React.JSX.Element;
@@ -39,5 +39,5 @@ declare function DrawerFooter({ className, ...props }: DrawerFooterProps): React
39
39
  declare function DrawerTitle({ className, ...props }: DrawerTitleProps): React.JSX.Element;
40
40
  declare function DrawerDescription({ className, ...props }: DrawerDescriptionProps): React.JSX.Element;
41
41
  //#endregion
42
- export { Drawer, DrawerBody, DrawerBodyProps, DrawerClose, DrawerCloseProps, DrawerContent, DrawerContentProps, DrawerDescription, DrawerDescriptionProps, DrawerFooter, DrawerFooterProps, DrawerHeader, DrawerHeaderProps, DrawerOverlay, DrawerOverlayProps, DrawerPortal, DrawerPortalProps, DrawerProps, DrawerTitle, DrawerTitleProps, DrawerTrigger, DrawerTriggerProps };
42
+ export { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger };
43
43
  //# sourceMappingURL=drawer.d.ts.map
@@ -1,2 +1,2 @@
1
- import"../rolldown-runtime-BhWHdk3m.js";import{cn as e}from"../lib/utils.js";import{Button as t}from"./button.js";import{IconX as n}from"@tabler/icons-react";import{Dialog as r}from"radix-ui";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{cva as o}from"class-variance-authority";import*as s from"react";const c=o([`bg-background flex h-auto flex-col text-sm fixed z-50 outline-none duration-200`,`data-open:animate-in data-closed:animate-out`],{variants:{direction:{top:`inset-x-0 top-0 rounded-b-xl border-b data-closed:slide-out-to-top data-open:slide-in-from-top-10`,right:`inset-y-0 right-0 rounded-l-xl border-l data-closed:slide-out-to-right data-open:slide-in-from-right-10`,bottom:`inset-x-0 bottom-0 rounded-t-xl border-t data-closed:slide-out-to-bottom data-open:slide-in-from-bottom-10`,left:`inset-y-0 left-0 rounded-r-xl border-r data-closed:slide-out-to-left data-open:slide-in-from-left-10`},size:{sm:``,md:``,lg:``,xl:``,"2xl":``,"3xl":``,full:``}},compoundVariants:[{direction:[`left`,`right`],size:`sm`,className:`w-3/4 sm:max-w-sm`},{direction:[`left`,`right`],size:`md`,className:`w-4/5 sm:max-w-md`},{direction:[`left`,`right`],size:`lg`,className:`w-[90%] sm:max-w-lg`},{direction:[`left`,`right`],size:`xl`,className:`w-[90%] sm:max-w-195`},{direction:[`left`,`right`],size:`2xl`,className:`w-[90%] sm:max-w-240`},{direction:[`left`,`right`],size:`3xl`,className:`w-[90%] sm:max-w-300`},{direction:[`left`,`right`],size:`full`,className:`w-full`},{direction:`top`,size:`sm`,className:`mb-24 h-full max-h-96`},{direction:`top`,size:`md`,className:`mb-20 h-full max-h-112`},{direction:`top`,size:`lg`,className:`mb-12 h-full max-h-128`},{direction:`top`,size:`xl`,className:`mb-12 h-full max-h-195`},{direction:`top`,size:`2xl`,className:`mb-12 h-full max-h-240`},{direction:`top`,size:`3xl`,className:`mb-12 h-full max-h-300`},{direction:`top`,size:`full`,className:`mb-0 h-full`},{direction:`bottom`,size:`sm`,className:`mt-24 h-full max-h-96`},{direction:`bottom`,size:`md`,className:`mt-20 h-full max-h-112`},{direction:`bottom`,size:`lg`,className:`mt-12 h-full max-h-128`},{direction:`bottom`,size:`xl`,className:`mt-12 h-full max-h-195`},{direction:`bottom`,size:`2xl`,className:`mt-12 h-full max-h-240`},{direction:`bottom`,size:`3xl`,className:`mt-12 h-full max-h-300`},{direction:`bottom`,size:`full`,className:`mt-0 h-full`}],defaultVariants:{direction:`right`,size:`md`}}),l=s.createContext({size:`md`,direction:`right`,dismissible:!0});function Drawer({size:e=`md`,direction:t=`right`,dismissible:n=!0,...a}){let o=s.useMemo(()=>({size:e,direction:t,dismissible:n}),[e,t,n]);return i(l.Provider,{value:o,children:i(r.Root,{"data-slot":`drawer`,...a})})}function DrawerTrigger({...e}){return i(r.Trigger,{"data-slot":`drawer-trigger`,...e})}function DrawerPortal({...e}){return i(r.Portal,{"data-slot":`drawer-portal`,...e})}function DrawerClose({...e}){return i(r.Close,{"data-slot":`drawer-close`,...e})}function DrawerOverlay({className:t,...n}){return i(r.Overlay,{"data-slot":`drawer-overlay`,className:e(`bg-black/10 fixed inset-0 z-50`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0`,`supports-backdrop-filter:backdrop-blur-xs`,t),...n})}function DrawerContent({className:o,children:u,showCloseButton:d=!0,overlayProps:f,...p}){let{size:m,direction:h,dismissible:g}=s.useContext(l);return a(DrawerPortal,{children:[i(DrawerOverlay,{...f}),a(r.Content,{"data-slot":`drawer-content`,className:e(c({size:m,direction:h}),o),...p,onEscapeKeyDown:e=>{g||e.preventDefault(),p.onEscapeKeyDown?.(e)},onInteractOutside:e=>{g||e.preventDefault(),p.onInteractOutside?.(e)},children:[u,d&&i(DrawerClose,{asChild:!0,children:a(t,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[i(n,{}),i(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function DrawerHeader({className:t,...n}){let{direction:r}=s.useContext(l);return i(`div`,{"data-slot":`drawer-header`,className:e(`p-4 flex flex-col gap-0.5 md:gap-0.5`,(r===`top`||r===`bottom`)&&`text-center md:text-left`,t),...n})}function DrawerBody({className:t,...n}){return i(`div`,{"data-slot":`drawer-body`,className:e(`px-4 pb-4 flex-1 min-h-0 overflow-y-auto`,t),...n})}function DrawerFooter({className:t,...n}){return i(`div`,{"data-slot":`drawer-footer`,className:e(`gap-2 p-4 mt-auto flex flex-col sm:flex-row sm:justify-end`,t),...n})}function DrawerTitle({className:t,...n}){return i(r.Title,{"data-slot":`drawer-title`,className:e(`text-foreground text-base font-medium`,t),...n})}function DrawerDescription({className:t,...n}){return i(r.Description,{"data-slot":`drawer-description`,className:e(`text-muted-foreground text-sm`,t),...n})}export{Drawer,DrawerBody,DrawerClose,DrawerContent,DrawerDescription,DrawerFooter,DrawerHeader,DrawerOverlay,DrawerPortal,DrawerTitle,DrawerTrigger};
1
+ import"../rolldown-runtime-BhWHdk3m.js";import{cn as e,stopPropagationHandler as t}from"../lib/utils.js";import{Button as n}from"./button.js";import{IconX as r}from"@tabler/icons-react";import{Dialog as i}from"radix-ui";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{cva as s}from"class-variance-authority";import*as c from"react";const l=s([`bg-background flex h-auto flex-col text-sm fixed z-50 outline-none duration-200`,`data-open:animate-in data-closed:animate-out`],{variants:{direction:{top:`inset-x-0 top-0 rounded-b-xl border-b data-closed:slide-out-to-top data-open:slide-in-from-top-10`,right:`inset-y-0 right-0 rounded-l-xl border-l data-closed:slide-out-to-right data-open:slide-in-from-right-10`,bottom:`inset-x-0 bottom-0 rounded-t-xl border-t data-closed:slide-out-to-bottom data-open:slide-in-from-bottom-10`,left:`inset-y-0 left-0 rounded-r-xl border-r data-closed:slide-out-to-left data-open:slide-in-from-left-10`},size:{sm:``,md:``,lg:``,xl:``,"2xl":``,"3xl":``,full:``}},compoundVariants:[{direction:[`left`,`right`],size:`sm`,className:`w-3/4 sm:max-w-sm`},{direction:[`left`,`right`],size:`md`,className:`w-4/5 sm:max-w-md`},{direction:[`left`,`right`],size:`lg`,className:`w-[90%] sm:max-w-lg`},{direction:[`left`,`right`],size:`xl`,className:`w-[90%] sm:max-w-195`},{direction:[`left`,`right`],size:`2xl`,className:`w-[90%] sm:max-w-240`},{direction:[`left`,`right`],size:`3xl`,className:`w-[90%] sm:max-w-300`},{direction:[`left`,`right`],size:`full`,className:`w-full`},{direction:`top`,size:`sm`,className:`mb-24 h-full max-h-96`},{direction:`top`,size:`md`,className:`mb-20 h-full max-h-112`},{direction:`top`,size:`lg`,className:`mb-12 h-full max-h-128`},{direction:`top`,size:`xl`,className:`mb-12 h-full max-h-195`},{direction:`top`,size:`2xl`,className:`mb-12 h-full max-h-240`},{direction:`top`,size:`3xl`,className:`mb-12 h-full max-h-300`},{direction:`top`,size:`full`,className:`mb-0 h-full`},{direction:`bottom`,size:`sm`,className:`mt-24 h-full max-h-96`},{direction:`bottom`,size:`md`,className:`mt-20 h-full max-h-112`},{direction:`bottom`,size:`lg`,className:`mt-12 h-full max-h-128`},{direction:`bottom`,size:`xl`,className:`mt-12 h-full max-h-195`},{direction:`bottom`,size:`2xl`,className:`mt-12 h-full max-h-240`},{direction:`bottom`,size:`3xl`,className:`mt-12 h-full max-h-300`},{direction:`bottom`,size:`full`,className:`mt-0 h-full`}],defaultVariants:{direction:`right`,size:`md`}}),u=c.createContext({size:`md`,direction:`right`,dismissible:!0});function Drawer({size:e=`md`,direction:t=`right`,dismissible:n=!0,...r}){let o=c.useMemo(()=>({size:e,direction:t,dismissible:n}),[e,t,n]);return a(u.Provider,{value:o,children:a(i.Root,{"data-slot":`drawer`,...r})})}function DrawerTrigger({...e}){return a(i.Trigger,{"data-slot":`drawer-trigger`,...e})}function DrawerPortal({...e}){return a(i.Portal,{"data-slot":`drawer-portal`,...e})}function DrawerClose({...e}){return a(i.Close,{"data-slot":`drawer-close`,...e})}function DrawerOverlay({className:n,onClick:r,...o}){return a(i.Overlay,{"data-slot":`drawer-overlay`,className:e(`bg-black/10 fixed inset-0 z-50`,`data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0`,`supports-backdrop-filter:backdrop-blur-xs`,n),onClick:t(r),...o})}function DrawerContent({className:s,children:d,showCloseButton:f=!0,overlayProps:p,...m}){let{size:h,direction:g,dismissible:_}=c.useContext(u);return o(DrawerPortal,{children:[a(DrawerOverlay,{...p}),o(i.Content,{"data-slot":`drawer-content`,className:e(l({size:h,direction:g}),s),...m,onEscapeKeyDown:e=>{_||e.preventDefault(),m.onEscapeKeyDown?.(e)},onInteractOutside:e=>{_||e.preventDefault(),m.onInteractOutside?.(e)},onClick:t(m.onClick),onSubmit:t(m.onSubmit),children:[d,f&&a(DrawerClose,{asChild:!0,children:o(n,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[a(r,{}),a(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function DrawerHeader({className:t,...n}){let{direction:r}=c.useContext(u);return a(`div`,{"data-slot":`drawer-header`,className:e(`p-4 flex flex-col gap-0.5 md:gap-0.5`,(r===`top`||r===`bottom`)&&`text-center md:text-left`,t),...n})}function DrawerBody({className:t,...n}){return a(`div`,{"data-slot":`drawer-body`,className:e(`px-4 pb-4 flex-1 min-h-0 overflow-y-auto`,t),...n})}function DrawerFooter({className:t,...n}){return a(`div`,{"data-slot":`drawer-footer`,className:e(`gap-2 p-4 mt-auto flex flex-col sm:flex-row sm:justify-end`,t),...n})}function DrawerTitle({className:t,...n}){return a(i.Title,{"data-slot":`drawer-title`,className:e(`text-foreground text-base font-medium`,t),...n})}function DrawerDescription({className:t,...n}){return a(i.Description,{"data-slot":`drawer-description`,className:e(`text-muted-foreground text-sm`,t),...n})}export{Drawer,DrawerBody,DrawerClose,DrawerContent,DrawerDescription,DrawerFooter,DrawerHeader,DrawerOverlay,DrawerPortal,DrawerTitle,DrawerTrigger};
2
2
  //# sourceMappingURL=drawer.js.map