panelui-native 0.22.6 → 0.25.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 (135) hide show
  1. package/README.md +1 -0
  2. package/lib/module/components/area-chart/index.js +826 -0
  3. package/lib/module/components/area-chart/index.js.map +1 -0
  4. package/lib/module/components/avatar/index.js +1 -1
  5. package/lib/module/components/avatar/index.js.map +1 -1
  6. package/lib/module/components/bar-chart/index.js +853 -0
  7. package/lib/module/components/bar-chart/index.js.map +1 -0
  8. package/lib/module/components/bottom-sheet/index.js +207 -23
  9. package/lib/module/components/bottom-sheet/index.js.map +1 -1
  10. package/lib/module/components/breadcrumb/index.js +275 -0
  11. package/lib/module/components/breadcrumb/index.js.map +1 -0
  12. package/lib/module/components/chip/index.js +2 -2
  13. package/lib/module/components/direction/index.js +13 -19
  14. package/lib/module/components/direction/index.js.map +1 -1
  15. package/lib/module/components/frame/index.js +17 -0
  16. package/lib/module/components/frame/index.js.map +1 -1
  17. package/lib/module/components/heatmap-chart/index.js +28 -8
  18. package/lib/module/components/heatmap-chart/index.js.map +1 -1
  19. package/lib/module/components/input-group/index.js +2 -2
  20. package/lib/module/components/input-group/index.js.map +1 -1
  21. package/lib/module/components/line-chart/index.js +4 -146
  22. package/lib/module/components/line-chart/index.js.map +1 -1
  23. package/lib/module/components/loader/index.js +758 -0
  24. package/lib/module/components/loader/index.js.map +1 -0
  25. package/lib/module/components/map/basemap.js +265 -0
  26. package/lib/module/components/map/basemap.js.map +1 -0
  27. package/lib/module/components/map/index.js +850 -0
  28. package/lib/module/components/map/index.js.map +1 -0
  29. package/lib/module/components/map/maplibre.js +87 -0
  30. package/lib/module/components/map/maplibre.js.map +1 -0
  31. package/lib/module/components/message/index.js +8 -7
  32. package/lib/module/components/message/index.js.map +1 -1
  33. package/lib/module/components/otp-input/index.js +2 -2
  34. package/lib/module/components/progress/index.js +8 -2
  35. package/lib/module/components/progress/index.js.map +1 -1
  36. package/lib/module/components/ring-chart/index.js +423 -0
  37. package/lib/module/components/ring-chart/index.js.map +1 -0
  38. package/lib/module/components/section-rail/index.js +2 -2
  39. package/lib/module/components/separator/index.js +76 -22
  40. package/lib/module/components/separator/index.js.map +1 -1
  41. package/lib/module/components/shimmer/index.js +10 -1
  42. package/lib/module/components/shimmer/index.js.map +1 -1
  43. package/lib/module/components/slider/index.js +19 -5
  44. package/lib/module/components/slider/index.js.map +1 -1
  45. package/lib/module/components/steps/index.js +1 -1
  46. package/lib/module/components/switch/index.js +6 -1
  47. package/lib/module/components/switch/index.js.map +1 -1
  48. package/lib/module/components/typography/index.js +5 -0
  49. package/lib/module/components/typography/index.js.map +1 -1
  50. package/lib/module/hooks/use-direction.js +43 -0
  51. package/lib/module/hooks/use-direction.js.map +1 -0
  52. package/lib/module/icons/index.js +117 -2
  53. package/lib/module/icons/index.js.map +1 -1
  54. package/lib/module/index.js +8 -2
  55. package/lib/module/index.js.map +1 -1
  56. package/lib/module/primitives/text.js +30 -10
  57. package/lib/module/primitives/text.js.map +1 -1
  58. package/lib/module/utils/chart.js +279 -0
  59. package/lib/module/utils/chart.js.map +1 -0
  60. package/lib/typescript/src/components/area-chart/index.d.ts +197 -0
  61. package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -0
  62. package/lib/typescript/src/components/bar-chart/index.d.ts +228 -0
  63. package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -0
  64. package/lib/typescript/src/components/bottom-sheet/index.d.ts +75 -4
  65. package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
  66. package/lib/typescript/src/components/breadcrumb/index.d.ts +100 -0
  67. package/lib/typescript/src/components/breadcrumb/index.d.ts.map +1 -0
  68. package/lib/typescript/src/components/direction/index.d.ts +11 -10
  69. package/lib/typescript/src/components/direction/index.d.ts.map +1 -1
  70. package/lib/typescript/src/components/frame/index.d.ts +17 -0
  71. package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
  72. package/lib/typescript/src/components/heatmap-chart/index.d.ts +22 -3
  73. package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
  74. package/lib/typescript/src/components/line-chart/index.d.ts +1 -0
  75. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
  76. package/lib/typescript/src/components/loader/index.d.ts +38 -0
  77. package/lib/typescript/src/components/loader/index.d.ts.map +1 -0
  78. package/lib/typescript/src/components/map/basemap.d.ts +76 -0
  79. package/lib/typescript/src/components/map/basemap.d.ts.map +1 -0
  80. package/lib/typescript/src/components/map/index.d.ts +367 -0
  81. package/lib/typescript/src/components/map/index.d.ts.map +1 -0
  82. package/lib/typescript/src/components/map/maplibre.d.ts +193 -0
  83. package/lib/typescript/src/components/map/maplibre.d.ts.map +1 -0
  84. package/lib/typescript/src/components/message/index.d.ts.map +1 -1
  85. package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
  86. package/lib/typescript/src/components/ring-chart/index.d.ts +156 -0
  87. package/lib/typescript/src/components/ring-chart/index.d.ts.map +1 -0
  88. package/lib/typescript/src/components/separator/index.d.ts +36 -1
  89. package/lib/typescript/src/components/separator/index.d.ts.map +1 -1
  90. package/lib/typescript/src/components/shimmer/index.d.ts.map +1 -1
  91. package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
  92. package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
  93. package/lib/typescript/src/components/typography/index.d.ts +6 -0
  94. package/lib/typescript/src/components/typography/index.d.ts.map +1 -1
  95. package/lib/typescript/src/hooks/use-direction.d.ts +20 -0
  96. package/lib/typescript/src/hooks/use-direction.d.ts.map +1 -0
  97. package/lib/typescript/src/icons/index.d.ts +5 -0
  98. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  99. package/lib/typescript/src/index.d.ts +9 -3
  100. package/lib/typescript/src/index.d.ts.map +1 -1
  101. package/lib/typescript/src/primitives/text.d.ts.map +1 -1
  102. package/lib/typescript/src/utils/chart.d.ts +96 -0
  103. package/lib/typescript/src/utils/chart.d.ts.map +1 -0
  104. package/package.json +9 -1
  105. package/src/components/area-chart/index.tsx +994 -0
  106. package/src/components/avatar/index.tsx +1 -1
  107. package/src/components/bar-chart/index.tsx +1048 -0
  108. package/src/components/bottom-sheet/index.tsx +280 -20
  109. package/src/components/breadcrumb/index.tsx +365 -0
  110. package/src/components/chip/index.tsx +2 -2
  111. package/src/components/direction/index.tsx +20 -21
  112. package/src/components/frame/index.tsx +17 -0
  113. package/src/components/heatmap-chart/index.tsx +58 -11
  114. package/src/components/input-group/index.tsx +2 -2
  115. package/src/components/line-chart/index.tsx +13 -181
  116. package/src/components/loader/index.tsx +812 -0
  117. package/src/components/map/basemap.ts +304 -0
  118. package/src/components/map/index.tsx +1118 -0
  119. package/src/components/map/maplibre.ts +201 -0
  120. package/src/components/message/index.tsx +8 -7
  121. package/src/components/otp-input/index.tsx +2 -2
  122. package/src/components/progress/index.tsx +10 -2
  123. package/src/components/ring-chart/index.tsx +543 -0
  124. package/src/components/section-rail/index.tsx +2 -2
  125. package/src/components/separator/index.tsx +77 -19
  126. package/src/components/shimmer/index.tsx +10 -1
  127. package/src/components/slider/index.tsx +20 -5
  128. package/src/components/steps/index.tsx +1 -1
  129. package/src/components/switch/index.tsx +6 -1
  130. package/src/components/typography/index.tsx +5 -0
  131. package/src/hooks/use-direction.ts +45 -0
  132. package/src/icons/index.tsx +66 -0
  133. package/src/index.ts +84 -0
  134. package/src/primitives/text.tsx +25 -7
  135. package/src/utils/chart.ts +355 -0
