@pago-sh/ui 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 (229) hide show
  1. package/.turbo/turbo-build.log +195 -0
  2. package/CHANGELOG.md +47 -0
  3. package/README.md +22 -0
  4. package/components.json +17 -0
  5. package/dist/chunk-2RCGDEGJ.mjs +1 -0
  6. package/dist/chunk-3GDNSYGJ.mjs +1 -0
  7. package/dist/chunk-4TCUGB6E.mjs +1 -0
  8. package/dist/chunk-6XCXQA5L.mjs +1 -0
  9. package/dist/chunk-BBYR3CIF.mjs +1 -0
  10. package/dist/chunk-CFBUY7KY.mjs +1 -0
  11. package/dist/chunk-CHG2VB73.mjs +1 -0
  12. package/dist/chunk-GCVBVZU7.mjs +1 -0
  13. package/dist/chunk-HRGUR4R2.mjs +1 -0
  14. package/dist/chunk-IVU4SSCD.mjs +1 -0
  15. package/dist/chunk-N6WI5TGM.mjs +1 -0
  16. package/dist/chunk-OTKGECM3.mjs +1 -0
  17. package/dist/chunk-SRZFZUN4.mjs +1 -0
  18. package/dist/chunk-VPECET7P.mjs +1 -0
  19. package/dist/chunk-WQPSZXQS.mjs +1 -0
  20. package/dist/chunk-YXNT3UEO.mjs +1 -0
  21. package/dist/components/atoms/Accordion.d.mts +20 -0
  22. package/dist/components/atoms/Accordion.d.ts +20 -0
  23. package/dist/components/atoms/Accordion.js +1 -0
  24. package/dist/components/atoms/Accordion.mjs +1 -0
  25. package/dist/components/atoms/Card.d.mts +18 -0
  26. package/dist/components/atoms/Card.d.ts +18 -0
  27. package/dist/components/atoms/Card.js +1 -0
  28. package/dist/components/atoms/Card.mjs +1 -0
  29. package/dist/components/atoms/Combobox.d.mts +24 -0
  30. package/dist/components/atoms/Combobox.d.ts +24 -0
  31. package/dist/components/atoms/Combobox.js +1 -0
  32. package/dist/components/atoms/Combobox.mjs +1 -0
  33. package/dist/components/atoms/CopyToClipboardInput.d.mts +12 -0
  34. package/dist/components/atoms/CopyToClipboardInput.d.ts +12 -0
  35. package/dist/components/atoms/CopyToClipboardInput.js +1 -0
  36. package/dist/components/atoms/CopyToClipboardInput.mjs +1 -0
  37. package/dist/components/atoms/CountryPicker.d.mts +16 -0
  38. package/dist/components/atoms/CountryPicker.d.ts +16 -0
  39. package/dist/components/atoms/CountryPicker.js +1 -0
  40. package/dist/components/atoms/CountryPicker.mjs +1 -0
  41. package/dist/components/atoms/CountryStatePicker.d.mts +18 -0
  42. package/dist/components/atoms/CountryStatePicker.d.ts +18 -0
  43. package/dist/components/atoms/CountryStatePicker.js +1 -0
  44. package/dist/components/atoms/CountryStatePicker.mjs +1 -0
  45. package/dist/components/atoms/DateTimePicker.d.mts +10 -0
  46. package/dist/components/atoms/DateTimePicker.d.ts +10 -0
  47. package/dist/components/atoms/DateTimePicker.js +1 -0
  48. package/dist/components/atoms/DateTimePicker.mjs +1 -0
  49. package/dist/components/atoms/DropdownMenu.d.mts +22 -0
  50. package/dist/components/atoms/DropdownMenu.d.ts +22 -0
  51. package/dist/components/atoms/DropdownMenu.js +1 -0
  52. package/dist/components/atoms/DropdownMenu.mjs +1 -0
  53. package/dist/components/atoms/FormattedDateTime.d.mts +10 -0
  54. package/dist/components/atoms/FormattedDateTime.d.ts +10 -0
  55. package/dist/components/atoms/FormattedDateTime.js +1 -0
  56. package/dist/components/atoms/FormattedDateTime.mjs +1 -0
  57. package/dist/components/atoms/FormattedInterval.d.mts +9 -0
  58. package/dist/components/atoms/FormattedInterval.d.ts +9 -0
  59. package/dist/components/atoms/FormattedInterval.js +1 -0
  60. package/dist/components/atoms/FormattedInterval.mjs +1 -0
  61. package/dist/components/atoms/InputOTP.d.mts +4 -0
  62. package/dist/components/atoms/InputOTP.d.ts +4 -0
  63. package/dist/components/atoms/InputOTP.js +1 -0
  64. package/dist/components/atoms/InputOTP.mjs +1 -0
  65. package/dist/components/atoms/MoneyInput.d.mts +21 -0
  66. package/dist/components/atoms/MoneyInput.d.ts +21 -0
  67. package/dist/components/atoms/MoneyInput.js +1 -0
  68. package/dist/components/atoms/MoneyInput.mjs +1 -0
  69. package/dist/components/atoms/Paginator.d.mts +21 -0
  70. package/dist/components/atoms/Paginator.d.ts +21 -0
  71. package/dist/components/atoms/Paginator.js +1 -0
  72. package/dist/components/atoms/Paginator.mjs +1 -0
  73. package/dist/components/atoms/PagoTimeAgo.d.mts +8 -0
  74. package/dist/components/atoms/PagoTimeAgo.d.ts +8 -0
  75. package/dist/components/atoms/PagoTimeAgo.js +1 -0
  76. package/dist/components/atoms/PagoTimeAgo.mjs +1 -0
  77. package/dist/components/atoms/PercentageInput.d.mts +19 -0
  78. package/dist/components/atoms/PercentageInput.d.ts +19 -0
  79. package/dist/components/atoms/PercentageInput.js +1 -0
  80. package/dist/components/atoms/PercentageInput.mjs +1 -0
  81. package/dist/components/atoms/ShadowBox.d.mts +14 -0
  82. package/dist/components/atoms/ShadowBox.d.ts +14 -0
  83. package/dist/components/atoms/ShadowBox.js +1 -0
  84. package/dist/components/atoms/ShadowBox.mjs +1 -0
  85. package/dist/components/atoms/ShadowBoxOnMd.d.mts +6 -0
  86. package/dist/components/atoms/ShadowBoxOnMd.d.ts +6 -0
  87. package/dist/components/atoms/ShadowBoxOnMd.js +1 -0
  88. package/dist/components/atoms/ShadowBoxOnMd.mjs +1 -0
  89. package/dist/components/atoms/Sidebar.d.mts +11 -0
  90. package/dist/components/atoms/Sidebar.d.ts +11 -0
  91. package/dist/components/atoms/Sidebar.js +1 -0
  92. package/dist/components/atoms/Sidebar.mjs +1 -0
  93. package/dist/components/molecules/Banner.d.mts +11 -0
  94. package/dist/components/molecules/Banner.d.ts +11 -0
  95. package/dist/components/molecules/Banner.js +1 -0
  96. package/dist/components/molecules/Banner.mjs +1 -0
  97. package/dist/components/ui/accordion.d.mts +19 -0
  98. package/dist/components/ui/accordion.d.ts +19 -0
  99. package/dist/components/ui/accordion.js +1 -0
  100. package/dist/components/ui/accordion.mjs +1 -0
  101. package/dist/components/ui/alert-dialog.d.mts +41 -0
  102. package/dist/components/ui/alert-dialog.d.ts +41 -0
  103. package/dist/components/ui/alert-dialog.js +1 -0
  104. package/dist/components/ui/alert-dialog.mjs +1 -0
  105. package/dist/components/ui/calendar.d.mts +12 -0
  106. package/dist/components/ui/calendar.d.ts +12 -0
  107. package/dist/components/ui/calendar.js +1 -0
  108. package/dist/components/ui/calendar.mjs +1 -0
  109. package/dist/components/ui/card.d.mts +23 -0
  110. package/dist/components/ui/card.d.ts +23 -0
  111. package/dist/components/ui/card.js +1 -0
  112. package/dist/components/ui/card.mjs +1 -0
  113. package/dist/components/ui/chart.d.mts +55 -0
  114. package/dist/components/ui/chart.d.ts +55 -0
  115. package/dist/components/ui/chart.js +7 -0
  116. package/dist/components/ui/chart.mjs +7 -0
  117. package/dist/components/ui/checkbox.d.mts +2 -0
  118. package/dist/components/ui/checkbox.d.ts +2 -0
  119. package/dist/components/ui/checkbox.js +1 -0
  120. package/dist/components/ui/checkbox.mjs +1 -0
  121. package/dist/components/ui/command.d.mts +36 -0
  122. package/dist/components/ui/command.d.ts +36 -0
  123. package/dist/components/ui/command.js +1 -0
  124. package/dist/components/ui/command.mjs +1 -0
  125. package/dist/components/ui/dialog.d.mts +34 -0
  126. package/dist/components/ui/dialog.d.ts +34 -0
  127. package/dist/components/ui/dialog.js +1 -0
  128. package/dist/components/ui/dialog.mjs +1 -0
  129. package/dist/components/ui/dropdown-menu.d.mts +23 -0
  130. package/dist/components/ui/dropdown-menu.d.ts +23 -0
  131. package/dist/components/ui/dropdown-menu.js +1 -0
  132. package/dist/components/ui/dropdown-menu.mjs +1 -0
  133. package/dist/components/ui/form.d.mts +43 -0
  134. package/dist/components/ui/form.d.ts +43 -0
  135. package/dist/components/ui/form.js +1 -0
  136. package/dist/components/ui/form.mjs +1 -0
  137. package/dist/components/ui/input-otp.d.mts +21 -0
  138. package/dist/components/ui/input-otp.d.ts +21 -0
  139. package/dist/components/ui/input-otp.js +1 -0
  140. package/dist/components/ui/input-otp.mjs +1 -0
  141. package/dist/components/ui/label.d.mts +9 -0
  142. package/dist/components/ui/label.d.ts +9 -0
  143. package/dist/components/ui/label.js +1 -0
  144. package/dist/components/ui/label.mjs +1 -0
  145. package/dist/components/ui/popover.d.mts +12 -0
  146. package/dist/components/ui/popover.d.ts +12 -0
  147. package/dist/components/ui/popover.js +1 -0
  148. package/dist/components/ui/popover.mjs +1 -0
  149. package/dist/components/ui/radio-group.d.mts +14 -0
  150. package/dist/components/ui/radio-group.d.ts +14 -0
  151. package/dist/components/ui/radio-group.js +1 -0
  152. package/dist/components/ui/radio-group.mjs +1 -0
  153. package/dist/components/ui/separator.d.mts +10 -0
  154. package/dist/components/ui/separator.d.ts +10 -0
  155. package/dist/components/ui/separator.js +1 -0
  156. package/dist/components/ui/separator.mjs +1 -0
  157. package/dist/components/ui/sheet.d.mts +43 -0
  158. package/dist/components/ui/sheet.d.ts +43 -0
  159. package/dist/components/ui/sheet.js +1 -0
  160. package/dist/components/ui/sheet.mjs +1 -0
  161. package/dist/components/ui/sidebar.d.mts +149 -0
  162. package/dist/components/ui/sidebar.d.ts +149 -0
  163. package/dist/components/ui/sidebar.js +1 -0
  164. package/dist/components/ui/sidebar.mjs +1 -0
  165. package/dist/components/ui/tooltip.d.mts +1 -0
  166. package/dist/components/ui/tooltip.d.ts +1 -0
  167. package/dist/components/ui/tooltip.js +1 -0
  168. package/dist/components/ui/tooltip.mjs +1 -0
  169. package/dist/hooks/theming.d.mts +76 -0
  170. package/dist/hooks/theming.d.ts +76 -0
  171. package/dist/hooks/theming.js +1 -0
  172. package/dist/hooks/theming.mjs +1 -0
  173. package/dist/hooks/use-mobile.d.mts +3 -0
  174. package/dist/hooks/use-mobile.d.ts +3 -0
  175. package/dist/hooks/use-mobile.js +1 -0
  176. package/dist/hooks/use-mobile.mjs +1 -0
  177. package/dist/lib/meterUnit.d.mts +34 -0
  178. package/dist/lib/meterUnit.d.ts +34 -0
  179. package/dist/lib/meterUnit.js +1 -0
  180. package/dist/lib/meterUnit.mjs +1 -0
  181. package/dist/lib/utils.d.mts +5 -0
  182. package/dist/lib/utils.d.ts +5 -0
  183. package/dist/lib/utils.js +1 -0
  184. package/dist/lib/utils.mjs +1 -0
  185. package/eslint.config.mjs +18 -0
  186. package/package.json +74 -0
  187. package/src/components/atoms/Accordion.tsx +56 -0
  188. package/src/components/atoms/Card.tsx +52 -0
  189. package/src/components/atoms/Combobox.tsx +166 -0
  190. package/src/components/atoms/CopyToClipboardInput.tsx +72 -0
  191. package/src/components/atoms/CountryPicker.tsx +81 -0
  192. package/src/components/atoms/CountryStatePicker.tsx +155 -0
  193. package/src/components/atoms/DateTimePicker.tsx +69 -0
  194. package/src/components/atoms/DropdownMenu.tsx +68 -0
  195. package/src/components/atoms/FormattedDateTime.tsx +58 -0
  196. package/src/components/atoms/FormattedInterval.tsx +81 -0
  197. package/src/components/atoms/InputOTP.tsx +7 -0
  198. package/src/components/atoms/MoneyInput.tsx +297 -0
  199. package/src/components/atoms/Paginator.tsx +227 -0
  200. package/src/components/atoms/PagoTimeAgo.tsx +19 -0
  201. package/src/components/atoms/PercentageInput.tsx +97 -0
  202. package/src/components/atoms/ShadowBox.tsx +26 -0
  203. package/src/components/atoms/ShadowBoxOnMd.tsx +20 -0
  204. package/src/components/atoms/Sidebar.tsx +1 -0
  205. package/src/components/molecules/Banner.tsx +42 -0
  206. package/src/components/ui/accordion.tsx +63 -0
  207. package/src/components/ui/alert-dialog.tsx +147 -0
  208. package/src/components/ui/calendar.tsx +81 -0
  209. package/src/components/ui/card.tsx +47 -0
  210. package/src/components/ui/chart.tsx +372 -0
  211. package/src/components/ui/checkbox.tsx +3 -0
  212. package/src/components/ui/command.tsx +133 -0
  213. package/src/components/ui/dialog.tsx +127 -0
  214. package/src/components/ui/dropdown-menu.tsx +74 -0
  215. package/src/components/ui/form.tsx +180 -0
  216. package/src/components/ui/input-otp.tsx +68 -0
  217. package/src/components/ui/label.tsx +25 -0
  218. package/src/components/ui/popover.tsx +34 -0
  219. package/src/components/ui/radio-group.tsx +46 -0
  220. package/src/components/ui/separator.tsx +29 -0
  221. package/src/components/ui/sheet.tsx +149 -0
  222. package/src/components/ui/sidebar.tsx +742 -0
  223. package/src/components/ui/tooltip.tsx +8 -0
  224. package/src/hooks/theming.ts +87 -0
  225. package/src/hooks/use-mobile.ts +19 -0
  226. package/src/lib/meterUnit.ts +52 -0
  227. package/src/lib/utils.ts +6 -0
  228. package/tsconfig.json +15 -0
  229. package/tsup.config.ts +11 -0
