@brightlocal/ui-components 3.1.0 → 3.3.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.
- package/AI_USAGE.md +10 -0
- package/README.md +8 -1
- package/component-meta.json +1591 -123
- package/deprecations.json +45 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +73 -102
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +36 -5
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +83 -128
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +4 -4
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +116 -177
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.js +13 -16
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +30 -45
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +32 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +90 -71
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +130 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +24 -6
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +74 -140
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +136 -176
- package/dist/blocks/progress-state.cjs +1 -1
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/progress-state.js +223 -347
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +28 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +763 -1086
- package/dist/brand-illustration-motif.cjs +1 -1
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/brand-illustration-motif.js +40 -61
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +62 -102
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.js +23 -31
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +4 -2
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +149 -189
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts +87 -3
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +116 -173
- package/dist/callout.cjs +1 -1
- package/dist/callout.js +73 -96
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +92 -6
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +240 -234
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +3 -3
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +174 -268
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.js +27 -48
- package/dist/chart-empty.cjs +1 -1
- package/dist/chart-empty.js +18 -27
- package/dist/chart.cjs +7 -7
- package/dist/chart.d.ts +253 -25
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +465 -511
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +37 -69
- package/dist/chip.cjs +1 -1
- package/dist/chip.js +116 -173
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +35 -41
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +14 -4
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +440 -639
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +273 -420
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts +5 -5
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +121 -191
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +442 -144
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +708 -835
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +15 -4
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +156 -231
- package/dist/delta.cjs +1 -0
- package/dist/delta.d.ts +79 -0
- package/dist/delta.d.ts.map +1 -0
- package/dist/delta.js +62 -0
- package/dist/description.cjs +1 -1
- package/dist/description.js +11 -20
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +76 -116
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +11 -11
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +76 -134
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +6 -6
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +179 -300
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +9 -9
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +166 -286
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.js +203 -342
- package/dist/grid.cjs +1 -1
- package/dist/grid.d.ts +24 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +16 -29
- package/dist/header.cjs +1 -1
- package/dist/header.js +21 -38
- package/dist/height-transition.cjs +1 -1
- package/dist/height-transition.js +38 -55
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +10 -9
- package/dist/hooks/use-debounce.cjs +1 -1
- package/dist/hooks/use-debounce.js +12 -11
- package/dist/hooks/use-delayed-pending.cjs +1 -1
- package/dist/hooks/use-delayed-pending.js +8 -9
- package/dist/hooks/use-filter-search-params.cjs +1 -0
- package/dist/hooks/use-filter-search-params.d.ts +93 -0
- package/dist/hooks/use-filter-search-params.d.ts.map +1 -0
- package/dist/hooks/use-filter-search-params.js +122 -0
- package/dist/hooks/use-mobile.cjs +1 -1
- package/dist/hooks/use-mobile.js +6 -6
- package/dist/hooks/use-overlay-pointer-lock.cjs +1 -1
- package/dist/hooks/use-overlay-pointer-lock.js +8 -9
- package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
- package/dist/hooks/use-prefers-reduced-motion.js +5 -8
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +1 -1
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +30 -62
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +636 -582
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +27 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +32 -3
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +182 -231
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +188 -122
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +3 -3
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +102 -146
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +26 -8
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +139 -171
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +51 -73
- package/dist/label.cjs +1 -1
- package/dist/label.js +20 -38
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +5 -2
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +16 -17
- package/dist/lib/compose-event-handlers.cjs +1 -0
- package/dist/lib/compose-event-handlers.d.ts +9 -0
- package/dist/lib/compose-event-handlers.d.ts.map +1 -0
- package/dist/lib/compose-event-handlers.js +8 -0
- package/dist/lib/download-file.cjs +1 -0
- package/dist/lib/download-file.d.ts +14 -0
- package/dist/lib/download-file.d.ts.map +1 -0
- package/dist/lib/download-file.js +40 -0
- package/dist/lib/empty-canvas.cjs +1 -1
- package/dist/lib/empty-canvas.js +28 -56
- package/dist/lib/empty-chip.cjs +1 -1
- package/dist/lib/empty-chip.d.ts +14 -3
- package/dist/lib/empty-chip.d.ts.map +1 -1
- package/dist/lib/empty-chip.js +15 -11
- package/dist/lib/field-aria.cjs +1 -0
- package/dist/lib/field-aria.d.ts +34 -0
- package/dist/lib/field-aria.d.ts.map +1 -0
- package/dist/lib/field-aria.js +52 -0
- package/dist/lib/image-file-info.cjs +1 -0
- package/dist/lib/image-file-info.d.ts +25 -0
- package/dist/lib/image-file-info.d.ts.map +1 -0
- package/dist/lib/image-file-info.js +67 -0
- package/dist/lib/media-viewer-content.cjs +1 -0
- package/dist/lib/media-viewer-content.d.ts +102 -0
- package/dist/lib/media-viewer-content.d.ts.map +1 -0
- package/dist/lib/media-viewer-content.js +650 -0
- package/dist/lib/media-viewer-internal.cjs +1 -0
- package/dist/lib/media-viewer-internal.d.ts +98 -0
- package/dist/lib/media-viewer-internal.d.ts.map +1 -0
- package/dist/lib/media-viewer-internal.js +61 -0
- package/dist/lib/media-viewer-motion.cjs +1 -0
- package/dist/lib/media-viewer-motion.d.ts +40 -0
- package/dist/lib/media-viewer-motion.d.ts.map +1 -0
- package/dist/lib/media-viewer-motion.js +37 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.d.ts +8 -0
- package/dist/lib/motion.d.ts.map +1 -1
- package/dist/lib/motion.js +11 -10
- package/dist/lib/optical-center.cjs +1 -1
- package/dist/lib/optical-center.d.ts +1 -1
- package/dist/lib/optical-center.d.ts.map +1 -1
- package/dist/lib/optical-center.js +12 -5
- package/dist/lib/spring-settle.cjs +1 -1
- package/dist/lib/spring-settle.js +1 -1
- package/dist/lib/table-internal.cjs +1 -0
- package/dist/lib/table-internal.d.ts +62 -0
- package/dist/lib/table-internal.d.ts.map +1 -0
- package/dist/lib/table-internal.js +18 -0
- package/dist/lib/use-controllable.cjs +1 -0
- package/dist/lib/use-controllable.d.ts +12 -0
- package/dist/lib/use-controllable.d.ts.map +1 -0
- package/dist/lib/use-controllable.js +15 -0
- package/dist/lib/use-dev-warning.cjs +1 -1
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +29 -35
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +78 -124
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +8 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +94 -156
- package/dist/loading.cjs +1 -1
- package/dist/loading.js +124 -151
- package/dist/logo-mark.cjs +1 -0
- package/dist/logo-mark.d.ts +79 -0
- package/dist/logo-mark.d.ts.map +1 -0
- package/dist/logo-mark.js +219 -0
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +51 -87
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +390 -586
- package/dist/media-empty.cjs +1 -1
- package/dist/media-empty.js +27 -42
- package/dist/media-viewer.cjs +1 -0
- package/dist/media-viewer.d.ts +224 -0
- package/dist/media-viewer.d.ts.map +1 -0
- package/dist/media-viewer.js +295 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +14 -14
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +130 -267
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +186 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +374 -0
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +108 -172
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +36 -12
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +208 -281
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +34 -45
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +139 -17
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +116 -148
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +90 -146
- package/dist/rating.cjs +1 -1
- package/dist/rating.d.ts +80 -13
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +70 -65
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +112 -0
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +39 -23
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +42 -44
- package/dist/result-count.cjs +1 -0
- package/dist/result-count.d.ts +110 -0
- package/dist/result-count.d.ts.map +1 -0
- package/dist/result-count.js +49 -0
- package/dist/route-progress.cjs +1 -1
- package/dist/route-progress.js +58 -102
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +9 -1
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +44 -79
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +20 -10
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +132 -236
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +90 -78
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +86 -7
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +275 -235
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +113 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +224 -0
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +24 -38
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +51 -81
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +113 -137
- package/dist/spinner.cjs +1 -1
- package/dist/spinner.js +22 -31
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +53 -102
- package/dist/status.cjs +1 -0
- package/dist/status.d.ts +51 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +60 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +184 -316
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +17 -32
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +127 -13
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +170 -192
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +123 -146
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.js +307 -363
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +23 -36
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.js +43 -62
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +34 -46
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +175 -78
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.js +25 -61
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +1 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +27 -57
- package/dist/typography.cjs +1 -1
- package/dist/typography.d.ts +1 -1
- package/dist/typography.js +132 -340
- package/package.json +45 -46
- package/src/blocks/empty-state.tsx +42 -21
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +111 -32
- package/src/components/accordion.tsx +1 -1
- package/src/components/alert-dialog.tsx +52 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +152 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button.tsx +8 -6
- package/src/components/calendar.tsx +155 -9
- package/src/components/card.tsx +266 -26
- package/src/components/carousel.tsx +4 -1
- package/src/components/chart.tsx +664 -42
- package/src/components/checkbox.tsx +2 -2
- package/src/components/collapsible.tsx +4 -1
- package/src/components/combobox.tsx +42 -9
- package/src/components/command.tsx +10 -11
- package/src/components/context-menu.tsx +4 -4
- package/src/components/data-table.tsx +1363 -398
- package/src/components/date-picker.tsx +31 -4
- package/src/components/delta.tsx +217 -0
- package/src/components/drawer.tsx +5 -5
- package/src/components/dropdown-menu.tsx +4 -4
- package/src/components/field.tsx +36 -15
- package/src/components/global-layout.tsx +1 -1
- package/src/components/grid.tsx +32 -1
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +52 -8
- package/src/components/input-group.tsx +247 -12
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +29 -11
- package/src/components/input.tsx +11 -2
- package/src/components/list.tsx +15 -3
- package/src/components/logo-mark.tsx +345 -0
- package/src/components/map.tsx +18 -20
- package/src/components/media-viewer.tsx +908 -0
- package/src/components/multi-select-filter.tsx +1046 -0
- package/src/components/navigation-menu.tsx +2 -2
- package/src/components/pagination.tsx +86 -26
- package/src/components/progress.tsx +281 -54
- package/src/components/rating.tsx +200 -74
- package/src/components/relative-date.tsx +238 -0
- package/src/components/resizable.tsx +86 -33
- package/src/components/result-count.tsx +253 -0
- package/src/components/scroll-area.tsx +31 -5
- package/src/components/select.tsx +37 -7
- package/src/components/sheet.tsx +252 -6
- package/src/components/single-select-filter.tsx +538 -0
- package/src/components/slider.tsx +2 -2
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/status.tsx +162 -0
- package/src/components/switch.tsx +1 -1
- package/src/components/table.tsx +305 -73
- package/src/components/tabs.tsx +94 -46
- package/src/components/textarea.tsx +21 -3
- package/src/components/toggle.tsx +2 -2
- package/src/components/tooltip.tsx +431 -68
- package/src/components/typography-text.tsx +1 -2
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/hooks/use-filter-search-params.ts +302 -0
- package/src/index.ts +11 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/compose-event-handlers.ts +14 -0
- package/src/lib/download-file.ts +61 -0
- package/src/lib/empty-chip.tsx +52 -0
- package/src/lib/field-aria.tsx +97 -0
- package/src/lib/image-file-info.ts +102 -0
- package/src/lib/media-viewer-content.tsx +1587 -0
- package/src/lib/media-viewer-internal.tsx +191 -0
- package/src/lib/media-viewer-motion.ts +120 -0
- package/src/lib/motion.ts +9 -0
- package/src/lib/table-internal.ts +74 -0
- package/src/lib/use-controllable.ts +43 -0
- package/src/lib/utils.ts +1 -0
- package/src/lib/empty-chip.ts +0 -24
package/dist/centred-layout.js
CHANGED
|
@@ -1,53 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"data-hook": a,
|
|
15
|
-
"data-slot": "centred-layout",
|
|
16
|
-
"data-tracking-el": r,
|
|
17
|
-
"data-tracking-label": d,
|
|
18
|
-
...s,
|
|
19
|
-
children: t
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
);
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { cn as o } from "@brightlocal/ui-components/lib/utils";
|
|
3
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
4
|
+
var f = n.forwardRef(({ className: e, children: t, dataHook: a, trackingEl: r, trackingLabel: d, ...s }, c) => /* @__PURE__ */ l("div", {
|
|
5
|
+
ref: c,
|
|
6
|
+
className: o("bg-background p-section-sm flex min-h-screen w-full flex-col items-center justify-center gap-4", e),
|
|
7
|
+
"data-hook": a,
|
|
8
|
+
"data-slot": "centred-layout",
|
|
9
|
+
"data-tracking-el": r,
|
|
10
|
+
"data-tracking-label": d,
|
|
11
|
+
...s,
|
|
12
|
+
children: t
|
|
13
|
+
}));
|
|
23
14
|
f.displayName = "CentredLayout";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
),
|
|
32
|
-
"data-slot": "centred-layout-header",
|
|
33
|
-
...a,
|
|
34
|
-
children: t
|
|
35
|
-
}
|
|
36
|
-
));
|
|
15
|
+
var i = n.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ l("div", {
|
|
16
|
+
ref: r,
|
|
17
|
+
className: o("flex w-full items-center justify-center lg:justify-start", e),
|
|
18
|
+
"data-slot": "centred-layout-header",
|
|
19
|
+
...a,
|
|
20
|
+
children: t
|
|
21
|
+
}));
|
|
37
22
|
i.displayName = "CentredLayoutHeader";
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
),
|
|
46
|
-
"data-slot": "centred-layout-content",
|
|
47
|
-
...a,
|
|
48
|
-
children: t
|
|
49
|
-
}
|
|
50
|
-
));
|
|
23
|
+
var u = n.forwardRef(({ className: e, children: t, ...a }, r) => /* @__PURE__ */ l("div", {
|
|
24
|
+
ref: r,
|
|
25
|
+
className: o("flex w-full flex-1 flex-col items-center justify-center", e),
|
|
26
|
+
"data-slot": "centred-layout-content",
|
|
27
|
+
...a,
|
|
28
|
+
children: t
|
|
29
|
+
}));
|
|
51
30
|
u.displayName = "CentredLayoutContent";
|
|
52
31
|
export {
|
|
53
32
|
f as CentredLayout,
|
package/dist/chart-empty.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const m=require("./_virtual/_rolldown/runtime.cjs"),n=require("./lib/empty-canvas.cjs");let e=require("react");e=m.__toESM(e,1);let h=require("@brightlocal/icons"),p=require("@brightlocal/ui-components/lib/utils"),r=require("react/jsx-runtime");var t=e.forwardRef(({className:a,dataHook:i,icon:l,message:s,trackingEl:o,trackingLabel:u,..._},c)=>(0,r.jsx)(n.EmptyCanvas,{ref:c,className:(0,p.cn)("w-full rounded-lg",a),dataHook:i,icon:l??(0,r.jsx)(h.ChartColumn,{strokeWidth:2}),message:s??"No data yet",slot:"chart-empty",trackingEl:o,trackingLabel:u,..._}));t.displayName="ChartEmpty";exports.ChartEmpty=t;
|
package/dist/chart-empty.js
CHANGED
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
3
|
-
import { ChartColumn as
|
|
4
|
-
import { cn as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
slot: "chart-empty",
|
|
19
|
-
trackingEl: e,
|
|
20
|
-
trackingLabel: p,
|
|
21
|
-
...s
|
|
22
|
-
}
|
|
23
|
-
)
|
|
24
|
-
)
|
|
25
|
-
);
|
|
26
|
-
n.displayName = "ChartEmpty";
|
|
1
|
+
import { EmptyCanvas as i } from "./lib/empty-canvas.js";
|
|
2
|
+
import * as l from "react";
|
|
3
|
+
import { ChartColumn as d } from "@brightlocal/icons";
|
|
4
|
+
import { cn as y } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
var c = l.forwardRef(({ className: t, dataHook: m, icon: o, message: a, trackingEl: e, trackingLabel: p, ...s }, f) => /* @__PURE__ */ r(i, {
|
|
7
|
+
ref: f,
|
|
8
|
+
className: y("w-full rounded-lg", t),
|
|
9
|
+
dataHook: m,
|
|
10
|
+
icon: o ?? /* @__PURE__ */ r(d, { strokeWidth: 2 }),
|
|
11
|
+
message: a ?? "No data yet",
|
|
12
|
+
slot: "chart-empty",
|
|
13
|
+
trackingEl: e,
|
|
14
|
+
trackingLabel: p,
|
|
15
|
+
...s
|
|
16
|
+
}));
|
|
17
|
+
c.displayName = "ChartEmpty";
|
|
27
18
|
export {
|
|
28
|
-
|
|
19
|
+
c as ChartEmpty
|
|
29
20
|
};
|
package/dist/chart.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use
|
|
2
|
-
[data-chart=${
|
|
3
|
-
--color-${
|
|
1
|
+
"use client";const $=require("./_virtual/_rolldown/runtime.cjs"),Z=require("./chart-empty.cjs");let x=require("react");x=$.__toESM(x,1);let y=require("@brightlocal/ui-components/lib/utils"),o=require("react/jsx-runtime"),S=require("@radix-ui/react-slot"),J=require("class-variance-authority"),c=require("recharts");c=$.__toESM(c,1);var k=x.createContext(null);function z(){const t=x.useContext(k);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}function A(){return x.useContext(k)}var E=x.forwardRef(({id:t,className:n,children:l,config:e,dataHook:r,width:a,height:i,minWidth:d,minHeight:s,maxHeight:f,trackingEl:m,trackingLabel:b,...C},v)=>{const j=x.useId(),g=`chart-${t||j.replace(/:/g,"")}`,h=x.useRef(null),L=x.useCallback(p=>{h.current=p,typeof v=="function"?v(p):v&&(v.current=p)},[v]),u=typeof i=="number";return(0,o.jsx)(k.Provider,{value:{config:e,containerRef:h},children:(0,o.jsxs)("div",{ref:L,className:(0,y.cn)("[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-polar-radius-axis-tick-value]:fill-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-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 [&_.recharts-pie-sector]:stroke-background text-body-xs flex justify-center [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-pie-sector]:stroke-2 [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none [&_svg_g]:outline-none [&_svg_g]:focus:outline-none",u?"aspect-auto":"aspect-video",n),"data-chart":g,"data-hook":r,"data-slot":"chart-container","data-tracking-el":m,"data-tracking-label":b,style:u?{height:i}:void 0,...C,children:[(0,o.jsx)(T,{config:e,id:g}),(0,o.jsx)(c.ResponsiveContainer,{height:i??"100%",initialDimension:{width:1,height:1},maxHeight:f,minHeight:s,minWidth:d??0,width:a??"100%",children:l})]})})});E.displayName="ChartContainer";function T({id:t,config:n}){const l=Object.entries(n).filter(([,e])=>e.theme||e.color);return l.length?(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:l.map(([e,r])=>{const a=typeof r.color=="string"?r.color.replace(/^hsl\((.*)\)$/,"$1"):null;return a?`
|
|
2
|
+
[data-chart=${t}] {
|
|
3
|
+
--color-${e}: ${a};
|
|
4
4
|
}
|
|
5
|
-
`:
|
|
6
|
-
.${i} [data-chart=${
|
|
7
|
-
--color-${
|
|
5
|
+
`:r.theme?Object.entries(r.theme).map(([i,d])=>`
|
|
6
|
+
.${i} [data-chart=${t}] {
|
|
7
|
+
--color-${e}: ${d.replace(/^hsl\((.*)\)$/,"$1")};
|
|
8
8
|
}
|
|
9
9
|
`).join(""):""}).join(`
|
|
10
|
-
`)}}):null}function O(e){return e==null||e===""?!1:typeof e=="number"?Number.isFinite(e):!0}function w({...e}){return a.jsx(P.Tooltip,{...e})}w.displayName="ChartTooltip";function A({active:e,payload:r,className:l,indicator:t="dot",hideLabel:n=!1,hideIndicator:o=!1,label:i,labelFormatter:d,labelClassName:c,formatter:h,color:f,nameKey:m,labelKey:g}){const{config:C}=R(),x=y.useMemo(()=>{if(n||!r?.length)return null;const[u]=r;if(!u)return null;const L=`${g||u.dataKey||u.name||"value"}`,v=C[L],j=!g&&typeof i=="string"?C[i]?.label||i:v?.label;return d?a.jsx("div",{className:b.cn("font-medium",c),children:d(j,r)}):j?a.jsx("div",{className:b.cn("font-medium",c),children:j}):null},[i,d,r,n,c,C,g]);if(!e||!r?.length)return null;const p=r.length===1&&t!=="dot";return a.jsxs("div",{className:b.cn("border-border/50 bg-background text-body-xs grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 shadow-xl",l),"data-slot":"chart-tooltip-content",children:[p?null:x,a.jsx("div",{className:"grid gap-1.5",children:r.map((u,L)=>{const v=`${m||u.name||u.dataKey||"value"}`,j=C[v],k=f||u.color||u.payload.fill||`var(--color-${v})`;return a.jsx("div",{className:b.cn("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2",t==="dot"&&"items-center"),"data-slot":"chart-tooltip-item",children:h&&O(u.value)&&u.name?h(u.value,u.name,u,L,r):a.jsxs(a.Fragment,{children:[j?.icon&&!o?a.jsx(j.icon,{size:10}):!o&&a.jsx("div",{className:b.cn("shrink-0 rounded-[2px]",{"h-2.5 w-2.5":t==="dot","w-1":t==="line","w-0 border-[1.5px] border-dashed bg-transparent":t==="dashed","my-0.5":p&&t==="dashed"}),style:{backgroundColor:t==="dashed"?"transparent":k,borderColor:k}}),a.jsxs("div",{className:b.cn("flex flex-1 justify-between gap-2 leading-none",p?"items-end":"items-center"),children:[a.jsxs("div",{className:"grid gap-1.5",children:[p?x:null,a.jsx("span",{className:"text-muted-foreground","data-slot":"chart-tooltip-item-name",children:j?.label||u.name})]}),O(u.value)&&a.jsx("span",{className:"text-foreground tabular-nums","data-slot":"chart-tooltip-item-value",children:typeof u.value=="number"?u.value.toLocaleString():u.value})]})]})},u.dataKey)})})]})}A.displayName="ChartTooltipContent";function T({...e}){return a.jsx(P.Legend,{...e})}T.displayName="ChartLegend";function D({className:e,hideIcon:r=!1,payload:l,verticalAlign:t="bottom",nameKey:n}){const{config:o}=R();return l?.length?a.jsx("div",{className:b.cn("flex items-center justify-center gap-4",t==="top"?"pb-4":"pt-4",e),"data-slot":"chart-legend-content",children:l.map(i=>{const d=`${n||i.dataKey||"value"}`,c=o[d];return a.jsxs("div",{className:b.cn("[&>svg]:text-muted-foreground flex items-center gap-1.5"),children:[c?.icon&&!r?a.jsx(c.icon,{size:12}):a.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:i.color}}),c?.label||i.value]},i.value)})}):null}D.displayName="ChartLegendContent";function G({colorKey:e,color:r,fill:l,stroke:t,payload:n}){return(e&&typeof n?.[e]=="string"?n[e]:void 0)??r??l??t??"currentColor"}function W({size:e=8,custom:r=!1,color:l,colorKey:t,cx:n,cy:o,stroke:i,fill:d,payload:c}){if(n==null||o==null)return null;const h=G({colorKey:t,color:l,fill:d,stroke:i,payload:c});return a.jsx("circle",{className:r?"fill-background":void 0,cx:n,cy:o,"data-slot":"chart-dot",fill:r?void 0:h,r:e/2,stroke:r?h:"none",strokeWidth:r?2:void 0})}W.displayName="ChartDot";function B({size:e=6,color:r,colorKey:l,cx:t,cy:n,stroke:o,fill:i,payload:d}){if(t==null||n==null)return null;const c=G({colorKey:l,color:r,fill:i,stroke:o,payload:d});return a.jsx("circle",{className:"stroke-background",cx:t,cy:n,"data-slot":"chart-dot-on-stroke",fill:c,r:e/2,strokeWidth:2})}B.displayName="ChartDotOnStroke";function M({type:e="default",filled:r=!1,fillColor:l="var(--chart-teal)",fillOpacity:t=.2,boundaryOnly:n=!1,radialLines:o,className:i,...d}){const c=e==="circle"?"circle":"polygon",f=n?`[&_.${c==="circle"?"recharts-polar-grid-concentric-circle":"recharts-polar-grid-concentric-polygon"}:not(:last-of-type)]:stroke-transparent`:void 0;return r?a.jsx(P.PolarGrid,{className:b.cn(f,i),fill:l,fillOpacity:t,gridType:c,radialLines:o??!1,stroke:"none",...d}):a.jsx(P.PolarGrid,{className:b.cn(f,i),gridType:c,radialLines:o,...d})}M.displayName="ChartRadarGrid";function z({type:e="default",data:r,primaryKey:l,secondaryKey:t,x:n,y:o,textAnchor:i,payload:d,index:c}){const h=r!=null&&c!=null?r[c]:void 0,f=h&&l!=null?h[l]:void 0,m=h&&t!=null?h[t]:void 0,g=e==="default"&&f!=null?m!=null?`${String(f)}/${String(m)}`:String(f):null;return a.jsxs("text",{className:"text-body-xs","data-slot":"chart-radar-label-wrapper",textAnchor:i,x:n,y:o,children:[g!=null&&a.jsx("tspan",{className:"fill-card-foreground",dy:"-0.5em",x:n,children:g}),a.jsx("tspan",{className:"fill-muted-foreground",dy:g!=null?"1.2em":void 0,x:n,children:d?.value})]})}z.displayName="ChartRadarLabelWrapper";function q({nameKey:e,config:r,radiusRatio:l=.5,cx:t,cy:n,midAngle:o=0,innerRadius:i=0,outerRadius:d=0,payload:c,name:h}){if(t==null||n==null)return null;const f=Math.PI/180,m=i+(d-i)*l,g=t+m*Math.cos(-o*f),C=n+m*Math.sin(-o*f),x=e!=null&&c!=null?c[e]:void 0,p=x!=null?String(x):h,u=p!=null?r?.[p]?.label??p:p;return a.jsx("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-list",dominantBaseline:"middle",textAnchor:"middle",x:g,y:C,children:u})}q.displayName="ChartPieLabelList";function I({valueKey:e,x:r,y:l,textAnchor:t,payload:n,value:o}){if(r==null||l==null)return null;const i=e!=null&&n!=null?n[e]:o;return a.jsx("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-wrapper",dominantBaseline:"middle",textAnchor:t,x:r,y:l,children:i})}I.displayName="ChartPieLabelWrapper";const Y={"2xl":"text-metric","3xl":"font-sans text-3xl font-semibold","4xl":"font-sans text-4xl font-semibold"};function V({primary:e,secondary:r,size:l="3xl",viewBox:t}){if(t==null||typeof t!="object"||!("cx"in t)||!("cy"in t))return null;const{cx:n,cy:o}=t;return a.jsxs("text",{"data-slot":"chart-center-label",dominantBaseline:"middle",textAnchor:"middle",x:n,y:o,children:[a.jsx("tspan",{className:b.cn("fill-foreground",Y[l]),x:n,y:o,children:e}),r!=null&&a.jsx("tspan",{className:"fill-muted-foreground text-body-xs",x:n,y:o+24,children:r})]})}V.displayName="ChartCenterLabel";Object.defineProperty(exports,"Area",{enumerable:!0,get:()=>s.Area});Object.defineProperty(exports,"AreaChart",{enumerable:!0,get:()=>s.AreaChart});Object.defineProperty(exports,"Bar",{enumerable:!0,get:()=>s.Bar});Object.defineProperty(exports,"BarChart",{enumerable:!0,get:()=>s.BarChart});Object.defineProperty(exports,"CartesianGrid",{enumerable:!0,get:()=>s.CartesianGrid});Object.defineProperty(exports,"Cell",{enumerable:!0,get:()=>s.Cell});Object.defineProperty(exports,"ChartLabel",{enumerable:!0,get:()=>s.Label});Object.defineProperty(exports,"ChartsLegend",{enumerable:!0,get:()=>s.Legend});Object.defineProperty(exports,"ChartsTooltip",{enumerable:!0,get:()=>s.Tooltip});Object.defineProperty(exports,"Customized",{enumerable:!0,get:()=>s.Customized});Object.defineProperty(exports,"LabelList",{enumerable:!0,get:()=>s.LabelList});Object.defineProperty(exports,"Line",{enumerable:!0,get:()=>s.Line});Object.defineProperty(exports,"LineChart",{enumerable:!0,get:()=>s.LineChart});Object.defineProperty(exports,"Pie",{enumerable:!0,get:()=>s.Pie});Object.defineProperty(exports,"PieChart",{enumerable:!0,get:()=>s.PieChart});Object.defineProperty(exports,"PolarAngleAxis",{enumerable:!0,get:()=>s.PolarAngleAxis});Object.defineProperty(exports,"PolarGrid",{enumerable:!0,get:()=>s.PolarGrid});Object.defineProperty(exports,"PolarRadiusAxis",{enumerable:!0,get:()=>s.PolarRadiusAxis});Object.defineProperty(exports,"Radar",{enumerable:!0,get:()=>s.Radar});Object.defineProperty(exports,"RadarChart",{enumerable:!0,get:()=>s.RadarChart});Object.defineProperty(exports,"RadialBar",{enumerable:!0,get:()=>s.RadialBar});Object.defineProperty(exports,"RadialBarChart",{enumerable:!0,get:()=>s.RadialBarChart});Object.defineProperty(exports,"Rectangle",{enumerable:!0,get:()=>s.Rectangle});Object.defineProperty(exports,"ReferenceLine",{enumerable:!0,get:()=>s.ReferenceLine});Object.defineProperty(exports,"ResponsiveContainer",{enumerable:!0,get:()=>s.ResponsiveContainer});Object.defineProperty(exports,"Sector",{enumerable:!0,get:()=>s.Sector});Object.defineProperty(exports,"XAxis",{enumerable:!0,get:()=>s.XAxis});Object.defineProperty(exports,"YAxis",{enumerable:!0,get:()=>s.YAxis});exports.ChartCenterLabel=V;exports.ChartContainer=$;exports.ChartDot=W;exports.ChartDotOnStroke=B;exports.ChartLegend=T;exports.ChartLegendContent=D;exports.ChartPieLabelList=q;exports.ChartPieLabelWrapper=I;exports.ChartRadarGrid=M;exports.ChartRadarLabelWrapper=z;exports.ChartStyle=S;exports.ChartTooltip=w;exports.ChartTooltipContent=A;
|
|
10
|
+
`)}}):null}function R(t){return t==null||t===""?!1:typeof t=="number"?Number.isFinite(t):!0}var Q=50;function U(t){const[n,l]=x.useState(null);return x.useEffect(()=>{if(!t){l(null);return}const e=document.createElement("div");return e.setAttribute("data-slot","chart-tooltip-portal"),document.body.appendChild(e),l(e),()=>{document.body.removeChild(e)}},[t]),n}function K(t,n){x.useEffect(()=>{const l=t?.current;if(!l)return;const e=n??l;let r=!1;function a(){const s=e.querySelector(".recharts-tooltip-wrapper");s&&(s.style.visibility="hidden")}function i(s){r=!0;const f=s.target;!l.contains(f)&&!e.contains(f)&&(a(),r=!1)}function d(){r&&(a(),r=!1)}return document.addEventListener("touchstart",i,{passive:!0}),window.addEventListener("scroll",d,{passive:!0,capture:!0}),()=>{document.removeEventListener("touchstart",i),window.removeEventListener("scroll",d,{capture:!0})}},[t,n])}function I({portal:t,wrapperStyle:n,allowEscapeViewBox:l,...e}){const r=A(),a=U(t!==null);return K(r?.containerRef,a),(0,o.jsx)(c.Tooltip,{allowEscapeViewBox:l??{x:!0,y:!0},portal:t!==void 0?t:a,wrapperStyle:{zIndex:Q,...n},...e})}I.displayName="ChartTooltip";function q({active:t,payload:n,className:l,indicator:e="dot",hideLabel:r=!1,hideIndicator:a=!1,label:i,labelFormatter:d,labelClassName:s,formatter:f,color:m,nameKey:b,labelKey:C}){const{config:v}=z(),j=x.useMemo(()=>{if(r||!n?.length)return null;const[h]=n;if(!h)return null;const L=`${C||h.dataKey||h.name||"value"}`,u=v[L],p=!C&&typeof i=="string"?v[i]?.label||i:u?.label;return d?(0,o.jsx)("div",{className:(0,y.cn)("font-medium",s),children:d(p,n)}):p?(0,o.jsx)("div",{className:(0,y.cn)("font-medium",s),children:p}):null},[i,d,n,r,s,v,C]);if(!t||!n?.length)return null;const g=n.length===1&&e!=="dot";return(0,o.jsxs)("div",{className:(0,y.cn)("border-border/50 bg-background text-body-xs grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 shadow-xl",l),"data-slot":"chart-tooltip-content",children:[g?null:j,(0,o.jsx)("div",{className:"grid gap-1.5",children:n.map((h,L)=>{const u=`${b||h.name||h.dataKey||"value"}`,p=v[u],P=m||h.color||h.payload.fill||`var(--color-${u})`;return(0,o.jsx)("div",{className:(0,y.cn)("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2",e==="dot"&&"items-center"),"data-slot":"chart-tooltip-item",children:f&&R(h.value)&&h.name?f(h.value,h.name,h,L,n):(0,o.jsxs)(o.Fragment,{children:[p?.icon&&!a?(0,o.jsx)(p.icon,{size:10}):!a&&(0,o.jsx)("div",{className:(0,y.cn)("shrink-0 rounded-[2px]",{"h-2.5 w-2.5":e==="dot","w-1":e==="line","w-0 border-[1.5px] border-dashed bg-transparent":e==="dashed","my-0.5":g&&e==="dashed"}),style:{backgroundColor:e==="dashed"?"transparent":P,borderColor:P}}),(0,o.jsxs)("div",{className:(0,y.cn)("flex flex-1 justify-between gap-2 leading-none",g?"items-end":"items-center"),children:[(0,o.jsxs)("div",{className:"grid gap-1.5",children:[g?j:null,(0,o.jsx)("span",{className:"text-muted-foreground","data-slot":"chart-tooltip-item-name",children:p?.label||h.name})]}),R(h.value)&&(0,o.jsx)("span",{className:"text-foreground tabular-nums","data-slot":"chart-tooltip-item-value",children:typeof h.value=="number"?h.value.toLocaleString():h.value})]})]})},h.dataKey)})})]})}q.displayName="ChartTooltipContent";function D({...t}){return(0,o.jsx)(c.Legend,{...t})}D.displayName="ChartLegend";var N=x.forwardRef(({asChild:t=!1,children:n,className:l,color:e,dataHook:r,hidden:a=!1,hideIcon:i=!1,muted:d=!1,seriesKey:s,trackingEl:f,trackingLabel:m,value:b,...C},v)=>{const j=A(),g=s?j?.config[s]:void 0,h=e??g?.color??(s?`var(--color-${s})`:void 0),L=!!s&&!e&&(!j||!!j.standalone&&!g?.color);x.useEffect(()=>{process.env.NODE_ENV!=="production"&&L&&console.warn(`ChartLegendItem: seriesKey="${s}" has no colour to resolve — render it inside a ChartContainer, give the ChartLegendList config a \`color\` for this key (a \`theme\` only resolves inside a container), or set \`color\`.`)},[s,L]);const u=t?S.Slot:"div",p=n??g?.label??s;return(0,o.jsxs)(u,{ref:v,className:(0,y.cn)("[&>svg]:text-muted-foreground focus-visible:shadow-default flex items-center gap-1.5 rounded-sm outline-none group-data-[size=md]/legend:gap-2 [&>svg]:size-3 group-data-[size=md]/legend:[&>svg]:size-3.5",(d||a)&&"text-muted-foreground",a&&"line-through [&_:is(button,a)]:line-through",l),"data-hidden":a||void 0,"data-hook":r,"data-muted":d||a||void 0,"data-slot":"chart-legend-item","data-tracking-el":f,"data-tracking-label":m,...C,children:[g?.icon&&!i?(0,o.jsx)(g.icon,{size:12}):(0,o.jsx)("span",{"aria-hidden":"true",className:(0,y.cn)("duration-fast block size-2 shrink-0 rounded-[2px] transition-opacity ease-out group-data-[size=md]/legend:size-2.5",(d||a)&&"opacity-40"),"data-slot":"chart-legend-item-swatch",style:{backgroundColor:h}}),(0,o.jsx)(S.Slottable,{children:p}),b!=null&&(0,o.jsx)("span",{className:"ml-auto pl-0.5 tabular-nums","data-slot":"chart-legend-item-value",children:(0,o.jsx)("span",{className:"inline-block",children:b})})]})});N.displayName="ChartLegendItem";var ee=(0,J.cva)("group/legend flex",{variants:{size:{sm:"text-body-xs",md:"text-body-sm"},orientation:{horizontal:"flex-wrap items-center justify-center gap-x-4 gap-y-1",vertical:"flex-col items-stretch gap-3"}},defaultVariants:{orientation:"horizontal",size:"sm"}}),O=x.forwardRef(({ariaLabel:t,children:n,className:l,config:e,dataHook:r,orientation:a="horizontal",size:i="sm",trackingEl:d,trackingLabel:s,...f},m)=>{const b=x.useMemo(()=>e?{config:e,standalone:!0}:null,[e]),C=(0,o.jsx)("div",{ref:m,"aria-label":t??"Chart legend",className:(0,y.cn)(ee({orientation:a,size:i}),l),"data-hook":r,"data-orientation":a,"data-size":i,"data-slot":"chart-legend-list","data-tracking-el":d,"data-tracking-label":s,role:"group",...f,children:n});return b?(0,o.jsx)(k.Provider,{value:b,children:C}):C});O.displayName="ChartLegendList";var te=t=>t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function G({ariaLabel:t,className:n,dataHook:l="chart-legend",hideIcon:e=!1,nameKey:r,orientation:a="horizontal",payload:i,renderItem:d,showValue:s=!1,size:f="sm",sortBy:m,valueFormatter:b,valueKey:C,verticalAlign:v="bottom"}){const{config:j}=z();if(!i?.length)return null;const g=u=>{const p=u.dataKey!==void 0&&u.payload?.dataKey===u.dataKey;return String((r?u.payload?.[r]:void 0)??(p?u.dataKey:u.value??u.dataKey))},h=u=>{const p=Array.isArray(m)?m.indexOf(g(u)):-1;return p===-1?Number.POSITIVE_INFINITY:p},L=m?[...i].sort(Array.isArray(m)?(u,p)=>{const P=h(u),_=h(p);return P===_?0:P-_}:m):i;return(0,o.jsx)(O,{ariaLabel:t,className:(0,y.cn)(v==="top"&&"pb-4",v==="bottom"&&"pt-4",n),"data-slot":"chart-legend-content",dataHook:l,orientation:a,size:f,children:L.map(u=>{const p=g(u),P=j[p],_=s?b?b(u):u.payload?.[C??u.dataKey??"value"]:void 0,w=(0,o.jsx)(N,{color:u.color,dataHook:`${l}-${te(p)}`,hideIcon:e,seriesKey:p,value:_,children:P?.label||u.value},u.value);return d?(0,o.jsx)(x.Fragment,{children:d(u,w)},u.value):w})})}G.displayName="ChartLegendContent";function V({colorKey:t,color:n,fill:l,stroke:e,payload:r}){return(t&&typeof r?.[t]=="string"?r[t]:void 0)??n??l??e??"currentColor"}function W({size:t=8,custom:n=!1,color:l,colorKey:e,cx:r,cy:a,stroke:i,fill:d,payload:s}){if(r==null||a==null)return null;const f=V({colorKey:e,color:l,fill:d,stroke:i,payload:s});return(0,o.jsx)("circle",{className:n?"fill-background":void 0,cx:r,cy:a,"data-slot":"chart-dot",fill:n?void 0:f,r:t/2,stroke:n?f:"none",strokeWidth:n?2:void 0})}W.displayName="ChartDot";function M({size:t=6,color:n,colorKey:l,cx:e,cy:r,stroke:a,fill:i,payload:d}){if(e==null||r==null)return null;const s=V({colorKey:l,color:n,fill:i,stroke:a,payload:d});return(0,o.jsx)("circle",{className:"stroke-background",cx:e,cy:r,"data-slot":"chart-dot-on-stroke",fill:s,r:t/2,strokeWidth:2})}M.displayName="ChartDotOnStroke";function B({type:t="default",filled:n=!1,fillColor:l="var(--chart-teal)",fillOpacity:e=.2,boundaryOnly:r=!1,radialLines:a,className:i,...d}){const s=t==="circle"?"circle":"polygon",f=r?`[&_.${s==="circle"?"recharts-polar-grid-concentric-circle":"recharts-polar-grid-concentric-polygon"}:not(:last-of-type)]:stroke-transparent`:void 0;return n?(0,o.jsx)(c.PolarGrid,{className:(0,y.cn)(f,i),fill:l,fillOpacity:e,gridType:s,radialLines:a??!1,stroke:"none",...d}):(0,o.jsx)(c.PolarGrid,{className:(0,y.cn)(f,i),gridType:s,radialLines:a,...d})}B.displayName="ChartRadarGrid";function H({type:t="default",data:n,primaryKey:l,secondaryKey:e,x:r,y:a,textAnchor:i,payload:d,index:s}){const f=n!=null&&s!=null?n[s]:void 0,m=f&&l!=null?f[l]:void 0,b=f&&e!=null?f[e]:void 0,C=t==="default"&&m!=null?b!=null?`${String(m)}/${String(b)}`:String(m):null;return(0,o.jsxs)("text",{className:"text-body-xs","data-slot":"chart-radar-label-wrapper",textAnchor:i,x:r,y:a,children:[C!=null&&(0,o.jsx)("tspan",{className:"fill-card-foreground",dy:"-0.5em",x:r,children:C}),(0,o.jsx)("tspan",{className:"fill-muted-foreground",dy:C!=null?"1.2em":void 0,x:r,children:d?.value})]})}H.displayName="ChartRadarLabelWrapper";function X({nameKey:t,config:n,radiusRatio:l=.5,cx:e,cy:r,midAngle:a=0,innerRadius:i=0,outerRadius:d=0,payload:s,name:f}){if(e==null||r==null)return null;const m=Math.PI/180,b=i+(d-i)*l,C=e+b*Math.cos(-a*m),v=r+b*Math.sin(-a*m),j=t!=null&&s!=null?s[t]:void 0,g=j!=null?String(j):f,h=g!=null?n?.[g]?.label??g:g;return(0,o.jsx)("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-list",dominantBaseline:"middle",textAnchor:"middle",x:C,y:v,children:h})}X.displayName="ChartPieLabelList";function Y({valueKey:t,x:n,y:l,textAnchor:e,payload:r,value:a}){if(n==null||l==null)return null;const i=t!=null&&r!=null?r[t]:a;return(0,o.jsx)("text",{className:"fill-foreground text-body-xs","data-slot":"chart-pie-label-wrapper",dominantBaseline:"middle",textAnchor:e,x:n,y:l,children:i})}Y.displayName="ChartPieLabelWrapper";var re={"2xl":"text-metric","3xl":"font-sans text-3xl font-semibold","4xl":"font-sans text-4xl font-semibold"};function F({primary:t,secondary:n,size:l="3xl",viewBox:e}){if(e==null||typeof e!="object"||!("cx"in e)||!("cy"in e))return null;const{cx:r,cy:a}=e;return(0,o.jsxs)("text",{"data-slot":"chart-center-label",dominantBaseline:"middle",textAnchor:"middle",x:r,y:a,children:[(0,o.jsx)("tspan",{className:(0,y.cn)("fill-foreground",re[l]),x:r,y:a,children:t}),n!=null&&(0,o.jsx)("tspan",{className:"fill-muted-foreground text-body-xs",x:r,y:a+24,children:n})]})}F.displayName="ChartCenterLabel";Object.defineProperty(exports,"Area",{enumerable:!0,get:function(){return c.Area}});Object.defineProperty(exports,"AreaChart",{enumerable:!0,get:function(){return c.AreaChart}});Object.defineProperty(exports,"Bar",{enumerable:!0,get:function(){return c.Bar}});Object.defineProperty(exports,"BarChart",{enumerable:!0,get:function(){return c.BarChart}});Object.defineProperty(exports,"CartesianGrid",{enumerable:!0,get:function(){return c.CartesianGrid}});Object.defineProperty(exports,"Cell",{enumerable:!0,get:function(){return c.Cell}});exports.ChartCenterLabel=F;exports.ChartContainer=E;exports.ChartDot=W;exports.ChartDotOnStroke=M;exports.ChartEmpty=Z.ChartEmpty;Object.defineProperty(exports,"ChartLabel",{enumerable:!0,get:function(){return c.Label}});exports.ChartLegend=D;exports.ChartLegendContent=G;exports.ChartLegendItem=N;exports.ChartLegendList=O;exports.ChartPieLabelList=X;exports.ChartPieLabelWrapper=Y;exports.ChartRadarGrid=B;exports.ChartRadarLabelWrapper=H;exports.ChartStyle=T;exports.ChartTooltip=I;exports.ChartTooltipContent=q;Object.defineProperty(exports,"ChartsLegend",{enumerable:!0,get:function(){return c.Legend}});Object.defineProperty(exports,"ChartsTooltip",{enumerable:!0,get:function(){return c.Tooltip}});Object.defineProperty(exports,"Customized",{enumerable:!0,get:function(){return c.Customized}});Object.defineProperty(exports,"LabelList",{enumerable:!0,get:function(){return c.LabelList}});Object.defineProperty(exports,"Line",{enumerable:!0,get:function(){return c.Line}});Object.defineProperty(exports,"LineChart",{enumerable:!0,get:function(){return c.LineChart}});Object.defineProperty(exports,"Pie",{enumerable:!0,get:function(){return c.Pie}});Object.defineProperty(exports,"PieChart",{enumerable:!0,get:function(){return c.PieChart}});Object.defineProperty(exports,"PolarAngleAxis",{enumerable:!0,get:function(){return c.PolarAngleAxis}});Object.defineProperty(exports,"PolarGrid",{enumerable:!0,get:function(){return c.PolarGrid}});Object.defineProperty(exports,"PolarRadiusAxis",{enumerable:!0,get:function(){return c.PolarRadiusAxis}});Object.defineProperty(exports,"Radar",{enumerable:!0,get:function(){return c.Radar}});Object.defineProperty(exports,"RadarChart",{enumerable:!0,get:function(){return c.RadarChart}});Object.defineProperty(exports,"RadialBar",{enumerable:!0,get:function(){return c.RadialBar}});Object.defineProperty(exports,"RadialBarChart",{enumerable:!0,get:function(){return c.RadialBarChart}});Object.defineProperty(exports,"Rectangle",{enumerable:!0,get:function(){return c.Rectangle}});Object.defineProperty(exports,"ReferenceLine",{enumerable:!0,get:function(){return c.ReferenceLine}});Object.defineProperty(exports,"ResponsiveContainer",{enumerable:!0,get:function(){return c.ResponsiveContainer}});Object.defineProperty(exports,"Sector",{enumerable:!0,get:function(){return c.Sector}});Object.defineProperty(exports,"XAxis",{enumerable:!0,get:function(){return c.XAxis}});Object.defineProperty(exports,"YAxis",{enumerable:!0,get:function(){return c.YAxis}});
|
package/dist/chart.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ declare const ChartContainer: React.ForwardRefExoticComponent<Omit<ChartContaine
|
|
|
76
76
|
declare function ChartStyle({ id, config }: {
|
|
77
77
|
id: string;
|
|
78
78
|
config: ChartConfig;
|
|
79
|
-
}):
|
|
79
|
+
}): React.JSX.Element | null;
|
|
80
80
|
/**
|
|
81
81
|
* A single entry of the Recharts tooltip payload, as `ChartTooltipContent`
|
|
82
82
|
* receives it. This is the `item` argument given to `formatter` and the
|
|
@@ -100,6 +100,11 @@ interface ChartTooltipPayloadItem {
|
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Props for the ChartTooltip component.
|
|
103
|
+
*
|
|
104
|
+
* Inherits all Recharts Tooltip props. Notable defaults changed by the DS:
|
|
105
|
+
* - `portal` — renders to `document.body`; pass `null` for inline (Recharts default)
|
|
106
|
+
* - `allowEscapeViewBox` — `{ x: true, y: true }` so the tooltip is never clipped
|
|
107
|
+
* - `wrapperStyle` — includes `zIndex: 50`; consumer values are merged on top
|
|
103
108
|
*/
|
|
104
109
|
interface ChartTooltipProps extends React.ComponentProps<typeof RechartsPrimitive.Tooltip> {
|
|
105
110
|
/** Hide the tooltip label */
|
|
@@ -114,9 +119,14 @@ interface ChartTooltipProps extends React.ComponentProps<typeof RechartsPrimitiv
|
|
|
114
119
|
labelKey?: string;
|
|
115
120
|
}
|
|
116
121
|
/**
|
|
117
|
-
* ChartTooltip displays data values on hover.
|
|
122
|
+
* ChartTooltip displays data values on hover/tap. Portals to `document.body`
|
|
123
|
+
* by default so the tooltip escapes chart overflow clipping and sits above
|
|
124
|
+
* page-level widgets (z-index 50). On touch devices, dismisses on tap-outside
|
|
125
|
+
* and scroll.
|
|
126
|
+
*
|
|
127
|
+
* Pass `portal={null}` to render inline (pre-portal Recharts default).
|
|
118
128
|
*/
|
|
119
|
-
declare function ChartTooltip({ ...props }: ChartTooltipProps):
|
|
129
|
+
declare function ChartTooltip({ portal, wrapperStyle, allowEscapeViewBox, ...props }: ChartTooltipProps): React.JSX.Element;
|
|
120
130
|
declare namespace ChartTooltip {
|
|
121
131
|
var displayName: string;
|
|
122
132
|
}
|
|
@@ -152,7 +162,7 @@ declare function ChartTooltipContent({ active, payload, className, indicator, hi
|
|
|
152
162
|
payload?: ChartTooltipPayloadItem[];
|
|
153
163
|
label?: string;
|
|
154
164
|
color?: string;
|
|
155
|
-
}):
|
|
165
|
+
}): React.JSX.Element | null;
|
|
156
166
|
declare namespace ChartTooltipContent {
|
|
157
167
|
var displayName: string;
|
|
158
168
|
}
|
|
@@ -164,35 +174,253 @@ interface ChartLegendProps extends React.ComponentProps<typeof RechartsPrimitive
|
|
|
164
174
|
nameKey?: string;
|
|
165
175
|
}
|
|
166
176
|
/**
|
|
167
|
-
* ChartLegend
|
|
177
|
+
* ChartLegend positions a legend inside a Recharts chart. Pass
|
|
178
|
+
* `content={<ChartLegendContent />}` to render it with DS styling.
|
|
179
|
+
*
|
|
180
|
+
* For a legend that lives *beside* a chart (next to a donut, or shared by
|
|
181
|
+
* several charts) compose {@link ChartLegendList} and {@link ChartLegendItem}
|
|
182
|
+
* directly instead — Recharts' Legend takes its room from the plot area.
|
|
168
183
|
*/
|
|
169
|
-
declare function ChartLegend({ ...props }: ChartLegendProps):
|
|
184
|
+
declare function ChartLegend({ ...props }: ChartLegendProps): React.JSX.Element;
|
|
170
185
|
declare namespace ChartLegend {
|
|
171
186
|
var displayName: string;
|
|
172
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Layout direction of a {@link ChartLegendList}.
|
|
190
|
+
*/
|
|
191
|
+
type ChartLegendOrientation = "horizontal" | "vertical";
|
|
192
|
+
/**
|
|
193
|
+
* Scale of a {@link ChartLegendList} and its items.
|
|
194
|
+
* - `sm` — 12/16 text, 8px swatch: chart chrome, next to axis ticks and the tooltip.
|
|
195
|
+
* - `md` — 14/20 text, 10px swatch: a key read as content, beside a donut or under a report chart.
|
|
196
|
+
*/
|
|
197
|
+
type ChartLegendSize = "sm" | "md";
|
|
198
|
+
/**
|
|
199
|
+
* Props for the ChartLegendItem component.
|
|
200
|
+
*/
|
|
201
|
+
interface ChartLegendItemProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
202
|
+
/**
|
|
203
|
+
* Data hook for automated testing (required)
|
|
204
|
+
* @example "sources-legend-google"
|
|
205
|
+
*/
|
|
206
|
+
dataHook: string;
|
|
207
|
+
/**
|
|
208
|
+
* Key into the chart config. Resolves the swatch colour, the custom icon and
|
|
209
|
+
* the default label. Reads the config from the nearest `ChartContainer` or
|
|
210
|
+
* `ChartLegendList config={…}`; outside both, pass `color` and a label.
|
|
211
|
+
*/
|
|
212
|
+
seriesKey?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Swatch colour. Wins over the config colour — the way to colour an item
|
|
215
|
+
* that renders beside a chart rather than inside one.
|
|
216
|
+
* @example "var(--chart-blue)"
|
|
217
|
+
*/
|
|
218
|
+
color?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Hide the series icon from the config and draw the colour swatch instead.
|
|
221
|
+
* @default false
|
|
222
|
+
*/
|
|
223
|
+
hideIcon?: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Trailing value (a count, a percentage), rendered in tabular figures and
|
|
226
|
+
* pushed to the far edge in a vertical list.
|
|
227
|
+
*/
|
|
228
|
+
value?: React.ReactNode;
|
|
229
|
+
/**
|
|
230
|
+
* De-emphasised: the swatch dims and the text turns muted. The series is
|
|
231
|
+
* still drawn and still counts — it is just not what the reader is looking
|
|
232
|
+
* at (e.g. sources a filter has not chosen). Figma `Visibility=Muted`.
|
|
233
|
+
* @default false
|
|
234
|
+
*/
|
|
235
|
+
muted?: boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Switched off: the muted look plus a strike through the label (the value
|
|
238
|
+
* stays legible), so a hidden series reads as hidden in greyscale and in a
|
|
239
|
+
* screenshot — never by colour alone. The strike also reaches a nested
|
|
240
|
+
* button or link used as the label. Use it for a toggled-off series in an
|
|
241
|
+
* interactive legend. Wins over `muted`. Figma `Visibility=Hidden`.
|
|
242
|
+
* @default false
|
|
243
|
+
*/
|
|
244
|
+
hidden?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Render the child element instead of a `div`, merging the item's props
|
|
247
|
+
* into it — so the item can be a `PopoverTrigger` or a `<button
|
|
248
|
+
* aria-pressed>`. The child's own content becomes the label; the swatch
|
|
249
|
+
* and value are placed around it.
|
|
250
|
+
* @default false
|
|
251
|
+
*/
|
|
252
|
+
asChild?: boolean;
|
|
253
|
+
/** Analytics element identifier */
|
|
254
|
+
trackingEl?: string;
|
|
255
|
+
/** Analytics label */
|
|
256
|
+
trackingLabel?: string;
|
|
257
|
+
/**
|
|
258
|
+
* The label. Defaults to the config label for `seriesKey`, then to the key
|
|
259
|
+
* itself. Required when `asChild` is set (it is the element to render).
|
|
260
|
+
*/
|
|
261
|
+
children?: React.ReactNode;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* One legend entry: a colour swatch (or the series icon), a label and an
|
|
265
|
+
* optional value. Composable — it renders inside a chart via
|
|
266
|
+
* {@link ChartLegendContent}, or anywhere else inside a
|
|
267
|
+
* {@link ChartLegendList}.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```tsx
|
|
271
|
+
* <ChartLegendList dataHook="sources-legend" orientation="vertical" config={config}>
|
|
272
|
+
* <ChartLegendItem dataHook="sources-legend-google" seriesKey="google" value={1240} />
|
|
273
|
+
* <ChartLegendItem dataHook="sources-legend-other" seriesKey="other" value={88} asChild>
|
|
274
|
+
* <PopoverTrigger>Other</PopoverTrigger>
|
|
275
|
+
* </ChartLegendItem>
|
|
276
|
+
* </ChartLegendList>
|
|
277
|
+
* ```
|
|
278
|
+
*/
|
|
279
|
+
declare const ChartLegendItem: React.ForwardRefExoticComponent<ChartLegendItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
280
|
+
/**
|
|
281
|
+
* Props for the ChartLegendList component.
|
|
282
|
+
*/
|
|
283
|
+
interface ChartLegendListProps extends React.ComponentPropsWithoutRef<"div"> {
|
|
284
|
+
/**
|
|
285
|
+
* Data hook for automated testing (required)
|
|
286
|
+
* @example "sources-legend"
|
|
287
|
+
*/
|
|
288
|
+
dataHook: string;
|
|
289
|
+
/**
|
|
290
|
+
* Layout direction. Horizontal wraps under or above a plot; vertical stacks
|
|
291
|
+
* beside a donut, label left and value right.
|
|
292
|
+
* @default "horizontal"
|
|
293
|
+
*/
|
|
294
|
+
orientation?: ChartLegendOrientation;
|
|
295
|
+
/**
|
|
296
|
+
* Scale of the list and its items. `sm` matches the chart's axis ticks and
|
|
297
|
+
* tooltip; `md` is for a key read as content beside a donut or under a
|
|
298
|
+
* report chart (14px text, 10px swatch).
|
|
299
|
+
* @default "sm"
|
|
300
|
+
*/
|
|
301
|
+
size?: ChartLegendSize;
|
|
302
|
+
/**
|
|
303
|
+
* Accessible name of the legend group.
|
|
304
|
+
* @default "Chart legend"
|
|
305
|
+
*/
|
|
306
|
+
ariaLabel?: string;
|
|
307
|
+
/**
|
|
308
|
+
* Chart config for the items, when the list renders outside a
|
|
309
|
+
* `ChartContainer`. Replaces (does not merge with) a surrounding
|
|
310
|
+
* container's config. Give each key a `color` — a `theme` only resolves
|
|
311
|
+
* inside a container.
|
|
312
|
+
*/
|
|
313
|
+
config?: ChartConfig;
|
|
314
|
+
/** Analytics element identifier */
|
|
315
|
+
trackingEl?: string;
|
|
316
|
+
/** Analytics label */
|
|
317
|
+
trackingLabel?: string;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* A legend as a standalone list of {@link ChartLegendItem}s — the key beside
|
|
321
|
+
* a donut, a shared key under several charts, or a row of series toggles.
|
|
322
|
+
* {@link ChartLegendContent} renders one of these inside a chart.
|
|
323
|
+
*
|
|
324
|
+
* It is a labelled `role="group"`, not a list: the same container holds
|
|
325
|
+
* static keys and rows of toggle buttons, and a group with a name reads
|
|
326
|
+
* correctly for both ("Chart legend, group"). A static key therefore no
|
|
327
|
+
* longer announces its item count — accepted trade-off (DS-1026 review).
|
|
328
|
+
*/
|
|
329
|
+
declare const ChartLegendList: React.ForwardRefExoticComponent<ChartLegendListProps & React.RefAttributes<HTMLDivElement>>;
|
|
330
|
+
/**
|
|
331
|
+
* One entry of the legend payload Recharts hands to `ChartLegend`'s content.
|
|
332
|
+
*/
|
|
333
|
+
interface ChartLegendPayloadItem {
|
|
334
|
+
/** Display name — the series name for Bar/Line, the sector name for Pie. */
|
|
335
|
+
value: string;
|
|
336
|
+
/** Series key. Present for Bar/Line/Area series; Pie entries have none. */
|
|
337
|
+
dataKey?: string;
|
|
338
|
+
color?: string;
|
|
339
|
+
/** The series' or sector's raw datum. */
|
|
340
|
+
payload: Record<string, unknown>;
|
|
341
|
+
}
|
|
173
342
|
/**
|
|
174
343
|
* Props for the ChartLegendContent component.
|
|
175
344
|
*/
|
|
176
345
|
interface ChartLegendContentProps extends React.ComponentProps<"div">, Pick<ChartLegendProps, "nameKey"> {
|
|
346
|
+
/**
|
|
347
|
+
* Data hook for automated testing. Items derive theirs from it
|
|
348
|
+
* (`<dataHook>-<entry key>`, where the entry key is the series `dataKey`,
|
|
349
|
+
* or the Pie entry's `nameKey` value, slugified).
|
|
350
|
+
* @default "chart-legend"
|
|
351
|
+
*/
|
|
352
|
+
dataHook?: string;
|
|
177
353
|
/** Hide the series icon in the legend */
|
|
178
354
|
hideIcon?: boolean;
|
|
179
355
|
/** Legend payload from Recharts (automatically provided) */
|
|
180
|
-
payload?: Array<
|
|
181
|
-
value: string;
|
|
182
|
-
dataKey: string;
|
|
183
|
-
color?: string;
|
|
184
|
-
payload: Record<string, unknown>;
|
|
185
|
-
}>;
|
|
356
|
+
payload?: Array<ChartLegendPayloadItem>;
|
|
186
357
|
/**
|
|
187
|
-
* Vertical alignment of the legend relative to the chart
|
|
358
|
+
* Vertical alignment of the legend relative to the chart — sets the gap
|
|
359
|
+
* to the plot. Pass the same value to `ChartLegend`.
|
|
188
360
|
* @default "bottom"
|
|
189
361
|
*/
|
|
190
|
-
verticalAlign?: "top" | "bottom";
|
|
362
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
363
|
+
/**
|
|
364
|
+
* Layout direction. Pair `vertical` with
|
|
365
|
+
* `<ChartLegend layout="vertical" align="right" verticalAlign="middle" />`.
|
|
366
|
+
* @default "horizontal"
|
|
367
|
+
*/
|
|
368
|
+
orientation?: ChartLegendOrientation;
|
|
369
|
+
/**
|
|
370
|
+
* Accessible name of the legend group.
|
|
371
|
+
* @default "Chart legend"
|
|
372
|
+
*/
|
|
373
|
+
ariaLabel?: string;
|
|
374
|
+
/**
|
|
375
|
+
* Scale of the legend. Keep `sm` inside a chart — it matches the axis
|
|
376
|
+
* ticks and the tooltip; `md` is for a key read as content.
|
|
377
|
+
* @default "sm"
|
|
378
|
+
*/
|
|
379
|
+
size?: ChartLegendSize;
|
|
380
|
+
/**
|
|
381
|
+
* Show each entry's value after its label, read from `payload[valueKey]`.
|
|
382
|
+
* Meaningful for Pie/Donut, whose payload is the sector's datum — for Bar
|
|
383
|
+
* and Line series the payload carries no total, so render a
|
|
384
|
+
* `ChartLegendList` beside the chart with your own values instead.
|
|
385
|
+
* @default false
|
|
386
|
+
*/
|
|
387
|
+
showValue?: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Field of each entry's datum that holds its value — for a Pie, its
|
|
390
|
+
* `dataKey` (e.g. `"visitors"`). Defaults to the series `dataKey`, then
|
|
391
|
+
* `"value"`.
|
|
392
|
+
*/
|
|
393
|
+
valueKey?: string;
|
|
394
|
+
/**
|
|
395
|
+
* Formats the value shown by `showValue`. Receives the payload entry;
|
|
396
|
+
* read the number from `item.payload`.
|
|
397
|
+
* @example (item) => `${item.payload.visitors} visitors`
|
|
398
|
+
*/
|
|
399
|
+
valueFormatter?: (item: ChartLegendPayloadItem) => React.ReactNode;
|
|
400
|
+
/**
|
|
401
|
+
* Order of the entries. Recharts sorts the payload alphabetically by
|
|
402
|
+
* default; pass the entry keys (series `dataKey`s, or Pie `nameKey`
|
|
403
|
+
* values) in the order the chart declares them, or a comparator. Keys not
|
|
404
|
+
* listed go last. Legend order should match series order and tooltip
|
|
405
|
+
* order.
|
|
406
|
+
* @example ["google", "facebook", "other"]
|
|
407
|
+
*/
|
|
408
|
+
sortBy?: string[] | ((a: ChartLegendPayloadItem, b: ChartLegendPayloadItem) => number);
|
|
409
|
+
/**
|
|
410
|
+
* Replace the rendering of one entry — e.g. wrap "Other" in a popover
|
|
411
|
+
* trigger. Receives the entry and the default item. Recharts positions the
|
|
412
|
+
* legend inside the chart's box, so floating content opened from here can
|
|
413
|
+
* be clipped by it; for an interactive legend prefer a `ChartLegendList`
|
|
414
|
+
* beside the chart.
|
|
415
|
+
*/
|
|
416
|
+
renderItem?: (item: ChartLegendPayloadItem, defaultNode: React.ReactNode) => React.ReactNode;
|
|
191
417
|
}
|
|
192
418
|
/**
|
|
193
|
-
* ChartLegendContent renders
|
|
419
|
+
* ChartLegendContent renders Recharts' legend payload as a
|
|
420
|
+
* {@link ChartLegendList} of {@link ChartLegendItem}s. Use as
|
|
421
|
+
* `<ChartLegend content={<ChartLegendContent />} />`.
|
|
194
422
|
*/
|
|
195
|
-
declare function ChartLegendContent({ className, hideIcon, payload,
|
|
423
|
+
declare function ChartLegendContent({ ariaLabel, className, dataHook, hideIcon, nameKey, orientation, payload, renderItem, showValue, size, sortBy, valueFormatter, valueKey, verticalAlign, }: ChartLegendContentProps): React.JSX.Element | null;
|
|
196
424
|
declare namespace ChartLegendContent {
|
|
197
425
|
var displayName: string;
|
|
198
426
|
}
|
|
@@ -244,7 +472,7 @@ interface ChartDotProps {
|
|
|
244
472
|
/**
|
|
245
473
|
* ChartDot renders a data-point marker for line/area/scatter charts.
|
|
246
474
|
*/
|
|
247
|
-
declare function ChartDot({ size, custom, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotProps):
|
|
475
|
+
declare function ChartDot({ size, custom, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotProps): React.JSX.Element | null;
|
|
248
476
|
declare namespace ChartDot {
|
|
249
477
|
var displayName: string;
|
|
250
478
|
}
|
|
@@ -282,7 +510,7 @@ interface ChartDotOnStrokeProps {
|
|
|
282
510
|
/**
|
|
283
511
|
* ChartDotOnStroke renders a solid marker ringed with the background colour.
|
|
284
512
|
*/
|
|
285
|
-
declare function ChartDotOnStroke({ size, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotOnStrokeProps):
|
|
513
|
+
declare function ChartDotOnStroke({ size, color, colorKey, cx, cy, stroke, fill, payload, }: ChartDotOnStrokeProps): React.JSX.Element | null;
|
|
286
514
|
declare namespace ChartDotOnStroke {
|
|
287
515
|
var displayName: string;
|
|
288
516
|
}
|
|
@@ -331,7 +559,7 @@ interface ChartRadarGridProps extends Omit<React.ComponentProps<typeof RechartsP
|
|
|
331
559
|
/**
|
|
332
560
|
* ChartRadarGrid renders a design-system polar grid for radar / radial charts.
|
|
333
561
|
*/
|
|
334
|
-
declare function ChartRadarGrid({ type, filled, fillColor, fillOpacity, boundaryOnly, radialLines, className, ...props }: ChartRadarGridProps):
|
|
562
|
+
declare function ChartRadarGrid({ type, filled, fillColor, fillOpacity, boundaryOnly, radialLines, className, ...props }: ChartRadarGridProps): React.JSX.Element;
|
|
335
563
|
declare namespace ChartRadarGrid {
|
|
336
564
|
var displayName: string;
|
|
337
565
|
}
|
|
@@ -383,7 +611,7 @@ interface ChartRadarLabelWrapperProps {
|
|
|
383
611
|
/**
|
|
384
612
|
* ChartRadarLabelWrapper renders a one- or two-line polar axis tick label.
|
|
385
613
|
*/
|
|
386
|
-
declare function ChartRadarLabelWrapper({ type, data, primaryKey, secondaryKey, x, y, textAnchor, payload, index, }: ChartRadarLabelWrapperProps):
|
|
614
|
+
declare function ChartRadarLabelWrapper({ type, data, primaryKey, secondaryKey, x, y, textAnchor, payload, index, }: ChartRadarLabelWrapperProps): React.JSX.Element;
|
|
387
615
|
declare namespace ChartRadarLabelWrapper {
|
|
388
616
|
var displayName: string;
|
|
389
617
|
}
|
|
@@ -422,7 +650,7 @@ interface ChartPieLabelListProps {
|
|
|
422
650
|
/**
|
|
423
651
|
* ChartPieLabelList renders a category-name label inside a pie slice.
|
|
424
652
|
*/
|
|
425
|
-
declare function ChartPieLabelList({ nameKey, config, radiusRatio, cx, cy, midAngle, innerRadius, outerRadius, payload, name, }: ChartPieLabelListProps):
|
|
653
|
+
declare function ChartPieLabelList({ nameKey, config, radiusRatio, cx, cy, midAngle, innerRadius, outerRadius, payload, name, }: ChartPieLabelListProps): React.JSX.Element | null;
|
|
426
654
|
declare namespace ChartPieLabelList {
|
|
427
655
|
var displayName: string;
|
|
428
656
|
}
|
|
@@ -450,7 +678,7 @@ interface ChartPieLabelWrapperProps {
|
|
|
450
678
|
/**
|
|
451
679
|
* ChartPieLabelWrapper renders a value label outside a pie slice.
|
|
452
680
|
*/
|
|
453
|
-
declare function ChartPieLabelWrapper({ valueKey, x, y, textAnchor, payload, value, }: ChartPieLabelWrapperProps):
|
|
681
|
+
declare function ChartPieLabelWrapper({ valueKey, x, y, textAnchor, payload, value, }: ChartPieLabelWrapperProps): React.JSX.Element | null;
|
|
454
682
|
declare namespace ChartPieLabelWrapper {
|
|
455
683
|
var displayName: string;
|
|
456
684
|
}
|
|
@@ -480,12 +708,12 @@ interface ChartCenterLabelProps {
|
|
|
480
708
|
* The primary value is a KPI figure in the `text-metric` type-scale style;
|
|
481
709
|
* `size` scales the figure.
|
|
482
710
|
*/
|
|
483
|
-
declare function ChartCenterLabel({ primary, secondary, size, viewBox, }: ChartCenterLabelProps):
|
|
711
|
+
declare function ChartCenterLabel({ primary, secondary, size, viewBox, }: ChartCenterLabelProps): React.JSX.Element | null;
|
|
484
712
|
declare namespace ChartCenterLabel {
|
|
485
713
|
var displayName: string;
|
|
486
714
|
}
|
|
487
|
-
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, ChartDot, ChartDotOnStroke, ChartRadarGrid, ChartRadarLabelWrapper, ChartPieLabelList, ChartPieLabelWrapper, ChartCenterLabel, };
|
|
488
|
-
export type { ChartContainerProps, ChartTooltipProps, ChartTooltipContentProps, ChartTooltipPayloadItem, ChartLegendProps, ChartLegendContentProps, ChartDotProps, ChartDotOnStrokeProps, ChartDotSize, ChartDotOnStrokeSize, ChartRadarGridProps, ChartRadarGridType, ChartRadarLabelWrapperProps, ChartRadarLabelWrapperType, ChartPieLabelListProps, ChartPieLabelWrapperProps, ChartCenterLabelProps, ChartCenterLabelSize, };
|
|
715
|
+
export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartLegendList, ChartLegendItem, ChartStyle, ChartDot, ChartDotOnStroke, ChartRadarGrid, ChartRadarLabelWrapper, ChartPieLabelList, ChartPieLabelWrapper, ChartCenterLabel, };
|
|
716
|
+
export type { ChartContainerProps, ChartTooltipProps, ChartTooltipContentProps, ChartTooltipPayloadItem, ChartLegendProps, ChartLegendContentProps, ChartLegendListProps, ChartLegendItemProps, ChartLegendOrientation, ChartLegendPayloadItem, ChartLegendSize, ChartDotProps, ChartDotOnStrokeProps, ChartDotSize, ChartDotOnStrokeSize, ChartRadarGridProps, ChartRadarGridType, ChartRadarLabelWrapperProps, ChartRadarLabelWrapperType, ChartPieLabelListProps, ChartPieLabelWrapperProps, ChartCenterLabelProps, ChartCenterLabelSize, };
|
|
489
717
|
export { ChartEmpty } from './chart-empty';
|
|
490
718
|
export type { ChartEmptyProps } from './chart-empty';
|
|
491
719
|
export { Area, AreaChart, Bar, BarChart, CartesianGrid, Cell, Customized, Label as ChartLabel, LabelList, Legend as ChartsLegend, Line, LineChart, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart, RadialBar, RadialBarChart, Rectangle, ReferenceLine, ResponsiveContainer, Sector, Tooltip as ChartsTooltip, XAxis, YAxis, } from 'recharts';
|