@@ -26,16 +26,20 @@ export { Accordion } from "./components/accordion/index.js";
26
26
  export { Alert } from "./components/alert/index.js";
27
27
  export { Avatar } from "./components/avatar/index.js";
28
28
  export { Attachment } from "./components/attachment/index.js";
29
+ export { AreaChart, useAreaChart } from "./components/area-chart/index.js";
29
30
  export { Badge } from "./components/badge/index.js";
31
+ export { BarChart, useBarChart } from "./components/bar-chart/index.js";
30
32
  export { BottomSheet } from "./components/bottom-sheet/index.js";
33
+ export { Breadcrumb } from "./components/breadcrumb/index.js";
31
34
  export { Button } from "./components/button/index.js";
32
35
  export { ToggleButton, ToggleButtonGroup, useToggleButton } from "./components/toggle-button/index.js";
33
36
  export { Dialog } from "./components/dialog/index.js";
34
37
  export { Soundwave } from "./components/soundwave/index.js";
35
- export { Direction, useDirection } from "./components/direction/index.js";
38
+ export { Direction, useDirection, useDirectionSign } from "./components/direction/index.js";
36
39
  export { Flow } from "./components/flow/index.js";
37
40
  export { Frame } from "./components/frame/index.js";
38
41
  export { HeatmapChart, useHeatmapChart, buildHeatmapCalendar } from "./components/heatmap-chart/index.js";
42
+ export { Map, useMap, hasMapLibre, CARTO_SOURCE } from "./components/map/index.js";
39
43
  export { Select } from "./components/select/index.js";
40
44
  export { SectionRail } from "./components/section-rail/index.js";
41
45
  export { Tabs } from "./components/tabs/index.js";
@@ -52,6 +56,7 @@ export { OtpInput } from "./components/otp-input/index.js";
52
56
  export { Item } from "./components/item/index.js";
53
57
  export { Label } from "./components/label/index.js";
54
58
  export { LineChart, useLineChart } from "./components/line-chart/index.js";
59
+ export { Loader } from "./components/loader/index.js";
55
60
  export { Marker } from "./components/marker/index.js";
56
61
  export { MessageScroller, useMessageScroller, useMessageScrollerVisibility } from "./components/message-scroller/index.js";
57
62
  export { Message } from "./components/message/index.js";
@@ -59,6 +64,7 @@ export { Popover } from "./components/popover/index.js";
59
64
  export { Progress } from "./components/progress/index.js";
60
65
  export { RadioGroup } from "./components/radio-group/index.js";
61
66
  export { Rating } from "./components/rating/index.js";
67
+ export { RingChart, useRingChart } from "./components/ring-chart/index.js";
62
68
  export { ScrollFade } from "./components/scroll-fade/index.js";
63
69
  export { Separator } from "./components/separator/index.js";
64
70
  export { Signature, hasSignatureFileSystem, hasSignatureRaster } from "./components/signature/index.js";
@@ -77,7 +83,7 @@ export { Toast, ToastViewport, toast, useToast } from "./components/toast/index.
77
83
  export { Typography } from "./components/typography/index.js";
78
84
 
79
85
  // Icons
80
- export { AlertTriangleIcon, AppleIcon, ArrowUpRightIcon, BellIcon, CardIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, DownloadIcon, FacebookIcon, FileIcon, GoogleIcon, IconColorProvider, InfoIcon, ImageIcon, LockIcon, MaximizeIcon, MicIcon, MinusIcon, MoonIcon, PackageIcon, PaperclipIcon, PauseIcon, PencilIcon, PlayIcon, PlusIcon, PlusSquareIcon, ReceiptIcon, RotateCcwIcon, SearchIcon, SendIcon, ShareNodesIcon, ShieldAlertIcon, ShieldCheckIcon, SunIcon, TrashIcon, UnlockIcon, XIcon, useIconColor } from "./icons/index.js";
86
+ export { AlertTriangleIcon, AppleIcon, ArrowUpRightIcon, BellIcon, CardIcon, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, DownloadIcon, EllipsisIcon, FacebookIcon, FileIcon, GoogleIcon, IconColorProvider, InfoIcon, ImageIcon, LockIcon, MaximizeIcon, MicIcon, MinusIcon, MoonIcon, PackageIcon, PaperclipIcon, PauseIcon, PencilIcon, PlayIcon, PlusIcon, PlusSquareIcon, ReceiptIcon, RotateCcwIcon, SearchIcon, SendIcon, ShareNodesIcon, ShieldAlertIcon, ShieldCheckIcon, SunIcon, TrashIcon, UnlockIcon, XIcon, useIconColor } from "./icons/index.js";
81
87
 
