@timefoldai/viz-react 0.0.0-stage → 0.1.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/LICENSE +202 -0
- package/README.md +240 -2
- package/dist/THIRD-PARTY-NOTICES.txt +99 -0
- package/dist/a11y/AccessibleTable.d.mts +42 -0
- package/dist/a11y/AccessibleTable.mjs +82 -0
- package/dist/a11y/activation.d.mts +4 -0
- package/dist/a11y/activation.mjs +0 -0
- package/dist/analytics/AnalyticsProvider.d.mts +16 -0
- package/dist/analytics/AnalyticsProvider.mjs +32 -0
- package/dist/assets/Inter-latin-ext.woff2 +0 -0
- package/dist/badge/Badge.css +122 -0
- package/dist/badge/Badge.d.mts +50 -0
- package/dist/badge/Badge.mjs +145 -0
- package/dist/badge/Badge.module.css.mjs +15 -0
- package/dist/badge/BadgeFacetGroup.d.mts +23 -0
- package/dist/badge/BadgeFacetGroup.mjs +220 -0
- package/dist/badge/BadgeGroup.d.mts +13 -0
- package/dist/badge/BadgeGroup.mjs +53 -0
- package/dist/badge/BadgeList.d.mts +14 -0
- package/dist/badge/BadgeList.mjs +15 -0
- package/dist/badge/badge-facet-fit.d.mts +18 -0
- package/dist/badge/badge-facet-fit.mjs +50 -0
- package/dist/badge/badge-item.d.mts +19 -0
- package/dist/badge/badge-item.mjs +23 -0
- package/dist/button/CopyButton.d.mts +12 -0
- package/dist/button/CopyButton.mjs +52 -0
- package/dist/button/ShowAllButton.d.mts +14 -0
- package/dist/button/ShowAllButton.mjs +61 -0
- package/dist/button/ShowMoreButton.d.mts +13 -0
- package/dist/button/ShowMoreButton.mjs +51 -0
- package/dist/button/SolveButton.d.mts +16 -0
- package/dist/button/SolveButton.mjs +56 -0
- package/dist/charts/BarChart.css +59 -0
- package/dist/charts/BarChart.d.mts +26 -0
- package/dist/charts/BarChart.mjs +167 -0
- package/dist/charts/BarChart.module.css.mjs +10 -0
- package/dist/charts/ChartGrid.d.mts +8 -0
- package/dist/charts/ChartGrid.mjs +47 -0
- package/dist/charts/DistributionChart.d.mts +60 -0
- package/dist/charts/DistributionChart.mjs +151 -0
- package/dist/code/CodeBlock.d.mts +13 -0
- package/dist/code/CodeBlock.mjs +71 -0
- package/dist/composition-bar/CompositionBar.d.mts +24 -0
- package/dist/composition-bar/CompositionBar.mjs +124 -0
- package/dist/composition-bar/composition-shares.d.mts +8 -0
- package/dist/composition-bar/composition-shares.mjs +30 -0
- package/dist/data-gate/DataGate.d.mts +34 -0
- package/dist/data-gate/DataGate.mjs +80 -0
- package/dist/date-scope/DateScope.d.mts +30 -0
- package/dist/date-scope/DateScope.mjs +285 -0
- package/dist/design-system/part-props.d.mts +39 -0
- package/dist/design-system/part-props.mjs +0 -0
- package/dist/detail-panel/DetailPanel.d.mts +22 -0
- package/dist/detail-panel/DetailPanel.mjs +80 -0
- package/dist/detail-panel/DetailPanelSection.d.mts +20 -0
- package/dist/detail-panel/DetailPanelSection.mjs +27 -0
- package/dist/detail-panel/micro-label.d.mts +7 -0
- package/dist/detail-panel/micro-label.mjs +9 -0
- package/dist/env.d.mts +2 -0
- package/dist/env.mjs +4 -0
- package/dist/export/ExportCsvButton.d.mts +19 -0
- package/dist/export/ExportCsvButton.mjs +73 -0
- package/dist/export/download-csv.d.mts +5 -0
- package/dist/export/download-csv.mjs +11 -0
- package/dist/export/download-file.d.mts +11 -0
- package/dist/export/download-file.mjs +32 -0
- package/dist/export/download-json.d.mts +2 -0
- package/dist/export/download-json.mjs +8 -0
- package/dist/filter/FilterGroup.d.mts +24 -0
- package/dist/filter/FilterGroup.mjs +71 -0
- package/dist/filter/FilterGroupTitle.d.mts +3 -0
- package/dist/filter/FilterGroupTitle.mjs +18 -0
- package/dist/filter/FilterItem.d.mts +17 -0
- package/dist/filter/FilterItem.mjs +94 -0
- package/dist/filter/FilterPanel.d.mts +22 -0
- package/dist/filter/FilterPanel.mjs +158 -0
- package/dist/filter/FilterToggleButton.d.mts +15 -0
- package/dist/filter/FilterToggleButton.mjs +30 -0
- package/dist/filter/date-range.d.mts +8 -0
- package/dist/filter/date-range.mjs +13 -0
- package/dist/filter/filter-facet.d.mts +7 -0
- package/dist/filter/filter-facet.mjs +0 -0
- package/dist/heatmap/Heatmap.css +138 -0
- package/dist/heatmap/Heatmap.d.mts +10 -0
- package/dist/heatmap/Heatmap.mjs +370 -0
- package/dist/heatmap/Heatmap.module.css.mjs +17 -0
- package/dist/heatmap/HeatmapCell.d.mts +25 -0
- package/dist/heatmap/HeatmapCell.mjs +124 -0
- package/dist/heatmap/heatmap-scale.d.mts +19 -0
- package/dist/heatmap/heatmap-scale.mjs +43 -0
- package/dist/heatmap/heatmap-types.d.mts +49 -0
- package/dist/heatmap/heatmap-types.mjs +0 -0
- package/dist/hooks/use-controllable-state.d.mts +9 -0
- package/dist/hooks/use-controllable-state.mjs +44 -0
- package/dist/hooks/use-debounced-value.d.mts +1 -0
- package/dist/hooks/use-debounced-value.mjs +27 -0
- package/dist/hooks/use-detail-panel-layout.d.mts +18 -0
- package/dist/hooks/use-detail-panel-layout.mjs +94 -0
- package/dist/hooks/use-hover-card.d.mts +47 -0
- package/dist/hooks/use-hover-card.mjs +190 -0
- package/dist/hooks/use-hover-focus-card.d.mts +38 -0
- package/dist/hooks/use-hover-focus-card.mjs +321 -0
- package/dist/hooks/use-hover-intent.d.mts +6 -0
- package/dist/hooks/use-hover-intent.mjs +55 -0
- package/dist/hooks/use-merged-ref.d.mts +2 -0
- package/dist/hooks/use-merged-ref.mjs +36 -0
- package/dist/hooks/use-tracked-anchor.d.mts +14 -0
- package/dist/hooks/use-tracked-anchor.mjs +42 -0
- package/dist/index.d.mts +97 -0
- package/dist/index.mjs +88 -0
- package/dist/input/MenuButton.d.mts +47 -0
- package/dist/input/MenuButton.mjs +152 -0
- package/dist/interval-strip/IntervalStrip.css +7 -0
- package/dist/interval-strip/IntervalStrip.d.mts +39 -0
- package/dist/interval-strip/IntervalStrip.mjs +233 -0
- package/dist/interval-strip/IntervalStrip.module.css.mjs +4 -0
- package/dist/interval-strip/IntervalStripAxis.d.mts +18 -0
- package/dist/interval-strip/IntervalStripAxis.mjs +73 -0
- package/dist/interval-strip/interval-fill.d.mts +2 -0
- package/dist/interval-strip/interval-fill.mjs +13 -0
- package/dist/interval-strip/interval-layout.d.mts +33 -0
- package/dist/interval-strip/interval-layout.mjs +79 -0
- package/dist/layout/AppShell.css +103 -0
- package/dist/layout/AppShell.d.mts +73 -0
- package/dist/layout/AppShell.mjs +397 -0
- package/dist/layout/AppShell.module.css.mjs +16 -0
- package/dist/layout/ColorSchemeMenu.d.mts +14 -0
- package/dist/layout/ColorSchemeMenu.mjs +92 -0
- package/dist/layout/DemoDataPicker.d.mts +17 -0
- package/dist/layout/DemoDataPicker.mjs +150 -0
- package/dist/layout/OverflowMenu.d.mts +11 -0
- package/dist/layout/OverflowMenu.mjs +94 -0
- package/dist/layout/SidebarLayout.css +70 -0
- package/dist/layout/SidebarLayout.d.mts +33 -0
- package/dist/layout/SidebarLayout.mjs +129 -0
- package/dist/layout/SidebarLayout.module.css.mjs +8 -0
- package/dist/layout/use-date-scope-day.d.mts +23 -0
- package/dist/layout/use-date-scope-day.mjs +63 -0
- package/dist/layout/use-fill-height.d.mts +7 -0
- package/dist/layout/use-fill-height.mjs +50 -0
- package/dist/layout/use-followed-state.d.mts +5 -0
- package/dist/layout/use-followed-state.mjs +75 -0
- package/dist/layout/use-page-route.d.mts +10 -0
- package/dist/layout/use-page-route.mjs +65 -0
- package/dist/legend/Legend.d.mts +54 -0
- package/dist/legend/Legend.mjs +132 -0
- package/dist/map/MapLayersControl.d.mts +11 -0
- package/dist/map/MapLayersControl.mjs +157 -0
- package/dist/map/MapLocator.css +9 -0
- package/dist/map/MapLocator.d.mts +18 -0
- package/dist/map/MapLocator.mjs +97 -0
- package/dist/map/MapLocator.module.css.mjs +4 -0
- package/dist/map/MapMarker.d.mts +29 -0
- package/dist/map/MapMarker.mjs +265 -0
- package/dist/map/MapStops.d.mts +19 -0
- package/dist/map/MapStops.mjs +355 -0
- package/dist/map/MapView.css +24 -0
- package/dist/map/MapView.d.mts +11 -0
- package/dist/map/MapView.mjs +141 -0
- package/dist/map/MapWebgl.d.mts +9 -0
- package/dist/map/MapWebgl.mjs +727 -0
- package/dist/map/area-layers.d.mts +33 -0
- package/dist/map/area-layers.mjs +96 -0
- package/dist/map/control-group.d.mts +6 -0
- package/dist/map/control-group.mjs +12 -0
- package/dist/map/for-each-chunk.d.mts +4 -0
- package/dist/map/for-each-chunk.mjs +14 -0
- package/dist/map/highlight.d.mts +30 -0
- package/dist/map/highlight.mjs +99 -0
- package/dist/map/locator-tile.d.mts +24 -0
- package/dist/map/locator-tile.mjs +41 -0
- package/dist/map/map-sites.d.mts +12 -0
- package/dist/map/map-sites.mjs +39 -0
- package/dist/map/map-style.d.mts +24 -0
- package/dist/map/map-style.mjs +79 -0
- package/dist/map/marker-geometry.d.mts +5 -0
- package/dist/map/marker-geometry.mjs +13 -0
- package/dist/map/marker-icon.d.mts +26 -0
- package/dist/map/marker-icon.mjs +223 -0
- package/dist/map/observe-color-scheme.d.mts +5 -0
- package/dist/map/observe-color-scheme.mjs +19 -0
- package/dist/map/popup-placement.d.mts +20 -0
- package/dist/map/popup-placement.mjs +20 -0
- package/dist/map/route-layers.d.mts +28 -0
- package/dist/map/route-layers.mjs +73 -0
- package/dist/map/types.d.mts +97 -0
- package/dist/map/types.mjs +0 -0
- package/dist/map/use-painted-color-scheme.d.mts +6 -0
- package/dist/map/use-painted-color-scheme.mjs +43 -0
- package/dist/map/use-resolved-colors.d.mts +5 -0
- package/dist/map/use-resolved-colors.mjs +63 -0
- package/dist/pagination/paginationLabels.d.mts +6 -0
- package/dist/pagination/paginationLabels.mjs +8 -0
- package/dist/popover/Popover.css +176 -0
- package/dist/popover/Popover.d.mts +239 -0
- package/dist/popover/Popover.mjs +672 -0
- package/dist/popover/Popover.module.css.mjs +18 -0
- package/dist/popover/PopoverFacts.d.mts +24 -0
- package/dist/popover/PopoverFacts.mjs +63 -0
- package/dist/readout/Readout.d.mts +15 -0
- package/dist/readout/Readout.mjs +53 -0
- package/dist/readout/TimeZoneReadout.d.mts +11 -0
- package/dist/readout/TimeZoneReadout.mjs +46 -0
- package/dist/score-box/ScoreBox.css +62 -0
- package/dist/score-box/ScoreBox.d.mts +12 -0
- package/dist/score-box/ScoreBox.mjs +143 -0
- package/dist/score-box/ScoreBox.module.css.mjs +15 -0
- package/dist/segment-bar/Segment.d.mts +23 -0
- package/dist/segment-bar/Segment.mjs +27 -0
- package/dist/segment-bar/SegmentBar.css +44 -0
- package/dist/segment-bar/SegmentBar.d.mts +35 -0
- package/dist/segment-bar/SegmentBar.mjs +57 -0
- package/dist/segment-bar/SegmentBar.module.css.mjs +9 -0
- package/dist/segment-bar/segment-box.d.mts +10 -0
- package/dist/segment-bar/segment-box.mjs +30 -0
- package/dist/stat/Stat.d.mts +25 -0
- package/dist/stat/Stat.mjs +36 -0
- package/dist/stat/StatTile.d.mts +18 -0
- package/dist/stat/StatTile.mjs +37 -0
- package/dist/styles.css +1 -0
- package/dist/swatch/Swatch.d.mts +8 -0
- package/dist/swatch/Swatch.mjs +30 -0
- package/dist/swatch/legend-swatch.d.mts +3 -0
- package/dist/swatch/legend-swatch.mjs +0 -0
- package/dist/tab-bar/FilteredTabBar.d.mts +32 -0
- package/dist/tab-bar/FilteredTabBar.mjs +181 -0
- package/dist/tab-bar/TabBar.d.mts +22 -0
- package/dist/tab-bar/TabBar.mjs +151 -0
- package/dist/tab-bar/TabPanel.d.mts +9 -0
- package/dist/tab-bar/TabPanel.mjs +55 -0
- package/dist/tab-bar/assert-named-value.d.mts +4 -0
- package/dist/tab-bar/assert-named-value.mjs +6 -0
- package/dist/table/DataTable.d.mts +31 -0
- package/dist/table/DataTable.mjs +43 -0
- package/dist/theme/use-color-scheme.d.mts +14 -0
- package/dist/theme/use-color-scheme.mjs +92 -0
- package/dist/theme.css +58 -0
- package/dist/timeline/Timeline.d.mts +54 -0
- package/dist/timeline/Timeline.mjs +220 -0
- package/dist/timeline/TimelineBand.d.mts +18 -0
- package/dist/timeline/TimelineBand.mjs +30 -0
- package/dist/timeline/TimelineGroup.d.mts +7 -0
- package/dist/timeline/TimelineGroup.mjs +50 -0
- package/dist/timeline/TimelineItem.d.mts +19 -0
- package/dist/timeline/TimelineItem.mjs +64 -0
- package/dist/timeline/TimelineItemChip.css +153 -0
- package/dist/timeline/TimelineItemChip.d.mts +23 -0
- package/dist/timeline/TimelineItemChip.mjs +74 -0
- package/dist/timeline/TimelineItemChip.module.css.mjs +15 -0
- package/dist/timeline/TimelineItemMark.css +38 -0
- package/dist/timeline/TimelineItemMark.d.mts +15 -0
- package/dist/timeline/TimelineItemMark.mjs +129 -0
- package/dist/timeline/TimelineItemMark.module.css.mjs +4 -0
- package/dist/timeline/TimelineRoot.d.mts +19 -0
- package/dist/timeline/TimelineRoot.mjs +742 -0
- package/dist/timeline/TimelineRowHeader.d.mts +23 -0
- package/dist/timeline/TimelineRowHeader.mjs +244 -0
- package/dist/timeline/TimelineZoomHint.d.mts +9 -0
- package/dist/timeline/TimelineZoomHint.mjs +32 -0
- package/dist/timeline/axis-label.d.mts +5 -0
- package/dist/timeline/axis-label.mjs +53 -0
- package/dist/timeline/batched-dataset-writer.d.mts +29 -0
- package/dist/timeline/batched-dataset-writer.mjs +58 -0
- package/dist/timeline/row-card-side.d.mts +7 -0
- package/dist/timeline/row-card-side.mjs +6 -0
- package/dist/timeline/timeline-a11y.d.mts +33 -0
- package/dist/timeline/timeline-a11y.mjs +96 -0
- package/dist/timeline/timeline-context.d.mts +33 -0
- package/dist/timeline/timeline-context.mjs +40 -0
- package/dist/timeline/timeline-types.d.mts +126 -0
- package/dist/timeline/timeline-types.mjs +0 -0
- package/dist/timeline/timeline-utils.d.mts +52 -0
- package/dist/timeline/timeline-utils.mjs +130 -0
- package/dist/timeline/zoom-modifier.d.mts +21 -0
- package/dist/timeline/zoom-modifier.mjs +25 -0
- package/dist/toast/ToastProvider.d.mts +33 -0
- package/dist/toast/ToastProvider.mjs +257 -0
- package/dist/toast/toast-context.d.mts +2 -0
- package/dist/toast/toast-context.mjs +5 -0
- package/dist/tokens.css +1 -0
- package/dist/tooltip/Tooltip.d.mts +17 -0
- package/dist/tooltip/Tooltip.mjs +41 -0
- package/dist/tooltip/hover-open-delay.d.mts +2 -0
- package/dist/tooltip/hover-open-delay.mjs +4 -0
- package/dist/tooltip/is-text-cut.d.mts +1 -0
- package/dist/tooltip/is-text-cut.mjs +5 -0
- package/dist/vendor/components.d.mts +664 -0
- package/dist/vendor/components.mjs +2060 -0
- package/package.json +61 -3
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import AccessibleTable from "./a11y/AccessibleTable.mjs";
|
|
2
|
+
import { AnalyticsProvider, useAnalytics } from "./analytics/AnalyticsProvider.mjs";
|
|
3
|
+
import Badge from "./badge/Badge.mjs";
|
|
4
|
+
import BadgeFacetGroup from "./badge/BadgeFacetGroup.mjs";
|
|
5
|
+
import BadgeGroup from "./badge/BadgeGroup.mjs";
|
|
6
|
+
import BadgeList from "./badge/BadgeList.mjs";
|
|
7
|
+
import CopyButton from "./button/CopyButton.mjs";
|
|
8
|
+
import ShowAllButton from "./button/ShowAllButton.mjs";
|
|
9
|
+
import ShowMoreButton from "./button/ShowMoreButton.mjs";
|
|
10
|
+
import SolveButton from "./button/SolveButton.mjs";
|
|
11
|
+
import ChartGrid from "./charts/ChartGrid.mjs";
|
|
12
|
+
import DistributionChart from "./charts/DistributionChart.mjs";
|
|
13
|
+
import BarChart from "./charts/BarChart.mjs";
|
|
14
|
+
import CodeBlock from "./code/CodeBlock.mjs";
|
|
15
|
+
import CompositionBar from "./composition-bar/CompositionBar.mjs";
|
|
16
|
+
import DataGate, { DataGateStatusProvider } from "./data-gate/DataGate.mjs";
|
|
17
|
+
import DateScope from "./date-scope/DateScope.mjs";
|
|
18
|
+
import DetailPanel from "./detail-panel/DetailPanel.mjs";
|
|
19
|
+
import { downloadCsv } from "./export/download-csv.mjs";
|
|
20
|
+
import { downloadJson } from "./export/download-json.mjs";
|
|
21
|
+
import ExportCsvButton from "./export/ExportCsvButton.mjs";
|
|
22
|
+
import { intervalToTimelineBounds } from "./filter/date-range.mjs";
|
|
23
|
+
import FilterGroup_default from "./filter/FilterGroup.mjs";
|
|
24
|
+
import FilterItem from "./filter/FilterItem.mjs";
|
|
25
|
+
import FilterPanel from "./filter/FilterPanel.mjs";
|
|
26
|
+
import FilterToggleButton from "./filter/FilterToggleButton.mjs";
|
|
27
|
+
import Heatmap from "./heatmap/Heatmap.mjs";
|
|
28
|
+
import { useHoverCard } from "./hooks/use-hover-card.mjs";
|
|
29
|
+
import { useHoverIntent } from "./hooks/use-hover-intent.mjs";
|
|
30
|
+
import { DETAIL_PANEL_OVERLAY_WIDTH_PX, useDetailPanelLayout } from "./hooks/use-detail-panel-layout.mjs";
|
|
31
|
+
import IntervalStrip from "./interval-strip/IntervalStrip.mjs";
|
|
32
|
+
import IntervalStripAxis from "./interval-strip/IntervalStripAxis.mjs";
|
|
33
|
+
import MenuButton from "./input/MenuButton.mjs";
|
|
34
|
+
import Legend from "./legend/Legend.mjs";
|
|
35
|
+
import AppShell from "./layout/AppShell.mjs";
|
|
36
|
+
import SidebarLayout, { SidebarLayoutContent, SidebarLayoutSidebar } from "./layout/SidebarLayout.mjs";
|
|
37
|
+
import { useDateScopeDay } from "./layout/use-date-scope-day.mjs";
|
|
38
|
+
import { useFillHeight } from "./layout/use-fill-height.mjs";
|
|
39
|
+
import { useFollowedState } from "./layout/use-followed-state.mjs";
|
|
40
|
+
import { usePageRoute } from "./layout/use-page-route.mjs";
|
|
41
|
+
import MapLocator from "./map/MapLocator.mjs";
|
|
42
|
+
import { OSM_RASTER_STYLE } from "./map/map-style.mjs";
|
|
43
|
+
import { mapMarkerBadgeOffset } from "./map/marker-geometry.mjs";
|
|
44
|
+
import MapView from "./map/MapView.mjs";
|
|
45
|
+
import { paginationLabels } from "./pagination/paginationLabels.mjs";
|
|
46
|
+
import DetailPanelSection from "./detail-panel/DetailPanelSection.mjs";
|
|
47
|
+
import StatTile from "./stat/StatTile.mjs";
|
|
48
|
+
import Stat from "./stat/Stat.mjs";
|
|
49
|
+
import Popover, { PopoverCard, PopoverDataGrid, PopoverDataGridItem, PopoverDivider, PopoverFacet, PopoverHeader, PopoverHeading, PopoverLabelWidth, PopoverNote, PopoverSection, PopoverTitle, PopoverValue, isInPopover } from "./popover/Popover.mjs";
|
|
50
|
+
import { PopoverFactsGrid, popoverFactValue, popoverFactsText } from "./popover/PopoverFacts.mjs";
|
|
51
|
+
import Readout from "./readout/Readout.mjs";
|
|
52
|
+
import TimeZoneReadout from "./readout/TimeZoneReadout.mjs";
|
|
53
|
+
import ScoreBox from "./score-box/ScoreBox.mjs";
|
|
54
|
+
import Segment from "./segment-bar/Segment.mjs";
|
|
55
|
+
import SegmentBar from "./segment-bar/SegmentBar.mjs";
|
|
56
|
+
import Swatch from "./swatch/Swatch.mjs";
|
|
57
|
+
import TabBar from "./tab-bar/TabBar.mjs";
|
|
58
|
+
import FilteredTabBar from "./tab-bar/FilteredTabBar.mjs";
|
|
59
|
+
import DataTable from "./table/DataTable.mjs";
|
|
60
|
+
import Timeline from "./timeline/Timeline.mjs";
|
|
61
|
+
import TimelineBand from "./timeline/TimelineBand.mjs";
|
|
62
|
+
import TimelineGroup from "./timeline/TimelineGroup.mjs";
|
|
63
|
+
import { TimelineItem } from "./timeline/TimelineItem.mjs";
|
|
64
|
+
import TimelineItemChip from "./timeline/TimelineItemChip.mjs";
|
|
65
|
+
import TimelineItemMark from "./timeline/TimelineItemMark.mjs";
|
|
66
|
+
import TimelineRoot from "./timeline/TimelineRoot.mjs";
|
|
67
|
+
import TimelineRowHeader from "./timeline/TimelineRowHeader.mjs";
|
|
68
|
+
import ToastProvider, { useToast } from "./toast/ToastProvider.mjs";
|
|
69
|
+
import Tooltip from "./tooltip/Tooltip.mjs";
|
|
70
|
+
import { Alert, AlertDescription, AlertTitle, Button, ControlRow, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem as DropdownMenuItem$1, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, InputGroup, InputGroupPrefix, Label, Link, NativeSelect, NativeSelectOption, Pagination as Pagination$1, SearchInput as SearchInput$1, Skeleton, StatusScreen, StatusScreenActions, StatusScreenDescription, StatusScreenIcon, StatusScreenTitle, Switch, Table as Table$1, TableBody, TableCell, TableHeadCell, TableHeader, TableRow } from "./vendor/components.mjs";
|
|
71
|
+
// src/index.ts
|
|
72
|
+
/**
|
|
73
|
+
* A menu item of a `DropdownMenu`, with optional icons; `destructive` marks an irreversible action.
|
|
74
|
+
*/
|
|
75
|
+
const DropdownMenuItem = DropdownMenuItem$1;
|
|
76
|
+
/**
|
|
77
|
+
* Previous and next page buttons around the first, last and nearby page numbers of `pageCount` pages.
|
|
78
|
+
*/
|
|
79
|
+
const Pagination = Pagination$1;
|
|
80
|
+
/**
|
|
81
|
+
* A text field with a search icon, for a filter or a lookup.
|
|
82
|
+
*/
|
|
83
|
+
const SearchInput = SearchInput$1;
|
|
84
|
+
/**
|
|
85
|
+
* A table frame with the design-system look; `plain` keeps only the frame and semantics.
|
|
86
|
+
*/
|
|
87
|
+
const Table = Table$1;
|
|
88
|
+
export { AccessibleTable, Alert, AlertDescription, AlertTitle, AnalyticsProvider, AppShell, Badge, BadgeFacetGroup, BadgeGroup, BadgeList, BarChart, Button, ChartGrid, CodeBlock, CompositionBar, ControlRow, CopyButton, DETAIL_PANEL_OVERLAY_WIDTH_PX, DataGate, DataGateStatusProvider, DataTable, DateScope, DetailPanel, DetailPanelSection, DistributionChart, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ExportCsvButton, FilterGroup_default as FilterGroup, FilterItem, FilterPanel, FilterToggleButton, FilteredTabBar, Heatmap, InputGroup, InputGroupPrefix, IntervalStrip, IntervalStripAxis, Label, Legend, Link, MapLocator, MapView, MenuButton, NativeSelect, NativeSelectOption, OSM_RASTER_STYLE, Pagination, Popover, PopoverCard, PopoverDataGrid, PopoverDataGridItem, PopoverDivider, PopoverFacet, PopoverFactsGrid, PopoverHeader, PopoverHeading, PopoverLabelWidth, PopoverNote, PopoverSection, PopoverTitle, PopoverValue, Readout, ScoreBox, SearchInput, Segment, SegmentBar, ShowAllButton, ShowMoreButton, SidebarLayout, SidebarLayoutContent, SidebarLayoutSidebar, Skeleton, SolveButton, Stat, StatTile, StatusScreen, StatusScreenActions, StatusScreenDescription, StatusScreenIcon, StatusScreenTitle, Swatch, Switch, TabBar, Table, TableBody, TableCell, TableHeadCell, TableHeader, TableRow, TimeZoneReadout, Timeline, TimelineBand, TimelineGroup, TimelineItem, TimelineItemChip, TimelineItemMark, TimelineRoot, TimelineRowHeader, ToastProvider, Tooltip, downloadCsv, downloadJson, intervalToTimelineBounds, isInPopover, mapMarkerBadgeOffset, paginationLabels, popoverFactValue, popoverFactsText, useAnalytics, useDateScopeDay, useDetailPanelLayout, useFillHeight, useFollowedState, useHoverCard, useHoverIntent, usePageRoute, useToast };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { SlotIcon } from "../vendor/components.mjs";
|
|
3
|
+
/** A menu entry: an action, a disabled placeholder with no action, or a submenu. */
|
|
4
|
+
export type MenuButtonOption = {
|
|
5
|
+
value: string;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
icon?: SlotIcon;
|
|
8
|
+
} & ({
|
|
9
|
+
onSelect: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
submenu?: never;
|
|
12
|
+
} | {
|
|
13
|
+
disabled: true;
|
|
14
|
+
onSelect?: never;
|
|
15
|
+
submenu?: never;
|
|
16
|
+
} | {
|
|
17
|
+
submenu: MenuButtonMenu;
|
|
18
|
+
onSelect?: never;
|
|
19
|
+
disabled?: never;
|
|
20
|
+
});
|
|
21
|
+
/** A group of options in the menu of a `MenuButton`. */
|
|
22
|
+
export type MenuButtonSection = {
|
|
23
|
+
options: MenuButtonOption[];
|
|
24
|
+
};
|
|
25
|
+
/** A menu's content: its sections, and which of their options is selected. */
|
|
26
|
+
export type MenuButtonMenu = {
|
|
27
|
+
sections: MenuButtonSection[];
|
|
28
|
+
selectedValue?: string;
|
|
29
|
+
};
|
|
30
|
+
/** The props of `MenuButton`: its label, its icon and the sections of its menu. */
|
|
31
|
+
export type MenuButtonProps = MenuButtonMenu & {
|
|
32
|
+
label: ReactNode;
|
|
33
|
+
} & ({
|
|
34
|
+
soloIcon: SlotIcon;
|
|
35
|
+
leadingIcon?: never;
|
|
36
|
+
} | {
|
|
37
|
+
soloIcon?: never;
|
|
38
|
+
leadingIcon?: SlotIcon;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* A menu button built from data, on the design-system `DropdownMenu`, non-modal so an embed's host page keeps
|
|
42
|
+
* scrolling.
|
|
43
|
+
*
|
|
44
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/
|
|
45
|
+
* @category Controls
|
|
46
|
+
*/
|
|
47
|
+
export default function MenuButton({ label, sections, selectedValue, leadingIcon, soloIcon }: MenuButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as Fragment$1 } from "react";
|
|
5
|
+
import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "../vendor/components.mjs";
|
|
6
|
+
import { OVERLAY_ATTRIBUTE } from "@timefoldai/viz-core";
|
|
7
|
+
import { TbSelector } from "react-icons/tb";
|
|
8
|
+
// src/input/MenuButton.tsx
|
|
9
|
+
const OVERLAY = { [OVERLAY_ATTRIBUTE]: "" };
|
|
10
|
+
/**
|
|
11
|
+
* A menu button built from data, on the design-system `DropdownMenu`, non-modal so an embed's host page keeps
|
|
12
|
+
* scrolling.
|
|
13
|
+
*
|
|
14
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/
|
|
15
|
+
* @category Controls
|
|
16
|
+
*/
|
|
17
|
+
function MenuButton(t0) {
|
|
18
|
+
const $ = c(11);
|
|
19
|
+
const { label, sections, selectedValue, leadingIcon, soloIcon } = t0;
|
|
20
|
+
const t1 = soloIcon ? void 0 : TbSelector;
|
|
21
|
+
let t2;
|
|
22
|
+
if ($[0] !== label || $[1] !== leadingIcon || $[2] !== soloIcon || $[3] !== t1) {
|
|
23
|
+
t2 = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
24
|
+
asChild: true,
|
|
25
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
26
|
+
"data-slot": "menu-button",
|
|
27
|
+
variant: "outline",
|
|
28
|
+
leadingIcon,
|
|
29
|
+
soloIcon,
|
|
30
|
+
trailingIcon: t1,
|
|
31
|
+
children: label
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
$[0] = label;
|
|
35
|
+
$[1] = leadingIcon;
|
|
36
|
+
$[2] = soloIcon;
|
|
37
|
+
$[3] = t1;
|
|
38
|
+
$[4] = t2;
|
|
39
|
+
} else t2 = $[4];
|
|
40
|
+
let t3;
|
|
41
|
+
if ($[5] !== sections || $[6] !== selectedValue) {
|
|
42
|
+
t3 = /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
43
|
+
align: "start",
|
|
44
|
+
...OVERLAY,
|
|
45
|
+
children: /* @__PURE__ */ jsx(MenuSections, {
|
|
46
|
+
sections,
|
|
47
|
+
selectedValue
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
$[5] = sections;
|
|
51
|
+
$[6] = selectedValue;
|
|
52
|
+
$[7] = t3;
|
|
53
|
+
} else t3 = $[7];
|
|
54
|
+
let t4;
|
|
55
|
+
if ($[8] !== t2 || $[9] !== t3) {
|
|
56
|
+
t4 = /* @__PURE__ */ jsxs(DropdownMenu, {
|
|
57
|
+
modal: false,
|
|
58
|
+
children: [t2, t3]
|
|
59
|
+
});
|
|
60
|
+
$[8] = t2;
|
|
61
|
+
$[9] = t3;
|
|
62
|
+
$[10] = t4;
|
|
63
|
+
} else t4 = $[10];
|
|
64
|
+
return t4;
|
|
65
|
+
}
|
|
66
|
+
function MenuSections({ sections, selectedValue }) {
|
|
67
|
+
return sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs(Fragment$1, { children: [sectionIndex > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}), /* @__PURE__ */ jsx(DropdownMenuGroup, { children: section.options.map((option) => option.submenu ? /* @__PURE__ */ jsx(Submenu, {
|
|
68
|
+
option,
|
|
69
|
+
submenu: option.submenu
|
|
70
|
+
}, option.value) : /* @__PURE__ */ jsx(ActionItem, {
|
|
71
|
+
option,
|
|
72
|
+
selectedValue
|
|
73
|
+
}, option.value)) })] }, sectionIndex));
|
|
74
|
+
}
|
|
75
|
+
function ActionItem(t0) {
|
|
76
|
+
const $ = c(10);
|
|
77
|
+
const { option, selectedValue } = t0;
|
|
78
|
+
const isSelected = selectedValue !== void 0 && option.value === selectedValue;
|
|
79
|
+
let t1;
|
|
80
|
+
if ($[0] !== isSelected || $[1] !== selectedValue) {
|
|
81
|
+
t1 = selectedValue !== void 0 && {
|
|
82
|
+
role: "menuitemradio",
|
|
83
|
+
"aria-checked": isSelected,
|
|
84
|
+
"aria-current": void 0
|
|
85
|
+
};
|
|
86
|
+
$[0] = isSelected;
|
|
87
|
+
$[1] = selectedValue;
|
|
88
|
+
$[2] = t1;
|
|
89
|
+
} else t1 = $[2];
|
|
90
|
+
let t2;
|
|
91
|
+
if ($[3] !== isSelected || $[4] !== option.disabled || $[5] !== option.icon || $[6] !== option.label || $[7] !== option.onSelect || $[8] !== t1) {
|
|
92
|
+
t2 = /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
93
|
+
leadingIcon: option.icon,
|
|
94
|
+
disabled: option.disabled,
|
|
95
|
+
selected: isSelected,
|
|
96
|
+
...t1,
|
|
97
|
+
onSelect: option.onSelect,
|
|
98
|
+
children: option.label
|
|
99
|
+
});
|
|
100
|
+
$[3] = isSelected;
|
|
101
|
+
$[4] = option.disabled;
|
|
102
|
+
$[5] = option.icon;
|
|
103
|
+
$[6] = option.label;
|
|
104
|
+
$[7] = option.onSelect;
|
|
105
|
+
$[8] = t1;
|
|
106
|
+
$[9] = t2;
|
|
107
|
+
} else t2 = $[9];
|
|
108
|
+
return t2;
|
|
109
|
+
}
|
|
110
|
+
function Submenu(t0) {
|
|
111
|
+
const $ = c(11);
|
|
112
|
+
const { option, submenu } = t0;
|
|
113
|
+
const Icon = option.icon;
|
|
114
|
+
let t1;
|
|
115
|
+
if ($[0] !== Icon) {
|
|
116
|
+
t1 = Icon && /* @__PURE__ */ jsx(Icon, {
|
|
117
|
+
"aria-hidden": true,
|
|
118
|
+
className: "size-(--tf-icon-size-sm) shrink-0"
|
|
119
|
+
});
|
|
120
|
+
$[0] = Icon;
|
|
121
|
+
$[1] = t1;
|
|
122
|
+
} else t1 = $[1];
|
|
123
|
+
let t2;
|
|
124
|
+
if ($[2] !== option.label || $[3] !== t1) {
|
|
125
|
+
t2 = /* @__PURE__ */ jsxs(DropdownMenuSubTrigger, { children: [t1, option.label] });
|
|
126
|
+
$[2] = option.label;
|
|
127
|
+
$[3] = t1;
|
|
128
|
+
$[4] = t2;
|
|
129
|
+
} else t2 = $[4];
|
|
130
|
+
let t3;
|
|
131
|
+
if ($[5] !== submenu.sections || $[6] !== submenu.selectedValue) {
|
|
132
|
+
t3 = /* @__PURE__ */ jsx(DropdownMenuPortal, { children: /* @__PURE__ */ jsx(DropdownMenuSubContent, {
|
|
133
|
+
...OVERLAY,
|
|
134
|
+
children: /* @__PURE__ */ jsx(MenuSections, {
|
|
135
|
+
sections: submenu.sections,
|
|
136
|
+
selectedValue: submenu.selectedValue
|
|
137
|
+
})
|
|
138
|
+
}) });
|
|
139
|
+
$[5] = submenu.sections;
|
|
140
|
+
$[6] = submenu.selectedValue;
|
|
141
|
+
$[7] = t3;
|
|
142
|
+
} else t3 = $[7];
|
|
143
|
+
let t4;
|
|
144
|
+
if ($[8] !== t2 || $[9] !== t3) {
|
|
145
|
+
t4 = /* @__PURE__ */ jsxs(DropdownMenuSub, { children: [t2, t3] });
|
|
146
|
+
$[8] = t2;
|
|
147
|
+
$[9] = t3;
|
|
148
|
+
$[10] = t4;
|
|
149
|
+
} else t4 = $[10];
|
|
150
|
+
return t4;
|
|
151
|
+
}
|
|
152
|
+
export { MenuButton as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { IntervalStripDomain } from "./interval-layout.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
/** A segment's verdict: `neutral` for a value in range, `warning` below it and `positive` above it. */
|
|
4
|
+
export type IntervalStripState = "neutral" | "warning" | "positive";
|
|
5
|
+
/** A segment's fill strength: `strong` marks a larger distance from the range. */
|
|
6
|
+
export type IntervalStripVariant = "subtle" | "strong";
|
|
7
|
+
/** A segment's `state` and `variant`. An in-range segment has no distance, so it takes no `strong` fill. */
|
|
8
|
+
export type IntervalStripFill = {
|
|
9
|
+
state: "neutral";
|
|
10
|
+
variant?: "subtle";
|
|
11
|
+
} | {
|
|
12
|
+
state: Exclude<IntervalStripState, "neutral">;
|
|
13
|
+
variant?: IntervalStripVariant;
|
|
14
|
+
};
|
|
15
|
+
/** One interval of a strip. Its popover card opens on hover and on focus, describes the focused segment, and takes
|
|
16
|
+
* Tab when it holds a link or a button. */
|
|
17
|
+
export type IntervalStripSegment = IntervalStripFill & {
|
|
18
|
+
id: string;
|
|
19
|
+
start: number;
|
|
20
|
+
end: number;
|
|
21
|
+
label?: string;
|
|
22
|
+
"aria-label": string;
|
|
23
|
+
};
|
|
24
|
+
/** The props of `IntervalStrip`: the domain it spans and the segments it draws. */
|
|
25
|
+
export interface IntervalStripProps extends Pick<React.ComponentProps<"div">, "className" | "style" | "ref"> {
|
|
26
|
+
domain: IntervalStripDomain;
|
|
27
|
+
segments: IntervalStripSegment[];
|
|
28
|
+
"aria-label": string;
|
|
29
|
+
renderPopover?: (segment: IntervalStripSegment) => ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One row of segments at their real boundaries over a fixed domain, with hatched gaps where no segment has data.
|
|
33
|
+
* A toolbar of buttons: one tab stop, arrow keys between segments.
|
|
34
|
+
*
|
|
35
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/
|
|
36
|
+
* @category Charts
|
|
37
|
+
*/
|
|
38
|
+
export default function IntervalStrip({ domain, segments, "aria-label": ariaLabel, renderPopover, className, style, ref }: IntervalStripProps): import("react").JSX.Element;
|
|
39
|
+
export type { IntervalStripDomain };
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { isDevBuild } from "../env.mjs";
|
|
3
|
+
import { useHoverFocusCard } from "../hooks/use-hover-focus-card.mjs";
|
|
4
|
+
import { useMergedRef } from "../hooks/use-merged-ref.mjs";
|
|
5
|
+
import Popover, { focusablesInPopover } from "../popover/Popover.mjs";
|
|
6
|
+
import { intervalFillClass } from "./interval-fill.mjs";
|
|
7
|
+
import { layoutIntervals } from "./interval-layout.mjs";
|
|
8
|
+
import IntervalStrip_module_default from "./IntervalStrip.module.css.mjs";
|
|
9
|
+
import { c } from "react/compiler-runtime";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
12
|
+
import clsx$1 from "clsx";
|
|
13
|
+
// src/interval-strip/IntervalStrip.tsx
|
|
14
|
+
/**
|
|
15
|
+
* One row of segments at their real boundaries over a fixed domain, with hatched gaps where no segment has data.
|
|
16
|
+
* A toolbar of buttons: one tab stop, arrow keys between segments.
|
|
17
|
+
*
|
|
18
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/
|
|
19
|
+
* @category Charts
|
|
20
|
+
*/
|
|
21
|
+
function IntervalStrip(t0) {
|
|
22
|
+
const $ = c(29);
|
|
23
|
+
const { domain, segments, "aria-label": ariaLabel, renderPopover, className, style, ref } = t0;
|
|
24
|
+
const stripRef = useRef(null);
|
|
25
|
+
const rootRef = useMergedRef(stripRef, ref);
|
|
26
|
+
const popupId = useId();
|
|
27
|
+
const factsId = useId();
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
30
|
+
t1 = () => stripRef.current?.querySelector("[tabindex=\"0\"]")?.focus();
|
|
31
|
+
$[0] = t1;
|
|
32
|
+
} else t1 = $[0];
|
|
33
|
+
const focusTabStop = t1;
|
|
34
|
+
const [focusedId, setFocusedId] = useState(null);
|
|
35
|
+
let t2;
|
|
36
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
37
|
+
t2 = /* @__PURE__ */ new Set();
|
|
38
|
+
$[1] = t2;
|
|
39
|
+
} else t2 = $[1];
|
|
40
|
+
const warnedRef = useRef(t2);
|
|
41
|
+
const { placed, gaps, skipped } = layoutIntervals(domain, segments);
|
|
42
|
+
const card = useHoverFocusCard({
|
|
43
|
+
popupId,
|
|
44
|
+
renderPopover: (target) => {
|
|
45
|
+
const shown = placed.find((t3) => {
|
|
46
|
+
const { segment } = t3;
|
|
47
|
+
return segment.id === target.id;
|
|
48
|
+
});
|
|
49
|
+
return shown ? renderPopover?.(shown.segment) : null;
|
|
50
|
+
},
|
|
51
|
+
refocusFallback: focusTabStop
|
|
52
|
+
});
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!isDevBuild) return;
|
|
55
|
+
const unwarned = skipped.filter((t4) => {
|
|
56
|
+
const { id, reason } = t4;
|
|
57
|
+
return !warnedRef.current.has(`${reason}:${id}`);
|
|
58
|
+
});
|
|
59
|
+
if (unwarned.length === 0) return;
|
|
60
|
+
for (const { id: id_0, reason: reason_0 } of unwarned) warnedRef.current.add(`${reason_0}:${id_0}`);
|
|
61
|
+
console.warn(`IntervalStrip: skipped segments ${unwarned.map(_temp).join(", ")}.`);
|
|
62
|
+
}, [skipped]);
|
|
63
|
+
const placedIds = placed.map(_temp2);
|
|
64
|
+
const tabStopId = focusedId !== null && placedIds.includes(focusedId) ? focusedId : placedIds[0];
|
|
65
|
+
const hasPopover = renderPopover !== void 0;
|
|
66
|
+
const focusSegment = function focusSegment(id_2) {
|
|
67
|
+
stripRef.current?.querySelector(`[data-segment-id="${CSS.escape(id_2)}"]`)?.focus();
|
|
68
|
+
};
|
|
69
|
+
let t5;
|
|
70
|
+
if ($[2] !== card.target?.element || $[3] !== popupId) {
|
|
71
|
+
t5 = function enterCard(event) {
|
|
72
|
+
const [first] = focusablesInPopover(popupId);
|
|
73
|
+
if (card.target?.element !== event.target || first === void 0) return;
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
first.focus();
|
|
76
|
+
};
|
|
77
|
+
$[2] = card.target?.element;
|
|
78
|
+
$[3] = popupId;
|
|
79
|
+
$[4] = t5;
|
|
80
|
+
} else t5 = $[4];
|
|
81
|
+
const enterCard = t5;
|
|
82
|
+
let t6;
|
|
83
|
+
if ($[5] !== card || $[6] !== popupId) {
|
|
84
|
+
t6 = function leaveCardAtItsEdge(event_0) {
|
|
85
|
+
if (event_0.key !== "Tab") return;
|
|
86
|
+
const focusables = focusablesInPopover(popupId);
|
|
87
|
+
const edge = event_0.shiftKey ? focusables[0] : focusables.at(-1);
|
|
88
|
+
if (edge !== void 0 && event_0.target !== edge) return;
|
|
89
|
+
event_0.preventDefault();
|
|
90
|
+
card.close();
|
|
91
|
+
};
|
|
92
|
+
$[5] = card;
|
|
93
|
+
$[6] = popupId;
|
|
94
|
+
$[7] = t6;
|
|
95
|
+
} else t6 = $[7];
|
|
96
|
+
const leaveCardAtItsEdge = t6;
|
|
97
|
+
const onStripKeyDown = function onStripKeyDown(event_1) {
|
|
98
|
+
if (event_1.key === "Tab" && !event_1.shiftKey) {
|
|
99
|
+
enterCard(event_1);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const current = placedIds.indexOf(tabStopId ?? "");
|
|
103
|
+
const last = placedIds.length - 1;
|
|
104
|
+
const next = {
|
|
105
|
+
ArrowRight: Math.min(current + 1, last),
|
|
106
|
+
ArrowLeft: Math.max(current - 1, 0),
|
|
107
|
+
Home: 0,
|
|
108
|
+
End: last
|
|
109
|
+
}[event_1.key];
|
|
110
|
+
const nextId = next === void 0 ? void 0 : placedIds[next];
|
|
111
|
+
if (nextId === void 0) return;
|
|
112
|
+
event_1.preventDefault();
|
|
113
|
+
focusSegment(nextId);
|
|
114
|
+
};
|
|
115
|
+
const describedSegmentId = card.open && card.focusOwned ? card.target?.id : null;
|
|
116
|
+
const t7 = "toolbar";
|
|
117
|
+
const t8 = "interval-strip";
|
|
118
|
+
let t9;
|
|
119
|
+
if ($[8] !== className) {
|
|
120
|
+
t9 = clsx$1("relative h-8 min-w-0", className);
|
|
121
|
+
$[8] = className;
|
|
122
|
+
$[9] = t9;
|
|
123
|
+
} else t9 = $[9];
|
|
124
|
+
const t10 = gaps.map(_temp3);
|
|
125
|
+
const t12 = placed.map((t11) => {
|
|
126
|
+
const { segment: segment_1, left, width } = t11;
|
|
127
|
+
const target_0 = (element) => ({
|
|
128
|
+
id: segment_1.id,
|
|
129
|
+
element
|
|
130
|
+
});
|
|
131
|
+
return /* @__PURE__ */ jsx("button", {
|
|
132
|
+
type: "button",
|
|
133
|
+
"aria-label": segment_1["aria-label"],
|
|
134
|
+
"aria-describedby": segment_1.id === describedSegmentId ? factsId : void 0,
|
|
135
|
+
tabIndex: segment_1.id === tabStopId ? 0 : -1,
|
|
136
|
+
"data-slot": "interval-strip-segment",
|
|
137
|
+
"data-segment-id": segment_1.id,
|
|
138
|
+
"data-variant": segment_1.variant ?? "subtle",
|
|
139
|
+
"data-state": segment_1.state,
|
|
140
|
+
className: clsx$1(intervalFillClass(segment_1), "@container absolute inset-y-0 flex items-center justify-center rounded-sm border-x border-transparent bg-clip-padding font-mono text-xs", "cursor-default focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--tf-color-ring)"),
|
|
141
|
+
style: {
|
|
142
|
+
left: `${left}%`,
|
|
143
|
+
width: `${width}%`
|
|
144
|
+
},
|
|
145
|
+
onFocus: (event_2) => {
|
|
146
|
+
setFocusedId(segment_1.id);
|
|
147
|
+
card.focusIn(target_0(event_2.currentTarget));
|
|
148
|
+
},
|
|
149
|
+
onBlur: card.focusOut,
|
|
150
|
+
onPointerEnter: hasPopover ? (event_3) => card.hoverIn(target_0(event_3.currentTarget)) : void 0,
|
|
151
|
+
onPointerLeave: hasPopover ? (event_4) => card.hoverOut(target_0(event_4.currentTarget)) : void 0,
|
|
152
|
+
children: segment_1.label && /* @__PURE__ */ jsx("span", {
|
|
153
|
+
"aria-hidden": "true",
|
|
154
|
+
"data-slot": "interval-strip-label",
|
|
155
|
+
className: "truncate px-1 @max-[1.5rem]:hidden",
|
|
156
|
+
children: segment_1.label
|
|
157
|
+
})
|
|
158
|
+
}, segment_1.id);
|
|
159
|
+
});
|
|
160
|
+
let t13;
|
|
161
|
+
if ($[10] !== ariaLabel || $[11] !== onStripKeyDown || $[12] !== rootRef || $[13] !== style || $[14] !== t10 || $[15] !== t12 || $[16] !== t9) {
|
|
162
|
+
t13 = /* @__PURE__ */ jsxs("div", {
|
|
163
|
+
ref: rootRef,
|
|
164
|
+
style,
|
|
165
|
+
role: t7,
|
|
166
|
+
"aria-label": ariaLabel,
|
|
167
|
+
"data-slot": t8,
|
|
168
|
+
className: t9,
|
|
169
|
+
onKeyDown: onStripKeyDown,
|
|
170
|
+
children: [t10, t12]
|
|
171
|
+
});
|
|
172
|
+
$[10] = ariaLabel;
|
|
173
|
+
$[11] = onStripKeyDown;
|
|
174
|
+
$[12] = rootRef;
|
|
175
|
+
$[13] = style;
|
|
176
|
+
$[14] = t10;
|
|
177
|
+
$[15] = t12;
|
|
178
|
+
$[16] = t9;
|
|
179
|
+
$[17] = t13;
|
|
180
|
+
} else t13 = $[17];
|
|
181
|
+
let t14;
|
|
182
|
+
if ($[18] !== card.anchor || $[19] !== card.content || $[20] !== card.popoverProps || $[21] !== factsId || $[22] !== hasPopover || $[23] !== leaveCardAtItsEdge || $[24] !== popupId) {
|
|
183
|
+
t14 = hasPopover && /* @__PURE__ */ jsx(Popover, {
|
|
184
|
+
...card.popoverProps,
|
|
185
|
+
anchor: card.anchor,
|
|
186
|
+
side: "bottom",
|
|
187
|
+
sideOffset: 6,
|
|
188
|
+
id: popupId,
|
|
189
|
+
"aria-label": "Segment details",
|
|
190
|
+
onKeyDown: leaveCardAtItsEdge,
|
|
191
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
192
|
+
id: factsId,
|
|
193
|
+
children: card.content
|
|
194
|
+
})
|
|
195
|
+
});
|
|
196
|
+
$[18] = card.anchor;
|
|
197
|
+
$[19] = card.content;
|
|
198
|
+
$[20] = card.popoverProps;
|
|
199
|
+
$[21] = factsId;
|
|
200
|
+
$[22] = hasPopover;
|
|
201
|
+
$[23] = leaveCardAtItsEdge;
|
|
202
|
+
$[24] = popupId;
|
|
203
|
+
$[25] = t14;
|
|
204
|
+
} else t14 = $[25];
|
|
205
|
+
let t15;
|
|
206
|
+
if ($[26] !== t13 || $[27] !== t14) {
|
|
207
|
+
t15 = /* @__PURE__ */ jsxs(Fragment, { children: [t13, t14] });
|
|
208
|
+
$[26] = t13;
|
|
209
|
+
$[27] = t14;
|
|
210
|
+
$[28] = t15;
|
|
211
|
+
} else t15 = $[28];
|
|
212
|
+
return t15;
|
|
213
|
+
}
|
|
214
|
+
function _temp3(gap) {
|
|
215
|
+
return /* @__PURE__ */ jsx("div", {
|
|
216
|
+
"aria-hidden": "true",
|
|
217
|
+
"data-slot": "interval-strip-gap",
|
|
218
|
+
className: clsx$1(IntervalStrip_module_default.gap, "absolute inset-y-0 rounded-sm border-x border-transparent bg-viz-tint bg-clip-padding"),
|
|
219
|
+
style: {
|
|
220
|
+
left: `${gap.left}%`,
|
|
221
|
+
width: `${gap.width}%`
|
|
222
|
+
}
|
|
223
|
+
}, gap.left);
|
|
224
|
+
}
|
|
225
|
+
function _temp2(t0) {
|
|
226
|
+
const { segment: segment_0 } = t0;
|
|
227
|
+
return segment_0.id;
|
|
228
|
+
}
|
|
229
|
+
function _temp(t0) {
|
|
230
|
+
const { id: id_1, reason: reason_1 } = t0;
|
|
231
|
+
return `"${id_1}" (${reason_1})`;
|
|
232
|
+
}
|
|
233
|
+
export { IntervalStrip as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IntervalStripDomain } from "./interval-layout.mjs";
|
|
2
|
+
/** A tick on an interval strip axis: its position and label. */
|
|
3
|
+
export interface IntervalStripTick {
|
|
4
|
+
at: number;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
/** The props of `IntervalStripAxis`: the domain it spans and its ticks. */
|
|
8
|
+
export interface IntervalStripAxisProps extends Pick<React.ComponentProps<"div">, "className" | "style" | "ref"> {
|
|
9
|
+
domain: IntervalStripDomain;
|
|
10
|
+
ticks: IntervalStripTick[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Tick labels over an {@link IntervalStrip}'s domain, so strips stacked under one axis line up. Decorative: each
|
|
14
|
+
* segment's accessible name carries its own times.
|
|
15
|
+
*
|
|
16
|
+
* @category Charts
|
|
17
|
+
*/
|
|
18
|
+
export default function IntervalStripAxis({ domain, ticks, className, style, ref }: IntervalStripAxisProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { domainPercent } from "./interval-layout.mjs";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import clsx$1 from "clsx";
|
|
5
|
+
// src/interval-strip/IntervalStripAxis.tsx
|
|
6
|
+
function anchorClass(percent) {
|
|
7
|
+
if (percent <= 0) return "";
|
|
8
|
+
if (percent >= 100) return "-translate-x-full";
|
|
9
|
+
return "-translate-x-1/2";
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Tick labels over an {@link IntervalStrip}'s domain, so strips stacked under one axis line up. Decorative: each
|
|
13
|
+
* segment's accessible name carries its own times.
|
|
14
|
+
*
|
|
15
|
+
* @category Charts
|
|
16
|
+
*/
|
|
17
|
+
function IntervalStripAxis(t0) {
|
|
18
|
+
const $ = c(12);
|
|
19
|
+
const { domain, ticks, className, style, ref } = t0;
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] !== className) {
|
|
22
|
+
t1 = clsx$1("text-viz-muted relative h-4 min-w-0 font-mono text-xs", className);
|
|
23
|
+
$[0] = className;
|
|
24
|
+
$[1] = t1;
|
|
25
|
+
} else t1 = $[1];
|
|
26
|
+
let t2;
|
|
27
|
+
if ($[2] !== domain || $[3] !== ticks) {
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[5] !== domain) {
|
|
30
|
+
t3 = (tick) => ({
|
|
31
|
+
...tick,
|
|
32
|
+
percent: domainPercent(tick.at, domain)
|
|
33
|
+
});
|
|
34
|
+
$[5] = domain;
|
|
35
|
+
$[6] = t3;
|
|
36
|
+
} else t3 = $[6];
|
|
37
|
+
t2 = ticks.map(t3).filter(_temp).map(_temp2);
|
|
38
|
+
$[2] = domain;
|
|
39
|
+
$[3] = ticks;
|
|
40
|
+
$[4] = t2;
|
|
41
|
+
} else t2 = $[4];
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[7] !== ref || $[8] !== style || $[9] !== t1 || $[10] !== t2) {
|
|
44
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
45
|
+
ref,
|
|
46
|
+
style,
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
"data-slot": "interval-strip-axis",
|
|
49
|
+
className: t1,
|
|
50
|
+
children: t2
|
|
51
|
+
});
|
|
52
|
+
$[7] = ref;
|
|
53
|
+
$[8] = style;
|
|
54
|
+
$[9] = t1;
|
|
55
|
+
$[10] = t2;
|
|
56
|
+
$[11] = t3;
|
|
57
|
+
} else t3 = $[11];
|
|
58
|
+
return t3;
|
|
59
|
+
}
|
|
60
|
+
function _temp2(t0, index) {
|
|
61
|
+
const { label, percent: percent_0 } = t0;
|
|
62
|
+
return /* @__PURE__ */ jsx("span", {
|
|
63
|
+
"data-slot": "interval-strip-axis-tick",
|
|
64
|
+
className: clsx$1("absolute top-0 whitespace-nowrap", anchorClass(percent_0)),
|
|
65
|
+
style: { left: `${percent_0}%` },
|
|
66
|
+
children: label
|
|
67
|
+
}, index);
|
|
68
|
+
}
|
|
69
|
+
function _temp(t0) {
|
|
70
|
+
const { percent } = t0;
|
|
71
|
+
return percent >= 0 && percent <= 100;
|
|
72
|
+
}
|
|
73
|
+
export { IntervalStripAxis as default };
|