@giddaa-housing/ui 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -6
- package/css/base.css +37 -0
- package/css/components.css +135 -0
- package/css/generated/shared.css +1 -0
- package/css/giddaa.css +402 -0
- package/css/preset.css +77 -0
- package/css/styles.css +2 -0
- package/css/theme.css +255 -0
- package/dist/accordion.js +5 -35
- package/dist/accordion.js.map +1 -1
- package/dist/activity-timeline.d.ts +33 -0
- package/dist/activity-timeline.js +212 -0
- package/dist/activity-timeline.js.map +1 -0
- package/dist/alert.js +5 -35
- package/dist/alert.js.map +1 -1
- package/dist/auth-layout.d.ts +23 -0
- package/dist/auth-layout.js +304 -0
- package/dist/auth-layout.js.map +1 -0
- package/dist/avatar.js +10 -142
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +6 -114
- package/dist/badge.js.map +1 -1
- package/dist/bar-chart.d.ts +101 -77
- package/dist/bar-chart.js +142 -220
- package/dist/bar-chart.js.map +1 -1
- package/dist/breadcrumb.js +5 -35
- package/dist/breadcrumb.js.map +1 -1
- package/dist/bullet-chart.js +15 -48
- package/dist/bullet-chart.js.map +1 -1
- package/dist/button-group.js +14 -90
- package/dist/button-group.js.map +1 -1
- package/dist/button.d.ts +5 -5
- package/dist/button.js +7 -140
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +12 -287
- package/dist/calendar.js.map +1 -1
- package/dist/card.js +5 -35
- package/dist/card.js.map +1 -1
- package/dist/carousel.js +12 -386
- package/dist/carousel.js.map +1 -1
- package/dist/chart.js +16 -480
- package/dist/chart.js.map +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +13 -48
- package/dist/checkbox.js.map +1 -1
- package/dist/chunk-322YCNVL.js +278 -0
- package/dist/chunk-322YCNVL.js.map +1 -0
- package/dist/chunk-3ACQVT7A.js +25 -0
- package/dist/chunk-3ACQVT7A.js.map +1 -0
- package/dist/chunk-3T65TLJX.js +334 -0
- package/dist/chunk-3T65TLJX.js.map +1 -0
- package/dist/chunk-6ZSGQHH2.js +192 -0
- package/dist/chunk-6ZSGQHH2.js.map +1 -0
- package/dist/chunk-7TBMLFGW.js +41 -0
- package/dist/chunk-7TBMLFGW.js.map +1 -0
- package/dist/chunk-B4H6RNDH.js +135 -0
- package/dist/chunk-B4H6RNDH.js.map +1 -0
- package/dist/chunk-BUXCGZ6X.js +219 -0
- package/dist/chunk-BUXCGZ6X.js.map +1 -0
- package/dist/chunk-CHII2QHH.js +58 -0
- package/dist/chunk-CHII2QHH.js.map +1 -0
- package/dist/chunk-DMNOXRRW.js +147 -0
- package/dist/chunk-DMNOXRRW.js.map +1 -0
- package/dist/chunk-EFSOSSIC.js +130 -0
- package/dist/chunk-EFSOSSIC.js.map +1 -0
- package/dist/chunk-FZDSVMKY.js +363 -0
- package/dist/chunk-FZDSVMKY.js.map +1 -0
- package/dist/chunk-GJOFIJS3.js +246 -0
- package/dist/chunk-GJOFIJS3.js.map +1 -0
- package/dist/chunk-HL3ZSYES.js +23 -0
- package/dist/chunk-HL3ZSYES.js.map +1 -0
- package/dist/chunk-JVLUBAPB.js +129 -0
- package/dist/chunk-JVLUBAPB.js.map +1 -0
- package/dist/chunk-KDPYSOYZ.js +64 -0
- package/dist/chunk-KDPYSOYZ.js.map +1 -0
- package/dist/chunk-KSMDANKI.js +43 -0
- package/dist/chunk-KSMDANKI.js.map +1 -0
- package/dist/chunk-MEKCCOP5.js +46 -0
- package/dist/chunk-MEKCCOP5.js.map +1 -0
- package/dist/chunk-NOFXVRWL.js +451 -0
- package/dist/chunk-NOFXVRWL.js.map +1 -0
- package/dist/chunk-PC5MHNVA.js +171 -0
- package/dist/chunk-PC5MHNVA.js.map +1 -0
- package/dist/chunk-QKAQZ2GU.js +122 -0
- package/dist/chunk-QKAQZ2GU.js.map +1 -0
- package/dist/chunk-QZHSHSVV.js +26 -0
- package/dist/chunk-QZHSHSVV.js.map +1 -0
- package/dist/chunk-RBMK26XD.js +19 -0
- package/dist/chunk-RBMK26XD.js.map +1 -0
- package/dist/chunk-SFNJGF6M.js +262 -0
- package/dist/chunk-SFNJGF6M.js.map +1 -0
- package/dist/chunk-UJJNLGTM.js +112 -0
- package/dist/chunk-UJJNLGTM.js.map +1 -0
- package/dist/chunk-VGR4ZWJ3.js +418 -0
- package/dist/chunk-VGR4ZWJ3.js.map +1 -0
- package/dist/chunk-XG47P6D4.js +99 -0
- package/dist/chunk-XG47P6D4.js.map +1 -0
- package/dist/chunk-XZZAHNVM.js +21 -0
- package/dist/chunk-XZZAHNVM.js.map +1 -0
- package/dist/chunk-Y4TTYVNE.js +36 -0
- package/dist/chunk-Y4TTYVNE.js.map +1 -0
- package/dist/chunk-YDWIHW6Q.js +69 -0
- package/dist/chunk-YDWIHW6Q.js.map +1 -0
- package/dist/collapsible.js +6 -35
- package/dist/collapsible.js.map +1 -1
- package/dist/combobox.js +26 -694
- package/dist/combobox.js.map +1 -1
- package/dist/cta.d.ts +66 -0
- package/dist/cta.js +358 -0
- package/dist/cta.js.map +1 -0
- package/dist/currency-selector.d.ts +42 -0
- package/dist/currency-selector.js +192 -0
- package/dist/currency-selector.js.map +1 -0
- package/dist/date-picker.d.ts +18 -10
- package/dist/date-picker.js +105 -430
- package/dist/date-picker.js.map +1 -1
- package/dist/details-card.d.ts +19 -0
- package/dist/details-card.js +267 -0
- package/dist/details-card.js.map +1 -0
- package/dist/dialog.js +36 -146
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +20 -358
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/dropzone.js +13 -40
- package/dist/dropzone.js.map +1 -1
- package/dist/editorial-card.d.ts +29 -0
- package/dist/editorial-card.js +311 -0
- package/dist/editorial-card.js.map +1 -0
- package/dist/empty-state.js +5 -35
- package/dist/empty-state.js.map +1 -1
- package/dist/field.js +30 -135
- package/dist/field.js.map +1 -1
- package/dist/footer.d.ts +47 -0
- package/dist/footer.js +430 -0
- package/dist/footer.js.map +1 -0
- package/dist/funnel-chart.js +42 -415
- package/dist/funnel-chart.js.map +1 -1
- package/dist/gallery-indicator.d.ts +18 -0
- package/dist/gallery-indicator.js +12 -0
- package/dist/gallery-indicator.js.map +1 -0
- package/dist/heatmap-chart.d.ts +98 -0
- package/dist/heatmap-chart.js +248 -0
- package/dist/heatmap-chart.js.map +1 -0
- package/dist/infotip.d.ts +11 -0
- package/dist/infotip.js +66 -0
- package/dist/infotip.js.map +1 -0
- package/dist/input-group.d.ts +2 -1
- package/dist/input-group.js +15 -371
- package/dist/input-group.js.map +1 -1
- package/dist/input-size-context.js +5 -19
- package/dist/input-size-context.js.map +1 -1
- package/dist/input.js +6 -78
- package/dist/input.js.map +1 -1
- package/dist/item.js +5 -35
- package/dist/item.js.map +1 -1
- package/dist/kpi-card.js +12 -52
- package/dist/kpi-card.js.map +1 -1
- package/dist/label.js +5 -64
- package/dist/label.js.map +1 -1
- package/dist/line-chart.js +9 -166
- package/dist/line-chart.js.map +1 -1
- package/dist/logo.js +4 -141
- package/dist/logo.js.map +1 -1
- package/dist/map-indicator.d.ts +13 -0
- package/dist/map-indicator.js +109 -0
- package/dist/map-indicator.js.map +1 -0
- package/dist/match.d.ts +16 -0
- package/dist/match.js +113 -0
- package/dist/match.js.map +1 -0
- package/dist/media-gallery-hero.d.ts +60 -0
- package/dist/media-gallery-hero.js +362 -0
- package/dist/media-gallery-hero.js.map +1 -0
- package/dist/media-player.d.ts +60 -0
- package/dist/media-player.js +1394 -0
- package/dist/media-player.js.map +1 -0
- package/dist/number-input.js +30 -325
- package/dist/number-input.js.map +1 -1
- package/dist/page-header.js +4 -32
- package/dist/page-header.js.map +1 -1
- package/dist/pagination.d.ts +1 -0
- package/dist/pagination.js +27 -161
- package/dist/pagination.js.map +1 -1
- package/dist/password-input.d.ts +1 -0
- package/dist/password-input.js +21 -319
- package/dist/password-input.js.map +1 -1
- package/dist/phone-input.d.ts +2 -1
- package/dist/phone-input.js +148 -359
- package/dist/phone-input.js.map +1 -1
- package/dist/photo-gallery.d.ts +1 -1
- package/dist/photo-gallery.js +97 -393
- package/dist/photo-gallery.js.map +1 -1
- package/dist/pie-chart.js +17 -52
- package/dist/pie-chart.js.map +1 -1
- package/dist/popover.js +13 -158
- package/dist/popover.js.map +1 -1
- package/dist/price-tag.d.ts +35 -0
- package/dist/price-tag.js +178 -0
- package/dist/price-tag.js.map +1 -0
- package/dist/progress.d.ts +5 -2
- package/dist/progress.js +14 -303
- package/dist/progress.js.map +1 -1
- package/dist/property-listing-card.d.ts +32 -0
- package/dist/property-listing-card.js +235 -0
- package/dist/property-listing-card.js.map +1 -0
- package/dist/radar-chart.d.ts +110 -0
- package/dist/radar-chart.js +147 -0
- package/dist/radar-chart.js.map +1 -0
- package/dist/radio-group.js +15 -50
- package/dist/radio-group.js.map +1 -1
- package/dist/review-block.d.ts +20 -0
- package/dist/review-block.js +10 -0
- package/dist/review-block.js.map +1 -0
- package/dist/rich-text-editor.js +172 -433
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/scatter-chart.d.ts +142 -0
- package/dist/scatter-chart.js +252 -0
- package/dist/scatter-chart.js.map +1 -0
- package/dist/search-input.d.ts +1 -0
- package/dist/search-input.js +22 -320
- package/dist/search-input.js.map +1 -1
- package/dist/select.js +15 -292
- package/dist/select.js.map +1 -1
- package/dist/separator.js +5 -68
- package/dist/separator.js.map +1 -1
- package/dist/sheet.js +14 -271
- package/dist/sheet.js.map +1 -1
- package/dist/sidebar.d.ts +1 -1
- package/dist/sidebar.js +89 -494
- package/dist/sidebar.js.map +1 -1
- package/dist/size-context.js +5 -17
- package/dist/size-context.js.map +1 -1
- package/dist/skeleton.js +4 -44
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.d.ts +28 -0
- package/dist/slider.js +152 -0
- package/dist/slider.js.map +1 -0
- package/dist/sparkline.js +33 -341
- package/dist/sparkline.js.map +1 -1
- package/dist/stepper.js +5 -35
- package/dist/stepper.js.map +1 -1
- package/dist/styles.css +9593 -2
- package/dist/switch.js +13 -48
- package/dist/switch.js.map +1 -1
- package/dist/tab-list.js +35 -306
- package/dist/tab-list.js.map +1 -1
- package/dist/table.js +5 -32
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +10 -150
- package/dist/tabs.js.map +1 -1
- package/dist/tag.d.ts +7 -6
- package/dist/tag.js +101 -97
- package/dist/tag.js.map +1 -1
- package/dist/testimonial-block.d.ts +34 -0
- package/dist/testimonial-block.js +377 -0
- package/dist/testimonial-block.js.map +1 -0
- package/dist/textarea.js +6 -73
- package/dist/textarea.js.map +1 -1
- package/dist/time-picker.js +119 -279
- package/dist/time-picker.js.map +1 -1
- package/dist/toast.js +27 -132
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.d.ts +5 -5
- package/dist/tooltip.js +7 -90
- package/dist/tooltip.js.map +1 -1
- package/dist/tree-map.js +41 -414
- package/dist/tree-map.js.map +1 -1
- package/dist/waterfall-chart.d.ts +129 -0
- package/dist/waterfall-chart.js +577 -0
- package/dist/waterfall-chart.js.map +1 -0
- package/package.json +98 -28
- package/dist/base.css +0 -32
- package/dist/files/red-hat-display-latin-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff2 +0 -0
- package/dist/index.d.ts +0 -87
- package/dist/index.js +0 -10448
- package/dist/index.js.map +0 -1
- package/dist/red-hat-display.css +0 -2
- package/dist/theme/giddaa.css +0 -2
package/dist/bar-chart.d.ts
CHANGED
|
@@ -1,39 +1,50 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { BarChart as BarChart$1, CartesianGrid, Bar, XAxis, YAxis } from 'recharts';
|
|
3
|
+
import { ChartConfig } from './chart.js';
|
|
2
4
|
import { ComponentSize } from './size-context.js';
|
|
5
|
+
import 'class-variance-authority/types';
|
|
6
|
+
import 'class-variance-authority';
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
|
-
* Bar charts are
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Bar charts are composable wrappers over the recharts cartesian primitives.
|
|
10
|
+
* recharts 3 registers graphical items through context when they render, so the
|
|
11
|
+
* primitives CAN be wrapped in our own components. Each wrapper bakes in the
|
|
12
|
+
* giddaa defaults (tokens, size-scaled type, mark specs) and forwards every
|
|
13
|
+
* recharts prop, so anything can be overridden in place or replaced with the
|
|
14
|
+
* raw recharts element.
|
|
15
|
+
*
|
|
16
|
+
* Anatomy: `BarChart` is the plot root (frame + responsive box + recharts
|
|
17
|
+
* chart); compose the grid, axes, series, and the shared overlays from
|
|
18
|
+
* `./chart` as children:
|
|
11
19
|
*
|
|
12
20
|
* @example
|
|
13
|
-
* const chart = useBarChartLayout();
|
|
14
21
|
* <ChartCard size="md">
|
|
15
22
|
* <ChartHeader>
|
|
16
23
|
* <ChartTitle>Revenue Overview</ChartTitle>
|
|
17
|
-
* <ChartDescription>Monthly revenue
|
|
24
|
+
* <ChartDescription>Monthly revenue - Jan-Jul</ChartDescription>
|
|
18
25
|
* </ChartHeader>
|
|
19
|
-
* <
|
|
20
|
-
* <
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* <
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* </Bar>
|
|
29
|
-
* </BarChart>
|
|
30
|
-
* </ChartContainer>
|
|
26
|
+
* <BarChart config={config} data={data}>
|
|
27
|
+
* <BarChartGrid />
|
|
28
|
+
* <BarChartXAxis dataKey="month" />
|
|
29
|
+
* <BarChartYAxis domain={[0, 120]} />
|
|
30
|
+
* <ChartTooltip content={<ChartTooltipContent />} />
|
|
31
|
+
* <BarChartSeries dataKey="revenue" name="Revenue">
|
|
32
|
+
* <LabelList dataKey="revenue" content={<BarValueLabel />} />
|
|
33
|
+
* </BarChartSeries>
|
|
34
|
+
* </BarChart>
|
|
31
35
|
* </ChartCard>
|
|
32
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* Categorical series palette - the theme-aware `chart-1`...`chart-3` tokens.
|
|
39
|
+
* Assign colours in this fixed order, never cycled: a fourth series folds into
|
|
40
|
+
* "Other" or becomes a second chart.
|
|
41
|
+
*/
|
|
42
|
+
declare const BAR_CHART_PALETTE: readonly ["var(--color-chart-1)", "var(--color-chart-2)", "var(--color-chart-3)"];
|
|
43
|
+
type BarChartOrientation = "vertical" | "horizontal";
|
|
33
44
|
type BarChartLayout = {
|
|
34
45
|
/** Plot height in px. Width stays fluid via the ResponsiveContainer. */
|
|
35
46
|
height: number;
|
|
36
|
-
/** Outer margin
|
|
47
|
+
/** Outer margin - top leaves room for value labels above the tallest bar. */
|
|
37
48
|
margin: {
|
|
38
49
|
top: number;
|
|
39
50
|
right: number;
|
|
@@ -58,72 +69,85 @@ type BarChartLayout = {
|
|
|
58
69
|
tickMargin: number;
|
|
59
70
|
};
|
|
60
71
|
declare const BAR_CHART_LAYOUT: Record<ComponentSize, BarChartLayout>;
|
|
72
|
+
type BarChartProps = Omit<React.ComponentProps<typeof BarChart$1>, "width" | "height"> & {
|
|
73
|
+
/** Series labels/icons for the shared tooltip and legend (see `ChartConfig`). */
|
|
74
|
+
config?: ChartConfig;
|
|
75
|
+
/** Plot scale; inherited from the nearest `SizeProvider` when omitted. */
|
|
76
|
+
size?: ComponentSize;
|
|
77
|
+
/** Applied to the responsive plot box, e.g. to override its height. */
|
|
78
|
+
className?: string;
|
|
79
|
+
/** Visual bar direction. `horizontal` maps to recharts `layout="vertical"`. */
|
|
80
|
+
orientation?: BarChartOrientation;
|
|
81
|
+
};
|
|
61
82
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* const chart = useBarChartLayout(size);
|
|
69
|
-
* <ChartContainer config={config} {...chart.container}>
|
|
70
|
-
* <BarChart data={data} {...chart.chart}>
|
|
71
|
-
* <XAxis dataKey="month" {...chart.xAxis} />
|
|
72
|
-
* <YAxis {...chart.yAxis} />
|
|
73
|
-
* <Bar dataKey="revenue" fill="var(--color-revenue)" {...chart.bar} />
|
|
83
|
+
* Plot root - wraps the shared `ChartContainer` (tooltip/legend theming,
|
|
84
|
+
* responsive box) around the recharts `BarChart` with size-scaled height,
|
|
85
|
+
* margin, and bar gaps. `size` also flows to the child primitives through
|
|
86
|
+
* `SizeProvider`. Extra props reach the recharts chart (`data`, `syncId`,
|
|
87
|
+
* `layout`, ...); passing `layout` directly overrides `orientation`.
|
|
74
88
|
*/
|
|
75
|
-
declare function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
readonly tick: {
|
|
98
|
-
fontSize: number;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
yAxis: {
|
|
102
|
-
readonly tickLine: false;
|
|
103
|
-
readonly axisLine: false;
|
|
104
|
-
readonly width: number;
|
|
105
|
-
readonly tick: {
|
|
106
|
-
fontSize: number;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
bar: {
|
|
110
|
-
radius: [number, number, number, number];
|
|
111
|
-
maxBarSize: number;
|
|
112
|
-
};
|
|
89
|
+
declare function BarChart({ config, size, className, children, orientation, layout, ...props }: BarChartProps): React.JSX.Element;
|
|
90
|
+
type BarChartGridProps = React.ComponentProps<typeof CartesianGrid>;
|
|
91
|
+
/**
|
|
92
|
+
* Value reference lines - recharts `CartesianGrid` with vertical lines hidden
|
|
93
|
+
* and the visible grid painted with the `line` token (`line-subtle` matches the
|
|
94
|
+
* chart card surface in both themes, so it would vanish). For horizontal bar
|
|
95
|
+
* charts, pass `horizontal={false} vertical`.
|
|
96
|
+
*/
|
|
97
|
+
declare function BarChartGrid(props: BarChartGridProps): React.JSX.Element;
|
|
98
|
+
type BarChartXAxisProps = React.ComponentProps<typeof XAxis> & {
|
|
99
|
+
/** Explicit axis scale; otherwise inherited from the chart's `size`. */
|
|
100
|
+
size?: ComponentSize;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Category/value axis - recharts `XAxis` with no axis/tick lines,
|
|
104
|
+
* size-scaled tick margin, and caption-placeholder tick ink. Passing your own
|
|
105
|
+
* `tick` replaces the default styling entirely.
|
|
106
|
+
*/
|
|
107
|
+
declare function BarChartXAxis({ size, tick, ...props }: BarChartXAxisProps): React.JSX.Element;
|
|
108
|
+
type BarChartYAxisProps = React.ComponentProps<typeof YAxis> & {
|
|
109
|
+
/** Explicit axis scale; otherwise inherited from the chart's `size`. */
|
|
110
|
+
size?: ComponentSize;
|
|
113
111
|
};
|
|
112
|
+
/**
|
|
113
|
+
* Value/category axis - recharts `YAxis` with no axis/tick lines,
|
|
114
|
+
* size-scaled tick type, and reserved width for value labels. Override `width`
|
|
115
|
+
* for long horizontal-category labels.
|
|
116
|
+
*/
|
|
117
|
+
declare function BarChartYAxis({ size, tick, ...props }: BarChartYAxisProps): React.JSX.Element;
|
|
118
|
+
type BarChartSeriesProps = React.ComponentProps<typeof Bar> & {
|
|
119
|
+
/** Series colour for the bar. Defaults to the first categorical chart token. */
|
|
120
|
+
color?: string;
|
|
121
|
+
/** Explicit mark scale; otherwise inherited from the chart's `size`. */
|
|
122
|
+
size?: ComponentSize;
|
|
123
|
+
/** Override visual direction for radius when the root orientation is absent. */
|
|
124
|
+
orientation?: BarChartOrientation;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* One data series - recharts `Bar` with the giddaa mark spec: a theme-aware
|
|
128
|
+
* series colour, size-scaled max thickness, and a small radius only on the
|
|
129
|
+
* leading edge (top for vertical bars, right for horizontal bars). `color`
|
|
130
|
+
* drives `fill`; `fill`, `radius`, and `maxBarSize` still win when passed
|
|
131
|
+
* directly.
|
|
132
|
+
*/
|
|
133
|
+
declare function BarChartSeries({ color, size, orientation, ...props }: BarChartSeriesProps): React.JSX.Element;
|
|
114
134
|
/**
|
|
115
135
|
* Renderer for recharts `<LabelList content={<BarValueLabel />} />`. recharts
|
|
116
136
|
* injects the bar geometry (`x`, `y`, `width`, `height`, `value`); the rest are
|
|
117
137
|
* caller props. For a vertical bar the label sits above the bar; for a
|
|
118
|
-
* horizontal bar
|
|
138
|
+
* horizontal bar it sits to the right of the bar. When used inside `BarChart`,
|
|
139
|
+
* the root `orientation` is inherited unless this component receives an
|
|
140
|
+
* explicit `orientation`.
|
|
119
141
|
*/
|
|
120
142
|
type BarValueLabelProps = {
|
|
121
|
-
/** Bar
|
|
122
|
-
orientation?:
|
|
143
|
+
/** Bar visual direction - drives where the label is placed. */
|
|
144
|
+
orientation?: BarChartOrientation;
|
|
123
145
|
/** Override the on-bar font size (defaults to the size-scaled value). */
|
|
124
146
|
fontSize?: number;
|
|
125
|
-
/** Format the raw value before display, e.g. `(v) =>
|
|
147
|
+
/** Format the raw value before display, e.g. `(v) => String(v)`. */
|
|
126
148
|
formatter?: (value: React.ReactNode) => React.ReactNode;
|
|
149
|
+
/** Explicit label scale; otherwise inherited from the chart's `size`. */
|
|
150
|
+
size?: ComponentSize;
|
|
127
151
|
className?: string;
|
|
128
152
|
x?: string | number;
|
|
129
153
|
y?: string | number;
|
|
@@ -131,6 +155,6 @@ type BarValueLabelProps = {
|
|
|
131
155
|
height?: string | number;
|
|
132
156
|
value?: React.ReactNode;
|
|
133
157
|
};
|
|
134
|
-
declare function BarValueLabel({ orientation, fontSize, formatter, className, x, y, width, height, value, }: BarValueLabelProps): React.JSX.Element | null;
|
|
158
|
+
declare function BarValueLabel({ orientation, fontSize, formatter, size, className, x, y, width, height, value, }: BarValueLabelProps): React.JSX.Element | null;
|
|
135
159
|
|
|
136
|
-
export { BAR_CHART_LAYOUT, type BarChartLayout, BarValueLabel, type BarValueLabelProps
|
|
160
|
+
export { BAR_CHART_LAYOUT, BAR_CHART_PALETTE, BarChart, BarChartGrid, type BarChartGridProps, type BarChartLayout, type BarChartOrientation, type BarChartProps, BarChartSeries, type BarChartSeriesProps, BarChartXAxis, type BarChartXAxisProps, BarChartYAxis, type BarChartYAxisProps, BarValueLabel, type BarValueLabelProps };
|
package/dist/bar-chart.js
CHANGED
|
@@ -1,203 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"gdt-h3",
|
|
14
|
-
"gdt-h4",
|
|
15
|
-
"gdt-h5",
|
|
16
|
-
"gdt-xl",
|
|
17
|
-
"gdt-lg",
|
|
18
|
-
"gdt-md",
|
|
19
|
-
"gdt-sm",
|
|
20
|
-
"gdt-xs",
|
|
21
|
-
"gdt-subtext",
|
|
22
|
-
"gdt-capitalized"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
function cn(...inputs) {
|
|
30
|
-
return twMerge(clsx(inputs));
|
|
31
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ChartContainer,
|
|
4
|
+
cartesianAxisProps
|
|
5
|
+
} from "./chunk-NOFXVRWL.js";
|
|
6
|
+
import {
|
|
7
|
+
SizeProvider,
|
|
8
|
+
useComponentSize
|
|
9
|
+
} from "./chunk-HL3ZSYES.js";
|
|
10
|
+
import {
|
|
11
|
+
cn
|
|
12
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
32
13
|
|
|
33
|
-
// src/
|
|
34
|
-
import { cva } from "class-variance-authority";
|
|
14
|
+
// src/bar-chart.tsx
|
|
35
15
|
import * as React from "react";
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
var chartCardVariants = cva(
|
|
51
|
-
"flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1",
|
|
52
|
-
{
|
|
53
|
-
variants: {
|
|
54
|
-
size: {
|
|
55
|
-
sm: "gap-3 p-4",
|
|
56
|
-
md: "gap-4 p-5",
|
|
57
|
-
lg: "gap-5 p-6"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
defaultVariants: { size: "md" }
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
var chartTitleVariants = cva("min-w-0 font-bold text-fg-primary", {
|
|
64
|
-
variants: {
|
|
65
|
-
size: {
|
|
66
|
-
sm: "text-gdt-md",
|
|
67
|
-
md: "text-gdt-lg",
|
|
68
|
-
lg: "text-gdt-h5"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
defaultVariants: { size: "md" }
|
|
72
|
-
});
|
|
73
|
-
var chartDescriptionVariants = cva("min-w-0 font-normal text-fg-secondary", {
|
|
74
|
-
variants: {
|
|
75
|
-
size: {
|
|
76
|
-
sm: "text-gdt-xs",
|
|
77
|
-
md: "text-gdt-sm",
|
|
78
|
-
lg: "text-gdt-sm"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
defaultVariants: { size: "md" }
|
|
82
|
-
});
|
|
83
|
-
var chartTooltipVariants = cva(
|
|
84
|
-
"flex flex-col bg-surface-overlay border border-line-subtle shadow-2",
|
|
85
|
-
{
|
|
86
|
-
variants: {
|
|
87
|
-
size: {
|
|
88
|
-
xs: "gap-0.5 rounded-md p-2",
|
|
89
|
-
sm: "gap-0.5 rounded-md p-2.5",
|
|
90
|
-
md: "gap-1 rounded-lg p-3",
|
|
91
|
-
lg: "gap-1 rounded-xl p-3.5"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
defaultVariants: {
|
|
95
|
-
size: "md"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
var chartTooltipDotVariants = cva("shrink-0 rounded-full", {
|
|
100
|
-
variants: {
|
|
101
|
-
size: {
|
|
102
|
-
xs: "size-1.5",
|
|
103
|
-
sm: "size-2",
|
|
104
|
-
md: "size-2.5",
|
|
105
|
-
lg: "size-2.5"
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
defaultVariants: {
|
|
109
|
-
size: "md"
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
var chartTooltipLabelVariants = cva("font-medium text-fg-secondary", {
|
|
113
|
-
variants: {
|
|
114
|
-
size: {
|
|
115
|
-
xs: "text-gdt-xs",
|
|
116
|
-
sm: "text-gdt-xs",
|
|
117
|
-
md: "text-gdt-sm",
|
|
118
|
-
lg: "text-gdt-sm"
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
defaultVariants: { size: "md" }
|
|
122
|
-
});
|
|
123
|
-
var chartTooltipValueVariants = cva(
|
|
124
|
-
"font-extrabold text-fg-primary tabular-nums",
|
|
125
|
-
{
|
|
126
|
-
variants: {
|
|
127
|
-
size: {
|
|
128
|
-
xs: "text-gdt-sm",
|
|
129
|
-
sm: "text-gdt-md",
|
|
130
|
-
md: "text-gdt-lg",
|
|
131
|
-
lg: "text-gdt-xl"
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
defaultVariants: { size: "md" }
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
var chartLegendItemVariants = cva(
|
|
138
|
-
"group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0",
|
|
139
|
-
{
|
|
140
|
-
variants: {
|
|
141
|
-
size: {
|
|
142
|
-
sm: "gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3",
|
|
143
|
-
md: "gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5"
|
|
144
|
-
},
|
|
145
|
-
interactive: {
|
|
146
|
-
true: "cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised",
|
|
147
|
-
false: ""
|
|
148
|
-
},
|
|
149
|
-
inactive: {
|
|
150
|
-
true: "text-fg-caption-placeholder line-through",
|
|
151
|
-
false: ""
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
defaultVariants: {
|
|
155
|
-
size: "md",
|
|
156
|
-
interactive: false,
|
|
157
|
-
inactive: false
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
var chartLegendMarkerSizeVariants = cva("shrink-0", {
|
|
162
|
-
variants: {
|
|
163
|
-
marker: {
|
|
164
|
-
dot: "rounded-full",
|
|
165
|
-
square: "rounded-[2px]",
|
|
166
|
-
line: "rounded-full"
|
|
167
|
-
},
|
|
168
|
-
size: {
|
|
169
|
-
sm: "",
|
|
170
|
-
md: ""
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
compoundVariants: [
|
|
174
|
-
{ marker: ["dot", "square"], size: "sm", className: "size-2" },
|
|
175
|
-
{ marker: ["dot", "square"], size: "md", className: "size-2.5" },
|
|
176
|
-
{ marker: "line", size: "sm", className: "h-[3px] w-3" },
|
|
177
|
-
{ marker: "line", size: "md", className: "h-[3px] w-3.5" }
|
|
178
|
-
],
|
|
179
|
-
defaultVariants: { marker: "dot", size: "md" }
|
|
180
|
-
});
|
|
181
|
-
function cartesianAxisProps(layout) {
|
|
182
|
-
const tick = { fontSize: layout.tickFontSize };
|
|
183
|
-
return {
|
|
184
|
-
xAxis: {
|
|
185
|
-
tickLine: false,
|
|
186
|
-
axisLine: false,
|
|
187
|
-
tickMargin: layout.tickMargin,
|
|
188
|
-
tick
|
|
189
|
-
},
|
|
190
|
-
yAxis: {
|
|
191
|
-
tickLine: false,
|
|
192
|
-
axisLine: false,
|
|
193
|
-
width: layout.yAxisWidth,
|
|
194
|
-
tick
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// src/components/ui/bar-chart.tsx
|
|
200
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
16
|
+
import {
|
|
17
|
+
Bar,
|
|
18
|
+
BarChart as BarChartPrimitive,
|
|
19
|
+
CartesianGrid,
|
|
20
|
+
XAxis,
|
|
21
|
+
YAxis
|
|
22
|
+
} from "recharts";
|
|
23
|
+
import { jsx } from "react/jsx-runtime";
|
|
24
|
+
var BAR_CHART_PALETTE = [
|
|
25
|
+
"var(--color-chart-1)",
|
|
26
|
+
"var(--color-chart-2)",
|
|
27
|
+
"var(--color-chart-3)"
|
|
28
|
+
];
|
|
29
|
+
var DEFAULT_SERIES_COLOR = BAR_CHART_PALETTE[0];
|
|
201
30
|
var BAR_CHART_LAYOUT = {
|
|
202
31
|
sm: {
|
|
203
32
|
height: 180,
|
|
@@ -236,32 +65,116 @@ var BAR_CHART_LAYOUT = {
|
|
|
236
65
|
tickMargin: 10
|
|
237
66
|
}
|
|
238
67
|
};
|
|
239
|
-
|
|
240
|
-
|
|
68
|
+
var BarChartContext = React.createContext(null);
|
|
69
|
+
function useBarChartOrientation(orientation) {
|
|
70
|
+
const context = React.useContext(BarChartContext);
|
|
71
|
+
return orientation ?? context?.orientation ?? "vertical";
|
|
72
|
+
}
|
|
73
|
+
function barChartAxisProps(layout) {
|
|
241
74
|
const axes = cartesianAxisProps(layout);
|
|
75
|
+
const tick = {
|
|
76
|
+
...axes.xAxis.tick,
|
|
77
|
+
fill: "var(--color-fg-caption-placeholder)"
|
|
78
|
+
};
|
|
242
79
|
return {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
},
|
|
247
|
-
chart: {
|
|
248
|
-
accessibilityLayer: true,
|
|
249
|
-
margin: layout.margin,
|
|
250
|
-
barCategoryGap: layout.barCategoryGap,
|
|
251
|
-
barGap: layout.barGap
|
|
80
|
+
xAxis: {
|
|
81
|
+
...axes.xAxis,
|
|
82
|
+
tick
|
|
252
83
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
radius: [layout.barRadius, layout.barRadius, 0, 0],
|
|
257
|
-
maxBarSize: layout.maxBarSize
|
|
84
|
+
yAxis: {
|
|
85
|
+
...axes.yAxis,
|
|
86
|
+
tick
|
|
258
87
|
}
|
|
259
88
|
};
|
|
260
89
|
}
|
|
261
|
-
function
|
|
90
|
+
function BarChart({
|
|
91
|
+
config = {},
|
|
92
|
+
size,
|
|
93
|
+
className,
|
|
94
|
+
children,
|
|
262
95
|
orientation = "vertical",
|
|
96
|
+
layout,
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
const resolvedSize = useComponentSize(size);
|
|
100
|
+
const chartLayout = BAR_CHART_LAYOUT[resolvedSize];
|
|
101
|
+
const rechartsLayout = layout ?? (orientation === "horizontal" ? "vertical" : "horizontal");
|
|
102
|
+
return /* @__PURE__ */ jsx(SizeProvider, { size: resolvedSize, children: /* @__PURE__ */ jsx(BarChartContext.Provider, { value: { orientation }, children: /* @__PURE__ */ jsx(
|
|
103
|
+
ChartContainer,
|
|
104
|
+
{
|
|
105
|
+
config,
|
|
106
|
+
className: cn("aspect-auto w-full", className),
|
|
107
|
+
style: { height: chartLayout.height },
|
|
108
|
+
children: /* @__PURE__ */ jsx(
|
|
109
|
+
BarChartPrimitive,
|
|
110
|
+
{
|
|
111
|
+
accessibilityLayer: true,
|
|
112
|
+
margin: chartLayout.margin,
|
|
113
|
+
barCategoryGap: chartLayout.barCategoryGap,
|
|
114
|
+
barGap: chartLayout.barGap,
|
|
115
|
+
layout: rechartsLayout,
|
|
116
|
+
...props,
|
|
117
|
+
children
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
) }) });
|
|
122
|
+
}
|
|
123
|
+
function BarChartGrid(props) {
|
|
124
|
+
return /* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: "var(--color-line)", ...props });
|
|
125
|
+
}
|
|
126
|
+
function BarChartXAxis({ size, tick, ...props }) {
|
|
127
|
+
const layout = BAR_CHART_LAYOUT[useComponentSize(size)];
|
|
128
|
+
const axes = barChartAxisProps(layout);
|
|
129
|
+
return /* @__PURE__ */ jsx(
|
|
130
|
+
XAxis,
|
|
131
|
+
{
|
|
132
|
+
tickLine: axes.xAxis.tickLine,
|
|
133
|
+
axisLine: axes.xAxis.axisLine,
|
|
134
|
+
tickMargin: axes.xAxis.tickMargin,
|
|
135
|
+
tick: tick ?? axes.xAxis.tick,
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function BarChartYAxis({ size, tick, ...props }) {
|
|
141
|
+
const layout = BAR_CHART_LAYOUT[useComponentSize(size)];
|
|
142
|
+
const axes = barChartAxisProps(layout);
|
|
143
|
+
return /* @__PURE__ */ jsx(
|
|
144
|
+
YAxis,
|
|
145
|
+
{
|
|
146
|
+
tickLine: axes.yAxis.tickLine,
|
|
147
|
+
axisLine: axes.yAxis.axisLine,
|
|
148
|
+
width: axes.yAxis.width,
|
|
149
|
+
tick: tick ?? axes.yAxis.tick,
|
|
150
|
+
...props
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function BarChartSeries({
|
|
155
|
+
color = DEFAULT_SERIES_COLOR,
|
|
156
|
+
size,
|
|
157
|
+
orientation,
|
|
158
|
+
...props
|
|
159
|
+
}) {
|
|
160
|
+
const layout = BAR_CHART_LAYOUT[useComponentSize(size)];
|
|
161
|
+
const resolvedOrientation = useBarChartOrientation(orientation);
|
|
162
|
+
const radius = resolvedOrientation === "horizontal" ? [0, layout.barRadius, layout.barRadius, 0] : [layout.barRadius, layout.barRadius, 0, 0];
|
|
163
|
+
return /* @__PURE__ */ jsx(
|
|
164
|
+
Bar,
|
|
165
|
+
{
|
|
166
|
+
fill: color,
|
|
167
|
+
radius,
|
|
168
|
+
maxBarSize: layout.maxBarSize,
|
|
169
|
+
...props
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function BarValueLabel({
|
|
174
|
+
orientation,
|
|
263
175
|
fontSize,
|
|
264
176
|
formatter,
|
|
177
|
+
size,
|
|
265
178
|
className,
|
|
266
179
|
x,
|
|
267
180
|
y,
|
|
@@ -269,7 +182,8 @@ function BarValueLabel({
|
|
|
269
182
|
height,
|
|
270
183
|
value
|
|
271
184
|
}) {
|
|
272
|
-
const
|
|
185
|
+
const resolvedOrientation = useBarChartOrientation(orientation);
|
|
186
|
+
const valueFontSize = BAR_CHART_LAYOUT[useComponentSize(size)].valueFontSize;
|
|
273
187
|
if (value == null || x == null || y == null || width == null) {
|
|
274
188
|
return null;
|
|
275
189
|
}
|
|
@@ -278,10 +192,13 @@ function BarValueLabel({
|
|
|
278
192
|
const numWidth = Number(width);
|
|
279
193
|
const numHeight = Number(height ?? 0);
|
|
280
194
|
const gap = 6;
|
|
281
|
-
|
|
195
|
+
if (!Number.isFinite(numX) || !Number.isFinite(numY) || !Number.isFinite(numWidth) || !Number.isFinite(numHeight)) {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
const isHorizontal = resolvedOrientation === "horizontal";
|
|
282
199
|
const labelX = isHorizontal ? numX + numWidth + gap : numX + numWidth / 2;
|
|
283
200
|
const labelY = isHorizontal ? numY + numHeight / 2 : numY - gap;
|
|
284
|
-
return /* @__PURE__ */
|
|
201
|
+
return /* @__PURE__ */ jsx(
|
|
285
202
|
"text",
|
|
286
203
|
{
|
|
287
204
|
x: labelX,
|
|
@@ -296,7 +213,12 @@ function BarValueLabel({
|
|
|
296
213
|
}
|
|
297
214
|
export {
|
|
298
215
|
BAR_CHART_LAYOUT,
|
|
299
|
-
|
|
300
|
-
|
|
216
|
+
BAR_CHART_PALETTE,
|
|
217
|
+
BarChart,
|
|
218
|
+
BarChartGrid,
|
|
219
|
+
BarChartSeries,
|
|
220
|
+
BarChartXAxis,
|
|
221
|
+
BarChartYAxis,
|
|
222
|
+
BarValueLabel
|
|
301
223
|
};
|
|
302
224
|
//# sourceMappingURL=bar-chart.js.map
|