@craftzbay/ui 0.11.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/_virtual/_rolldown/runtime.js +11 -0
  3. package/dist-lib/components/ui/Accordion.js +42 -67
  4. package/dist-lib/components/ui/Accordion.js.map +1 -1
  5. package/dist-lib/components/ui/Alert.js +71 -77
  6. package/dist-lib/components/ui/Alert.js.map +1 -1
  7. package/dist-lib/components/ui/Avatar.js +67 -92
  8. package/dist-lib/components/ui/Avatar.js.map +1 -1
  9. package/dist-lib/components/ui/Badge.js +119 -74
  10. package/dist-lib/components/ui/Badge.js.map +1 -1
  11. package/dist-lib/components/ui/Breadcrumbs.js +62 -50
  12. package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
  13. package/dist-lib/components/ui/Button.js +129 -131
  14. package/dist-lib/components/ui/Button.js.map +1 -1
  15. package/dist-lib/components/ui/Calendar.d.ts +1 -1
  16. package/dist-lib/components/ui/Calendar.js +99 -136
  17. package/dist-lib/components/ui/Calendar.js.map +1 -1
  18. package/dist-lib/components/ui/Card.js +88 -94
  19. package/dist-lib/components/ui/Card.js.map +1 -1
  20. package/dist-lib/components/ui/Carousel.js +125 -170
  21. package/dist-lib/components/ui/Carousel.js.map +1 -1
  22. package/dist-lib/components/ui/Chart.d.ts +3 -3
  23. package/dist-lib/components/ui/Chart.js +435 -464
  24. package/dist-lib/components/ui/Chart.js.map +1 -1
  25. package/dist-lib/components/ui/Checkbox.js +60 -69
  26. package/dist-lib/components/ui/Checkbox.js.map +1 -1
  27. package/dist-lib/components/ui/Combobox.js +179 -192
  28. package/dist-lib/components/ui/Combobox.js.map +1 -1
  29. package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
  30. package/dist-lib/components/ui/CommandPalette.js +106 -167
  31. package/dist-lib/components/ui/CommandPalette.js.map +1 -1
  32. package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
  33. package/dist-lib/components/ui/ContextMenu.js +89 -154
  34. package/dist-lib/components/ui/ContextMenu.js.map +1 -1
  35. package/dist-lib/components/ui/DataGrid.d.ts +1 -1
  36. package/dist-lib/components/ui/DataGrid.js +99 -96
  37. package/dist-lib/components/ui/DataGrid.js.map +1 -1
  38. package/dist-lib/components/ui/DatePicker.js +151 -188
  39. package/dist-lib/components/ui/DatePicker.js.map +1 -1
  40. package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
  41. package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
  42. package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
  43. package/dist-lib/components/ui/Dialog.d.ts +3 -3
  44. package/dist-lib/components/ui/Dialog.js +108 -156
  45. package/dist-lib/components/ui/Dialog.js.map +1 -1
  46. package/dist-lib/components/ui/Drawer.d.ts +3 -3
  47. package/dist-lib/components/ui/Drawer.js +90 -124
  48. package/dist-lib/components/ui/Drawer.js.map +1 -1
  49. package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
  50. package/dist-lib/components/ui/DropdownMenu.js +92 -158
  51. package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
  52. package/dist-lib/components/ui/EmptyState.js +31 -44
  53. package/dist-lib/components/ui/EmptyState.js.map +1 -1
  54. package/dist-lib/components/ui/ErrorState.js +57 -67
  55. package/dist-lib/components/ui/ErrorState.js.map +1 -1
  56. package/dist-lib/components/ui/FileUpload.js +113 -107
  57. package/dist-lib/components/ui/FileUpload.js.map +1 -1
  58. package/dist-lib/components/ui/Form.d.ts +6 -4
  59. package/dist-lib/components/ui/Form.js +117 -122
  60. package/dist-lib/components/ui/Form.js.map +1 -1
  61. package/dist-lib/components/ui/Icon.d.ts +1 -1
  62. package/dist-lib/components/ui/Icon.js +30 -29
  63. package/dist-lib/components/ui/Icon.js.map +1 -1
  64. package/dist-lib/components/ui/IconButton.js +61 -63
  65. package/dist-lib/components/ui/IconButton.js.map +1 -1
  66. package/dist-lib/components/ui/Input.js +133 -156
  67. package/dist-lib/components/ui/Input.js.map +1 -1
  68. package/dist-lib/components/ui/Kbd.js +14 -21
  69. package/dist-lib/components/ui/Kbd.js.map +1 -1
  70. package/dist-lib/components/ui/MultiSelect.js +176 -208
  71. package/dist-lib/components/ui/MultiSelect.js.map +1 -1
  72. package/dist-lib/components/ui/Pagination.js +152 -149
  73. package/dist-lib/components/ui/Pagination.js.map +1 -1
  74. package/dist-lib/components/ui/Popover.js +18 -33
  75. package/dist-lib/components/ui/Popover.js.map +1 -1
  76. package/dist-lib/components/ui/Progress.js +77 -99
  77. package/dist-lib/components/ui/Progress.js.map +1 -1
  78. package/dist-lib/components/ui/RadioGroup.js +51 -80
  79. package/dist-lib/components/ui/RadioGroup.js.map +1 -1
  80. package/dist-lib/components/ui/RelativeTime.js +22 -29
  81. package/dist-lib/components/ui/RelativeTime.js.map +1 -1
  82. package/dist-lib/components/ui/ScrollArea.js +39 -58
  83. package/dist-lib/components/ui/ScrollArea.js.map +1 -1
  84. package/dist-lib/components/ui/Select.js +108 -131
  85. package/dist-lib/components/ui/Select.js.map +1 -1
  86. package/dist-lib/components/ui/Separator.js +18 -24
  87. package/dist-lib/components/ui/Separator.js.map +1 -1
  88. package/dist-lib/components/ui/Sheet.d.ts +2 -2
  89. package/dist-lib/components/ui/Sheet.js +77 -129
  90. package/dist-lib/components/ui/Sheet.js.map +1 -1
  91. package/dist-lib/components/ui/Sidebar.d.ts +1 -1
  92. package/dist-lib/components/ui/Sidebar.js +168 -207
  93. package/dist-lib/components/ui/Sidebar.js.map +1 -1
  94. package/dist-lib/components/ui/Skeleton.js +17 -27
  95. package/dist-lib/components/ui/Skeleton.js.map +1 -1
  96. package/dist-lib/components/ui/Slider.js +45 -62
  97. package/dist-lib/components/ui/Slider.js.map +1 -1
  98. package/dist-lib/components/ui/Snackbar.js +75 -55
  99. package/dist-lib/components/ui/Snackbar.js.map +1 -1
  100. package/dist-lib/components/ui/Spinner.js +45 -52
  101. package/dist-lib/components/ui/Spinner.js.map +1 -1
  102. package/dist-lib/components/ui/Stepper.js +56 -108
  103. package/dist-lib/components/ui/Stepper.js.map +1 -1
  104. package/dist-lib/components/ui/Switch.js +46 -79
  105. package/dist-lib/components/ui/Switch.js.map +1 -1
  106. package/dist-lib/components/ui/Table.js +108 -169
  107. package/dist-lib/components/ui/Table.js.map +1 -1
  108. package/dist-lib/components/ui/Tabs.js +57 -88
  109. package/dist-lib/components/ui/Tabs.js.map +1 -1
  110. package/dist-lib/components/ui/TagInput.js +76 -109
  111. package/dist-lib/components/ui/TagInput.js.map +1 -1
  112. package/dist-lib/components/ui/Textarea.js +74 -86
  113. package/dist-lib/components/ui/Textarea.js.map +1 -1
  114. package/dist-lib/components/ui/Timeline.d.ts +3 -3
  115. package/dist-lib/components/ui/Timeline.js +61 -49
  116. package/dist-lib/components/ui/Timeline.js.map +1 -1
  117. package/dist-lib/components/ui/Toast.d.ts +1 -1
  118. package/dist-lib/components/ui/Toast.js +136 -150
  119. package/dist-lib/components/ui/Toast.js.map +1 -1
  120. package/dist-lib/components/ui/Tooltip.d.ts +2 -2
  121. package/dist-lib/components/ui/Tooltip.js +35 -56
  122. package/dist-lib/components/ui/Tooltip.js.map +1 -1
  123. package/dist-lib/components/ui/TopNav.js +46 -66
  124. package/dist-lib/components/ui/TopNav.js.map +1 -1
  125. package/dist-lib/components/ui/Tree.js +134 -168
  126. package/dist-lib/components/ui/Tree.js.map +1 -1
  127. package/dist-lib/hooks/use-debounce.js +24 -33
  128. package/dist-lib/hooks/use-debounce.js.map +1 -1
  129. package/dist-lib/hooks/use-delayed-loading.js +20 -18
  130. package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
  131. package/dist-lib/hooks/use-field-ids.js +14 -16
  132. package/dist-lib/hooks/use-field-ids.js.map +1 -1
  133. package/dist-lib/hooks/use-media-query.js +15 -19
  134. package/dist-lib/hooks/use-media-query.js.map +1 -1
  135. package/dist-lib/hooks/use-modifier-key.d.ts +0 -4
  136. package/dist-lib/hooks/use-modifier-key.js +19 -16
  137. package/dist-lib/hooks/use-modifier-key.js.map +1 -1
  138. package/dist-lib/hooks/use-strings.js +10 -10
  139. package/dist-lib/hooks/use-strings.js.map +1 -1
  140. package/dist-lib/hooks/use-toast.js +73 -62
  141. package/dist-lib/hooks/use-toast.js.map +1 -1
  142. package/dist-lib/icon.js +2 -6
  143. package/dist-lib/icons/index.d.ts +1 -1
  144. package/dist-lib/icons/index.js +166 -163
  145. package/dist-lib/icons/index.js.map +1 -1
  146. package/dist-lib/illustrations/index.d.ts +7 -7
  147. package/dist-lib/illustrations/index.js +255 -106
  148. package/dist-lib/illustrations/index.js.map +1 -1
  149. package/dist-lib/index.js +69 -291
  150. package/dist-lib/lib/cva.js +2 -0
  151. package/dist-lib/lib/format.js +71 -87
  152. package/dist-lib/lib/format.js.map +1 -1
  153. package/dist-lib/lib/return-focus.js +11 -11
  154. package/dist-lib/lib/return-focus.js.map +1 -1
  155. package/dist-lib/lib/strings.js +167 -135
  156. package/dist-lib/lib/strings.js.map +1 -1
  157. package/dist-lib/lib/strings.mn.js +150 -113
  158. package/dist-lib/lib/strings.mn.js.map +1 -1
  159. package/dist-lib/lib/utils.js +9 -9
  160. package/dist-lib/lib/utils.js.map +1 -1
  161. package/dist-lib/styles.css +3 -1
  162. package/package.json +53 -53
  163. package/dist-lib/__tests__/helpers/color.d.ts +0 -9
  164. package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
  165. package/dist-lib/icon.js.map +0 -1
  166. package/dist-lib/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Timeline.js","sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type HTMLAttributes, type ReactNode, type TimeHTMLAttributes } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport type TimelineProps = HTMLAttributes<HTMLOListElement>;\n\nexport const Timeline = forwardRef<HTMLOListElement, TimelineProps>(function Timeline(\n { className, children, ...props },\n ref,\n) {\n return (\n <ol ref={ref} className={cn('relative flex flex-col gap-6', className)} {...props}>\n {children}\n </ol>\n );\n});\nTimeline.displayName = 'Timeline';\n\nexport interface TimelineItemProps extends HTMLAttributes<HTMLLIElement> {\n /** Optional bullet override. Default: small accent dot. */\n bullet?: ReactNode;\n /** Hide the connector line below this item — use for the last item. */\n isLast?: boolean;\n}\n\nexport const TimelineItem = forwardRef<HTMLLIElement, TimelineItemProps>(function TimelineItem(\n { bullet, isLast, className, children, ...props },\n ref,\n) {\n return (\n <li ref={ref} className={cn('relative flex gap-4 pb-1', className)} {...props}>\n <div className=\"relative flex shrink-0 flex-col items-center\">\n <div className=\"border-border bg-card text-foreground-muted flex size-6 items-center justify-center rounded-full border\">\n {bullet ?? <span className=\"bg-accent size-2 rounded-full\" aria-hidden />}\n </div>\n {!isLast && <span className=\"bg-border mt-1 w-px flex-1\" aria-hidden />}\n </div>\n <div className=\"min-w-0 flex-1 pb-4\">{children}</div>\n </li>\n );\n});\nTimelineItem.displayName = 'TimelineItem';\n\nexport interface TimelineTimeProps extends TimeHTMLAttributes<HTMLTimeElement> {\n /** Machine-readable value (ISO 8601). Defaults to `children` when it is a string. */\n dateTime?: string;\n children: ReactNode;\n}\n\n/** Accept only values `Date` can parse — an invalid `dateTime` is worse than none. */\nfunction validDateTime(v: string | undefined): string | undefined {\n if (!v || Number.isNaN(Date.parse(v))) return undefined;\n return v;\n}\n\nexport function TimelineTime({ className, children, dateTime, ...props }: TimelineTimeProps) {\n return (\n <time\n dateTime={validDateTime(dateTime ?? (typeof children === 'string' ? children : undefined))}\n className={cn('text-foreground-subtle block text-xs', className)}\n {...props}\n >\n {children}\n </time>\n );\n}\nTimelineTime.displayName = 'TimelineTime';\n\nexport function TimelineTitle({\n className,\n children,\n}: {\n className?: string;\n children: ReactNode;\n}) {\n return <p className={cn('text-sm font-medium', className)}>{children}</p>;\n}\nTimelineTitle.displayName = 'TimelineTitle';\n\nexport function TimelineDescription({\n className,\n children,\n}: {\n className?: string;\n children: ReactNode;\n}) {\n return <p className={cn('text-foreground-muted mt-0.5 text-sm', className)}>{children}</p>;\n}\nTimelineDescription.displayName = 'TimelineDescription';\n"],"names":["Timeline","forwardRef","className","children","props","ref","jsx","cn","TimelineItem","bullet","isLast","jsxs","validDateTime","v","TimelineTime","dateTime","TimelineTitle","TimelineDescription"],"mappings":";;;;AAOO,MAAMA,IAAWC,EAA4C,SAClE,EAAE,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC,EAAC,MAAA,EAAG,KAAAD,GAAU,WAAWE,EAAG,gCAAgCL,CAAS,GAAI,GAAGE,GACzE,UAAAD,EAAA,CACH;AAEJ,CAAC;AACDH,EAAS,cAAc;AAShB,MAAMQ,IAAeP,EAA6C,SACvE,EAAE,QAAAQ,GAAQ,QAAAC,GAAQ,WAAAR,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAC1CC,GACA;AACA,SACE,gBAAAM,EAAC,QAAG,KAAAN,GAAU,WAAWE,EAAG,4BAA4BL,CAAS,GAAI,GAAGE,GACtE,UAAA;AAAA,IAAA,gBAAAO,EAAC,OAAA,EAAI,WAAU,gDACb,UAAA;AAAA,MAAA,gBAAAL,EAAC,OAAA,EAAI,WAAU,2GACZ,UAAAG,KAAU,gBAAAH,EAAC,UAAK,WAAU,iCAAgC,eAAW,GAAA,CAAC,EAAA,CACzE;AAAA,MACC,CAACI,KAAU,gBAAAJ,EAAC,UAAK,WAAU,8BAA6B,eAAW,GAAA,CAAC;AAAA,IAAA,GACvE;AAAA,IACA,gBAAAA,EAAC,OAAA,EAAI,WAAU,uBAAuB,UAAAH,EAAA,CAAS;AAAA,EAAA,GACjD;AAEJ,CAAC;AACDK,EAAa,cAAc;AAS3B,SAASI,EAAcC,GAA2C;AAChE,MAAI,GAACA,KAAK,OAAO,MAAM,KAAK,MAAMA,CAAC,CAAC;AACpC,WAAOA;AACT;AAEO,SAASC,EAAa,EAAE,WAAAZ,GAAW,UAAAC,GAAU,UAAAY,GAAU,GAAGX,KAA4B;AAC3F,SACE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAUM,EAAcG,MAAa,OAAOZ,KAAa,WAAWA,IAAW,OAAU;AAAA,MACzF,WAAWI,EAAG,wCAAwCL,CAAS;AAAA,MAC9D,GAAGE;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;AACAW,EAAa,cAAc;AAEpB,SAASE,EAAc;AAAA,EAC5B,WAAAd;AAAA,EACA,UAAAC;AACF,GAGG;AACD,2BAAQ,KAAA,EAAE,WAAWI,EAAG,uBAAuBL,CAAS,GAAI,UAAAC,GAAS;AACvE;AACAa,EAAc,cAAc;AAErB,SAASC,EAAoB;AAAA,EAClC,WAAAf;AAAA,EACA,UAAAC;AACF,GAGG;AACD,2BAAQ,KAAA,EAAE,WAAWI,EAAG,wCAAwCL,CAAS,GAAI,UAAAC,GAAS;AACxF;AACAc,EAAoB,cAAc;"}
1
+ {"version":3,"file":"Timeline.js","names":[],"sources":["../../../src/components/ui/Timeline.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type HTMLAttributes, type ReactNode, type TimeHTMLAttributes } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport type TimelineProps = HTMLAttributes<HTMLOListElement>;\n\nexport const Timeline = forwardRef<HTMLOListElement, TimelineProps>(function Timeline(\n { className, children, ...props },\n ref,\n) {\n return (\n <ol ref={ref} className={cn('relative flex flex-col gap-6', className)} {...props}>\n {children}\n </ol>\n );\n});\nTimeline.displayName = 'Timeline';\n\nexport interface TimelineItemProps extends HTMLAttributes<HTMLLIElement> {\n /** Optional bullet override. Default: small accent dot. */\n bullet?: ReactNode;\n /** Hide the connector line below this item — use for the last item. */\n isLast?: boolean;\n}\n\nexport const TimelineItem = forwardRef<HTMLLIElement, TimelineItemProps>(function TimelineItem(\n { bullet, isLast, className, children, ...props },\n ref,\n) {\n return (\n <li ref={ref} className={cn('relative flex gap-4 pb-1', className)} {...props}>\n <div className=\"relative flex shrink-0 flex-col items-center\">\n <div className=\"border-border bg-card text-foreground-muted flex size-6 items-center justify-center rounded-full border\">\n {bullet ?? <span className=\"bg-accent size-2 rounded-full\" aria-hidden />}\n </div>\n {!isLast && <span className=\"bg-border mt-1 w-px flex-1\" aria-hidden />}\n </div>\n <div className=\"min-w-0 flex-1 pb-4\">{children}</div>\n </li>\n );\n});\nTimelineItem.displayName = 'TimelineItem';\n\nexport interface TimelineTimeProps extends TimeHTMLAttributes<HTMLTimeElement> {\n /** Machine-readable value (ISO 8601). Defaults to `children` when it is a string. */\n dateTime?: string;\n children: ReactNode;\n}\n\n/** Accept only values `Date` can parse — an invalid `dateTime` is worse than none. */\nfunction validDateTime(v: string | undefined): string | undefined {\n if (!v || Number.isNaN(Date.parse(v))) return undefined;\n return v;\n}\n\nexport function TimelineTime({ className, children, dateTime, ...props }: TimelineTimeProps) {\n return (\n <time\n dateTime={validDateTime(dateTime ?? (typeof children === 'string' ? children : undefined))}\n className={cn('text-foreground-subtle block text-xs', className)}\n {...props}\n >\n {children}\n </time>\n );\n}\nTimelineTime.displayName = 'TimelineTime';\n\nexport function TimelineTitle({\n className,\n children,\n}: {\n className?: string;\n children: ReactNode;\n}) {\n return <p className={cn('text-sm font-medium', className)}>{children}</p>;\n}\nTimelineTitle.displayName = 'TimelineTitle';\n\nexport function TimelineDescription({\n className,\n children,\n}: {\n className?: string;\n children: ReactNode;\n}) {\n return <p className={cn('text-foreground-muted mt-0.5 text-sm', className)}>{children}</p>;\n}\nTimelineDescription.displayName = 'TimelineDescription';\n"],"mappings":";;;;;AAOA,IAAa,IAAW,EAA4C,SAClE,EAAE,cAAW,aAAU,GAAG,KAC1B,GACA;CACA,OACE,kBAAC,MAAD;EAAS;EAAK,WAAW,EAAG,gCAAgC,CAAS;EAAG,GAAI;EACzE;CACC,CAAA;AAER,CAAC;AACD,EAAS,cAAc;AASvB,IAAa,IAAe,EAA6C,SACvE,EAAE,WAAQ,WAAQ,cAAW,aAAU,GAAG,KAC1C,GACA;CACA,OACE,kBAAC,MAAD;EAAS;EAAK,WAAW,EAAG,4BAA4B,CAAS;EAAG,GAAI;EAAxE,UAAA,CACE,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,kBAAC,OAAD;IAAK,WAAU;IACZ,UAAA,KAAU,kBAAC,QAAD;KAAM,WAAU;KAAgC,eAAA;IAAa,CAAA;GACrE,CAAA,GACJ,CAAC,KAAU,kBAAC,QAAD;IAAM,WAAU;IAA6B,eAAA;GAAa,CAAA,CACnE;EACL,CAAA,GAAA,kBAAC,OAAD;GAAK,WAAU;GAAuB;EAAc,CAAA,CAClD;;AAER,CAAC;AACD,EAAa,cAAc;AAS3B,SAAS,EAAc,GAA2C;CAC5D,IAAC,KAAK,QAAO,MAAM,KAAK,MAAM,CAAC,CAAC,GACpC,OAAO;AACT;AAEA,SAAgB,EAAa,EAAE,cAAW,aAAU,aAAU,GAAG,KAA4B;CAC3F,OACE,kBAAC,QAAD;EACE,UAAU,EAAc,MAAa,OAAO,KAAa,WAAW,IAAW,KAAA,EAAU;EACzF,WAAW,EAAG,wCAAwC,CAAS;EAC/D,GAAI;EAEH;CACG,CAAA;AAEV;AACA,EAAa,cAAc;AAE3B,SAAgB,EAAc,EAC5B,cACA,eAIC;CACD,OAAO,kBAAC,KAAD;EAAG,WAAW,EAAG,uBAAuB,CAAS;EAAI;CAAY,CAAA;AAC1E;AACA,EAAc,cAAc;AAE5B,SAAgB,EAAoB,EAClC,cACA,eAIC;CACD,OAAO,kBAAC,KAAD;EAAG,WAAW,EAAG,wCAAwC,CAAS;EAAI;CAAY,CAAA;AAC3F;AACA,EAAoB,cAAc"}
@@ -29,7 +29,7 @@ export declare const ToastClose: import('react').ForwardRefExoticComponent<Omit<
29
29
  * );
