@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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/** Records one usage event: a short event name plus a flat record of string properties. */
|
|
3
|
+
export type TrackAnalytics = (event: string, properties: Record<string, string>) => void;
|
|
4
|
+
/** The props of `AnalyticsProvider`: the `track` function and the content that uses it. */
|
|
5
|
+
export interface AnalyticsProviderProps {
|
|
6
|
+
track: TrackAnalytics;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Hands components below it the `track` function that `useAnalytics` returns.
|
|
11
|
+
*
|
|
12
|
+
* @category Layout
|
|
13
|
+
*/
|
|
14
|
+
export declare function AnalyticsProvider({ track, children }: AnalyticsProviderProps): import("react").JSX.Element;
|
|
15
|
+
/** The nearest `AnalyticsProvider`'s `track`, or a no-op without one. */
|
|
16
|
+
export declare function useAnalytics(): TrackAnalytics;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { createContext, use } from "react";
|
|
5
|
+
// src/analytics/AnalyticsProvider.tsx
|
|
6
|
+
const NO_TRACKING = () => {};
|
|
7
|
+
const AnalyticsContext = createContext(NO_TRACKING);
|
|
8
|
+
/**
|
|
9
|
+
* Hands components below it the `track` function that `useAnalytics` returns.
|
|
10
|
+
*
|
|
11
|
+
* @category Layout
|
|
12
|
+
*/
|
|
13
|
+
function AnalyticsProvider(t0) {
|
|
14
|
+
const $ = c(3);
|
|
15
|
+
const { track, children } = t0;
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[0] !== children || $[1] !== track) {
|
|
18
|
+
t1 = /* @__PURE__ */ jsx(AnalyticsContext, {
|
|
19
|
+
value: track,
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
$[0] = children;
|
|
23
|
+
$[1] = track;
|
|
24
|
+
$[2] = t1;
|
|
25
|
+
} else t1 = $[2];
|
|
26
|
+
return t1;
|
|
27
|
+
}
|
|
28
|
+
/** The nearest `AnalyticsProvider`'s `track`, or a no-op without one. */
|
|
29
|
+
function useAnalytics() {
|
|
30
|
+
return use(AnalyticsContext);
|
|
31
|
+
}
|
|
32
|
+
export { AnalyticsProvider, useAnalytics };
|
|
Binary file
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.aNZ4oW_badge {
|
|
3
|
+
vertical-align: middle;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.aNZ4oW_badge.aNZ4oW_categorised {
|
|
7
|
+
color: color-mix(in oklab,
|
|
8
|
+
var(--viz-badge-color) 55%,
|
|
9
|
+
var(--tf-color-foreground));
|
|
10
|
+
background-color: color-mix(in oklab,
|
|
11
|
+
var(--viz-badge-color) 10%,
|
|
12
|
+
var(--tf-color-background));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.aNZ4oW_outline {
|
|
16
|
+
vertical-align: middle;
|
|
17
|
+
box-shadow: inset 0 0 0 1px
|
|
18
|
+
color-mix(in oklab, var(--tf-color-primary) 20%, transparent);
|
|
19
|
+
color: var(--viz-tint-foreground);
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
border-radius: 99px;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 6px;
|
|
24
|
+
padding: .375rem .8em;
|
|
25
|
+
font-size: .75rem;
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.aNZ4oW_outline:has(.aNZ4oW_count) {
|
|
31
|
+
padding: 0 .8em 0 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.aNZ4oW_count {
|
|
35
|
+
background: color-mix(in oklab,
|
|
36
|
+
var(--tf-color-primary) 10%,
|
|
37
|
+
transparent);
|
|
38
|
+
text-align: center;
|
|
39
|
+
border-radius: 99px 0 0 99px;
|
|
40
|
+
min-width: 2em;
|
|
41
|
+
padding: .375rem .75em;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.aNZ4oW_badge.aNZ4oW_temporary, .aNZ4oW_outline.aNZ4oW_temporary, .aNZ4oW_priority.aNZ4oW_temporary {
|
|
45
|
+
outline-offset: -1px;
|
|
46
|
+
outline: 1px dashed;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:is([data-surface="record"] .aNZ4oW_badge, [data-slot="timeline-row-header"] .aNZ4oW_badge) {
|
|
50
|
+
padding: 0 var(--tf-space-1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.aNZ4oW_priority {
|
|
54
|
+
--priority-padding-block: 1px;
|
|
55
|
+
--priority-ink: var(--tf-color-primary);
|
|
56
|
+
--priority-face: var(--tf-color-primary-foreground);
|
|
57
|
+
--priority-size: calc(1lh + var(--priority-padding-block) * 2);
|
|
58
|
+
isolation: isolate;
|
|
59
|
+
vertical-align: middle;
|
|
60
|
+
font-size: var(--tf-font-size-label-small);
|
|
61
|
+
line-height: var(--tf-line-height-normal);
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
flex-shrink: 0;
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.aNZ4oW_priority-label, .aNZ4oW_priority-value {
|
|
68
|
+
padding: var(--priority-padding-block) .6em;
|
|
69
|
+
min-width: var(--priority-size);
|
|
70
|
+
color: var(--priority-ink);
|
|
71
|
+
position: relative;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.aNZ4oW_priority-label:before, .aNZ4oW_priority-label:after, .aNZ4oW_priority-value:before, .aNZ4oW_priority-value:after {
|
|
75
|
+
content: "";
|
|
76
|
+
z-index: -1;
|
|
77
|
+
inset: 0 calc(var(--priority-size) / 2) 0 0;
|
|
78
|
+
background: var(--priority-face);
|
|
79
|
+
position: absolute;
|
|
80
|
+
mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 252 16'%3e%3cpath d='M252,0 L252,16 L8,16 C7.5,16 7,15.81 6.62,15.43 L0.57,9.38 C-0.19,8.62 -0.19,7.38 0.57,6.62 L6.62,0.57 C7,0.19 7.5,0 8,0 L252,0 Z'/%3e%3c/svg%3e");
|
|
81
|
+
mask-size: cover;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.aNZ4oW_priority-label:after, .aNZ4oW_priority-value:after {
|
|
85
|
+
inset: 0 0 0 calc(var(--priority-size) / 2);
|
|
86
|
+
rotate: 180deg;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.aNZ4oW_priority-label {
|
|
90
|
+
padding-inline: 1em calc(var(--priority-size) + .4em);
|
|
91
|
+
color: var(--priority-face);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.aNZ4oW_priority-label:before, .aNZ4oW_priority-label:after {
|
|
95
|
+
background: var(--priority-ink);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.aNZ4oW_priority-value {
|
|
99
|
+
margin-left: calc(-1 * var(--priority-size));
|
|
100
|
+
font-family: var(--tf-font-mono);
|
|
101
|
+
font-variant-numeric: tabular-nums;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.aNZ4oW_badge-group {
|
|
105
|
+
--badge-group-gap: var(--tf-space-1);
|
|
106
|
+
gap: var(--badge-group-gap);
|
|
107
|
+
flex-wrap: wrap;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
[data-surface="record"] .aNZ4oW_badge-group {
|
|
111
|
+
min-width: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.vis-label .aNZ4oW_badge-group {
|
|
115
|
+
max-width: 300px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.aNZ4oW_badge-group.aNZ4oW_no-wrap {
|
|
119
|
+
flex-wrap: nowrap;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SlotIcon } from "../vendor/components.mjs";
|
|
2
|
+
import { VizCategory } from "@timefoldai/viz-core";
|
|
3
|
+
/** A verdict on a record; a badge with no `state` and no `category` is neutral. */
|
|
4
|
+
export type BadgeState = "positive" | "negative" | "warning";
|
|
5
|
+
/** The badge forms other than the default label: the `outline` count pill and the `priority` compound. */
|
|
6
|
+
export type BadgeVariant = "outline" | "priority";
|
|
7
|
+
/** The `Badge` props shared by every badge form. */
|
|
8
|
+
export interface BadgeBaseProps extends Omit<React.ComponentProps<"span">, "color"> {
|
|
9
|
+
temporary?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** `ComponentProps<"span">` gives every span attribute pass-through, including `ref`. */
|
|
12
|
+
export type BadgeProps = BadgeBaseProps & ({
|
|
13
|
+
variant: "outline";
|
|
14
|
+
count?: number;
|
|
15
|
+
label?: never;
|
|
16
|
+
category?: never;
|
|
17
|
+
state?: never;
|
|
18
|
+
fullLabel?: never;
|
|
19
|
+
border?: never;
|
|
20
|
+
leadingIcon?: never;
|
|
21
|
+
trailingIcon?: never;
|
|
22
|
+
} | {
|
|
23
|
+
variant: "priority";
|
|
24
|
+
label: string;
|
|
25
|
+
count?: never;
|
|
26
|
+
category?: never;
|
|
27
|
+
state?: never;
|
|
28
|
+
fullLabel?: never;
|
|
29
|
+
border?: never;
|
|
30
|
+
leadingIcon?: never;
|
|
31
|
+
trailingIcon?: never;
|
|
32
|
+
} | {
|
|
33
|
+
variant?: never;
|
|
34
|
+
label?: never;
|
|
35
|
+
count?: never;
|
|
36
|
+
category?: VizCategory;
|
|
37
|
+
state?: BadgeState;
|
|
38
|
+
fullLabel?: string;
|
|
39
|
+
border?: boolean;
|
|
40
|
+
leadingIcon?: SlotIcon;
|
|
41
|
+
trailingIcon?: SlotIcon;
|
|
42
|
+
});
|
|
43
|
+
/**
|
|
44
|
+
* The design-system badge, plus the viz parts it cannot draw: a categorical colour, a cut label
|
|
45
|
+
* with its tooltip, the outline pill with its count, the priority compound and the temporary mark.
|
|
46
|
+
*
|
|
47
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/
|
|
48
|
+
* @category Data display
|
|
49
|
+
*/
|
|
50
|
+
export default function Badge(props: BadgeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { isTextCut } from "../tooltip/is-text-cut.mjs";
|
|
3
|
+
import Tooltip$1 from "../tooltip/Tooltip.mjs";
|
|
4
|
+
import Badge_module_default from "./Badge.module.css.mjs";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useCallback, useRef, useState } from "react";
|
|
8
|
+
import { Badge as Badge$1 } from "../vendor/components.mjs";
|
|
9
|
+
import clsx$1 from "clsx";
|
|
10
|
+
// src/badge/Badge.tsx
|
|
11
|
+
const STATE_COLOR = {
|
|
12
|
+
positive: "green",
|
|
13
|
+
negative: "red",
|
|
14
|
+
warning: "yellow"
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The design-system badge, plus the viz parts it cannot draw: a categorical colour, a cut label
|
|
18
|
+
* with its tooltip, the outline pill with its count, the priority compound and the temporary mark.
|
|
19
|
+
*
|
|
20
|
+
* @see https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/
|
|
21
|
+
* @category Data display
|
|
22
|
+
*/
|
|
23
|
+
function Badge(props) {
|
|
24
|
+
const $ = c(6);
|
|
25
|
+
if (props.variant === "priority") {
|
|
26
|
+
let t0;
|
|
27
|
+
if ($[0] !== props) {
|
|
28
|
+
t0 = /* @__PURE__ */ jsx(PriorityBadge, { ...props });
|
|
29
|
+
$[0] = props;
|
|
30
|
+
$[1] = t0;
|
|
31
|
+
} else t0 = $[1];
|
|
32
|
+
return t0;
|
|
33
|
+
}
|
|
34
|
+
if (props.variant === "outline") {
|
|
35
|
+
let t0;
|
|
36
|
+
if ($[2] !== props) {
|
|
37
|
+
t0 = /* @__PURE__ */ jsx(OutlineBadge, { ...props });
|
|
38
|
+
$[2] = props;
|
|
39
|
+
$[3] = t0;
|
|
40
|
+
} else t0 = $[3];
|
|
41
|
+
return t0;
|
|
42
|
+
}
|
|
43
|
+
let t0;
|
|
44
|
+
if ($[4] !== props) {
|
|
45
|
+
t0 = /* @__PURE__ */ jsx(PillBadge, { ...props });
|
|
46
|
+
$[4] = props;
|
|
47
|
+
$[5] = t0;
|
|
48
|
+
} else t0 = $[5];
|
|
49
|
+
return t0;
|
|
50
|
+
}
|
|
51
|
+
function OutlineBadge({ count, children, className, temporary = false, variant, ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
53
|
+
"data-slot": "badge",
|
|
54
|
+
"data-variant": variant,
|
|
55
|
+
className: clsx$1(Badge_module_default.outline, "max-w-full shrink-0 overflow-hidden", temporary && Badge_module_default.temporary, className),
|
|
56
|
+
...props,
|
|
57
|
+
children: [
|
|
58
|
+
count !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
59
|
+
className: Badge_module_default.count,
|
|
60
|
+
"data-slot": "badge-count",
|
|
61
|
+
children: count
|
|
62
|
+
}),
|
|
63
|
+
children,
|
|
64
|
+
temporary && /* @__PURE__ */ jsx("span", {
|
|
65
|
+
className: "sr-only",
|
|
66
|
+
children: " (temporary)"
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function PriorityBadge({ label, children, className, temporary = false, variant, ...props }) {
|
|
72
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
73
|
+
"data-slot": "badge",
|
|
74
|
+
"data-variant": variant,
|
|
75
|
+
className: clsx$1(Badge_module_default.priority, temporary && Badge_module_default.temporary, className),
|
|
76
|
+
...props,
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx("span", {
|
|
79
|
+
className: Badge_module_default["priority-label"],
|
|
80
|
+
children: label
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: Badge_module_default["priority-value"],
|
|
84
|
+
"data-slot": "badge-priority-value",
|
|
85
|
+
children
|
|
86
|
+
}),
|
|
87
|
+
temporary && /* @__PURE__ */ jsx("span", {
|
|
88
|
+
className: "sr-only",
|
|
89
|
+
children: " (temporary)"
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function PillBadge({ category, className, children, state, temporary = false, fullLabel, border, leadingIcon, trailingIcon, style, ...props }) {
|
|
95
|
+
const labelRef = useRef(null);
|
|
96
|
+
const [labelCut, setLabelCut] = useState(false);
|
|
97
|
+
const isLabelCut = () => isTextCut(labelRef.current);
|
|
98
|
+
const watchLabel = useCallback((label) => {
|
|
99
|
+
labelRef.current = label;
|
|
100
|
+
if (!label) return;
|
|
101
|
+
const measure = () => setLabelCut(isTextCut(label));
|
|
102
|
+
const resizes = new ResizeObserver(measure);
|
|
103
|
+
const edits = new MutationObserver(measure);
|
|
104
|
+
resizes.observe(label);
|
|
105
|
+
edits.observe(label, {
|
|
106
|
+
subtree: true,
|
|
107
|
+
childList: true,
|
|
108
|
+
characterData: true
|
|
109
|
+
});
|
|
110
|
+
return () => {
|
|
111
|
+
resizes.disconnect();
|
|
112
|
+
edits.disconnect();
|
|
113
|
+
};
|
|
114
|
+
}, []);
|
|
115
|
+
const badge = /* @__PURE__ */ jsxs(Badge$1, {
|
|
116
|
+
"data-slot": "badge",
|
|
117
|
+
"data-state": state,
|
|
118
|
+
tabIndex: labelCut ? 0 : void 0,
|
|
119
|
+
color: state === void 0 ? "neutral" : STATE_COLOR[state],
|
|
120
|
+
border,
|
|
121
|
+
leadingIcon,
|
|
122
|
+
trailingIcon,
|
|
123
|
+
className: clsx$1(Badge_module_default.badge, "relative max-w-full shrink-0 overflow-hidden", temporary && Badge_module_default.temporary, category != null && Badge_module_default.categorised, className),
|
|
124
|
+
style: {
|
|
125
|
+
...category != null ? { "--viz-badge-color": `var(--viz-cat-${category})` } : void 0,
|
|
126
|
+
...style
|
|
127
|
+
},
|
|
128
|
+
...props,
|
|
129
|
+
children: [fullLabel === void 0 ? children : /* @__PURE__ */ jsx("span", {
|
|
130
|
+
ref: watchLabel,
|
|
131
|
+
"data-slot": "badge-label",
|
|
132
|
+
className: "relative min-w-0 truncate",
|
|
133
|
+
children
|
|
134
|
+
}), temporary && /* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: "sr-only",
|
|
136
|
+
children: " (temporary)"
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
return fullLabel === void 0 ? badge : /* @__PURE__ */ jsx(Tooltip$1, {
|
|
140
|
+
label: fullLabel,
|
|
141
|
+
shouldOpen: isLabelCut,
|
|
142
|
+
children: badge
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
export { Badge as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './Badge.css';
|
|
2
|
+
// src/badge/Badge.module.css
|
|
3
|
+
var Badge_module_default = {
|
|
4
|
+
"badge": "aNZ4oW_badge",
|
|
5
|
+
"badge-group": "aNZ4oW_badge-group",
|
|
6
|
+
"categorised": "aNZ4oW_categorised",
|
|
7
|
+
"count": "aNZ4oW_count",
|
|
8
|
+
"no-wrap": "aNZ4oW_no-wrap",
|
|
9
|
+
"outline": "aNZ4oW_outline",
|
|
10
|
+
"priority": "aNZ4oW_priority",
|
|
11
|
+
"priority-label": "aNZ4oW_priority-label",
|
|
12
|
+
"priority-value": "aNZ4oW_priority-value",
|
|
13
|
+
"temporary": "aNZ4oW_temporary"
|
|
14
|
+
};
|
|
15
|
+
export { Badge_module_default as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BadgeListValue } from "./badge-item.mjs";
|
|
2
|
+
import { SlotIcon } from "../vendor/components.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* One facet's values, plus the icon rendered before each of its badges (skills, tags, risk
|
|
5
|
+
* factors, …).
|
|
6
|
+
*/
|
|
7
|
+
export interface BadgeFacet {
|
|
8
|
+
items: BadgeListValue[] | null | undefined;
|
|
9
|
+
icon?: SlotIcon;
|
|
10
|
+
/** @defaultValue false */
|
|
11
|
+
temporary?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** The props of `BadgeFacetGroup`: its labelled facets and the attributes of its root `div`. */
|
|
14
|
+
export interface BadgeFacetGroupProps extends Omit<React.ComponentProps<"div">, "children"> {
|
|
15
|
+
facets: BadgeFacet[];
|
|
16
|
+
noWrap?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Several `BadgeList`-shaped facets sharing one overflow budget, folding overflow into a
|
|
20
|
+
* single trailing "+N" chip.
|
|
21
|
+
* @category Data display
|
|
22
|
+
*/
|
|
23
|
+
export default function BadgeFacetGroup({ facets, noWrap, ref, ...props }: BadgeFacetGroupProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMergedRef } from "../hooks/use-merged-ref.mjs";
|
|
3
|
+
import Badge from "./Badge.mjs";
|
|
4
|
+
import { fitWithReservedChip, growWithExactChip } from "./badge-facet-fit.mjs";
|
|
5
|
+
import { renderBadgeItem, valueOf } from "./badge-item.mjs";
|
|
6
|
+
import BadgeGroup from "./BadgeGroup.mjs";
|
|
7
|
+
import { c } from "react/compiler-runtime";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
|
+
// src/badge/BadgeFacetGroup.tsx
|
|
11
|
+
const KEY_SEPARATOR = "\0";
|
|
12
|
+
const MEASURER_STYLE = {
|
|
13
|
+
position: "fixed",
|
|
14
|
+
top: -9999,
|
|
15
|
+
left: -9999,
|
|
16
|
+
visibility: "hidden",
|
|
17
|
+
width: "max-content",
|
|
18
|
+
pointerEvents: "none"
|
|
19
|
+
};
|
|
20
|
+
function renderedWidth(el) {
|
|
21
|
+
return el.getBoundingClientRect().width;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Several `BadgeList`-shaped facets sharing one overflow budget, folding overflow into a
|
|
25
|
+
* single trailing "+N" chip.
|
|
26
|
+
* @category Data display
|
|
27
|
+
*/
|
|
28
|
+
function BadgeFacetGroup(t0) {
|
|
29
|
+
const $ = c(35);
|
|
30
|
+
let facets;
|
|
31
|
+
let noWrap;
|
|
32
|
+
let props;
|
|
33
|
+
let ref;
|
|
34
|
+
if ($[0] !== t0) {
|
|
35
|
+
({facets, noWrap, ref, ...props} = t0);
|
|
36
|
+
$[0] = t0;
|
|
37
|
+
$[1] = facets;
|
|
38
|
+
$[2] = noWrap;
|
|
39
|
+
$[3] = props;
|
|
40
|
+
$[4] = ref;
|
|
41
|
+
} else {
|
|
42
|
+
facets = $[1];
|
|
43
|
+
noWrap = $[2];
|
|
44
|
+
props = $[3];
|
|
45
|
+
ref = $[4];
|
|
46
|
+
}
|
|
47
|
+
const entries = facets.flatMap(_temp);
|
|
48
|
+
const entryCount = entries.length;
|
|
49
|
+
const entriesKey = entries.map(_temp2).join(KEY_SEPARATOR);
|
|
50
|
+
const [measurerEl, setMeasurerEl] = useState(null);
|
|
51
|
+
const [containerEl, setContainerEl] = useState(null);
|
|
52
|
+
const containerRef = useMergedRef(setContainerEl, ref);
|
|
53
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
54
|
+
const [measurement, setMeasurement] = useState(null);
|
|
55
|
+
const [chipCorrection, setChipCorrection] = useState(null);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!measurerEl || entryCount === 0) return;
|
|
58
|
+
const measure = () => {
|
|
59
|
+
const badgeWidths = Array.from(measurerEl.querySelectorAll(":scope > [data-slot=\"badge\"]"), renderedWidth);
|
|
60
|
+
const reservedChipWidth = badgeWidths.pop();
|
|
61
|
+
if (reservedChipWidth === void 0) return;
|
|
62
|
+
setMeasurement({
|
|
63
|
+
entriesKey,
|
|
64
|
+
widths: badgeWidths,
|
|
65
|
+
gap: parseFloat(getComputedStyle(measurerEl).columnGap) || 0,
|
|
66
|
+
reservedChipWidth
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const observer = new ResizeObserver(measure);
|
|
70
|
+
observer.observe(measurerEl);
|
|
71
|
+
return () => observer.disconnect();
|
|
72
|
+
}, [
|
|
73
|
+
measurerEl,
|
|
74
|
+
entriesKey,
|
|
75
|
+
entryCount
|
|
76
|
+
]);
|
|
77
|
+
let t1;
|
|
78
|
+
let t2;
|
|
79
|
+
if ($[5] !== containerEl) {
|
|
80
|
+
t1 = () => {
|
|
81
|
+
if (!containerEl) return;
|
|
82
|
+
const observer_0 = new ResizeObserver((observerEntries) => {
|
|
83
|
+
setContainerWidth(observerEntries[0]?.contentRect.width ?? 0);
|
|
84
|
+
});
|
|
85
|
+
observer_0.observe(containerEl);
|
|
86
|
+
return () => observer_0.disconnect();
|
|
87
|
+
};
|
|
88
|
+
t2 = [containerEl];
|
|
89
|
+
$[5] = containerEl;
|
|
90
|
+
$[6] = t1;
|
|
91
|
+
$[7] = t2;
|
|
92
|
+
} else {
|
|
93
|
+
t1 = $[6];
|
|
94
|
+
t2 = $[7];
|
|
95
|
+
}
|
|
96
|
+
useEffect(t1, t2);
|
|
97
|
+
const reservedFit = measurement?.entriesKey === entriesKey && containerWidth > 0 ? fitWithReservedChip(measurement.widths, measurement.gap, containerWidth, measurement.reservedChipWidth) : null;
|
|
98
|
+
const isChipCorrected = chipCorrection?.measurement === measurement && chipCorrection.containerWidth === containerWidth;
|
|
99
|
+
const layout = isChipCorrected ? chipCorrection.fit : reservedFit;
|
|
100
|
+
let t3;
|
|
101
|
+
let t4;
|
|
102
|
+
if ($[8] !== containerEl || $[9] !== containerWidth || $[10] !== isChipCorrected || $[11] !== measurement || $[12] !== reservedFit) {
|
|
103
|
+
t3 = () => {
|
|
104
|
+
if (!containerEl || !measurement || !reservedFit) return;
|
|
105
|
+
if (reservedFit.hiddenCount === 0 || isChipCorrected) return;
|
|
106
|
+
const badgeEls = containerEl.querySelectorAll(":scope > [data-slot=\"badge\"]");
|
|
107
|
+
const chipEl = badgeEls[badgeEls.length - 1];
|
|
108
|
+
if (chipEl?.dataset.overflowCount !== String(reservedFit.hiddenCount)) return;
|
|
109
|
+
setChipCorrection({
|
|
110
|
+
measurement,
|
|
111
|
+
containerWidth,
|
|
112
|
+
fit: growWithExactChip(measurement.widths, measurement.gap, containerWidth, reservedFit, renderedWidth(chipEl))
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
t4 = [
|
|
116
|
+
containerEl,
|
|
117
|
+
measurement,
|
|
118
|
+
reservedFit,
|
|
119
|
+
isChipCorrected,
|
|
120
|
+
containerWidth
|
|
121
|
+
];
|
|
122
|
+
$[8] = containerEl;
|
|
123
|
+
$[9] = containerWidth;
|
|
124
|
+
$[10] = isChipCorrected;
|
|
125
|
+
$[11] = measurement;
|
|
126
|
+
$[12] = reservedFit;
|
|
127
|
+
$[13] = t3;
|
|
128
|
+
$[14] = t4;
|
|
129
|
+
} else {
|
|
130
|
+
t3 = $[13];
|
|
131
|
+
t4 = $[14];
|
|
132
|
+
}
|
|
133
|
+
useEffect(t3, t4);
|
|
134
|
+
if (entryCount === 0) return null;
|
|
135
|
+
const allBadges = entries.map(_temp3);
|
|
136
|
+
const overflowChip = _temp4;
|
|
137
|
+
const visibleBadges = layout ? allBadges.slice(0, layout.visibleCount) : allBadges;
|
|
138
|
+
let t5;
|
|
139
|
+
if ($[15] !== entryCount || $[16] !== overflowChip) {
|
|
140
|
+
t5 = overflowChip("reserve", entryCount);
|
|
141
|
+
$[15] = entryCount;
|
|
142
|
+
$[16] = overflowChip;
|
|
143
|
+
$[17] = t5;
|
|
144
|
+
} else t5 = $[17];
|
|
145
|
+
let t6;
|
|
146
|
+
if ($[18] !== allBadges || $[19] !== setMeasurerEl || $[20] !== t5) {
|
|
147
|
+
t6 = /* @__PURE__ */ jsxs(BadgeGroup, {
|
|
148
|
+
ref: setMeasurerEl,
|
|
149
|
+
"aria-hidden": "true",
|
|
150
|
+
style: MEASURER_STYLE,
|
|
151
|
+
children: [allBadges, t5]
|
|
152
|
+
});
|
|
153
|
+
$[18] = allBadges;
|
|
154
|
+
$[19] = setMeasurerEl;
|
|
155
|
+
$[20] = t5;
|
|
156
|
+
$[21] = t6;
|
|
157
|
+
} else t6 = $[21];
|
|
158
|
+
const t7 = layout ? "fitted" : "measuring";
|
|
159
|
+
let t8;
|
|
160
|
+
if ($[22] !== layout || $[23] !== overflowChip) {
|
|
161
|
+
t8 = layout && layout.hiddenCount > 0 && overflowChip("overflow", layout.hiddenCount);
|
|
162
|
+
$[22] = layout;
|
|
163
|
+
$[23] = overflowChip;
|
|
164
|
+
$[24] = t8;
|
|
165
|
+
} else t8 = $[24];
|
|
166
|
+
let t9;
|
|
167
|
+
if ($[25] !== containerRef || $[26] !== noWrap || $[27] !== props || $[28] !== t7 || $[29] !== t8 || $[30] !== visibleBadges) {
|
|
168
|
+
t9 = /* @__PURE__ */ jsxs(BadgeGroup, {
|
|
169
|
+
...props,
|
|
170
|
+
ref: containerRef,
|
|
171
|
+
"data-state": t7,
|
|
172
|
+
noWrap,
|
|
173
|
+
children: [visibleBadges, t8]
|
|
174
|
+
});
|
|
175
|
+
$[25] = containerRef;
|
|
176
|
+
$[26] = noWrap;
|
|
177
|
+
$[27] = props;
|
|
178
|
+
$[28] = t7;
|
|
179
|
+
$[29] = t8;
|
|
180
|
+
$[30] = visibleBadges;
|
|
181
|
+
$[31] = t9;
|
|
182
|
+
} else t9 = $[31];
|
|
183
|
+
let t10;
|
|
184
|
+
if ($[32] !== t6 || $[33] !== t9) {
|
|
185
|
+
t10 = /* @__PURE__ */ jsxs(Fragment, { children: [t6, t9] });
|
|
186
|
+
$[32] = t6;
|
|
187
|
+
$[33] = t9;
|
|
188
|
+
$[34] = t10;
|
|
189
|
+
} else t10 = $[34];
|
|
190
|
+
return t10;
|
|
191
|
+
}
|
|
192
|
+
function _temp4(key, count) {
|
|
193
|
+
return /* @__PURE__ */ jsxs(Badge, {
|
|
194
|
+
"data-overflow-count": count,
|
|
195
|
+
children: [`+${count}`, /* @__PURE__ */ jsx("span", {
|
|
196
|
+
className: "sr-only",
|
|
197
|
+
children: " more"
|
|
198
|
+
})]
|
|
199
|
+
}, key);
|
|
200
|
+
}
|
|
201
|
+
function _temp3(t0, index) {
|
|
202
|
+
const { item: item_1, icon, temporary } = t0;
|
|
203
|
+
return renderBadgeItem(item_1, {
|
|
204
|
+
key: index,
|
|
205
|
+
icon,
|
|
206
|
+
temporary
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function _temp2(t0) {
|
|
210
|
+
const { item: item_0 } = t0;
|
|
211
|
+
return valueOf(item_0);
|
|
212
|
+
}
|
|
213
|
+
function _temp(facet) {
|
|
214
|
+
return (facet.items ?? []).map((item) => ({
|
|
215
|
+
item,
|
|
216
|
+
icon: facet.icon,
|
|
217
|
+
temporary: facet.temporary
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
export { BadgeFacetGroup as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `ComponentProps<"div">` gives every div attribute pass-through, including `ref` —
|
|
3
|
+
* `BadgeFacetGroup`'s measurer needs a ref onto this container.
|
|
4
|
+
*/
|
|
5
|
+
export interface BadgeGroupProps extends React.ComponentProps<"div"> {
|
|
6
|
+
noWrap?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A horizontal group of `Badge`s (a flex row that wraps).
|
|
10
|
+
*
|
|
11
|
+
* @category Data display
|
|
12
|
+
*/
|
|
13
|
+
export default function BadgeGroup({ children, className, noWrap, ...props }: BadgeGroupProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Badge_module_default from "./Badge.module.css.mjs";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import clsx$1 from "clsx";
|
|
5
|
+
// src/badge/BadgeGroup.tsx
|
|
6
|
+
/**
|
|
7
|
+
* A horizontal group of `Badge`s (a flex row that wraps).
|
|
8
|
+
*
|
|
9
|
+
* @category Data display
|
|
10
|
+
*/
|
|
11
|
+
function BadgeGroup(t0) {
|
|
12
|
+
const $ = c(12);
|
|
13
|
+
let children;
|
|
14
|
+
let className;
|
|
15
|
+
let noWrap;
|
|
16
|
+
let props;
|
|
17
|
+
if ($[0] !== t0) {
|
|
18
|
+
({children, className, noWrap, ...props} = t0);
|
|
19
|
+
$[0] = t0;
|
|
20
|
+
$[1] = children;
|
|
21
|
+
$[2] = className;
|
|
22
|
+
$[3] = noWrap;
|
|
23
|
+
$[4] = props;
|
|
24
|
+
} else {
|
|
25
|
+
children = $[1];
|
|
26
|
+
className = $[2];
|
|
27
|
+
noWrap = $[3];
|
|
28
|
+
props = $[4];
|
|
29
|
+
}
|
|
30
|
+
const t1 = noWrap && Badge_module_default["no-wrap"];
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[5] !== className || $[6] !== t1) {
|
|
33
|
+
t2 = clsx$1(Badge_module_default["badge-group"], "flex items-center", t1, className);
|
|
34
|
+
$[5] = className;
|
|
35
|
+
$[6] = t1;
|
|
36
|
+
$[7] = t2;
|
|
37
|
+
} else t2 = $[7];
|
|
38
|
+
let t3;
|
|
39
|
+
if ($[8] !== children || $[9] !== props || $[10] !== t2) {
|
|
40
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
41
|
+
"data-slot": "badge-group",
|
|
42
|
+
className: t2,
|
|
43
|
+
...props,
|
|
44
|
+
children
|
|
45
|
+
});
|
|
46
|
+
$[8] = children;
|
|
47
|
+
$[9] = props;
|
|
48
|
+
$[10] = t2;
|
|
49
|
+
$[11] = t3;
|
|
50
|
+
} else t3 = $[11];
|
|
51
|
+
return t3;
|
|
52
|
+
}
|
|
53
|
+
export { BadgeGroup as default };
|