@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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
+
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
type GalleryIndicatorSize = "sm" | "md" | "lg";
|
|
6
|
+
declare const galleryIndicatorVariants: (props?: ({
|
|
7
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
type GalleryIndicatorProps = React.ComponentProps<"span"> & VariantProps<typeof galleryIndicatorVariants> & {
|
|
10
|
+
photoCount?: number;
|
|
11
|
+
currentPhoto?: number;
|
|
12
|
+
totalPhotos?: number;
|
|
13
|
+
label?: string;
|
|
14
|
+
};
|
|
15
|
+
declare function GalleryIndicatorIcon(props: React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
|
16
|
+
declare function GalleryIndicator({ className, size, photoCount, currentPhoto, totalPhotos, label, children, ...props }: GalleryIndicatorProps): React.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { GalleryIndicator, GalleryIndicatorIcon, type GalleryIndicatorProps, type GalleryIndicatorSize, galleryIndicatorVariants };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GalleryIndicator,
|
|
3
|
+
GalleryIndicatorIcon,
|
|
4
|
+
galleryIndicatorVariants
|
|
5
|
+
} from "./chunk-UJJNLGTM.js";
|
|
6
|
+
import "./chunk-Y4TTYVNE.js";
|
|
7
|
+
export {
|
|
8
|
+
GalleryIndicator,
|
|
9
|
+
GalleryIndicatorIcon,
|
|
10
|
+
galleryIndicatorVariants
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=gallery-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartCard } from './chart.js';
|
|
3
|
+
import { ComponentSize } from './size-context.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import 'class-variance-authority';
|
|
6
|
+
import 'recharts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A heatmap — a row × column grid encoding magnitude as fill intensity.
|
|
10
|
+
* Reach for one to compare a measure across two categorical dimensions at a
|
|
11
|
+
* glance (listing inquiries by neighbourhood and month, traffic by day and
|
|
12
|
+
* hour, repayment rate by branch and quarter).
|
|
13
|
+
*
|
|
14
|
+
* Unlike the other charts in this folder it is not built on recharts
|
|
15
|
+
* (recharts has no heatmap/matrix primitive); it is a CSS grid of cells, a
|
|
16
|
+
* hover/focus tooltip per cell, and an optional sequential-scale legend. It
|
|
17
|
+
* stays size-aware via the shared `SizeProvider` and reuses `ChartCard`.
|
|
18
|
+
*
|
|
19
|
+
* Color encodes magnitude, so cells are `--color-surface-brand` at a
|
|
20
|
+
* magnitude-scaled opacity (8/22/44/70/100%) rather than a distinct hue per
|
|
21
|
+
* bucket — the brand token already flips per theme, so the ramp stays
|
|
22
|
+
* correct in both without a separate token set. Never the categorical
|
|
23
|
+
* `chart-1`…`3` tokens, which encode identity, not amount.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* <HeatmapChart
|
|
27
|
+
* data={[
|
|
28
|
+
* { row: "Lekki", column: "Jan", value: 42 },
|
|
29
|
+
* { row: "Lekki", column: "Feb", value: 58 },
|
|
30
|
+
* { row: "Yaba", column: "Jan", value: 21 },
|
|
31
|
+
* { row: "Yaba", column: "Feb", value: 30 },
|
|
32
|
+
* ]}
|
|
33
|
+
* title="Listing inquiries"
|
|
34
|
+
* description="By neighbourhood · Jan–Feb 2026"
|
|
35
|
+
* />
|
|
36
|
+
*/
|
|
37
|
+
/** Heatmap sizes line up with the three shared `ComponentSize` values. */
|
|
38
|
+
type HeatmapChartSize = ComponentSize;
|
|
39
|
+
type HeatmapChartCellDatum = {
|
|
40
|
+
/** Row category label. */
|
|
41
|
+
row: string;
|
|
42
|
+
/** Column category label. */
|
|
43
|
+
column: string;
|
|
44
|
+
/** Magnitude driving the cell's fill. Omit the datum entirely for "no data". */
|
|
45
|
+
value: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Sequential fill ramp — `--color-surface-brand` (already theme-aware) at five
|
|
49
|
+
* magnitude-scaled opacity stops: 8%, 22%, 44%, 70%, 100%. Index 0 is the
|
|
50
|
+
* lowest magnitude bucket, index 4 the highest — assign by bucket order,
|
|
51
|
+
* never by an arbitrary opacity pick. Relative color syntax (`rgb(from … / a)`)
|
|
52
|
+
* keeps each stop a true alpha over whatever surface it sits on, matching the
|
|
53
|
+
* shadow/gradient tokens in `styles/giddaa.css`.
|
|
54
|
+
*/
|
|
55
|
+
declare const HEATMAP_CHART_PALETTE: readonly ["rgb(from var(--color-surface-brand) r g b / 0.08)", "rgb(from var(--color-surface-brand) r g b / 0.22)", "rgb(from var(--color-surface-brand) r g b / 0.44)", "rgb(from var(--color-surface-brand) r g b / 0.7)", "rgb(from var(--color-surface-brand) r g b / 1)"];
|
|
56
|
+
type HeatmapChartLayout = {
|
|
57
|
+
/** Width/height of a single (square) cell in px. */
|
|
58
|
+
cellSize: number;
|
|
59
|
+
/** Gap between cells in px. */
|
|
60
|
+
gap: number;
|
|
61
|
+
/** Reserved width for row labels in px. */
|
|
62
|
+
rowLabelWidth: number;
|
|
63
|
+
/** Reserved height for the column header row in px. */
|
|
64
|
+
columnLabelHeight: number;
|
|
65
|
+
/** Row/column label font size in px. */
|
|
66
|
+
labelFontSize: number;
|
|
67
|
+
/** In-cell value label font size in px. */
|
|
68
|
+
valueFontSize: number;
|
|
69
|
+
/** Width of a single legend ramp swatch in px. */
|
|
70
|
+
legendSwatchSize: number;
|
|
71
|
+
};
|
|
72
|
+
declare const HEATMAP_CHART_LAYOUT: Record<HeatmapChartSize, HeatmapChartLayout>;
|
|
73
|
+
type HeatmapChartProps = Omit<React.ComponentProps<typeof ChartCard>, "size" | "children"> & {
|
|
74
|
+
/** Cells — one entry per row/column pair that has a value. */
|
|
75
|
+
data: HeatmapChartCellDatum[];
|
|
76
|
+
/** Row order, top to bottom. Defaults to first-seen order in `data`. */
|
|
77
|
+
rows?: string[];
|
|
78
|
+
/** Column order, left to right. Defaults to first-seen order in `data`. */
|
|
79
|
+
columns?: string[];
|
|
80
|
+
/** Fixed `[min, max]` for the color scale. Defaults to the data's range. */
|
|
81
|
+
domain?: [number, number];
|
|
82
|
+
/** Explicit size; otherwise inherited from the nearest `SizeProvider`. */
|
|
83
|
+
size?: HeatmapChartSize;
|
|
84
|
+
/** Chart heading. Omit to hide the title. */
|
|
85
|
+
title?: React.ReactNode;
|
|
86
|
+
/** Supporting metadata (period, source). Omit to hide the description. */
|
|
87
|
+
description?: React.ReactNode;
|
|
88
|
+
/** Show the sequential-scale legend under the grid. Default true. */
|
|
89
|
+
legend?: boolean;
|
|
90
|
+
/** Print the formatted value inside every cell. Default false — the
|
|
91
|
+
* hover/focus tooltip carries exact figures without crowding the grid. */
|
|
92
|
+
showValues?: boolean;
|
|
93
|
+
/** Format a cell value for the tooltip, legend, and in-cell label. */
|
|
94
|
+
valueFormatter?: (value: number) => string;
|
|
95
|
+
};
|
|
96
|
+
declare function HeatmapChart({ data, rows: rowsProp, columns: columnsProp, domain: domainProp, size, title, description, legend, showValues, valueFormatter, className, ...props }: HeatmapChartProps): React.JSX.Element;
|
|
97
|
+
|
|
98
|
+
export { HEATMAP_CHART_LAYOUT, HEATMAP_CHART_PALETTE, HeatmapChart, type HeatmapChartCellDatum, type HeatmapChartLayout, type HeatmapChartProps, type HeatmapChartSize };
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ChartCard,
|
|
4
|
+
ChartDescription,
|
|
5
|
+
ChartHeader,
|
|
6
|
+
ChartTitle
|
|
7
|
+
} from "./chunk-NOFXVRWL.js";
|
|
8
|
+
import {
|
|
9
|
+
useComponentSize
|
|
10
|
+
} from "./chunk-HL3ZSYES.js";
|
|
11
|
+
import "./chunk-Y4TTYVNE.js";
|
|
12
|
+
|
|
13
|
+
// src/heatmap-chart.tsx
|
|
14
|
+
import { Fragment } from "react";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var HEATMAP_CHART_PALETTE = [
|
|
17
|
+
"rgb(from var(--color-surface-brand) r g b / 0.08)",
|
|
18
|
+
"rgb(from var(--color-surface-brand) r g b / 0.22)",
|
|
19
|
+
"rgb(from var(--color-surface-brand) r g b / 0.44)",
|
|
20
|
+
"rgb(from var(--color-surface-brand) r g b / 0.7)",
|
|
21
|
+
"rgb(from var(--color-surface-brand) r g b / 1)"
|
|
22
|
+
];
|
|
23
|
+
var HEATMAP_CHART_LAYOUT = {
|
|
24
|
+
sm: {
|
|
25
|
+
cellSize: 20,
|
|
26
|
+
gap: 3,
|
|
27
|
+
rowLabelWidth: 64,
|
|
28
|
+
columnLabelHeight: 20,
|
|
29
|
+
labelFontSize: 10,
|
|
30
|
+
valueFontSize: 9,
|
|
31
|
+
legendSwatchSize: 14
|
|
32
|
+
},
|
|
33
|
+
md: {
|
|
34
|
+
cellSize: 26,
|
|
35
|
+
gap: 3,
|
|
36
|
+
rowLabelWidth: 80,
|
|
37
|
+
columnLabelHeight: 22,
|
|
38
|
+
labelFontSize: 11,
|
|
39
|
+
valueFontSize: 10,
|
|
40
|
+
legendSwatchSize: 16
|
|
41
|
+
},
|
|
42
|
+
lg: {
|
|
43
|
+
cellSize: 32,
|
|
44
|
+
gap: 4,
|
|
45
|
+
rowLabelWidth: 96,
|
|
46
|
+
columnLabelHeight: 24,
|
|
47
|
+
labelFontSize: 12,
|
|
48
|
+
valueFontSize: 11,
|
|
49
|
+
legendSwatchSize: 18
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function cellKey(row, column) {
|
|
53
|
+
return `${row}\u241F${column}`;
|
|
54
|
+
}
|
|
55
|
+
function heatmapStep(value, domain) {
|
|
56
|
+
const [min, max] = domain;
|
|
57
|
+
if (max <= min) return HEATMAP_CHART_PALETTE.length;
|
|
58
|
+
const ratio = (value - min) / (max - min);
|
|
59
|
+
const step = Math.ceil(ratio * HEATMAP_CHART_PALETTE.length);
|
|
60
|
+
return Math.min(HEATMAP_CHART_PALETTE.length, Math.max(1, step));
|
|
61
|
+
}
|
|
62
|
+
function HeatmapChart({
|
|
63
|
+
data,
|
|
64
|
+
rows: rowsProp,
|
|
65
|
+
columns: columnsProp,
|
|
66
|
+
domain: domainProp,
|
|
67
|
+
size,
|
|
68
|
+
title,
|
|
69
|
+
description,
|
|
70
|
+
legend = true,
|
|
71
|
+
showValues = false,
|
|
72
|
+
valueFormatter = (value) => value.toLocaleString("en-NG"),
|
|
73
|
+
className,
|
|
74
|
+
...props
|
|
75
|
+
}) {
|
|
76
|
+
const resolvedSize = useComponentSize(size);
|
|
77
|
+
const layout = HEATMAP_CHART_LAYOUT[resolvedSize];
|
|
78
|
+
const rows = rowsProp ?? Array.from(new Set(data.map((d) => d.row)));
|
|
79
|
+
const columns = columnsProp ?? Array.from(new Set(data.map((d) => d.column)));
|
|
80
|
+
const valuesByKey = new Map(
|
|
81
|
+
data.map((datum) => [cellKey(datum.row, datum.column), datum.value])
|
|
82
|
+
);
|
|
83
|
+
const values = data.map((datum) => datum.value);
|
|
84
|
+
const domain = domainProp ?? [
|
|
85
|
+
values.length ? Math.min(...values) : 0,
|
|
86
|
+
values.length ? Math.max(...values) : 1
|
|
87
|
+
];
|
|
88
|
+
return /* @__PURE__ */ jsxs(ChartCard, { size: resolvedSize, className, ...props, children: [
|
|
89
|
+
(title != null || description != null) && /* @__PURE__ */ jsxs(ChartHeader, { children: [
|
|
90
|
+
title != null && /* @__PURE__ */ jsx(ChartTitle, { children: title }),
|
|
91
|
+
description != null && /* @__PURE__ */ jsx(ChartDescription, { children: description })
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
94
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: "inline-grid",
|
|
98
|
+
style: {
|
|
99
|
+
gridTemplateColumns: `${layout.rowLabelWidth}px repeat(${columns.length}, ${layout.cellSize}px)`,
|
|
100
|
+
gap: layout.gap
|
|
101
|
+
},
|
|
102
|
+
children: [
|
|
103
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
|
|
104
|
+
columns.map((column) => /* @__PURE__ */ jsx(
|
|
105
|
+
"span",
|
|
106
|
+
{
|
|
107
|
+
className: "flex items-end justify-center truncate px-0.5 pb-1 text-fg-secondary",
|
|
108
|
+
style: {
|
|
109
|
+
fontSize: layout.labelFontSize,
|
|
110
|
+
height: layout.columnLabelHeight
|
|
111
|
+
},
|
|
112
|
+
title: column,
|
|
113
|
+
children: column
|
|
114
|
+
},
|
|
115
|
+
column
|
|
116
|
+
)),
|
|
117
|
+
rows.map((row) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
"span",
|
|
120
|
+
{
|
|
121
|
+
className: "flex items-center truncate pr-2 text-fg-secondary",
|
|
122
|
+
style: {
|
|
123
|
+
fontSize: layout.labelFontSize,
|
|
124
|
+
height: layout.cellSize
|
|
125
|
+
},
|
|
126
|
+
title: row,
|
|
127
|
+
children: row
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
columns.map((column) => /* @__PURE__ */ jsx(
|
|
131
|
+
HeatmapChartCell,
|
|
132
|
+
{
|
|
133
|
+
row,
|
|
134
|
+
column,
|
|
135
|
+
value: valuesByKey.get(cellKey(row, column)),
|
|
136
|
+
domain,
|
|
137
|
+
layout,
|
|
138
|
+
showValue: showValues,
|
|
139
|
+
valueFormatter
|
|
140
|
+
},
|
|
141
|
+
column
|
|
142
|
+
))
|
|
143
|
+
] }, row))
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
) }),
|
|
147
|
+
legend && /* @__PURE__ */ jsx(
|
|
148
|
+
HeatmapChartLegend,
|
|
149
|
+
{
|
|
150
|
+
domain,
|
|
151
|
+
layout,
|
|
152
|
+
valueFormatter
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
] })
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
function HeatmapChartCell({
|
|
159
|
+
row,
|
|
160
|
+
column,
|
|
161
|
+
value,
|
|
162
|
+
domain,
|
|
163
|
+
layout,
|
|
164
|
+
showValue,
|
|
165
|
+
valueFormatter
|
|
166
|
+
}) {
|
|
167
|
+
if (value == null) {
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
169
|
+
"span",
|
|
170
|
+
{
|
|
171
|
+
className: "rounded-[4px] border border-line-subtle border-dashed",
|
|
172
|
+
style: { width: layout.cellSize, height: layout.cellSize },
|
|
173
|
+
title: `${row} \xB7 ${column}: no data`
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
const step = heatmapStep(value, domain);
|
|
178
|
+
const color = HEATMAP_CHART_PALETTE[step - 1];
|
|
179
|
+
const formatted = valueFormatter(value);
|
|
180
|
+
const label = `${row} \xB7 ${column}: ${formatted}`;
|
|
181
|
+
const textColor = step >= 4 ? "var(--color-fg-on-brand)" : "var(--color-fg-primary)";
|
|
182
|
+
return /* @__PURE__ */ jsxs(
|
|
183
|
+
"button",
|
|
184
|
+
{
|
|
185
|
+
type: "button",
|
|
186
|
+
className: "group/cell relative flex items-center justify-center rounded-[4px] outline-none focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)]",
|
|
187
|
+
style: {
|
|
188
|
+
width: layout.cellSize,
|
|
189
|
+
height: layout.cellSize,
|
|
190
|
+
backgroundColor: color
|
|
191
|
+
},
|
|
192
|
+
"aria-label": label,
|
|
193
|
+
children: [
|
|
194
|
+
showValue && /* @__PURE__ */ jsx(
|
|
195
|
+
"span",
|
|
196
|
+
{
|
|
197
|
+
className: "pointer-events-none tabular-nums",
|
|
198
|
+
style: { fontSize: layout.valueFontSize, color: textColor },
|
|
199
|
+
children: formatted
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
203
|
+
"span",
|
|
204
|
+
{
|
|
205
|
+
role: "tooltip",
|
|
206
|
+
className: "pointer-events-none absolute bottom-full left-1/2 z-10 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded-md border border-line-subtle bg-surface-overlay px-2 py-1 text-fg-primary text-gdt-xs opacity-0 shadow-2 transition-opacity group-hover/cell:opacity-100 group-focus-visible/cell:opacity-100",
|
|
207
|
+
children: label
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
function HeatmapChartLegend({
|
|
215
|
+
domain,
|
|
216
|
+
layout,
|
|
217
|
+
valueFormatter
|
|
218
|
+
}) {
|
|
219
|
+
return /* @__PURE__ */ jsxs(
|
|
220
|
+
"div",
|
|
221
|
+
{
|
|
222
|
+
className: "flex items-center gap-2 text-fg-caption-placeholder",
|
|
223
|
+
style: { fontSize: layout.labelFontSize },
|
|
224
|
+
children: [
|
|
225
|
+
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: valueFormatter(domain[0]) }),
|
|
226
|
+
/* @__PURE__ */ jsx("div", { className: "flex overflow-hidden rounded-[3px]", children: HEATMAP_CHART_PALETTE.map((color) => /* @__PURE__ */ jsx(
|
|
227
|
+
"span",
|
|
228
|
+
{
|
|
229
|
+
"aria-hidden": "true",
|
|
230
|
+
style: {
|
|
231
|
+
backgroundColor: color,
|
|
232
|
+
width: layout.legendSwatchSize,
|
|
233
|
+
height: layout.legendSwatchSize / 2
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
color
|
|
237
|
+
)) }),
|
|
238
|
+
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: valueFormatter(domain[1]) })
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
export {
|
|
244
|
+
HEATMAP_CHART_LAYOUT,
|
|
245
|
+
HEATMAP_CHART_PALETTE,
|
|
246
|
+
HeatmapChart
|
|
247
|
+
};
|
|
248
|
+
//# sourceMappingURL=heatmap-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/heatmap-chart.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport { Fragment } from \"react\";\nimport { ChartCard, ChartDescription, ChartHeader, ChartTitle } from \"./chart\";\nimport { type ComponentSize, useComponentSize } from \"./size-context\";\n\n/**\n * A heatmap — a row × column grid encoding magnitude as fill intensity.\n * Reach for one to compare a measure across two categorical dimensions at a\n * glance (listing inquiries by neighbourhood and month, traffic by day and\n * hour, repayment rate by branch and quarter).\n *\n * Unlike the other charts in this folder it is not built on recharts\n * (recharts has no heatmap/matrix primitive); it is a CSS grid of cells, a\n * hover/focus tooltip per cell, and an optional sequential-scale legend. It\n * stays size-aware via the shared `SizeProvider` and reuses `ChartCard`.\n *\n * Color encodes magnitude, so cells are `--color-surface-brand` at a\n * magnitude-scaled opacity (8/22/44/70/100%) rather than a distinct hue per\n * bucket — the brand token already flips per theme, so the ramp stays\n * correct in both without a separate token set. Never the categorical\n * `chart-1`…`3` tokens, which encode identity, not amount.\n *\n * @example\n * <HeatmapChart\n * data={[\n * { row: \"Lekki\", column: \"Jan\", value: 42 },\n * { row: \"Lekki\", column: \"Feb\", value: 58 },\n * { row: \"Yaba\", column: \"Jan\", value: 21 },\n * { row: \"Yaba\", column: \"Feb\", value: 30 },\n * ]}\n * title=\"Listing inquiries\"\n * description=\"By neighbourhood · Jan–Feb 2026\"\n * />\n */\n\n/** Heatmap sizes line up with the three shared `ComponentSize` values. */\ntype HeatmapChartSize = ComponentSize;\n\ntype HeatmapChartCellDatum = {\n\t/** Row category label. */\n\trow: string;\n\t/** Column category label. */\n\tcolumn: string;\n\t/** Magnitude driving the cell's fill. Omit the datum entirely for \"no data\". */\n\tvalue: number;\n};\n\n/**\n * Sequential fill ramp — `--color-surface-brand` (already theme-aware) at five\n * magnitude-scaled opacity stops: 8%, 22%, 44%, 70%, 100%. Index 0 is the\n * lowest magnitude bucket, index 4 the highest — assign by bucket order,\n * never by an arbitrary opacity pick. Relative color syntax (`rgb(from … / a)`)\n * keeps each stop a true alpha over whatever surface it sits on, matching the\n * shadow/gradient tokens in `styles/giddaa.css`.\n */\nconst HEATMAP_CHART_PALETTE = [\n\t\"rgb(from var(--color-surface-brand) r g b / 0.08)\",\n\t\"rgb(from var(--color-surface-brand) r g b / 0.22)\",\n\t\"rgb(from var(--color-surface-brand) r g b / 0.44)\",\n\t\"rgb(from var(--color-surface-brand) r g b / 0.7)\",\n\t\"rgb(from var(--color-surface-brand) r g b / 1)\",\n] as const;\n\ntype HeatmapChartLayout = {\n\t/** Width/height of a single (square) cell in px. */\n\tcellSize: number;\n\t/** Gap between cells in px. */\n\tgap: number;\n\t/** Reserved width for row labels in px. */\n\trowLabelWidth: number;\n\t/** Reserved height for the column header row in px. */\n\tcolumnLabelHeight: number;\n\t/** Row/column label font size in px. */\n\tlabelFontSize: number;\n\t/** In-cell value label font size in px. */\n\tvalueFontSize: number;\n\t/** Width of a single legend ramp swatch in px. */\n\tlegendSwatchSize: number;\n};\n\nconst HEATMAP_CHART_LAYOUT: Record<HeatmapChartSize, HeatmapChartLayout> = {\n\tsm: {\n\t\tcellSize: 20,\n\t\tgap: 3,\n\t\trowLabelWidth: 64,\n\t\tcolumnLabelHeight: 20,\n\t\tlabelFontSize: 10,\n\t\tvalueFontSize: 9,\n\t\tlegendSwatchSize: 14,\n\t},\n\tmd: {\n\t\tcellSize: 26,\n\t\tgap: 3,\n\t\trowLabelWidth: 80,\n\t\tcolumnLabelHeight: 22,\n\t\tlabelFontSize: 11,\n\t\tvalueFontSize: 10,\n\t\tlegendSwatchSize: 16,\n\t},\n\tlg: {\n\t\tcellSize: 32,\n\t\tgap: 4,\n\t\trowLabelWidth: 96,\n\t\tcolumnLabelHeight: 24,\n\t\tlabelFontSize: 12,\n\t\tvalueFontSize: 11,\n\t\tlegendSwatchSize: 18,\n\t},\n};\n\n/** Joins a row/column pair into a stable lookup key. */\nfunction cellKey(row: string, column: string) {\n\treturn `${row}␟${column}`;\n}\n\n/** Buckets a value into one of the five palette steps (1 = lowest, 5 = highest). */\nfunction heatmapStep(value: number, domain: readonly [number, number]) {\n\tconst [min, max] = domain;\n\tif (max <= min) return HEATMAP_CHART_PALETTE.length;\n\tconst ratio = (value - min) / (max - min);\n\tconst step = Math.ceil(ratio * HEATMAP_CHART_PALETTE.length);\n\treturn Math.min(HEATMAP_CHART_PALETTE.length, Math.max(1, step));\n}\n\ntype HeatmapChartProps = Omit<\n\tReact.ComponentProps<typeof ChartCard>,\n\t\"size\" | \"children\"\n> & {\n\t/** Cells — one entry per row/column pair that has a value. */\n\tdata: HeatmapChartCellDatum[];\n\t/** Row order, top to bottom. Defaults to first-seen order in `data`. */\n\trows?: string[];\n\t/** Column order, left to right. Defaults to first-seen order in `data`. */\n\tcolumns?: string[];\n\t/** Fixed `[min, max]` for the color scale. Defaults to the data's range. */\n\tdomain?: [number, number];\n\t/** Explicit size; otherwise inherited from the nearest `SizeProvider`. */\n\tsize?: HeatmapChartSize;\n\t/** Chart heading. Omit to hide the title. */\n\ttitle?: React.ReactNode;\n\t/** Supporting metadata (period, source). Omit to hide the description. */\n\tdescription?: React.ReactNode;\n\t/** Show the sequential-scale legend under the grid. Default true. */\n\tlegend?: boolean;\n\t/** Print the formatted value inside every cell. Default false — the\n\t * hover/focus tooltip carries exact figures without crowding the grid. */\n\tshowValues?: boolean;\n\t/** Format a cell value for the tooltip, legend, and in-cell label. */\n\tvalueFormatter?: (value: number) => string;\n};\n\nfunction HeatmapChart({\n\tdata,\n\trows: rowsProp,\n\tcolumns: columnsProp,\n\tdomain: domainProp,\n\tsize,\n\ttitle,\n\tdescription,\n\tlegend = true,\n\tshowValues = false,\n\tvalueFormatter = (value) => value.toLocaleString(\"en-NG\"),\n\tclassName,\n\t...props\n}: HeatmapChartProps) {\n\tconst resolvedSize = useComponentSize(size);\n\tconst layout = HEATMAP_CHART_LAYOUT[resolvedSize];\n\n\tconst rows = rowsProp ?? Array.from(new Set(data.map((d) => d.row)));\n\tconst columns = columnsProp ?? Array.from(new Set(data.map((d) => d.column)));\n\n\tconst valuesByKey = new Map(\n\t\tdata.map((datum) => [cellKey(datum.row, datum.column), datum.value]),\n\t);\n\n\tconst values = data.map((datum) => datum.value);\n\tconst domain: [number, number] = domainProp ?? [\n\t\tvalues.length ? Math.min(...values) : 0,\n\t\tvalues.length ? Math.max(...values) : 1,\n\t];\n\n\treturn (\n\t\t<ChartCard size={resolvedSize} className={className} {...props}>\n\t\t\t{(title != null || description != null) && (\n\t\t\t\t<ChartHeader>\n\t\t\t\t\t{title != null && <ChartTitle>{title}</ChartTitle>}\n\t\t\t\t\t{description != null && (\n\t\t\t\t\t\t<ChartDescription>{description}</ChartDescription>\n\t\t\t\t\t)}\n\t\t\t\t</ChartHeader>\n\t\t\t)}\n\t\t\t<div className=\"flex flex-col gap-3\">\n\t\t\t\t<div className=\"overflow-x-auto\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"inline-grid\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tgridTemplateColumns: `${layout.rowLabelWidth}px repeat(${columns.length}, ${layout.cellSize}px)`,\n\t\t\t\t\t\t\tgap: layout.gap,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span aria-hidden=\"true\" />\n\t\t\t\t\t\t{columns.map((column) => (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tkey={column}\n\t\t\t\t\t\t\t\tclassName=\"flex items-end justify-center truncate px-0.5 pb-1 text-fg-secondary\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tfontSize: layout.labelFontSize,\n\t\t\t\t\t\t\t\t\theight: layout.columnLabelHeight,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttitle={column}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{column}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t{rows.map((row) => (\n\t\t\t\t\t\t\t<Fragment key={row}>\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tclassName=\"flex items-center truncate pr-2 text-fg-secondary\"\n\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\tfontSize: layout.labelFontSize,\n\t\t\t\t\t\t\t\t\t\theight: layout.cellSize,\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\ttitle={row}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{row}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{columns.map((column) => (\n\t\t\t\t\t\t\t\t\t<HeatmapChartCell\n\t\t\t\t\t\t\t\t\t\tkey={column}\n\t\t\t\t\t\t\t\t\t\trow={row}\n\t\t\t\t\t\t\t\t\t\tcolumn={column}\n\t\t\t\t\t\t\t\t\t\tvalue={valuesByKey.get(cellKey(row, column))}\n\t\t\t\t\t\t\t\t\t\tdomain={domain}\n\t\t\t\t\t\t\t\t\t\tlayout={layout}\n\t\t\t\t\t\t\t\t\t\tshowValue={showValues}\n\t\t\t\t\t\t\t\t\t\tvalueFormatter={valueFormatter}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t{legend && (\n\t\t\t\t\t<HeatmapChartLegend\n\t\t\t\t\t\tdomain={domain}\n\t\t\t\t\t\tlayout={layout}\n\t\t\t\t\t\tvalueFormatter={valueFormatter}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</ChartCard>\n\t);\n}\n\ntype HeatmapChartCellProps = {\n\trow: string;\n\tcolumn: string;\n\tvalue: number | undefined;\n\tdomain: readonly [number, number];\n\tlayout: HeatmapChartLayout;\n\tshowValue: boolean;\n\tvalueFormatter: (value: number) => string;\n};\n\n/**\n * One grid cell. Missing data (no matching datum for this row/column) renders\n * a dashed placeholder and is skipped from tab order — there is nothing to\n * announce or hover. A valued cell is a focusable, hoverable swatch: the\n * `aria-label` carries the row/column/value so screen readers get the exact\n * figure without relying on the visual tooltip, which mirrors it for sighted\n * hover/keyboard-focus use.\n */\nfunction HeatmapChartCell({\n\trow,\n\tcolumn,\n\tvalue,\n\tdomain,\n\tlayout,\n\tshowValue,\n\tvalueFormatter,\n}: HeatmapChartCellProps) {\n\tif (value == null) {\n\t\treturn (\n\t\t\t<span\n\t\t\t\tclassName=\"rounded-[4px] border border-line-subtle border-dashed\"\n\t\t\t\tstyle={{ width: layout.cellSize, height: layout.cellSize }}\n\t\t\t\ttitle={`${row} · ${column}: no data`}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst step = heatmapStep(value, domain);\n\tconst color = HEATMAP_CHART_PALETTE[step - 1];\n\tconst formatted = valueFormatter(value);\n\tconst label = `${row} · ${column}: ${formatted}`;\n\tconst textColor =\n\t\tstep >= 4 ? \"var(--color-fg-on-brand)\" : \"var(--color-fg-primary)\";\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName=\"group/cell relative flex items-center justify-center rounded-[4px] outline-none focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)]\"\n\t\t\tstyle={{\n\t\t\t\twidth: layout.cellSize,\n\t\t\t\theight: layout.cellSize,\n\t\t\t\tbackgroundColor: color,\n\t\t\t}}\n\t\t\taria-label={label}\n\t\t>\n\t\t\t{showValue && (\n\t\t\t\t<span\n\t\t\t\t\tclassName=\"pointer-events-none tabular-nums\"\n\t\t\t\t\tstyle={{ fontSize: layout.valueFontSize, color: textColor }}\n\t\t\t\t>\n\t\t\t\t\t{formatted}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t<span\n\t\t\t\trole=\"tooltip\"\n\t\t\t\tclassName=\"pointer-events-none absolute bottom-full left-1/2 z-10 mb-1.5 -translate-x-1/2 whitespace-nowrap rounded-md border border-line-subtle bg-surface-overlay px-2 py-1 text-fg-primary text-gdt-xs opacity-0 shadow-2 transition-opacity group-hover/cell:opacity-100 group-focus-visible/cell:opacity-100\"\n\t\t\t>\n\t\t\t\t{label}\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n\ntype HeatmapChartLegendProps = {\n\tdomain: readonly [number, number];\n\tlayout: HeatmapChartLayout;\n\tvalueFormatter: (value: number) => string;\n};\n\n/** Sequential-scale legend — the opacity ramp bounded by the domain's min/max. */\nfunction HeatmapChartLegend({\n\tdomain,\n\tlayout,\n\tvalueFormatter,\n}: HeatmapChartLegendProps) {\n\treturn (\n\t\t<div\n\t\t\tclassName=\"flex items-center gap-2 text-fg-caption-placeholder\"\n\t\t\tstyle={{ fontSize: layout.labelFontSize }}\n\t\t>\n\t\t\t<span className=\"tabular-nums\">{valueFormatter(domain[0])}</span>\n\t\t\t<div className=\"flex overflow-hidden rounded-[3px]\">\n\t\t\t\t{HEATMAP_CHART_PALETTE.map((color) => (\n\t\t\t\t\t<span\n\t\t\t\t\t\tkey={color}\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackgroundColor: color,\n\t\t\t\t\t\t\twidth: layout.legendSwatchSize,\n\t\t\t\t\t\t\theight: layout.legendSwatchSize / 2,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t\t<span className=\"tabular-nums\">{valueFormatter(domain[1])}</span>\n\t\t</div>\n\t);\n}\n\nexport { HEATMAP_CHART_LAYOUT, HEATMAP_CHART_PALETTE, HeatmapChart };\nexport type {\n\tHeatmapChartCellDatum,\n\tHeatmapChartLayout,\n\tHeatmapChartProps,\n\tHeatmapChartSize,\n};\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Popover } from '@base-ui/react/popover';
|
|
3
|
+
|
|
4
|
+
declare function Infotip({ ...props }: Popover.Root.Props): React.JSX.Element;
|
|
5
|
+
declare function InfotipTrigger({ ...props }: Popover.Trigger.Props): React.JSX.Element;
|
|
6
|
+
type InfotipContentProps = Popover.Popup.Props & Pick<Popover.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset"> & Pick<Popover.Portal.Props, "container"> & {
|
|
7
|
+
showArrow?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare function InfotipContent({ className, container, side, sideOffset, align, alignOffset, showArrow, children, ...props }: InfotipContentProps): React.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { Infotip, InfotipContent, InfotipTrigger };
|
package/dist/infotip.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
5
|
+
|
|
6
|
+
// src/infotip.tsx
|
|
7
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
function Infotip({ ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { "data-slot": "infotip", ...props });
|
|
11
|
+
}
|
|
12
|
+
function InfotipTrigger({ ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
PopoverPrimitive.Trigger,
|
|
15
|
+
{
|
|
16
|
+
nativeButton: false,
|
|
17
|
+
"data-slot": "infotip-trigger",
|
|
18
|
+
openOnHover: true,
|
|
19
|
+
delay: 100,
|
|
20
|
+
...props
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function InfotipContent({
|
|
25
|
+
className,
|
|
26
|
+
container,
|
|
27
|
+
side = "top",
|
|
28
|
+
sideOffset = 6,
|
|
29
|
+
align = "center",
|
|
30
|
+
alignOffset = 0,
|
|
31
|
+
showArrow = true,
|
|
32
|
+
children,
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container, children: /* @__PURE__ */ jsx(
|
|
36
|
+
PopoverPrimitive.Positioner,
|
|
37
|
+
{
|
|
38
|
+
align,
|
|
39
|
+
alignOffset,
|
|
40
|
+
side,
|
|
41
|
+
sideOffset,
|
|
42
|
+
className: "isolate z-50",
|
|
43
|
+
children: /* @__PURE__ */ jsxs(
|
|
44
|
+
PopoverPrimitive.Popup,
|
|
45
|
+
{
|
|
46
|
+
"data-slot": "infotip-content",
|
|
47
|
+
className: cn(
|
|
48
|
+
"z-50 relative inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-[6px] border border-line bg-surface-overlay px-3 py-2 text-gdt-sm font-medium text-fg-primary shadow-2 duration-100 has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
49
|
+
className
|
|
50
|
+
),
|
|
51
|
+
...props,
|
|
52
|
+
children: [
|
|
53
|
+
children,
|
|
54
|
+
showArrow ? /* @__PURE__ */ jsx(PopoverPrimitive.Arrow, { className: "relative block w-3 h-1.5 overflow-clip data-[side=bottom]:top-[-6px] data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 before:content-[''] before:absolute before:bottom-0 before:left-1/2 before:w-[calc(6px*sqrt(2))] before:h-[calc(6px*sqrt(2))] before:bg-surface-overlay before:border before:border-line before:[transform:translate(-50%,50%)_rotate(45deg)]" }) : null
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
) });
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
Infotip,
|
|
63
|
+
InfotipContent,
|
|
64
|
+
InfotipTrigger
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=infotip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/infotip.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\";\nimport { cn } from \"./lib/cn\";\n\nfunction Infotip({ ...props }: PopoverPrimitive.Root.Props) {\n\treturn <PopoverPrimitive.Root data-slot=\"infotip\" {...props} />;\n}\n\nfunction InfotipTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {\n\treturn (\n\t\t<PopoverPrimitive.Trigger\n\t\t\tnativeButton={false}\n\t\t\tdata-slot=\"infotip-trigger\"\n\t\t\topenOnHover={true}\n\t\t\tdelay={100}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\ntype InfotipContentProps = PopoverPrimitive.Popup.Props &\n\tPick<\n\t\tPopoverPrimitive.Positioner.Props,\n\t\t\"align\" | \"alignOffset\" | \"side\" | \"sideOffset\"\n\t> &\n\tPick<PopoverPrimitive.Portal.Props, \"container\"> & {\n\t\tshowArrow?: boolean;\n\t};\n\nfunction InfotipContent({\n\tclassName,\n\tcontainer,\n\tside = \"top\",\n\tsideOffset = 6,\n\talign = \"center\",\n\talignOffset = 0,\n\tshowArrow = true,\n\tchildren,\n\t...props\n}: InfotipContentProps) {\n\treturn (\n\t\t<PopoverPrimitive.Portal container={container}>\n\t\t\t<PopoverPrimitive.Positioner\n\t\t\t\talign={align}\n\t\t\t\talignOffset={alignOffset}\n\t\t\t\tside={side}\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName=\"isolate z-50\"\n\t\t\t>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tdata-slot=\"infotip-content\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"z-50 relative inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-[6px] border border-line bg-surface-overlay px-3 py-2 text-gdt-sm font-medium text-fg-primary shadow-2 duration-100 has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow ? (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className=\"relative block w-3 h-1.5 overflow-clip data-[side=bottom]:top-[-6px] data-[side=left]:right-[-9px] data-[side=left]:rotate-90 data-[side=right]:left-[-9px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-6px] data-[side=top]:rotate-180 before:content-[''] before:absolute before:bottom-0 before:left-1/2 before:w-[calc(6px*sqrt(2))] before:h-[calc(6px*sqrt(2))] before:bg-surface-overlay before:border before:border-line before:[transform:translate(-50%,50%)_rotate(45deg)]\" />\n\t\t\t\t\t) : null}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\nexport { Infotip, InfotipTrigger, InfotipContent };\n"],"mappings":";;;;;;AAEA,SAAS,WAAW,wBAAwB;AAIpC,cA4CJ,YA5CI;AADR,SAAS,QAAQ,EAAE,GAAG,MAAM,GAAgC;AAC3D,SAAO,oBAAC,iBAAiB,MAAjB,EAAsB,aAAU,WAAW,GAAG,OAAO;AAC9D;AAEA,SAAS,eAAe,EAAE,GAAG,MAAM,GAAmC;AACrE,SACC;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACA,cAAc;AAAA,MACd,aAAU;AAAA,MACV,aAAa;AAAA,MACb,OAAO;AAAA,MACN,GAAG;AAAA;AAAA,EACL;AAEF;AAWA,SAAS,eAAe;AAAA,EACvB;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACJ,GAAwB;AACvB,SACC,oBAAC,iBAAiB,QAAjB,EAAwB,WACxB;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAU;AAAA,MAEV;AAAA,QAAC,iBAAiB;AAAA,QAAjB;AAAA,UACA,aAAU;AAAA,UACV,WAAW;AAAA,YACV;AAAA,YACA;AAAA,UACD;AAAA,UACC,GAAG;AAAA,UAEH;AAAA;AAAA,YACA,YACA,oBAAC,iBAAiB,OAAjB,EAAuB,WAAU,meAAke,IACjgB;AAAA;AAAA;AAAA,MACL;AAAA;AAAA,EACD,GACD;AAEF;","names":[]}
|
package/dist/input-group.d.ts
CHANGED
|
@@ -5,13 +5,14 @@ import { Button } from './button.js';
|
|
|
5
5
|
import { InputSize } from './input.js';
|
|
6
6
|
import { TextareaSize } from './textarea.js';
|
|
7
7
|
import '@base-ui/react/button';
|
|
8
|
+
import '@base-ui/react/use-render';
|
|
8
9
|
import './input-size-context.js';
|
|
9
10
|
|
|
10
11
|
declare function InputGroup({ className, size, ...props }: React.ComponentProps<"div"> & {
|
|
11
12
|
size?: InputSize;
|
|
12
13
|
}): React.JSX.Element;
|
|
13
14
|
declare const inputGroupAddonVariants: (props?: ({
|
|
14
|
-
align?: "inline-
|
|
15
|
+
align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
|
|
15
16
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
16
17
|
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
17
18
|
declare const inputGroupButtonVariants: (props?: ({
|