@@ -0,0 +1,81 @@
1
+ 'use client'
2
+
3
+ import { ChevronLeft, ChevronRight } from 'lucide-react'
4
+ import * as React from 'react'
5
+ import { DateRange, DayPicker } from 'react-day-picker'
6
+
7
+ import { buttonVariants } from '@pago-sh/orbit/ui/button'
8
+ import { cn } from '@/lib/utils'
9
+
10
+ export type CalendarProps = React.ComponentProps<typeof DayPicker>
11
+
12
+ function Calendar({
13
+ className,
14
+ classNames,
15
+ showOutsideDays = true,
16
+ ...props
17
+ }: CalendarProps) {
18
+ return (
19
+ <DayPicker
20
+ showOutsideDays={showOutsideDays}
21
+ className={cn('p-3', className)}
22
+ classNames={{
23
+ months: 'relative',
24
+ month: 'space-y-4',
25
+ month_caption: 'flex justify-center pt-1 relative items-center',
26
+ caption_label: 'text-sm font-medium',
27
+ nav: 'absolute top-0 right-0 left-0 h-0 z-10',
28
+ button_previous: cn(
29
+ buttonVariants({ variant: 'outline' }),
30
+ 'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100',
31
+ 'absolute left-1',
32
+ ),
33
+ button_next: cn(
34
+ buttonVariants({ variant: 'outline' }),
35
+ 'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100',
36
+ 'absolute right-1',
37
+ ),
38
+ month_grid: 'w-full border-collapse space-y-1',
39
+ weekdays: 'flex',
40
+ weekday: 'text-muted-foreground rounded-md w-9 text-[0.8rem]',
41
+ week: 'flex w-full mt-2',
42
+ day: 'h-9 w-9 text-center text-sm p-0 relative [&[data-selected].day-outside]:bg-accent/50 data-[selected]:bg-accent first:data-selected:rounded-l-md last:data-selected:rounded-r-md focus-within:relative focus-within:z-20',
43
+ day_button: cn(
44
+ buttonVariants({ variant: 'ghost' }),
45
+ 'h-9 w-9 p-0 font-normal',
46
+ ),
47
+ range_start: 'rounded-l-md!', // !important has to override rounded-none from `today[data-selected]` that in its turn overrides the default rounded-md for today
48
+ range_end: 'rounded-r-md!', // !important has to override rounded-none from `today[data-selected]` that in its turn overrides the default rounded-md for today
49
+ selected:
50
+ 'bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground',
51
+ today:
52
+ 'bg-foreground text-accent-foreground rounded-md data-selected:rounded-none',
53
+ outside:
54
+ 'day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-foreground',
55
+ disabled: 'text-muted-foreground opacity-50',
56
+ range_middle:
57
+ 'aria-selected:bg-accent aria-selected:text-accent-foreground',
58
+ hidden: 'invisible',
59
+ ...classNames,
60
+ }}
61
+ components={{
62
+ Chevron: (props) => {
63
+ if (props.orientation === 'left') {
64
+ return (
65
+ <ChevronLeft className={cn('h-4 w-4', className)} {...props} />
66
+ )
67
+ }
68
+
69
+ return (
70
+ <ChevronRight className={cn('h-4 w-4', className)} {...props} />
71
+ )
72
+ },
73
+ }}
74
+ {...props}
75
+ />
76
+ )
77
+ }
78
+ Calendar.displayName = 'Calendar'
79
+
80
+ export { Calendar }
81
+ export type { DateRange }
@@ -0,0 +1,47 @@
1
+ import * as React from 'react'
2
+
3
+ import { cn } from '@/lib/utils'
4
+
5
+ const Card = ({
6
+ ref,
7
+ className,
8
+ ...props
9
+ }: React.HTMLAttributes<HTMLDivElement> & {
10
+ ref?: React.RefObject<HTMLDivElement>
11
+ }) => (
12
+ <div
13
+ ref={ref}
14
+ className={cn(
15
+ 'bg-card text-card-foreground rounded-lg border shadow-xs',
16
+ className,
17
+ )}
18
+ {...props}
19
+ />
20
+ )
21
+ Card.displayName = 'Card'
22
+
23
+ const CardHeader = ({
24
+ ref,
25
+ className,
26
+ ...props
27
+ }: React.HTMLAttributes<HTMLDivElement> & {
28
+ ref?: React.RefObject<HTMLDivElement>
29
+ }) => (
30
+ <div
31
+ ref={ref}
32
+ className={cn('flex flex-col space-y-1.5 p-6', className)}
33
+ {...props}
34
+ />
35
+ )
36
+ CardHeader.displayName = 'CardHeader'
37
+
38
+ const CardContent = ({
39
+ ref,
40
+ className,
41
+ ...props
42
+ }: React.HTMLAttributes<HTMLDivElement> & {
43
+ ref?: React.RefObject<HTMLDivElement>
44
+ }) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
45
+ CardContent.displayName = 'CardContent'
46
+
47
+ export { Card, CardContent, CardHeader }
@@ -0,0 +1,372 @@
1
+ 'use client'
2
+
3
+ import * as React from 'react'
4
+ import * as RechartsPrimitive from 'recharts'
5
+ import type {
6
+ NameType,
7
+ ValueType,
8
+ } from 'recharts/types/component/DefaultTooltipContent'
9
+
10
+ import { cn } from '@/lib/utils'
11
+
12
+ // Format: { THEME_NAME: CSS_SELECTOR }
13
+ const THEMES = { light: '', dark: '.dark' } as const
14
+
15
+ export type ChartConfig = {
16
+ [k in string]: {
17
+ label?: React.ReactNode
18
+ icon?: React.ComponentType
19
+ } & (
20
+ | { color?: string; theme?: never }
21
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
22
+ )
23
+ }
24
+
25
+ type ChartContextProps = {
26
+ config: ChartConfig
27
+ }
28
+
29
+ const ChartContext = React.createContext<ChartContextProps | null>(null)
30
+
31
+ function useChart() {
32
+ const context = React.useContext(ChartContext)
33
+
34
+ if (!context) {
35
+ throw new Error('useChart must be used within a <ChartContainer />')
36
+ }
37
+
38
+ return context
39
+ }
40
+
41
+ const ChartContainer = ({
42
+ ref,
43
+ id,
44
+ className,
45
+ children,
46
+ config,
47
+ ...props
48
+ }: {
49
+ config: ChartConfig
50
+ children: React.ComponentProps<
51
+ typeof RechartsPrimitive.ResponsiveContainer
52
+ >['children']
53
+ } & Omit<React.ComponentProps<'div'>, 'children'>) => {
54
+ const uniqueId = React.useId()
55
+ const chartId = `chart-${id || uniqueId.replace(/:/g, '')}`
56
+
57
+ return (
58
+ <ChartContext.Provider value={{ config }}>
59
+ <div
60
+ data-chart={chartId}
61
+ ref={ref}
62
+ className={cn(
63
+ "[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-pago-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-sector]:outline-none [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-none",
64
+ className,
65
+ )}
66
+ {...props}
67
+ >
68
+ <ChartStyle id={chartId} config={config} />
69
+ <RechartsPrimitive.ResponsiveContainer>
70
+ {children}
71
+ </RechartsPrimitive.ResponsiveContainer>
72
+ </div>
73
+ </ChartContext.Provider>
74
+ )
75
+ }
76
+ ChartContainer.displayName = 'Chart'
77
+
78
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
79
+ const colorConfig = Object.entries(config).filter(
80
+ ([, config]) => config.theme || config.color,
81
+ )
82
+
83
+ if (!colorConfig.length) {
84
+ return null
85
+ }
86
+
87
+ return (
88
+ <style
89
+ dangerouslySetInnerHTML={{
90
+ __html: Object.entries(THEMES)
91
+ .map(
92
+ ([theme, prefix]) => `
93
+ ${prefix} [data-chart=${id}] {
94
+ ${colorConfig
95
+ .map(([key, itemConfig]) => {
96
+ const color =
97
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
98
+ itemConfig.color
99
+ return color ? ` --color-${key}: ${color};` : null
100
+ })
101
+ .join('\n')}
102
+ }
103
+ `,
104
+ )
105
+ .join('\n'),
106
+ }}
107
+ />
108
+ )
109
+ }
110
+
111
+ const ChartTooltip = RechartsPrimitive.Tooltip
112
+
113
+ const ChartTooltipContent = <TValue extends ValueType, TName extends NameType>({
114
+ ref,
115
+ active,
116
+ payload,
117
+ className,
118
+ indicator = 'dot',
119
+ hideLabel = false,
120
+ hideIndicator = false,
121
+ label,
122
+ labelFormatter,
123
+ labelClassName,
124
+ formatter,
125
+ color,
126
+ nameKey,
127
+ labelKey,
128
+ }: RechartsPrimitive.TooltipContentProps<TValue, TName> &
129
+ Pick<React.ComponentProps<'div'>, 'ref' | 'className'> & {
130
+ indicator?: 'line' | 'dot' | 'dashed'
131
+ hideLabel?: boolean
132
+ hideIndicator?: boolean
133
+ color?: string
134
+ nameKey?: string
135
+ labelKey?: string
136
+ }) => {
137
+ const { config } = useChart()
138
+
139
+ const tooltipLabel = React.useMemo(() => {
140
+ if (hideLabel || !payload?.length) {
141
+ return null
142
+ }
143
+
144
+ const [item] = payload
145
+ const key = `${labelKey || item?.dataKey || item?.name || 'value'}`
146
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
147
+ const value =
148
+ !labelKey && typeof label === 'string'
149
+ ? config[label as keyof typeof config]?.label || label
150
+ : itemConfig?.label
151
+
152
+ if (labelFormatter) {
153
+ return (
154
+ <div className={cn('font-medium', labelClassName)}>
155
+ {labelFormatter(value, payload)}
156
+ </div>
157
+ )
158
+ }
159
+
160
+ if (!value) {
161
+ return null
162
+ }
163
+
164
+ return <div className={cn('font-medium', labelClassName)}>{value}</div>
165
+ }, [
166
+ label,
167
+ labelFormatter,
168
+ payload,
169
+ hideLabel,
170
+ labelClassName,
171
+ config,
172
+ labelKey,
173
+ ])
174
+
175
+ if (!active || !payload?.length) {
176
+ return null
177
+ }
178
+
179
+ const nestLabel = payload.length === 1 && indicator !== 'dot'
180
+
181
+ return (
182
+ <div
183
+ ref={ref}
184
+ className={cn(
185
+ 'border-border/50 bg-background grid min-w-32 items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl',
186
+ className,
187
+ )}
188
+ >
189
+ {!nestLabel ? tooltipLabel : null}
190
+ <div className="grid gap-1.5">
191
+ {payload.map((item, index) => {
192
+ const key = `${nameKey || item.name || item.dataKey || 'value'}`
193
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
194
+ const indicatorColor = color || item.payload.fill || item.color
195
+
196
+ return (
197
+ <div
198
+ key={typeof item.dataKey === 'function' ? index : item.dataKey}
199
+ className={cn(
200
+ '[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5',
201
+ indicator === 'dot' && 'items-center',
202
+ )}
203
+ >
204
+ {formatter && item?.value !== undefined && item.name ? (
205
+ formatter(
206
+ item.value as TValue,
207
+ item.name as TName,
208
+ item,
209
+ index,
210
+ payload,
211
+ )
212
+ ) : (
213
+ <>
214
+ {itemConfig?.icon ? (
215
+ <itemConfig.icon />
216
+ ) : (
217
+ !hideIndicator && (
218
+ <div
219
+ className={cn(
220
+ 'shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)',
221
+ indicator === 'dot' && 'h-2.5 w-2.5',
222
+ indicator === 'line' && 'w-1',
223
+ indicator === 'dashed' &&
224
+ 'w-0 border-[1.5px] border-dashed bg-transparent',
225
+ nestLabel && indicator === 'dashed' && 'my-0.5',
226
+ )}
227
+ style={
228
+ {
229
+ '--color-bg': indicatorColor,
230
+ '--color-border': indicatorColor,
231
+ } as React.CSSProperties
232
+ }
233
+ />
234
+ )
235
+ )}
236
+ <div
237
+ className={cn(
238
+ 'flex flex-1 justify-between leading-none',
239
+ nestLabel ? 'items-end' : 'items-center',
240
+ )}
241
+ >
242
+ <div className="grid gap-1.5">
243
+ {nestLabel ? tooltipLabel : null}
244
+ <span className="text-muted-foreground">
245
+ {itemConfig?.label || item.name}
246
+ </span>
247
+ </div>
248
+ {item.value !== undefined && item.value !== null && (
249
+ <span className="text-foreground font-mono font-medium tabular-nums">
250
+ {item.value.toLocaleString()}
251
+ </span>
252
+ )}
253
+ </div>
254
+ </>
255
+ )}
256
+ </div>
257
+ )
258
+ })}
259
+ </div>
260
+ </div>
261
+ )
262
+ }
263
+ ChartTooltipContent.displayName = 'ChartTooltip'
264
+
265
+ const ChartLegend = RechartsPrimitive.Legend
266
+
267
+ const ChartLegendContent = ({
268
+ ref,
269
+ className,
270
+ hideIcon = false,
271
+ payload,
272
+ verticalAlign = 'bottom',
273
+ nameKey,
274
+ }: RechartsPrimitive.DefaultLegendContentProps &
275
+ Pick<React.ComponentProps<'div'>, 'ref' | 'className'> & {
276
+ hideIcon?: boolean
277
+ nameKey?: string
278
+ }) => {
279
+ const { config } = useChart()
280
+
281
+ if (!payload?.length) {
282
+ return null
283
+ }
284
+
285
+ return (
286
+ <div
287
+ ref={ref}
288
+ className={cn(
289
+ 'flex flex-wrap items-center justify-center gap-x-4 gap-y-2',
290
+ verticalAlign === 'top' ? 'pb-3' : 'pt-3',
291
+ className,
292
+ )}
293
+ >
294
+ {payload.map((item) => {
295
+ const key = `${nameKey || item.dataKey || 'value'}`
296
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
297
+
298
+ return (
299
+ <div
300
+ key={item.value}
301
+ className={cn(
302
+ '[&>svg]:text-muted-foreground flex items-center gap-1.5 whitespace-nowrap [&>svg]:h-3 [&>svg]:w-3',
303
+ )}
304
+ >
305
+ {itemConfig?.icon && !hideIcon ? (
306
+ <itemConfig.icon />
307
+ ) : (
308
+ <div
309
+ className="h-2 w-2 shrink-0 rounded-[2px]"
310
+ style={{
311
+ backgroundColor: item.color,
312
+ }}
313
+ />
314
+ )}
315
+ {itemConfig?.label}
316
+ </div>
317
+ )
318
+ })}
319
+ </div>
320
+ )
321
+ }
322
+ ChartLegendContent.displayName = 'ChartLegend'
323
+
324
+ // Helper to extract item config from a payload.
325
+ function getPayloadConfigFromPayload(
326
+ config: ChartConfig,
327
+ payload: unknown,
328
+ key: string,
329
+ ) {
330
+ if (typeof payload !== 'object' || payload === null) {
331
+ return undefined
332
+ }
333
+
334
+ const payloadPayload =
335
+ 'payload' in payload &&
336
+ typeof payload.payload === 'object' &&
337
+ payload.payload !== null
338
+ ? payload.payload
339
+ : undefined
340
+
341
+ let configLabelKey: string = key
342
+
343
+ if (
344
+ key in payload &&
345
+ typeof payload[key as keyof typeof payload] === 'string'
346
+ ) {
347
+ configLabelKey = payload[key as keyof typeof payload] as string
348
+ } else if (
349
+ payloadPayload &&
350
+ key in payloadPayload &&
351
+ typeof payloadPayload[key as keyof typeof payloadPayload] === 'string'
352
+ ) {
353
+ configLabelKey = payloadPayload[
354
+ key as keyof typeof payloadPayload
355
+ ] as string
356
+ }
357
+
358
+ return configLabelKey in config
359
+ ? config[configLabelKey]
360
+ : config[key as keyof typeof config]
361
+ }
362
+
363
+ export {
364
+ ChartContainer,
365
+ ChartLegend,
366
+ ChartLegendContent,
367
+ ChartStyle,
368
+ ChartTooltip,
369
+ ChartTooltipContent,
370
+ }
371
+
372
+ export * from 'recharts'
@@ -0,0 +1,3 @@
1
+ // Migrated to @pago-sh/orbit. This re-export remains for cross-package
2
+ // consumers (checkout). Prefer importing from '@pago-sh/orbit'.
3
+ export { Checkbox } from '@pago-sh/orbit/Checkbox'
@@ -0,0 +1,133 @@
1
+ 'use client'
2
+
3
+ import { Command as CommandPrimitive } from 'cmdk'
4
+ import { Search } from 'lucide-react'
5
+ import * as React from 'react'
6
+
7
+ import { cn } from '@/lib/utils'
8
+
9
+ const Command = ({
10
+ ref,
11
+ className,
12
+ ...props
13
+ }: React.ComponentProps<typeof CommandPrimitive>) => (
14
+ <CommandPrimitive
15
+ ref={ref}
16
+ className={cn(
17
+ 'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
18
+ className,
19
+ )}
20
+ {...props}
21
+ />
22
+ )
23
+ Command.displayName = CommandPrimitive.displayName
24
+
25
+ const CommandInput = ({
26
+ ref,
27
+ className,
28
+ wrapperClassName,
29
+ ...props
30
+ }: React.ComponentProps<typeof CommandPrimitive.Input> & {
31
+ wrapperClassName?: string
32
+ }) => (
33
+ <div
34
+ className={cn('flex items-center border-b px-3', wrapperClassName)}
35
+ cmdk-input-wrapper=""
36
+ >
37
+ <Search className="h-4 w-4 shrink-0 opacity-50" />
38
+ <CommandPrimitive.Input
39
+ ref={ref}
40
+ className={cn(
41
+ 'placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50',
42
+ className,
43
+ )}
44
+ {...props}
45
+ />
46
+ </div>
47
+ )
48
+
49
+ CommandInput.displayName = CommandPrimitive.Input.displayName
50
+
51
+ const CommandList = ({
52
+ ref,
53
+ className,
54
+ ...props
55
+ }: React.ComponentProps<typeof CommandPrimitive.List>) => (
56
+ <CommandPrimitive.List
57
+ ref={ref}
58
+ className={cn('max-h-[300px] overflow-x-hidden overflow-y-auto', className)}
59
+ {...props}
60
+ />
61
+ )
62
+
63
+ CommandList.displayName = CommandPrimitive.List.displayName
64
+
65
+ const CommandEmpty = ({
66
+ ref,
67
+ ...props
68
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) => (
69
+ <CommandPrimitive.Empty
70
+ ref={ref}
71
+ className="py-6 text-center text-sm"
72
+ {...props}
73
+ />
74
+ )
75
+
76
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName
77
+
78
+ const CommandGroup = ({
79
+ ref,
80
+ className,
81
+ ...props
82
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) => (
83
+ <CommandPrimitive.Group
84
+ ref={ref}
85
+ className={cn(
86
+ 'text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium',
87
+ className,
88
+ )}
89
+ {...props}
90
+ />
91
+ )
92
+
93
+ CommandGroup.displayName = CommandPrimitive.Group.displayName
94
+
95
+ const CommandSeparator = ({
96
+ ref,
97
+ className,
98
+ ...props
99
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) => (
100
+ <CommandPrimitive.Separator
101
+ ref={ref}
102
+ className={cn('bg-border -mx-1 h-px', className)}
103
+ {...props}
104
+ />
105
+ )
106
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName
107
+
108
+ const CommandItem = ({
109
+ ref,
110
+ className,
111
+ ...props
112
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) => (
113
+ <CommandPrimitive.Item
114
+ ref={ref}
115
+ className={cn(
116
+ "group data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
117
+ className,
118
+ )}
119
+ {...props}
120
+ />
121
+ )
122
+
123
+ CommandItem.displayName = CommandPrimitive.Item.displayName
124
+
125
+ export {
126
+ Command,
127
+ CommandEmpty,
128
+ CommandGroup,
129
+ CommandInput,
130
+ CommandItem,
131
+ CommandList,
132
+ CommandSeparator,
133
+ }