30
30
  * }
31
31
  */
32
- export declare function Toaster(): import("react/jsx-runtime").JSX.Element;
32
+ export declare function Toaster(): import("react").JSX.Element;
33
33
  export declare namespace Toaster {
34
34
  var displayName: string;
35
35
  }
@@ -1,158 +1,144 @@
1
1
  "use client";
2
- import { jsxs as f, jsx as s } from "react/jsx-runtime";
3
- import { forwardRef as l, useEffect as v } from "react";
4
- import * as n from "@radix-ui/react-toast";
5
- import { X as T, Info as w, XCircle as N, AlertTriangle as y, CheckCircle2 as C } from "../../icons/index.js";
6
- import { cn as c } from "../../lib/utils.js";
7
- import { useStrings as m } from "../../hooks/use-strings.js";
8
- import { useToast as k } from "../../hooks/use-toast.js";
9
- import { cva as z } from "class-variance-authority";
10
- const A = n.Provider, u = l(function({ className: o, label: e, ...a }, t) {
11
- const r = m();
12
- return /* @__PURE__ */ s(
13
- n.Viewport,
14
- {
15
- ref: t,
16
- label: e ?? r.toast.region,
17
- className: c(
18
- "fixed right-0 bottom-0 z-[var(--z-toast)] flex max-h-dvh w-full flex-col-reverse gap-2 p-6",
19
- // Respect notched/home-indicator insets (consumers set viewport-fit=cover).
20
- "pr-[max(1.5rem,env(safe-area-inset-right))] pb-[max(1.5rem,env(safe-area-inset-bottom))] pl-[max(1.5rem,env(safe-area-inset-left))]",
21
- "sm:top-4 sm:right-4 sm:bottom-auto sm:max-w-sm sm:flex-col",
22
- o
23
- ),
24
- ...a
25
- }
26
- );
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { cva as t } from "../../lib/cva.js";
4
+ import { useToast as n } from "../../hooks/use-toast.js";
5
+ import { useStrings as r } from "../../hooks/use-strings.js";
6
+ import { AlertTriangle as i, CheckCircle2 as a, Info as o, X as s, XCircle as c } from "../../icons/index.js";
7
+ import { forwardRef as l, useEffect as u } from "react";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import * as p from "@radix-ui/react-toast";
10
+ //#region src/components/ui/Toast.tsx
11
+ var m = p.Provider, h = l(function({ className: t, label: n, ...i }, a) {
12
+ let o = r();
13
+ return /* @__PURE__ */ d(p.Viewport, {
14
+ ref: a,
15
+ label: n ?? o.toast.region,
16
+ className: e("fixed right-0 bottom-0 z-[var(--z-toast)] flex max-h-dvh w-full flex-col-reverse gap-2 p-6", "pr-[max(1.5rem,env(safe-area-inset-right))] pb-[max(1.5rem,env(safe-area-inset-bottom))] pl-[max(1.5rem,env(safe-area-inset-left))]", "sm:top-4 sm:right-4 sm:bottom-auto sm:max-w-sm sm:flex-col", t),
17
+ ...i
18
+ });
27
19
  });
28
- u.displayName = "ToastViewport";
29
- const V = z(
30
- [
31
- "group pointer-events-auto relative flex w-full items-start gap-3",
32
- "overflow-hidden rounded-lg border p-4 pr-8 shadow-md",
33
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
34
- "data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-right-full",
35
- "data-[state=closed]:slide-out-to-right-full",
36
- "data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]",
37
- "data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform",
38
- "data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)]"
39
- ],
40
- {
41
- variants: {
42
- variant: {
43
- default: "border-border bg-card text-card-foreground",
44
- success: "border-success-border-soft bg-success-soft text-success-text",
45
- warning: "border-warning-border-soft bg-warning-soft text-warning-text",
46
- danger: "border-danger-border-soft bg-danger-soft text-danger-text",
47
- info: "border-info-border-soft bg-info-soft text-info-text"
48
- }
49
- },
50
- defaultVariants: { variant: "default" }
51
- }
52
- ), j = {
53
- default: null,
54
- success: /* @__PURE__ */ s(C, { className: "text-success-text mt-0.5 size-5 shrink-0", "aria-hidden": !0 }),
55
- warning: /* @__PURE__ */ s(y, { className: "text-warning-text mt-0.5 size-5 shrink-0", "aria-hidden": !0 }),
56
- danger: /* @__PURE__ */ s(N, { className: "text-danger-text mt-0.5 size-5 shrink-0", "aria-hidden": !0 }),
57
- info: /* @__PURE__ */ s(w, { className: "text-info-text mt-0.5 size-5 shrink-0", "aria-hidden": !0 })
58
- }, p = l(function({ className: o, variant: e = "default", children: a, ...t }, r) {
59
- return /* @__PURE__ */ f(n.Root, { ref: r, className: c(V({ variant: e }), o), ...t, children: [
60
- j[e ?? "default"],
61
- /* @__PURE__ */ s("div", { className: "flex-1 space-y-1", children: a })
62
- ] });
20
+ h.displayName = "ToastViewport";
21
+ var g = t([
22
+ "group pointer-events-auto relative flex w-full items-start gap-3",
23
+ "overflow-hidden rounded-lg border p-4 pr-8 shadow-md",
24
+ "data-[state=open]:animate-in data-[state=closed]:animate-out",
25
+ "data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-right-full",
26
+ "data-[state=closed]:slide-out-to-right-full",
27
+ "data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]",
28
+ "data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform",
29
+ "data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)]"
30
+ ], {
31
+ variants: { variant: {
32
+ default: "border-border bg-card text-card-foreground",
33
+ success: "border-success-border-soft bg-success-soft text-success-text",
34
+ warning: "border-warning-border-soft bg-warning-soft text-warning-text",
35
+ danger: "border-danger-border-soft bg-danger-soft text-danger-text",
36
+ info: "border-info-border-soft bg-info-soft text-info-text"
37
+ } },
38
+ defaultVariants: { variant: "default" }
39
+ }), _ = {
40
+ default: null,
41
+ success: /* @__PURE__ */ d(a, {
42
+ className: "text-success-text mt-0.5 size-5 shrink-0",
43
+ "aria-hidden": !0
44
+ }),
45
+ warning: /* @__PURE__ */ d(i, {
46
+ className: "text-warning-text mt-0.5 size-5 shrink-0",
47
+ "aria-hidden": !0
48
+ }),
49
+ danger: /* @__PURE__ */ d(c, {
50
+ className: "text-danger-text mt-0.5 size-5 shrink-0",
51
+ "aria-hidden": !0
52
+ }),
53
+ info: /* @__PURE__ */ d(o, {
54
+ className: "text-info-text mt-0.5 size-5 shrink-0",
55
+ "aria-hidden": !0
56
+ })
57
+ }, v = l(function({ className: t, variant: n = "default", children: r, ...i }, a) {
58
+ return /* @__PURE__ */ f(p.Root, {
59
+ ref: a,
60
+ className: e(g({ variant: n }), t),
61
+ ...i,
62
+ children: [_[n ?? "default"], /* @__PURE__ */ d("div", {
63
+ className: "flex-1 space-y-1",
64
+ children: r
65
+ })]
66
+ });
63
67
  });
64
- p.displayName = "Toast";
65
- const g = l(function({ className: o, ...e }, a) {
66
- return /* @__PURE__ */ s(n.Title, { ref: a, className: c("text-sm font-medium", o), ...e });
68
+ v.displayName = "Toast";
69
+ var y = l(function({ className: t, ...n }, r) {
70
+ return /* @__PURE__ */ d(p.Title, {
71
+ ref: r,
72
+ className: e("text-sm font-medium", t),
73
+ ...n
74
+ });
67
75
  });
68
- g.displayName = "ToastTitle";
69
- const x = l(function({ className: o, ...e }, a) {
70
- return /* @__PURE__ */ s(
71
- n.Description,
72
- {
73
- ref: a,
74
- className: c("text-sm opacity-90", o),
75
- ...e
76
- }
77
- );
76
+ y.displayName = "ToastTitle";
77
+ var b = l(function({ className: t, ...n }, r) {
78
+ return /* @__PURE__ */ d(p.Description, {
79
+ ref: r,
80
+ className: e("text-sm opacity-90", t),
81
+ ...n
82
+ });
78
83
  });
79
- x.displayName = "ToastDescription";
80
- const b = l(function({ className: o, ...e }, a) {
81
- return /* @__PURE__ */ s(
82
- n.Action,
83
- {
84
- ref: a,
85
- className: c(
86
- "inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-current bg-transparent px-3 text-sm font-medium",
87
- "transition-colors outline-none hover:bg-current/10",
88
- "focus-visible:ring-ring focus-visible:ring-offset-card focus-visible:ring-2 focus-visible:ring-offset-2",
89
- o
90
- ),
91
- ...e
92
- }
93
- );
84
+ b.displayName = "ToastDescription";
85
+ var x = l(function({ className: t, ...n }, r) {
86
+ return /* @__PURE__ */ d(p.Action, {
87
+ ref: r,
88
+ className: e("inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-current bg-transparent px-3 text-sm font-medium", "transition-colors outline-none hover:bg-current/10", "focus-visible:ring-ring focus-visible:ring-offset-card focus-visible:ring-2 focus-visible:ring-offset-2", t),
89
+ ...n
90
+ });
94
91
  });
95
- b.displayName = "ToastAction";
96
- const h = l(function({ className: o, ...e }, a) {
97
- const t = m();
98
- return /* @__PURE__ */ s(
99
- n.Close,
100
- {
101
- ref: a,
102
- "aria-label": e["aria-label"] ?? t.toast.close,
103
- className: c(
104
- "text-foreground-subtle absolute top-2 right-2 inline-flex size-7 items-center justify-center rounded-md",
105
- "hover:text-foreground opacity-0 transition-opacity group-hover:opacity-100",
106
- "focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2",
107
- o
108
- ),
109
- "toast-close": "",
110
- ...e,
111
- children: /* @__PURE__ */ s(T, { className: "size-4", "aria-hidden": !0 })
112
- }
113
- );
92
+ x.displayName = "ToastAction";
93
+ var S = l(function({ className: t, ...n }, i) {
94
+ let a = r();
95
+ return /* @__PURE__ */ d(p.Close, {
96
+ ref: i,
97
+ "aria-label": n["aria-label"] ?? a.toast.close,
98
+ className: e("text-foreground-subtle absolute top-2 right-2 inline-flex size-7 items-center justify-center rounded-md", "hover:text-foreground opacity-0 transition-opacity group-hover:opacity-100", "focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2", t),
99
+ "toast-close": "",
100
+ ...n,
101
+ children: /* @__PURE__ */ d(s, {
102
+ className: "size-4",
103
+ "aria-hidden": !0
104
+ })
105
+ });
114
106
  });
115
- h.displayName = "ToastClose";
116
- function D() {
117
- const { toasts: i, dismiss: o, remove: e } = k();
118
- v(() => {
119
- const t = i.filter((d) => !d.open);
120
- if (t.length === 0) return;
121
- const r = t.map((d) => window.setTimeout(() => e(d.id), 200));
122
- return () => r.forEach((d) => window.clearTimeout(d));
123
- }, [i, e]);
124
- const a = m();
125
- return /* @__PURE__ */ f(A, { label: a.toast.region, children: [
126
- i.map((t) => /* @__PURE__ */ f(
127
- p,
128
- {
129
- variant: t.variant ?? "default",
130
- open: t.open,
131
- duration: t.duration === 0 ? 1 / 0 : t.duration,
132
- onOpenChange: (r) => {
133
- r || o(t.id);
134
- },
135
- children: [
136
- t.title && /* @__PURE__ */ s(g, { children: t.title }),
137
- t.description && /* @__PURE__ */ s(x, { children: t.description }),
138
- t.action && /* @__PURE__ */ s(b, { altText: t.action.altText, onClick: t.action.onClick, className: "mt-1", children: t.action.label }),
139
- /* @__PURE__ */ s(h, {})
140
- ]
141
- },
142
- t.id
143
- )),
144
- /* @__PURE__ */ s(u, {})
145
- ] });
107
+ S.displayName = "ToastClose";
108
+ function C() {
109
+ let { toasts: e, dismiss: t, remove: i } = n();
110
+ u(() => {
111
+ let t = e.filter((e) => !e.open);
112
+ if (t.length === 0) return;
113
+ let n = t.map((e) => window.setTimeout(() => i(e.id), 200));
114
+ return () => n.forEach((e) => window.clearTimeout(e));
115
+ }, [e, i]);
116
+ let a = r();
117
+ return /* @__PURE__ */ f(m, {
118
+ label: a.toast.region,
119
+ children: [e.map((e) => /* @__PURE__ */ f(v, {
120
+ variant: e.variant ?? "default",
121
+ open: e.open,
122
+ duration: e.duration === 0 ? Infinity : e.duration,
123
+ onOpenChange: (n) => {
124
+ n || t(e.id);
125
+ },
126
+ children: [
127
+ e.title && /* @__PURE__ */ d(y, { children: e.title }),
128
+ e.description && /* @__PURE__ */ d(b, { children: e.description }),
129
+ e.action && /* @__PURE__ */ d(x, {
130
+ altText: e.action.altText,
131
+ onClick: e.action.onClick,
132
+ className: "mt-1",
133
+ children: e.action.label
134
+ }),
135
+ /* @__PURE__ */ d(S, {})
136
+ ]
137
+ }, e.id)), /* @__PURE__ */ d(h, {})]
138
+ });
146
139
  }
147
- D.displayName = "Toaster";
148
- export {
149
- p as Toast,
150
- b as ToastAction,
151
- h as ToastClose,
152
- x as ToastDescription,
153
- A as ToastProvider,
154
- g as ToastTitle,
155
- u as ToastViewport,
156
- D as Toaster
157
- };
158
- //# sourceMappingURL=Toast.js.map
140
+ C.displayName = "Toaster";
141
+ //#endregion
142
+ export { v as Toast, x as ToastAction, S as ToastClose, b as ToastDescription, m as ToastProvider, y as ToastTitle, h as ToastViewport, C as Toaster };
143
+
144
+ //# sourceMappingURL=Toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../src/components/ui/Toast.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useEffect,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type ReactElement,\n} from 'react';\nimport * as ToastPrimitive from '@radix-ui/react-toast';\nimport { AlertTriangle, CheckCircle2, Info, X, XCircle } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { cva, type VariantProps } from '@/lib/cva';\nimport { useToast } from '@/hooks/use-toast';\n\nexport const ToastProvider = ToastPrimitive.Provider;\n\nexport const ToastViewport = forwardRef<\n ElementRef<typeof ToastPrimitive.Viewport>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport>\n>(function ToastViewport({ className, label, ...props }, ref) {\n const strings = useStrings();\n return (\n <ToastPrimitive.Viewport\n ref={ref}\n // Radix's default is \"Notifications ({hotkey})\" — route it through the\n // strings so the region landmark is localised like the rest.\n label={label ?? strings.toast.region}\n className={cn(\n 'fixed right-0 bottom-0 z-[var(--z-toast)] flex max-h-dvh w-full flex-col-reverse gap-2 p-6',\n // Respect notched/home-indicator insets (consumers set viewport-fit=cover).\n 'pr-[max(1.5rem,env(safe-area-inset-right))] pb-[max(1.5rem,env(safe-area-inset-bottom))] pl-[max(1.5rem,env(safe-area-inset-left))]',\n 'sm:top-4 sm:right-4 sm:bottom-auto sm:max-w-sm sm:flex-col',\n className,\n )}\n {...props}\n />\n );\n});\nToastViewport.displayName = 'ToastViewport';\n\nconst toast = cva(\n [\n 'group pointer-events-auto relative flex w-full items-start gap-3',\n 'overflow-hidden rounded-lg border p-4 pr-8 shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-right-full',\n 'data-[state=closed]:slide-out-to-right-full',\n 'data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]',\n 'data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform',\n 'data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)]',\n ],\n {\n variants: {\n variant: {\n default: 'border-border bg-card text-card-foreground',\n success: 'border-success-border-soft bg-success-soft text-success-text',\n warning: 'border-warning-border-soft bg-warning-soft text-warning-text',\n danger: 'border-danger-border-soft bg-danger-soft text-danger-text',\n info: 'border-info-border-soft bg-info-soft text-info-text',\n },\n },\n defaultVariants: { variant: 'default' },\n },\n);\n\nconst iconMap = {\n default: null,\n success: <CheckCircle2 className=\"text-success-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n warning: <AlertTriangle className=\"text-warning-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n danger: <XCircle className=\"text-danger-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n info: <Info className=\"text-info-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n} satisfies Record<'default' | 'success' | 'warning' | 'danger' | 'info', ReactElement | null>;\n\nexport interface ToastProps\n extends ComponentPropsWithoutRef<typeof ToastPrimitive.Root>, VariantProps<typeof toast> {}\n\nexport const Toast = forwardRef<ElementRef<typeof ToastPrimitive.Root>, ToastProps>(function Toast(\n { className, variant = 'default', children, ...props },\n ref,\n) {\n return (\n <ToastPrimitive.Root ref={ref} className={cn(toast({ variant }), className)} {...props}>\n {iconMap[variant ?? 'default']}\n <div className=\"flex-1 space-y-1\">{children}</div>\n </ToastPrimitive.Root>\n );\n});\nToast.displayName = 'Toast';\n\nexport const ToastTitle = forwardRef<\n ElementRef<typeof ToastPrimitive.Title>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Title>\n>(function ToastTitle({ className, ...props }, ref) {\n return (\n <ToastPrimitive.Title ref={ref} className={cn('text-sm font-medium', className)} {...props} />\n );\n});\nToastTitle.displayName = 'ToastTitle';\n\nexport const ToastDescription = forwardRef<\n ElementRef<typeof ToastPrimitive.Description>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Description>\n>(function ToastDescription({ className, ...props }, ref) {\n return (\n <ToastPrimitive.Description\n ref={ref}\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n );\n});\nToastDescription.displayName = 'ToastDescription';\n\nexport const ToastAction = forwardRef<\n ElementRef<typeof ToastPrimitive.Action>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Action>\n>(function ToastAction({ className, ...props }, ref) {\n return (\n <ToastPrimitive.Action\n ref={ref}\n className={cn(\n 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-current bg-transparent px-3 text-sm font-medium',\n 'transition-colors outline-none hover:bg-current/10',\n 'focus-visible:ring-ring focus-visible:ring-offset-card focus-visible:ring-2 focus-visible:ring-offset-2',\n className,\n )}\n {...props}\n />\n );\n});\nToastAction.displayName = 'ToastAction';\n\nexport const ToastClose = forwardRef<\n ElementRef<typeof ToastPrimitive.Close>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Close>\n>(function ToastClose({ className, ...props }, ref) {\n const strings = useStrings();\n return (\n <ToastPrimitive.Close\n ref={ref}\n aria-label={props['aria-label'] ?? strings.toast.close}\n className={cn(\n 'text-foreground-subtle absolute top-2 right-2 inline-flex size-7 items-center justify-center rounded-md',\n 'hover:text-foreground opacity-0 transition-opacity group-hover:opacity-100',\n 'focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2',\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-4\" aria-hidden />\n </ToastPrimitive.Close>\n );\n});\nToastClose.displayName = 'ToastClose';\n\n/**\n * Drop-in host that connects the `useToast()` queue to the Radix primitives.\n * Mount it once near your app root — then `useToast().push({...})` (or the\n * standalone `toast()`) from anywhere renders here. Self-contained: it brings\n * its own ToastProvider + Viewport, so no other Toast wiring is needed.\n *\n * @example\n * function App() {\n * return (\n * <>\n * <Routes />\n * <Toaster />\n * </>\n * );\n * }\n */\nexport function Toaster() {\n const { toasts, dismiss, remove } = useToast();\n\n // Closing a toast sets open:false so Radix can play the slide-out; drop it\n // from the queue once that animation has had time to finish.\n useEffect(() => {\n const closing = toasts.filter((t) => !t.open);\n if (closing.length === 0) return;\n const timers = closing.map((t) => window.setTimeout(() => remove(t.id), 200));\n return () => timers.forEach((id) => window.clearTimeout(id));\n }, [toasts, remove]);\n\n const strings = useStrings();\n return (\n <ToastProvider label={strings.toast.region}>\n {toasts.map((t) => (\n <Toast\n key={t.id}\n variant={t.variant ?? 'default'}\n open={t.open}\n // Radix treats 0 as \"dismiss immediately\"; the queue's 0 means \"keep open\".\n duration={t.duration === 0 ? Infinity : t.duration}\n onOpenChange={(open) => {\n if (!open) dismiss(t.id);\n }}\n >\n {t.title && <ToastTitle>{t.title}</ToastTitle>}\n {t.description && <ToastDescription>{t.description}</ToastDescription>}\n {t.action && (\n <ToastAction altText={t.action.altText} onClick={t.action.onClick} className=\"mt-1\">\n {t.action.label}\n </ToastAction>\n )}\n <ToastClose />\n </Toast>\n ))}\n <ToastViewport />\n </ToastProvider>\n );\n}\nToaster.displayName = 'Toaster';\n\n/**\n * @example\n * <ToastProvider>\n * …app…\n * <Toast variant=\"success\">\n * <ToastTitle>Saved</ToastTitle>\n * <ToastDescription>Your changes are live.</ToastDescription>\n * <ToastAction altText=\"Undo\">Undo</ToastAction>\n * <ToastClose />\n * </Toast>\n * <ToastViewport />\n * </ToastProvider>\n *\n * @do Use the `useToast()` hook (in `src/hooks/use-toast.ts`) in app code —\n * the components here are the primitives the hook renders.\n * @dont Stack more than two toasts at a time. Newer toasts replace older ones.\n */\n"],"names":["ToastProvider","ToastPrimitive","ToastViewport","forwardRef","className","label","props","ref","strings","useStrings","jsx","cn","toast","cva","iconMap","CheckCircle2","AlertTriangle","XCircle","Info","Toast","variant","children","jsxs","ToastTitle","ToastDescription","ToastAction","ToastClose","X","Toaster","toasts","dismiss","remove","useToast","useEffect","closing","t","timers","id","open"],"mappings":";;;;;;;;;AAgBO,MAAMA,IAAgBC,EAAe,UAE/BC,IAAg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E,OAAO,SAAS,SAAS,EAAE,OAAO,SAAS,WAAU,QAC1E,UAAA,EAAE,OAAO,OACZ;AAAA,4BAEDC,GAAA,CAAA,CAAW;AAAA,QAAA;AAAA,MAAA;AAAA,MAhBP,EAAE;AAAA,IAAA,CAkBV;AAAA,sBACAxB,GAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;AACA0B,EAAQ,cAAc;"}
1
+ {"version":3,"file":"Toast.js","names":[],"sources":["../../../src/components/ui/Toast.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n useEffect,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type ReactElement,\n} from 'react';\nimport * as ToastPrimitive from '@radix-ui/react-toast';\nimport { AlertTriangle, CheckCircle2, Info, X, XCircle } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\nimport { cva, type VariantProps } from '@/lib/cva';\nimport { useToast } from '@/hooks/use-toast';\n\nexport const ToastProvider = ToastPrimitive.Provider;\n\nexport const ToastViewport = forwardRef<\n ElementRef<typeof ToastPrimitive.Viewport>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport>\n>(function ToastViewport({ className, label, ...props }, ref) {\n const strings = useStrings();\n return (\n <ToastPrimitive.Viewport\n ref={ref}\n // Radix's default is \"Notifications ({hotkey})\" — route it through the\n // strings so the region landmark is localised like the rest.\n label={label ?? strings.toast.region}\n className={cn(\n 'fixed right-0 bottom-0 z-[var(--z-toast)] flex max-h-dvh w-full flex-col-reverse gap-2 p-6',\n // Respect notched/home-indicator insets (consumers set viewport-fit=cover).\n 'pr-[max(1.5rem,env(safe-area-inset-right))] pb-[max(1.5rem,env(safe-area-inset-bottom))] pl-[max(1.5rem,env(safe-area-inset-left))]',\n 'sm:top-4 sm:right-4 sm:bottom-auto sm:max-w-sm sm:flex-col',\n className,\n )}\n {...props}\n />\n );\n});\nToastViewport.displayName = 'ToastViewport';\n\nconst toast = cva(\n [\n 'group pointer-events-auto relative flex w-full items-start gap-3',\n 'overflow-hidden rounded-lg border p-4 pr-8 shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-right-full',\n 'data-[state=closed]:slide-out-to-right-full',\n 'data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]',\n 'data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform',\n 'data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)]',\n ],\n {\n variants: {\n variant: {\n default: 'border-border bg-card text-card-foreground',\n success: 'border-success-border-soft bg-success-soft text-success-text',\n warning: 'border-warning-border-soft bg-warning-soft text-warning-text',\n danger: 'border-danger-border-soft bg-danger-soft text-danger-text',\n info: 'border-info-border-soft bg-info-soft text-info-text',\n },\n },\n defaultVariants: { variant: 'default' },\n },\n);\n\nconst iconMap = {\n default: null,\n success: <CheckCircle2 className=\"text-success-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n warning: <AlertTriangle className=\"text-warning-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n danger: <XCircle className=\"text-danger-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n info: <Info className=\"text-info-text mt-0.5 size-5 shrink-0\" aria-hidden />,\n} satisfies Record<'default' | 'success' | 'warning' | 'danger' | 'info', ReactElement | null>;\n\nexport interface ToastProps\n extends ComponentPropsWithoutRef<typeof ToastPrimitive.Root>, VariantProps<typeof toast> {}\n\nexport const Toast = forwardRef<ElementRef<typeof ToastPrimitive.Root>, ToastProps>(function Toast(\n { className, variant = 'default', children, ...props },\n ref,\n) {\n return (\n <ToastPrimitive.Root ref={ref} className={cn(toast({ variant }), className)} {...props}>\n {iconMap[variant ?? 'default']}\n <div className=\"flex-1 space-y-1\">{children}</div>\n </ToastPrimitive.Root>\n );\n});\nToast.displayName = 'Toast';\n\nexport const ToastTitle = forwardRef<\n ElementRef<typeof ToastPrimitive.Title>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Title>\n>(function ToastTitle({ className, ...props }, ref) {\n return (\n <ToastPrimitive.Title ref={ref} className={cn('text-sm font-medium', className)} {...props} />\n );\n});\nToastTitle.displayName = 'ToastTitle';\n\nexport const ToastDescription = forwardRef<\n ElementRef<typeof ToastPrimitive.Description>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Description>\n>(function ToastDescription({ className, ...props }, ref) {\n return (\n <ToastPrimitive.Description\n ref={ref}\n className={cn('text-sm opacity-90', className)}\n {...props}\n />\n );\n});\nToastDescription.displayName = 'ToastDescription';\n\nexport const ToastAction = forwardRef<\n ElementRef<typeof ToastPrimitive.Action>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Action>\n>(function ToastAction({ className, ...props }, ref) {\n return (\n <ToastPrimitive.Action\n ref={ref}\n className={cn(\n 'inline-flex h-8 shrink-0 items-center justify-center rounded-md border border-current bg-transparent px-3 text-sm font-medium',\n 'transition-colors outline-none hover:bg-current/10',\n 'focus-visible:ring-ring focus-visible:ring-offset-card focus-visible:ring-2 focus-visible:ring-offset-2',\n className,\n )}\n {...props}\n />\n );\n});\nToastAction.displayName = 'ToastAction';\n\nexport const ToastClose = forwardRef<\n ElementRef<typeof ToastPrimitive.Close>,\n ComponentPropsWithoutRef<typeof ToastPrimitive.Close>\n>(function ToastClose({ className, ...props }, ref) {\n const strings = useStrings();\n return (\n <ToastPrimitive.Close\n ref={ref}\n aria-label={props['aria-label'] ?? strings.toast.close}\n className={cn(\n 'text-foreground-subtle absolute top-2 right-2 inline-flex size-7 items-center justify-center rounded-md',\n 'hover:text-foreground opacity-0 transition-opacity group-hover:opacity-100',\n 'focus-visible:ring-ring focus-visible:ring-offset-card outline-none focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2',\n className,\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"size-4\" aria-hidden />\n </ToastPrimitive.Close>\n );\n});\nToastClose.displayName = 'ToastClose';\n\n/**\n * Drop-in host that connects the `useToast()` queue to the Radix primitives.\n * Mount it once near your app root — then `useToast().push({...})` (or the\n * standalone `toast()`) from anywhere renders here. Self-contained: it brings\n * its own ToastProvider + Viewport, so no other Toast wiring is needed.\n *\n * @example\n * function App() {\n * return (\n * <>\n * <Routes />\n * <Toaster />\n * </>\n * );\n * }\n */\nexport function Toaster() {\n const { toasts, dismiss, remove } = useToast();\n\n // Closing a toast sets open:false so Radix can play the slide-out; drop it\n // from the queue once that animation has had time to finish.\n useEffect(() => {\n const closing = toasts.filter((t) => !t.open);\n if (closing.length === 0) return;\n const timers = closing.map((t) => window.setTimeout(() => remove(t.id), 200));\n return () => timers.forEach((id) => window.clearTimeout(id));\n }, [toasts, remove]);\n\n const strings = useStrings();\n return (\n <ToastProvider label={strings.toast.region}>\n {toasts.map((t) => (\n <Toast\n key={t.id}\n variant={t.variant ?? 'default'}\n open={t.open}\n // Radix treats 0 as \"dismiss immediately\"; the queue's 0 means \"keep open\".\n duration={t.duration === 0 ? Infinity : t.duration}\n onOpenChange={(open) => {\n if (!open) dismiss(t.id);\n }}\n >\n {t.title && <ToastTitle>{t.title}</ToastTitle>}\n {t.description && <ToastDescription>{t.description}</ToastDescription>}\n {t.action && (\n <ToastAction altText={t.action.altText} onClick={t.action.onClick} className=\"mt-1\">\n {t.action.label}\n </ToastAction>\n )}\n <ToastClose />\n </Toast>\n ))}\n <ToastViewport />\n </ToastProvider>\n );\n}\nToaster.displayName = 'Toaster';\n\n/**\n * @example\n * <ToastProvider>\n * …app…\n * <Toast variant=\"success\">\n * <ToastTitle>Saved</ToastTitle>\n * <ToastDescription>Your changes are live.</ToastDescription>\n * <ToastAction altText=\"Undo\">Undo</ToastAction>\n * <ToastClose />\n * </Toast>\n * <ToastViewport />\n * </ToastProvider>\n *\n * @do Use the `useToast()` hook (in `src/hooks/use-toast.ts`) in app code —\n * the components here are the primitives the hook renders.\n * @dont Stack more than two toasts at a time. Newer toasts replace older ones.\n */\n"],"mappings":";;;;;;;;;;AAgBA,IAAa,IAAgB,EAAe,UAE/B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AI,WAAW,EAAE;GAC1C,eAAe,MAAS;IACtB,AAAK,KAAM,EAAQ,EAAE,EAAE;GACzB;GARF,UAAA;IAUG,EAAE,SAAS,kBAAC,GAAD,EAAA,UAAa,EAAE,MAAkB,CAAA;IAC5C,EAAE,eAAe,kBAAC,GAAD,EAAA,UAAmB,EAAE,YAA8B,CAAA;IACpE,EAAE,UACD,kBAAC,GAAD;KAAa,SAAS,EAAE,OAAO;KAAS,SAAS,EAAE,OAAO;KAAS,WAAU;KAC1E,UAAA,EAAE,OAAO;IACC,CAAA;IAEf,kBAAC,GAAD,CAAa,CAAA;GACR;EAjBA,GAAA,EAAE,EAiBF,CACR,GACD,kBAAC,GAAD,CAAgB,CAAA,CACH;;AAEnB;AACA,EAAQ,cAAc"}
@@ -5,7 +5,7 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
5
5
  * share the same `delayDuration` and `skipDelayDuration`.
6
6
  */
7
7
  export declare const TooltipProvider: {
8
- ({ delayDuration, skipDelayDuration, ...props }: ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
8
+ ({ delayDuration, skipDelayDuration, ...props }: ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>): import("react").JSX.Element;
9
9
  displayName: string;
10
10
  };
11
11
  export declare const TooltipRoot: import('react').FC<TooltipPrimitive.TooltipProps>;
@@ -32,7 +32,7 @@ export interface TooltipProps {
32
32
  * @dont Wrap disabled buttons in Tooltip without `asChild + tabIndex={0}`.
33
33
  * Disabled elements don't receive focus, so the tooltip never opens.
34
34
  */
35
- export declare function Tooltip({ children, label, side, align, disabled, delayDuration, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function Tooltip({ children, label, side, align, disabled, delayDuration, }: TooltipProps): import("react").JSX.Element;
36
36
  export declare namespace Tooltip {
37
37
  var displayName: string;
38
38
  }
@@ -1,60 +1,39 @@
1
1
  "use client";
2
- import { jsx as o, Fragment as p, jsxs as l } from "react/jsx-runtime";
3
- import { forwardRef as m } from "react";
2
+ import { cn as e } from "../../lib/utils.js";
3
+ import { forwardRef as t } from "react";
4
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
5
  import * as a from "@radix-ui/react-tooltip";
5
- import { cn as c } from "../../lib/utils.js";
6
- const f = ({
7
- delayDuration: t = 500,
8
- skipDelayDuration: e = 200,
9
- ...i
10
- }) => /* @__PURE__ */ o(
11
- a.Provider,
12
- {
13
- delayDuration: t,
14
- skipDelayDuration: e,
15
- ...i
16
- }
17
- );
18
- f.displayName = "TooltipProvider";
19
- const u = a.Root, T = a.Trigger, d = m(function({ className: e, sideOffset: i = 4, ...r }, n) {
20
- return /* @__PURE__ */ o(a.Portal, { children: /* @__PURE__ */ o(
21
- a.Content,
22
- {
23
- ref: n,
24
- sideOffset: i,
25
- className: c(
26
- "z-[var(--z-tooltip)] overflow-hidden rounded-md px-2 py-1 text-xs font-medium",
27
- "bg-tooltip text-tooltip-foreground",
28
- "max-w-xs shadow-sm",
29
- "data-[state=open]:animate-in data-[state=closed]:animate-out",
30
- "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
31
- "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
32
- e
33
- ),
34
- ...r
35
- }
36
- ) });
6
+ //#region src/components/ui/Tooltip.tsx
7
+ var o = ({ delayDuration: e = 500, skipDelayDuration: t = 200, ...n }) => /* @__PURE__ */ r(a.Provider, {
8
+ delayDuration: e,
9
+ skipDelayDuration: t,
10
+ ...n
37
11
  });
38
- d.displayName = "TooltipContent";
39
- function x({
40
- children: t,
41
- label: e,
42
- side: i = "top",
43
- align: r = "center",
44
- disabled: n,
45
- delayDuration: s
46
- }) {
47
- return n ? /* @__PURE__ */ o(p, { children: t }) : /* @__PURE__ */ l(u, { delayDuration: s, children: [
48
- /* @__PURE__ */ o(T, { asChild: !0, children: t }),
49
- /* @__PURE__ */ o(d, { side: i, align: r, children: e })
50
- ] });
12
+ o.displayName = "TooltipProvider";
13
+ var s = a.Root, c = a.Trigger, l = t(function({ className: t, sideOffset: n = 4, ...i }, o) {
14
+ return /* @__PURE__ */ r(a.Portal, { children: /* @__PURE__ */ r(a.Content, {
15
+ ref: o,
16
+ sideOffset: n,
17
+ className: e("z-[var(--z-tooltip)] overflow-hidden rounded-md px-2 py-1 text-xs font-medium", "bg-tooltip text-tooltip-foreground", "max-w-xs shadow-sm", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", t),
18
+ ...i
19
+ }) });
20
+ });
21
+ l.displayName = "TooltipContent";
22
+ function u({ children: e, label: t, side: a = "top", align: o = "center", disabled: u, delayDuration: d }) {
23
+ return u ? /* @__PURE__ */ r(n, { children: e }) : /* @__PURE__ */ i(s, {
24
+ delayDuration: d,
25
+ children: [/* @__PURE__ */ r(c, {
26
+ asChild: !0,
27
+ children: e
28
+ }), /* @__PURE__ */ r(l, {
29
+ side: a,
30
+ align: o,
31
+ children: t
32
+ })]
33
+ });
51
34
  }
52
- x.displayName = "Tooltip";
53
- export {
54
- x as Tooltip,
55
- d as TooltipContent,
56
- f as TooltipProvider,
57
- u as TooltipRoot,
58
- T as TooltipTrigger
59
- };
60
- //# sourceMappingURL=Tooltip.js.map
35
+ u.displayName = "Tooltip";
36
+ //#endregion
37
+ export { u as Tooltip, l as TooltipContent, o as TooltipProvider, s as TooltipRoot, c as TooltipTrigger };
38
+
39
+ //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../src/components/ui/Tooltip.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport { cn } from '@/lib/utils';\n\n/**\n * Wrap the app in a single `<TooltipProvider>` near the root. All Tooltips\n * share the same `delayDuration` and `skipDelayDuration`.\n */\nexport const TooltipProvider = ({\n delayDuration = 500,\n skipDelayDuration = 200,\n ...props\n}: ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>) => (\n <TooltipPrimitive.Provider\n delayDuration={delayDuration}\n skipDelayDuration={skipDelayDuration}\n {...props}\n />\n);\nTooltipProvider.displayName = 'TooltipProvider';\n\nexport const TooltipRoot = TooltipPrimitive.Root;\nexport const TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport const TooltipContent = forwardRef<\n ElementRef<typeof TooltipPrimitive.Content>,\n ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(function TooltipContent({ className, sideOffset = 4, ...props }, ref) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-[var(--z-tooltip)] overflow-hidden rounded-md px-2 py-1 text-xs font-medium',\n 'bg-tooltip text-tooltip-foreground',\n 'max-w-xs shadow-sm',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = 'TooltipContent';\n\nexport interface TooltipProps {\n children: ReactNode;\n label: ReactNode;\n side?: 'top' | 'right' | 'bottom' | 'left';\n align?: 'start' | 'center' | 'end';\n /** Disable showing the tooltip (e.g. when text is not truncated). */\n disabled?: boolean;\n /** Override the global delay. */\n delayDuration?: number;\n}\n\n/**\n * Shorthand for the most common Tooltip case.\n *\n * @example\n * <Tooltip label=\"Copy link\"><IconButton aria-label=\"Copy\" icon={<Copy/>} /></Tooltip>\n *\n * @do Keep tooltip text short — one line, no full sentences. Use a Popover\n * for any content that needs structure.\n * @dont Wrap disabled buttons in Tooltip without `asChild + tabIndex={0}`.\n * Disabled elements don't receive focus, so the tooltip never opens.\n */\nexport function Tooltip({\n children,\n label,\n side = 'top',\n align = 'center',\n disabled,\n delayDuration,\n}: TooltipProps) {\n if (disabled) return <>{children}</>;\n return (\n <TooltipRoot delayDuration={delayDuration}>\n <TooltipTrigger asChild>{children}</TooltipTrigger>\n <TooltipContent side={side} align={align}>\n {label}\n </TooltipContent>\n </TooltipRoot>\n );\n}\nTooltip.displayName = 'Tooltip';\n"],"names":["TooltipProvider","delayDuration","skipDelayDuration","props","jsx","TooltipPrimitive","TooltipRoot","TooltipTrigger","TooltipContent","forwardRef","className","sideOffset","ref","cn","Tooltip","children","label","side","align","disabled","Fragment","jsxs"],"mappings":";;;;;AAUO,MAAMA,IAAkB,CAAC;AAAA,EAC9B,eAAAC,IAAgB;AAAA,EAChB,mBAAAC,IAAoB;AAAA,EACpB,GAAGC;AACL,MACE,gBAAAC;AAAA,EAACC,EAAiB;AAAA,EAAjB;AAAA,IACC,eAAAJ;AAAA,IACA,mBAAAC;AAAA,IACC,GAAGC;AAAA,EAAA;AACN;AAEFH,EAAgB,cAAc;AAEvB,MAAMM,IAAcD,EAAiB,MAC/BE,IAAiBF,EAAiB,SAElCG,IAAiBC,EAG5B,SAAwB,EAAE,WAAAC,GAAW,YAAAC,IAAa,GAAG,GAAGR,EAAA,GAASS,GAAK;AACtE,SACE,gBAAAR,EAACC,EAAiB,QAAjB,EACC,UAAA,gBAAAD;AAAA,IAACC,EAAiB;AAAA,IAAjB;AAAA,MACC,KAAAO;AAAA,MACA,YAAAD;AAAA,MACA,WAAWE;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACAH;AAAA,MAAA;AAAA,MAED,GAAGP;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ,CAAC;AACDK,EAAe,cAAc;AAwBtB,SAASM,EAAQ;AAAA,EACtB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,eAAAlB;AACF,GAAiB;AACf,SAAIkB,IAAiB,gBAAAf,EAAAgB,GAAA,EAAG,UAAAL,EAAA,CAAS,IAE/B,gBAAAM,EAACf,KAAY,eAAAL,GACX,UAAA;AAAA,IAAA,gBAAAG,EAACG,GAAA,EAAe,SAAO,IAAE,UAAAQ,EAAA,CAAS;AAAA,IAClC,gBAAAX,EAACI,GAAA,EAAe,MAAAS,GAAY,OAAAC,GACzB,UAAAF,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;AACAF,EAAQ,cAAc;"}
1
+ {"version":3,"file":"Tooltip.js","names":[],"sources":["../../../src/components/ui/Tooltip.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport { cn } from '@/lib/utils';\n\n/**\n * Wrap the app in a single `<TooltipProvider>` near the root. All Tooltips\n * share the same `delayDuration` and `skipDelayDuration`.\n */\nexport const TooltipProvider = ({\n delayDuration = 500,\n skipDelayDuration = 200,\n ...props\n}: ComponentPropsWithoutRef<typeof TooltipPrimitive.Provider>) => (\n <TooltipPrimitive.Provider\n delayDuration={delayDuration}\n skipDelayDuration={skipDelayDuration}\n {...props}\n />\n);\nTooltipProvider.displayName = 'TooltipProvider';\n\nexport const TooltipRoot = TooltipPrimitive.Root;\nexport const TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport const TooltipContent = forwardRef<\n ElementRef<typeof TooltipPrimitive.Content>,\n ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(function TooltipContent({ className, sideOffset = 4, ...props }, ref) {\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-[var(--z-tooltip)] overflow-hidden rounded-md px-2 py-1 text-xs font-medium',\n 'bg-tooltip text-tooltip-foreground',\n 'max-w-xs shadow-sm',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = 'TooltipContent';\n\nexport interface TooltipProps {\n children: ReactNode;\n label: ReactNode;\n side?: 'top' | 'right' | 'bottom' | 'left';\n align?: 'start' | 'center' | 'end';\n /** Disable showing the tooltip (e.g. when text is not truncated). */\n disabled?: boolean;\n /** Override the global delay. */\n delayDuration?: number;\n}\n\n/**\n * Shorthand for the most common Tooltip case.\n *\n * @example\n * <Tooltip label=\"Copy link\"><IconButton aria-label=\"Copy\" icon={<Copy/>} /></Tooltip>\n *\n * @do Keep tooltip text short — one line, no full sentences. Use a Popover\n * for any content that needs structure.\n * @dont Wrap disabled buttons in Tooltip without `asChild + tabIndex={0}`.\n * Disabled elements don't receive focus, so the tooltip never opens.\n */\nexport function Tooltip({\n children,\n label,\n side = 'top',\n align = 'center',\n disabled,\n delayDuration,\n}: TooltipProps) {\n if (disabled) return <>{children}</>;\n return (\n <TooltipRoot delayDuration={delayDuration}>\n <TooltipTrigger asChild>{children}</TooltipTrigger>\n <TooltipContent side={side} align={align}>\n {label}\n </TooltipContent>\n </TooltipRoot>\n );\n}\nTooltip.displayName = 'Tooltip';\n"],"mappings":";;;;;;AAUA,IAAa,KAAmB,EAC9B,mBAAgB,KAChB,uBAAoB,KACpB,GAAG,QAEH,kBAAC,EAAiB,UAAlB;CACiB;CACI;CACnB,GAAI;AACL,CAAA;AAEH,EAAgB,cAAc;AAE9B,IAAa,IAAc,EAAiB,MAC/B,IAAiB,EAAiB,SAElC,IAAiB,EAG5B,SAAwB,EAAE,cAAW,gBAAa,GAAG,GAAG,KAAS,GAAK;CACtE,OACE,kBAAC,EAAiB,QAAlB,EAAA,UACE,kBAAC,EAAiB,SAAlB;EACO;EACO;EACZ,WAAW,EACT,iFACA,sCACA,sBACA,gEACA,8DACA,gEACA,CACF;EACA,GAAI;CACL,CAAA,EACsB,CAAA;AAE7B,CAAC;AACD,EAAe,cAAc;AAwB7B,SAAgB,EAAQ,EACtB,aACA,UACA,UAAO,OACP,WAAQ,UACR,aACA,oBACe;CAEf,OADI,IAAiB,kBAAA,GAAA,EAAG,YAAW,CAAA,IAEjC,kBAAC,GAAD;EAA4B;EAA5B,UAAA,CACE,kBAAC,GAAD;GAAgB,SAAA;GAAS;EAAyB,CAAA,GAClD,kBAAC,GAAD;GAAsB;GAAa;GAChC,UAAA;EACa,CAAA,CACL;;AAEjB;AACA,EAAQ,cAAc"}