82
88
  // Hooks
83
89
  export * from "./hooks/index.js";
@@ -1 +1 @@
1
- {"version":3,"names":["PanelUIProvider","useTheme","useThemeMode","PANEL_THEMES","PANEL_THEME_NAMES","PANEL_EXTRA_THEMES","Portal","PortalHost","PortalProvider","Scrim","hasBlur","Text","KeyboardAvoider","AnimatedPressable","ScrollProgress","useScrollProgress","hasNativeUI","hasHaptics","selectionTick","Accordion","Alert","Avatar","Attachment","Badge","BottomSheet","Button","ToggleButton","ToggleButtonGroup","useToggleButton","Dialog","Soundwave","Direction","useDirection","Flow","Frame","HeatmapChart","useHeatmapChart","buildHeatmapCalendar","Select","SectionRail","Tabs","Card","Checkbox","Chip","useChip","EmptyState","Field","Form","useForm","useField","Input","InputGroup","NumberInput","OtpInput","Item","Label","LineChart","useLineChart","Marker","MessageScroller","useMessageScroller","useMessageScrollerVisibility","Message","Popover","Progress","RadioGroup","Rating","ScrollFade","Separator","Signature","hasSignatureFileSystem","hasSignatureRaster","Shimmer","ScrollText","ScrollCanvas","ThinkingOrb","Skeleton","Slider","Spinner","Steps","Surface","Switch","Timeline","Toast","ToastViewport","toast","useToast","Typography","AlertTriangleIcon","AppleIcon","ArrowUpRightIcon","BellIcon","CardIcon","CheckCircleIcon","CheckIcon","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","DownloadIcon","FacebookIcon","FileIcon","GoogleIcon","IconColorProvider","InfoIcon","ImageIcon","LockIcon","MaximizeIcon","MicIcon","MinusIcon","MoonIcon","PackageIcon","PaperclipIcon","PauseIcon","PencilIcon","PlayIcon","PlusIcon","PlusSquareIcon","ReceiptIcon","RotateCcwIcon","SearchIcon","SendIcon","ShareNodesIcon","ShieldAlertIcon","ShieldCheckIcon","SunIcon","TrashIcon","UnlockIcon","XIcon","useIconColor","cn"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,SAASA,eAAe,QAAmC,kCAA+B;;AAE1F;AACA,SACEC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,iBAAiB,EACjBC,kBAAkB,QAKb,sBAAmB;;AAE1B;AACA,SAASC,MAAM,EAAEC,UAAU,EAAEC,cAAc,QAAQ,wBAAqB;AACxE;AACA;AACA;AACA,SAASC,KAAK,EAAEC,OAAO,QAAyB,uBAAoB;AACpE,SAASC,IAAI,QAAwB,sBAAmB;AACxD,SACEC,eAAe,QAEV,kCAA+B;AACtC,SACEC,iBAAiB,QAEZ,oCAAiC;AACxC,SACEC,cAAc,EACdC,iBAAiB,QAGZ,iCAA8B;;AAErC;AACA,SAASC,WAAW,QAAQ,mBAAU;AACtC,SAASC,UAAU,EAAEC,aAAa,QAAQ,oBAAiB;;AAE3D;AACA,SACEC,SAAS,QAQJ,iCAAwB;AAC/B,SACEC,KAAK,QAG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QAEP,kBAAS;;AAEhB;AACA,cAAc,kBAAS;;AAEvB;AACA,SAASC,EAAE,QAAQ,eAAY","ignoreList":[]}
1
+ {"version":3,"names":["PanelUIProvider","useTheme","useThemeMode","PANEL_THEMES","PANEL_THEME_NAMES","PANEL_EXTRA_THEMES","Portal","PortalHost","PortalProvider","Scrim","hasBlur","Text","KeyboardAvoider","AnimatedPressable","ScrollProgress","useScrollProgress","hasNativeUI","hasHaptics","selectionTick","Accordion","Alert","Avatar","Attachment","AreaChart","useAreaChart","Badge","BarChart","useBarChart","BottomSheet","Breadcrumb","Button","ToggleButton","ToggleButtonGroup","useToggleButton","Dialog","Soundwave","Direction","useDirection","useDirectionSign","Flow","Frame","HeatmapChart","useHeatmapChart","buildHeatmapCalendar","Map","useMap","hasMapLibre","CARTO_SOURCE","Select","SectionRail","Tabs","Card","Checkbox","Chip","useChip","EmptyState","Field","Form","useForm","useField","Input","InputGroup","NumberInput","OtpInput","Item","Label","LineChart","useLineChart","Loader","Marker","MessageScroller","useMessageScroller","useMessageScrollerVisibility","Message","Popover","Progress","RadioGroup","Rating","RingChart","useRingChart","ScrollFade","Separator","Signature","hasSignatureFileSystem","hasSignatureRaster","Shimmer","ScrollText","ScrollCanvas","ThinkingOrb","Skeleton","Slider","Spinner","Steps","Surface","Switch","Timeline","Toast","ToastViewport","toast","useToast","Typography","AlertTriangleIcon","AppleIcon","ArrowUpRightIcon","BellIcon","CardIcon","CheckCircleIcon","CheckIcon","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","DownloadIcon","EllipsisIcon","FacebookIcon","FileIcon","GoogleIcon","IconColorProvider","InfoIcon","ImageIcon","LockIcon","MaximizeIcon","MicIcon","MinusIcon","MoonIcon","PackageIcon","PaperclipIcon","PauseIcon","PencilIcon","PlayIcon","PlusIcon","PlusSquareIcon","ReceiptIcon","RotateCcwIcon","SearchIcon","SendIcon","ShareNodesIcon","ShieldAlertIcon","ShieldCheckIcon","SunIcon","TrashIcon","UnlockIcon","XIc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EC,WAAW,QAGN,oCAA2B;AAClC,SAASC,QAAQ,QAA4B,gCAAuB;AACpE,SAASC,MAAM,QAA0B,8BAAqB;AAC9D,SAASC,OAAO,QAA2B,+BAAsB;AACjE,SACEC,KAAK,QAQA,6BAAoB;AAC3B,SAASC,OAAO,QAA2B,+BAAsB;AACjE,SAASC,MAAM,QAA0B,8BAAqB;AAC9D,SACEC,QAAQ,QAOH,gCAAuB;AAC9B,SACEC,KAAK,EACLC,aAAa,EACbC,KAAK,EACLC,QAAQ,QASH,6BAAoB;AAC3B,SACEC,UAAU,QAML,kCAAyB;;AAEhC;AACA,SACEC,iBAAiB,EACjBC,SAAS,EACTC,gBAAgB,EAChBC,QAAQ,EACRC,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,gBAAgB,EAChBC,YAAY,EACZC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,UAAU,EACVC,iBAAiB,EACjBC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,aAAa,EACbC,SAAS,EACTC,UAAU,EACVC,QAAQ,EACRC,QAAQ,EACRC,cAAc,EACdC,WAAW,EACXC,aAAa,EACbC,UAAU,EACVC,QAAQ,EACRC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,OAAO,EACPC,SAAS,EACTC,UAAU,EACVC,KAAK,EACLC,YAAY,QAEP,kBAAS;;AAEhB;AACA,cAAc,kBAAS;;AAEvB;AACA,SAASC,EAAE,QAAQ,eAAY","ignoreList":[]}
@@ -3,6 +3,7 @@
3
3
  import { forwardRef } from 'react';
4
4
  import { Text as RNText } from 'react-native';
5
5
  import { tv } from 'tailwind-variants';
6
+ import { useDirection } from "../hooks/use-direction.js";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  const textVariants = tv({
8
9
  base: 'text-foreground',
@@ -36,16 +37,35 @@ export const Text = /*#__PURE__*/forwardRef(({
36
37
  size,
37
38
  weight,
38
39
  muted,
40
+ style,
39
41
  ...props
40
- }, ref) => /*#__PURE__*/_jsx(RNText, {
41
- ref: ref,
42
- className: textVariants({
43
- size,
44
- weight,
45
- muted,
46
- className
47
- }),
48
- ...props
49
- }));
42
+ }, ref) => {
43
+ /*
44
+ * `direction` is a Yoga *layout* property, and React Native resolves a
45
+ * paragraph's own alignment from the process-wide `I18nManager.isRTL`
46
+ * instead — so a `<Direction dir="rtl">` mirrors the furniture around this
47
+ * text and leaves the text itself left-aligned inside it. Setting
48
+ * `writingDirection` is what closes that gap, and it also puts bidi
49
+ * punctuation on the correct end of a mixed line.
50
+ *
51
+ * Only the direction, not the alignment: `textAlign` stays whatever the
52
+ * caller asked for, or unset. A component that centres its label means it
53
+ * in both directions.
54
+ */
55
+ const direction = useDirection();
56
+ return /*#__PURE__*/_jsx(RNText, {
57
+ ref: ref,
58
+ className: textVariants({
59
+ size,
60
+ weight,
61
+ muted,
62
+ className
63
+ }),
64
+ style: [{
65
+ writingDirection: direction
66
+ }, style],
67
+ ...props
68
+ });
69
+ });
50
70
  Text.displayName = 'Text';
51
71
  //# sourceMappingURL=text.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","Text","RNText","tv","jsx","_jsx","textVariants","base","variants","size","xs","sm","lg","xl","weight","normal","medium","semibold","bold","muted","true","defaultVariants","className","props","ref","displayName"],"sourceRoot":"../../../src","sources":["primitives/text.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,IAAI,IAAIC,MAAM,QAAgE,cAAc;AACrG,SAASC,EAAE,QAA2B,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE1D,MAAMC,YAAY,GAAGH,EAAE,CAAC;EACtBI,IAAI,EAAE,iBAAiB;EACvBC,QAAQ,EAAE;IACRC,IAAI,EAAE;MACJC,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE,SAAS;MACbJ,IAAI,EAAE,WAAW;MACjBK,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE,SAAS;MACb,KAAK,EAAE,UAAU;MACjB,KAAK,EAAE;IACT,CAAC;IACDC,MAAM,EAAE;MACNC,MAAM,EAAE,aAAa;MACrBC,MAAM,EAAE,aAAa;MACrBC,QAAQ,EAAE,eAAe;MACzBC,IAAI,EAAE;IACR,CAAC;IACDC,KAAK,EAAE;MACLC,IAAI,EAAE;IACR;EACF,CAAC;EACDC,eAAe,EAAE;IACfZ,IAAI,EAAE,MAAM;IACZK,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAMF,OAAO,MAAMb,IAAI,gBAAGD,UAAU,CAC5B,CAAC;EAAEsB,SAAS;EAAEb,IAAI;EAAEK,MAAM;EAAEK,KAAK;EAAE,GAAGI;AAAM,CAAC,EAAEC,GAAG,kBAChDnB,IAAA,CAACH,MAAM;EACLsB,GAAG,EAAEA,GAAI;EACTF,SAAS,EAAEhB,YAAY,CAAC;IAAEG,IAAI;IAAEK,MAAM;IAAEK,KAAK;IAAEG;EAAU,CAAC,CAAE;EAAA,GACxDC;AAAK,CACV,CAEL,CAAC;AAEDtB,IAAI,CAACwB,WAAW,GAAG,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["forwardRef","Text","RNText","tv","useDirection","jsx","_jsx","textVariants","base","variants","size","xs","sm","lg","xl","weight","normal","medium","semibold","bold","muted","true","defaultVariants","className","style","props","ref","direction","writingDirection","displayName"],"sourceRoot":"../../../src","sources":["primitives/text.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,IAAI,IAAIC,MAAM,QAAgE,cAAc;AACrG,SAASC,EAAE,QAA2B,mBAAmB;AACzD,SAASC,YAAY,QAAQ,2BAAwB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtD,MAAMC,YAAY,GAAGJ,EAAE,CAAC;EACtBK,IAAI,EAAE,iBAAiB;EACvBC,QAAQ,EAAE;IACRC,IAAI,EAAE;MACJC,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE,SAAS;MACbJ,IAAI,EAAE,WAAW;MACjBK,EAAE,EAAE,SAAS;MACbC,EAAE,EAAE,SAAS;MACb,KAAK,EAAE,UAAU;MACjB,KAAK,EAAE;IACT,CAAC;IACDC,MAAM,EAAE;MACNC,MAAM,EAAE,aAAa;MACrBC,MAAM,EAAE,aAAa;MACrBC,QAAQ,EAAE,eAAe;MACzBC,IAAI,EAAE;IACR,CAAC;IACDC,KAAK,EAAE;MACLC,IAAI,EAAE;IACR;EACF,CAAC;EACDC,eAAe,EAAE;IACfZ,IAAI,EAAE,MAAM;IACZK,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAMF,OAAO,MAAMd,IAAI,gBAAGD,UAAU,CAC5B,CAAC;EAAEuB,SAAS;EAAEb,IAAI;EAAEK,MAAM;EAAEK,KAAK;EAAEI,KAAK;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EAC5D;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,MAAMC,SAAS,GAAGvB,YAAY,CAAC,CAAC;EAEhC,oBACEE,IAAA,CAACJ,MAAM;IACLwB,GAAG,EAAEA,GAAI;IACTH,SAAS,EAAEhB,YAAY,CAAC;MAAEG,IAAI;MAAEK,MAAM;MAAEK,KAAK;MAAEG;IAAU,CAAC,CAAE;IAC5DC,KAAK,EAAE,CAAC;MAAEI,gBAAgB,EAAED;IAAU,CAAC,EAAEH,KAAK,CAAE;IAAA,GAC5CC;EAAK,CACV,CAAC;AAEN,CACF,CAAC;AAEDxB,IAAI,CAAC4B,WAAW,GAAG,MAAM","ignoreList":[]}
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The maths every chart shares.
5
+ *
6
+ * Scales, monotone tangents and path building, in one place because four
7
+ * charts need them and a copy per chart is four chances for two charts to
8
+ * disagree about where a point goes. A line and an area drawn from different
9
+ * code do not lie on top of each other, and that is exactly the pair most
10
+ * often drawn together.
11
+ *
12
+ * Everything here is a worklet. The paths are rebuilt on the UI thread on
13
+ * every frame a domain is tweening, so none of it can be allowed to need the
14
+ * JS thread — which also rules out reaching for a charting dependency, since
15
+ * that is the one thing none of them are written to survive.
16
+ */
17
+
18
+ import { useCSSVariable } from 'uniwind';
19
+
20
+ /** Only reached if the theme CSS was never imported. */
21
+ const FALLBACK_SERIES = ['#3b82f6', '#10b981', '#f59e0b', '#8b5cf6', '#ec4899'];
22
+
23
+ /** Which of the five chart tokens a series takes. */
24
+
25
+ /**
26
+ * A series' colour: an explicit one, else the `--color-chart-*` token.
27
+ *
28
+ * Shared so every chart draws its first series in the same colour. Two charts
29
+ * on one screen disagreeing about what "series one" looks like is the kind of
30
+ * thing nobody reports and everybody notices.
31
+ */
32
+ export function useSeriesColor(explicit, index) {
33
+ const token = useCSSVariable(`--color-chart-${index}`);
34
+ return explicit ?? (typeof token === 'string' ? token : FALLBACK_SERIES[index - 1]);
35
+ }
36
+
37
+ /** `12.4k` rather than `12400` — a readout has one line to say it in. */
38
+ export function compactNumber(value) {
39
+ const abs = Math.abs(value);
40
+ if (abs >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`;
41
+ if (abs >= 1_000) return `${(value / 1_000).toFixed(1)}k`;
42
+ return Number.isInteger(value) ? String(value) : value.toFixed(1);
43
+ }
44
+
45
+ /** The drawable box inside a chart, after its padding is taken off. */
46
+
47
+ /** A point's x, spreading `total` of them evenly across the plot. */
48
+ export function xOf(index, total, plot) {
49
+ 'worklet';
50
+
51
+ if (total <= 1) return plot.left + plot.width / 2;
52
+ return plot.left + plot.width * index / (total - 1);
53
+ }
54
+
55
+ /** A value's y, with `min` at the bottom of the plot and `max` at the top. */
56
+ export function yOf(value, plot, min, max) {
57
+ 'worklet';
58
+
59
+ const span = max - min || 1;
60
+ return plot.top + plot.height - (value - min) / span * plot.height;
61
+ }
62
+
63
+ /** The centre of the `index`th of `total` bands, as used for bars and columns. */
64
+ export function bandOf(index, total, plot) {
65
+ 'worklet';
66
+
67
+ if (total <= 0) return plot.left + plot.width / 2;
68
+ const width = plot.width / total;
69
+ return plot.left + width * (index + 0.5);
70
+ }
71
+
72
+ /**
73
+ * Monotone cubic tangents.
74
+ *
75
+ * Written out rather than taken from a charting dependency, because it is forty
76
+ * lines and it has to run inside a worklet.
77
+ *
78
+ * Monotone is the right default for a time series. A plain cubic spline
79
+ * overshoots between points, so a series that never goes below zero draws a dip
80
+ * under the axis between two low values — a shape that is not in the data. This
81
+ * one cannot, because the tangent at each point is clamped against the slopes
82
+ * either side of it, and a local peak or trough is given a flat one.
83
+ */
84
+ export function tangents(xs, ys) {
85
+ 'worklet';
86
+
87
+ const n = xs.length;
88
+ const slopes = [];
89
+ for (let i = 0; i < n - 1; i += 1) {
90
+ slopes.push((ys[i + 1] - ys[i]) / (xs[i + 1] - xs[i] || 1));
91
+ }
92
+ const result = new Array(n).fill(0);
93
+ result[0] = slopes[0] ?? 0;
94
+ result[n - 1] = slopes[n - 2] ?? 0;
95
+ for (let i = 1; i < n - 1; i += 1) {
96
+ const previous = slopes[i - 1];
97
+ const next = slopes[i];
98
+ result[i] = previous * next <= 0 ? 0 : (previous + next) / 2;
99
+ }
100
+
101
+ // Fritsch–Carlson: pull any tangent back inside the circle of radius 3, which
102
+ // is the condition for the segment to stay monotone.
103
+ for (let i = 0; i < n - 1; i += 1) {
104
+ const slope = slopes[i];
105
+ if (slope === 0) {
106
+ result[i] = 0;
107
+ result[i + 1] = 0;
108
+ continue;
109
+ }
110
+ const a = result[i] / slope;
111
+ const b = result[i + 1] / slope;
112
+ const magnitude = Math.sqrt(a * a + b * b);
113
+ if (magnitude > 3) {
114
+ result[i] = 3 / magnitude * a * slope;
115
+ result[i + 1] = 3 / magnitude * b * slope;
116
+ }
117
+ }
118
+ return result;
119
+ }
120
+
121
+ /** How a series is joined between its points. */
122
+
123
+ /** Points, split at the gaps — a null breaks the series rather than crossing it. */
124
+ export function runsOf(values, plot, min, max, /** Baselines to stack each point on top of, for a stacked area. */
125
+ baselines) {
126
+ 'worklet';
127
+
128
+ const runs = [];
129
+ let run = [];
130
+ for (let i = 0; i < values.length; i += 1) {
131
+ const value = values[i];
132
+ if (value === null || value === undefined) {
133
+ if (run.length) runs.push(run);
134
+ run = [];
135
+ continue;
136
+ }
137
+ const stacked = value + (baselines?.[i] ?? 0);
138
+ run.push({
139
+ x: xOf(i, values.length, plot),
140
+ y: yOf(stacked, plot, min, max)
141
+ });
142
+ }
143
+ if (run.length) runs.push(run);
144
+ return runs;
145
+ }
146
+
147
+ /** One unbroken run of points as a path, curved or straight. */
148
+ export function segment(points, curve) {
149
+ 'worklet';
150
+
151
+ if (!points.length) return '';
152
+ if (points.length < 3 || curve === 'linear') {
153
+ return points.map((p, i) => `${i === 0 ? 'M' : 'L'}${p.x},${p.y}`).join(' ');
154
+ }
155
+ const xs = points.map(p => p.x);
156
+ const ys = points.map(p => p.y);
157
+ const ms = tangents(xs, ys);
158
+ let d = `M${xs[0]},${ys[0]}`;
159
+ for (let i = 0; i < points.length - 1; i += 1) {
160
+ const dx = (xs[i + 1] - xs[i]) / 3;
161
+ d += ` C${xs[i] + dx},${ys[i] + ms[i] * dx} ${xs[i + 1] - dx},${ys[i + 1] - ms[i + 1] * dx} ${xs[i + 1]},${ys[i + 1]}`;
162
+ }
163
+ return d;
164
+ }
165
+
166
+ /** A series as a stroked line. Flat down the middle while it is still loading. */
167
+ export function linePath(values, plot, min, max, curve, loading, baselines) {
168
+ 'worklet';
169
+
170
+ if (loading || plot.width <= 0) {
171
+ // Flat down the middle: the shape the skeleton holds, and the shape the
172
+ // real series grows out of once the data arrives.
173
+ const y = plot.top + plot.height / 2;
174
+ return `M${plot.left},${y} L${plot.left + plot.width},${y}`;
175
+ }
176
+ return runsOf(values, plot, min, max, baselines).map(run => segment(run, curve)).join(' ');
177
+ }
178
+
179
+ /**
180
+ * A series as a filled area.
181
+ *
182
+ * `floors` is what makes a stack: without it every run is closed against the
183
+ * bottom of the plot, and with it each run is closed against the series below,
184
+ * so the bands sit on each other rather than overlapping. The floor is walked
185
+ * backwards because the fill has to trace its underside right to left to close.
186
+ */
187
+ export function areaPath(values, plot, min, max, curve, loading, baselines) {
188
+ 'worklet';
189
+
190
+ if (loading || plot.width <= 0) return '';
191
+ const bottom = plot.top + plot.height;
192
+ const runs = runsOf(values, plot, min, max, baselines);
193
+ if (!baselines) {
194
+ return runs.map(run => {
195
+ const top = segment(run, curve);
196
+ if (!top) return '';
197
+ const first = run[0];
198
+ const last = run[run.length - 1];
199
+ return `${top} L${last.x},${bottom} L${first.x},${bottom} Z`;
200
+ }).join(' ');
201
+ }
202
+
203
+ // Stacked: the underside is the baseline itself, drawn as its own curve so
204
+ // the two edges of a band meet cleanly at both ends.
205
+ const floors = runsOf(values.map(value => value === null || value === undefined ? null : 0), plot, min, max, baselines);
206
+ return runs.map((run, index) => {
207
+ const top = segment(run, curve);
208
+ const floor = floors[index];
209
+ if (!top || !floor?.length) return '';
210
+ const under = segment([...floor].reverse(), curve).replace('M', 'L');
211
+ return `${top} ${under} Z`;
212
+ }).join(' ');
213
+ }
214
+
215
+ /**
216
+ * A rounded rectangle, built as a path rather than drawn as a `Rect`.
217
+ *
218
+ * A bar is rounded on the end it grows towards and square on the end it grows
219
+ * from, so it reads as sitting on the axis rather than floating above it —
220
+ * which `rx` cannot express, since it rounds all four corners or none.
221
+ */
222
+ export function barPath(x, y, width, height, radius, /** Which end is the growing one. */
223
+ towards) {
224
+ 'worklet';
225
+
226
+ if (width <= 0 || height <= 0) return '';
227
+ const r = Math.max(0, Math.min(radius, width / 2, height / 2));
228
+ const right = x + width;
229
+ const bottom = y + height;
230
+ if (towards === 'up') {
231
+ return `M${x},${bottom}L${x},${y + r}Q${x},${y} ${x + r},${y}` + `L${right - r},${y}Q${right},${y} ${right},${y + r}L${right},${bottom}Z`;
232
+ }
233
+ if (towards === 'down') {
234
+ return `M${x},${y}L${x},${bottom - r}Q${x},${bottom} ${x + r},${bottom}` + `L${right - r},${bottom}Q${right},${bottom} ${right},${bottom - r}L${right},${y}Z`;
235
+ }
236
+ if (towards === 'right') {
237
+ return `M${x},${y}L${right - r},${y}Q${right},${y} ${right},${y + r}` + `L${right},${bottom - r}Q${right},${bottom} ${right - r},${bottom}L${x},${bottom}Z`;
238
+ }
239
+ return `M${right},${y}L${x + r},${y}Q${x},${y} ${x},${y + r}` + `L${x},${bottom - r}Q${x},${bottom} ${x + r},${bottom}L${right},${bottom}Z`;
240
+ }
241
+
242
+ /**
243
+ * An arc of a circle, as a path.
244
+ *
245
+ * Angles are in turns from twelve o'clock, clockwise, because that is how a
246
+ * ring chart is described — "sixty percent of the way round" — and converting
247
+ * at every call site is where the sign errors live.
248
+ */
249
+ export function arcPath(cx, cy, radius, from, to) {
250
+ 'worklet';
251
+
252
+ const sweep = to - from;
253
+ if (radius <= 0 || sweep <= 0) return '';
254
+
255
+ // A full turn cannot be drawn as one arc — start and end are the same point,
256
+ // and the renderer draws nothing rather than everything. Two halves can.
257
+ if (sweep >= 1) {
258
+ const top = `${cx},${cy - radius}`;
259
+ const bottomPoint = `${cx},${cy + radius}`;
260
+ return `M${top}A${radius},${radius} 0 0 1 ${bottomPoint}` + `A${radius},${radius} 0 0 1 ${top}`;
261
+ }
262
+ const angle = turn => (turn - 0.25) * Math.PI * 2;
263
+ const x1 = cx + radius * Math.cos(angle(from));
264
+ const y1 = cy + radius * Math.sin(angle(from));
265
+ const x2 = cx + radius * Math.cos(angle(to));
266
+ const y2 = cy + radius * Math.sin(angle(to));
267
+ return `M${x1},${y1}A${radius},${radius} 0 ${sweep > 0.5 ? 1 : 0} 1 ${x2},${y2}`;
268
+ }
269
+
270
+ /** The numbers of one column, with anything unusable left as a gap. */
271
+ export function columnValues(data, key) {
272
+ 'worklet';
273
+
274
+ return data.map(row => {
275
+ const value = row[key];
276
+ return typeof value === 'number' && !Number.isNaN(value) ? value : null;
277
+ });
278
+ }
279
+ //# sourceMappingURL=chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCSSVariable","FALLBACK_SERIES","useSeriesColor","explicit","index","token","compactNumber","value","abs","Math","toFixed","Number","isInteger","String","xOf","total","plot","left","width","yOf","min","max","span","top","height","bandOf","tangents","xs","ys","n","length","slopes","i","push","result","Array","fill","previous","next","slope","a","b","magnitude","sqrt","runsOf","values","baselines","runs","run","undefined","stacked","x","y","segment","points","curve","map","p","join","ms","d","dx","linePath","loading","areaPath","bottom","first","last","floors","floor","under","reverse","replace","barPath","radius","towards","r","right","arcPath","cx","cy","from","to","sweep","bottomPoint","angle","turn","PI","x1","cos","y1","sin","x2","y2","columnValues","data","key","row","isNaN"],"sourceRoot":"../../../src","sources":["utils/chart.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,SAAS;;AAExC;AACA,MAAMC,eAAe,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;;AAE/E;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAC5BC,QAA4B,EAC5BC,KAAuB,EACf;EACR,MAAMC,KAAK,GAAGL,cAAc,CAAC,iBAAiBI,KAAK,EAAE,CAAC;EACtD,OAAOD,QAAQ,KAAK,OAAOE,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAGJ,eAAe,CAACG,KAAK,GAAG,CAAC,CAAE,CAAC;AACtF;;AAEA;AACA,OAAO,SAASE,aAAaA,CAACC,KAAa,EAAU;EACnD,MAAMC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAACD,KAAK,CAAC;EAC3B,IAAIC,GAAG,IAAI,SAAS,EAAE,OAAO,GAAG,CAACD,KAAK,GAAG,SAAS,EAAEG,OAAO,CAAC,CAAC,CAAC,GAAG;EACjE,IAAIF,GAAG,IAAI,KAAK,EAAE,OAAO,GAAG,CAACD,KAAK,GAAG,KAAK,EAAEG,OAAO,CAAC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,KAAK,KAAK,QAAQ,IAAI,CAACI,MAAM,CAACuF,KAAK,CAAC3F,KAAK,CAAC,GAAGA,KAAK,GAAG,IAAI;EACzE,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,197 @@
1
+ /**
2
+ * AreaChart — filled bands over time, stacked or overlaid.
3
+ *
4
+ * ```tsx
5
+ * <AreaChart data={traffic} xDataKey="date" stacked>
6
+ * <AreaChart.Grid />
7
+ * <AreaChart.Area dataKey="direct" />
8
+ * <AreaChart.Area dataKey="search" colorIndex={2} />
9
+ * <AreaChart.XAxis />
10
+ * <AreaChart.Tooltip />
11
+ * </AreaChart>
12
+ * ```
13
+ *
14
+ * ## Why this is not `LineChart.Area`
15
+ *
16
+ * `LineChart.Area` shades under a line, which is one series saying "this is
17
+ * the shape of the thing". This chart answers a different question — *what is
18
+ * it made of* — and that needs stacking: each band sits on the running total
19
+ * of the ones below it, so the top edge is the whole and the thickness of each
20
+ * band is its share.
21
+ *
22
+ * Stacking is not a flag that could be bolted on. It changes the y-domain from
23
+ * the largest single series to the largest *sum*, it makes each area's
24
+ * baseline a curve rather than the axis, and it makes the order the series are
25
+ * declared in load-bearing. A chart where all of that is true of some children
26
+ * and not others is a chart nobody can read, so it is a chart of its own.
27
+ *
28
+ * Unstacked, the bands overlay each other and the fills are drawn translucent,
29
+ * which is the right reading when the series are alternatives rather than
30
+ * parts — two plans compared, not two slices of one total.
31
+ */
32
+ import { type ReactNode } from 'react';
33
+ import { type ViewProps } from 'react-native';
34
+ import { type ChartCurve, type SeriesColorIndex } from '../../utils/chart.js';
35
+ type Layer = 'svg' | 'overlay';
36
+ export type AreaChartStatus = 'loading' | 'ready';
37
+ export type AreaChartDatum = Record<string, string | number | null | undefined>;
38
+ /**
39
+ * The point under the crosshair, for something rendered *inside* the chart.
40
+ * A readout in the card's header is outside this provider — use
41
+ * `onActiveIndexChange` for that.
42
+ */
43
+ export declare function useAreaChart(): {
44
+ activeIndex: number;
45
+ activePoint: AreaChartDatum | null;
46
+ xDataKey: string;
47
+ };
48
+ export interface AreaChartProps extends ViewProps {
49
+ className?: string;
50
+ /** The rows. Each one is a point along the x-axis. */
51
+ data: AreaChartDatum[];
52
+ /** Key holding the x label. Used by the axis and the crosshair readout. */
53
+ xDataKey?: string;
54
+ /** `loading` draws a flat skeleton and grows into the real bands on `ready`. */
55
+ status?: AreaChartStatus;
56
+ /** Width ÷ height. `2` is the wide card shape. */
57
+ aspectRatio?: number;
58
+ /** Milliseconds for the reveal on mount. */
59
+ animationDuration?: number;
60
+ /** Milliseconds for the y-axis to settle after the data changes. */
61
+ domainDuration?: number;
62
+ /** Fix the y-axis instead of deriving it from the data. */
63
+ yDomain?: [number, number];
64
+ /**
65
+ * Sit each band on the running total of the ones below it, so the top edge
66
+ * is the whole and each thickness is a share. The order the `Area` children
67
+ * are declared in is the stacking order, bottom first.
68
+ *
69
+ * Unstacked, the bands overlay and their fills are translucent — the right
70
+ * reading when the series are alternatives rather than parts of a total.
71
+ */
72
+ stacked?: boolean;
73
+ /** `monotone` never overshoots between points; `linear` joins them straight. */
74
+ curve?: ChartCurve;
75
+ /**
76
+ * The point under the crosshair as it moves, and `-1`/`null` when it lifts.
77
+ * Fires when the index changes, not per frame.
78
+ */
79
+ onActiveIndexChange?: (index: number, datum: AreaChartDatum | null) => void;
80
+ /** Drop the axis padding so the bands reach the edges, for a sparkline. */
81
+ compact?: boolean;
82
+ children?: ReactNode;
83
+ }
84
+ /** Imperative handle: re-run the reveal on demand, for a "replay" control. */
85
+ export interface AreaChartHandle {
86
+ replay: () => void;
87
+ }
88
+ export interface AreaChartGridProps {
89
+ rows?: number;
90
+ color?: string;
91
+ dashArray?: string;
92
+ opacity?: number;
93
+ }
94
+ /** Horizontal rules, so a band can be read against a number. */
95
+ declare function AreaChartGrid({ rows, color, dashArray, opacity }: AreaChartGridProps): import("react").JSX.Element;
96
+ declare namespace AreaChartGrid {
97
+ var displayName: string;
98
+ var layer: Layer;
99
+ }
100
+ export interface AreaChartAreaProps {
101
+ /** Column in the data holding this series' values. */
102
+ dataKey: string;
103
+ /** Explicit colour. Defaults to the `--color-chart-*` token for `colorIndex`. */
104
+ color?: string;
105
+ /** Which of the five chart tokens to take. */
106
+ colorIndex?: SeriesColorIndex;
107
+ /** Opacity of the fill at the top of the band. */
108
+ fillOpacity?: number;
109
+ /** Opacity at the bottom. `0` fades the band out; match `fillOpacity` for a flat fill. */
110
+ gradientToOpacity?: number;
111
+ /** Draw the line along the top edge of the band. */
112
+ showLine?: boolean;
113
+ /** Thickness of that line. */
114
+ strokeWidth?: number;
115
+ }
116
+ /**
117
+ * One filled band.
118
+ *
119
+ * The fill is a gradient by default rather than a flat wash, because a flat
120
+ * fill of any weight competes with the line on top of it — fading it downward
121
+ * keeps the top edge, which is the part carrying the numbers, the darkest
122
+ * thing in the band.
123
+ */
124
+ declare function AreaChartArea({ dataKey, color, colorIndex, fillOpacity, gradientToOpacity, showLine, strokeWidth, }: AreaChartAreaProps): import("react").JSX.Element;
125
+ declare namespace AreaChartArea {
126
+ var displayName: string;
127
+ var layer: Layer;
128
+ }
129
+ export interface AreaChartXAxisProps {
130
+ ticks?: number;
131
+ format?: (datum: AreaChartDatum, index: number) => string;
132
+ className?: string;
133
+ }
134
+ /** The x labels. Real text, so they follow the theme's font and text scaling. */
135
+ declare function AreaChartXAxis({ ticks, format, className }: AreaChartXAxisProps): import("react").JSX.Element;
136
+ declare namespace AreaChartXAxis {
137
+ var displayName: string;
138
+ var layer: Layer;
139
+ }
140
+ export interface AreaChartYAxisProps {
141
+ ticks?: number;
142
+ format?: (value: number) => string;
143
+ className?: string;
144
+ }
145
+ /** Value labels down the side, aligned to the grid lines. */
146
+ declare function AreaChartYAxis({ ticks, format, className }: AreaChartYAxisProps): import("react").JSX.Element;
147
+ declare namespace AreaChartYAxis {
148
+ var displayName: string;
149
+ var layer: Layer;
150
+ var axis: "y";
151
+ }
152
+ export interface AreaChartTooltipProps {
153
+ color?: string;
154
+ /** Format one series' value. Defaults to a compact number. */
155
+ formatValue?: (value: number, key: string) => string;
156
+ /** Format the readout's heading from the row. Defaults to the value at xDataKey. */
157
+ formatX?: (datum: AreaChartDatum) => string;
158
+ className?: string;
159
+ }
160
+ /**
161
+ * The crosshair, the gesture that drives it, and the readout that rides it.
162
+ *
163
+ * The hit area is the whole plot. A crosshair you have to land on a band to
164
+ * summon is a crosshair nobody finds.
165
+ */
166
+ declare function AreaChartTooltip({ color, formatValue, formatX, className }: AreaChartTooltipProps): import("react").JSX.Element | null;
167
+ declare namespace AreaChartTooltip {
168
+ var displayName: string;
169
+ var layer: Layer;
170
+ }
171
+ export interface AreaChartLegendProps extends ViewProps {
172
+ className?: string;
173
+ /** Prettier names for the series keys. */
174
+ labels?: Record<string, string>;
175
+ }
176
+ /**
177
+ * A swatch and a name per series.
178
+ *
179
+ * Reversed for a stack, so the key reads in the order the bands appear on the
180
+ * chart: the last one declared is the top band, and a legend listing it last
181
+ * points at the bottom one.
182
+ */
183
+ declare function AreaChartLegend({ className, labels, ...props }: AreaChartLegendProps): import("react").JSX.Element | null;
184
+ declare namespace AreaChartLegend {
185
+ var displayName: string;
186
+ var layer: Layer;
187
+ }
188
+ export declare const AreaChart: import("react").ForwardRefExoticComponent<AreaChartProps & import("react").RefAttributes<AreaChartHandle>> & {
189
+ Grid: typeof AreaChartGrid;
190
+ Area: typeof AreaChartArea;
191
+ XAxis: typeof AreaChartXAxis;
192
+ YAxis: typeof AreaChartYAxis;
193
+ Tooltip: typeof AreaChartTooltip;
194
+ Legend: typeof AreaChartLegend;
195
+ };
196
+ export {};
197
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/area-chart/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAYL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAA4C,KAAK,SAAS,EAAE,MA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