@seekalfred/primitives 0.6.0 → 0.7.3
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 +214 -15
- package/dist/activity-heatmap/activity-heatmap.d.ts +92 -0
- package/dist/activity-heatmap/activity-heatmap.js +699 -0
- package/dist/activity-heatmap/activity-heatmap.js.map +1 -0
- package/dist/activity-heatmap/index.d.ts +2 -0
- package/dist/activity-heatmap/index.js +2 -0
- package/dist/alert/alert.d.ts +53 -4
- package/dist/alert/alert.js +100 -11
- package/dist/alert/alert.js.map +1 -1
- package/dist/alert/index.d.ts +2 -2
- package/dist/alert/index.js +2 -2
- package/dist/alert-dialog/alert-dialog.d.ts +58 -18
- package/dist/alert-dialog/alert-dialog.js +152 -9
- package/dist/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/alert-dialog/index.d.ts +2 -2
- package/dist/alert-dialog/index.js +2 -2
- package/dist/animated-counter/animated-counter.d.ts +38 -0
- package/dist/animated-counter/animated-counter.js +230 -0
- package/dist/animated-counter/animated-counter.js.map +1 -0
- package/dist/animated-counter/index.d.ts +2 -0
- package/dist/animated-counter/index.js +2 -0
- package/dist/announcement-bar/announcement-bar.d.ts +67 -0
- package/dist/announcement-bar/announcement-bar.js +364 -0
- package/dist/announcement-bar/announcement-bar.js.map +1 -0
- package/dist/announcement-bar/index.d.ts +2 -0
- package/dist/announcement-bar/index.js +2 -0
- package/dist/badge/badge.d.ts +1 -1
- package/dist/bar-chart/bar-chart.d.ts +51 -0
- package/dist/bar-chart/bar-chart.js +565 -0
- package/dist/bar-chart/bar-chart.js.map +1 -0
- package/dist/bar-chart/index.d.ts +2 -0
- package/dist/bar-chart/index.js +2 -0
- package/dist/breadcrumb/breadcrumb.d.ts +2 -2
- package/dist/breadcrumb/breadcrumb.js +12 -3
- package/dist/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/brush-chart/brush-chart.d.ts +64 -0
- package/dist/brush-chart/brush-chart.js +1056 -0
- package/dist/brush-chart/brush-chart.js.map +1 -0
- package/dist/brush-chart/index.d.ts +2 -0
- package/dist/brush-chart/index.js +2 -0
- package/dist/button/button.d.ts +1 -1
- package/dist/button/button.js +31 -21
- package/dist/button/button.js.map +1 -1
- package/dist/button-group/button-group.js +3 -4
- package/dist/button-group/button-group.js.map +1 -1
- package/dist/calendar/calendar.d.ts +1 -1
- package/dist/card/card.d.ts +22 -1
- package/dist/card/card.js +60 -7
- package/dist/card/card.js.map +1 -1
- package/dist/card-stack/card-stack.d.ts +54 -0
- package/dist/card-stack/card-stack.js +492 -0
- package/dist/card-stack/card-stack.js.map +1 -0
- package/dist/card-stack/index.d.ts +2 -0
- package/dist/card-stack/index.js +2 -0
- package/dist/carousel/carousel.d.ts +77 -0
- package/dist/carousel/carousel.js +415 -0
- package/dist/carousel/carousel.js.map +1 -0
- package/dist/carousel/index.d.ts +2 -0
- package/dist/carousel/index.js +2 -0
- package/dist/checkbox/checkbox.js +4 -4
- package/dist/checkbox/checkbox.js.map +1 -1
- package/dist/chip-group/chip-group.d.ts +37 -0
- package/dist/chip-group/chip-group.js +148 -0
- package/dist/chip-group/chip-group.js.map +1 -0
- package/dist/chip-group/index.d.ts +2 -0
- package/dist/chip-group/index.js +2 -0
- package/dist/copy-button/copy-button.d.ts +18 -2
- package/dist/copy-button/copy-button.js +29 -8
- package/dist/copy-button/copy-button.js.map +1 -1
- package/dist/countdown/countdown.d.ts +45 -0
- package/dist/countdown/countdown.js +298 -0
- package/dist/countdown/countdown.js.map +1 -0
- package/dist/countdown/index.d.ts +2 -0
- package/dist/countdown/index.js +2 -0
- package/dist/date-picker/picker-parts.js +1 -1
- package/dist/date-picker/picker-parts.js.map +1 -1
- package/dist/dialog/dialog.js +1 -1
- package/dist/dialog/dialog.js.map +1 -1
- package/dist/donut-chart/donut-chart.d.ts +86 -0
- package/dist/donut-chart/donut-chart.js +593 -0
- package/dist/donut-chart/donut-chart.js.map +1 -0
- package/dist/donut-chart/index.d.ts +2 -0
- package/dist/donut-chart/index.js +2 -0
- package/dist/empty-state/empty-state.d.ts +42 -10
- package/dist/empty-state/empty-state.js +44 -26
- package/dist/empty-state/empty-state.js.map +1 -1
- package/dist/empty-state/index.d.ts +2 -2
- package/dist/empty-state/index.js +2 -2
- package/dist/file-drop-zone/file-drop-zone.js +1 -1
- package/dist/file-drop-zone/file-drop-zone.js.map +1 -1
- package/dist/filter-bar/filter-bar.d.ts +50 -26
- package/dist/filter-bar/filter-bar.js +317 -157
- package/dist/filter-bar/filter-bar.js.map +1 -1
- package/dist/gauge/gauge.d.ts +45 -0
- package/dist/gauge/gauge.js +219 -0
- package/dist/gauge/gauge.js.map +1 -0
- package/dist/gauge/index.d.ts +2 -0
- package/dist/gauge/index.js +2 -0
- package/dist/in-view-title/in-view-title.d.ts +33 -0
- package/dist/in-view-title/in-view-title.js +119 -0
- package/dist/in-view-title/in-view-title.js.map +1 -0
- package/dist/in-view-title/index.d.ts +2 -0
- package/dist/in-view-title/index.js +2 -0
- package/dist/index.d.ts +53 -10
- package/dist/index.js +52 -12
- package/dist/input/input.js +4 -4
- package/dist/input/input.js.map +1 -1
- package/dist/lib/cn.js +11 -1
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/field-message.js +28 -10
- package/dist/lib/field-message.js.map +1 -1
- package/dist/lib/field-shell.js +10 -3
- package/dist/lib/field-shell.js.map +1 -1
- package/dist/lib/field-surface.js +31 -9
- package/dist/lib/field-surface.js.map +1 -1
- package/dist/lib/flag-emoji.js +50 -0
- package/dist/lib/flag-emoji.js.map +1 -0
- package/dist/lib/flip.js +11 -3
- package/dist/lib/flip.js.map +1 -1
- package/dist/lib/menu-highlight.js +64 -0
- package/dist/lib/menu-highlight.js.map +1 -0
- package/dist/lib/motion.js +9 -2
- package/dist/lib/motion.js.map +1 -1
- package/dist/lib/rolling-value.js +1 -1
- package/dist/lib/rolling-value.js.map +1 -1
- package/dist/lib/spring-tween.js +500 -0
- package/dist/lib/spring-tween.js.map +1 -0
- package/dist/lib/swap-text.js +3 -1
- package/dist/lib/swap-text.js.map +1 -1
- package/dist/lib/use-copy-feedback.js +17 -3
- package/dist/lib/use-copy-feedback.js.map +1 -1
- package/dist/line-chart/index.d.ts +2 -0
- package/dist/line-chart/index.js +2 -0
- package/dist/line-chart/line-chart.d.ts +116 -0
- package/dist/line-chart/line-chart.js +740 -0
- package/dist/line-chart/line-chart.js.map +1 -0
- package/dist/mention-input/index.d.ts +2 -0
- package/dist/mention-input/index.js +2 -0
- package/dist/mention-input/mention-input.d.ts +98 -0
- package/dist/mention-input/mention-input.js +576 -0
- package/dist/mention-input/mention-input.js.map +1 -0
- package/dist/menu/menu.d.ts +2 -0
- package/dist/menu/menu.js +23 -12
- package/dist/menu/menu.js.map +1 -1
- package/dist/money-input/index.d.ts +2 -0
- package/dist/money-input/index.js +2 -0
- package/dist/money-input/money-input.d.ts +86 -0
- package/dist/money-input/money-input.js +613 -0
- package/dist/money-input/money-input.js.map +1 -0
- package/dist/morph-select/index.d.ts +2 -0
- package/dist/morph-select/index.js +2 -0
- package/dist/morph-select/morph-select.d.ts +89 -0
- package/dist/morph-select/morph-select.js +712 -0
- package/dist/morph-select/morph-select.js.map +1 -0
- package/dist/multi-select/index.d.ts +2 -0
- package/dist/multi-select/index.js +2 -0
- package/dist/multi-select/multi-select.d.ts +77 -0
- package/dist/multi-select/multi-select.js +209 -0
- package/dist/multi-select/multi-select.js.map +1 -0
- package/dist/number-field/index.d.ts +2 -0
- package/dist/number-field/index.js +2 -0
- package/dist/number-field/number-field.d.ts +42 -0
- package/dist/number-field/number-field.js +199 -0
- package/dist/number-field/number-field.js.map +1 -0
- package/dist/onboarding-checklist/index.d.ts +2 -0
- package/dist/onboarding-checklist/index.js +2 -0
- package/dist/onboarding-checklist/onboarding-checklist.d.ts +55 -0
- package/dist/onboarding-checklist/onboarding-checklist.js +577 -0
- package/dist/onboarding-checklist/onboarding-checklist.js.map +1 -0
- package/dist/password-field/password-field.d.ts +16 -0
- package/dist/password-field/password-field.js +39 -10
- package/dist/password-field/password-field.js.map +1 -1
- package/dist/phone-input/index.d.ts +3 -0
- package/dist/phone-input/index.js +3 -0
- package/dist/phone-input/phone-countries.d.ts +29 -0
- package/dist/phone-input/phone-countries.js +170 -0
- package/dist/phone-input/phone-countries.js.map +1 -0
- package/dist/phone-input/phone-input.d.ts +66 -0
- package/dist/phone-input/phone-input.js +440 -0
- package/dist/phone-input/phone-input.js.map +1 -0
- package/dist/popover/index.d.ts +2 -2
- package/dist/popover/index.js +2 -2
- package/dist/popover/popover.d.ts +51 -2
- package/dist/popover/popover.js +59 -8
- package/dist/popover/popover.js.map +1 -1
- package/dist/progress/progress.d.ts +16 -2
- package/dist/progress/progress.js +16 -9
- package/dist/progress/progress.js.map +1 -1
- package/dist/radio-group/index.d.ts +2 -2
- package/dist/radio-group/index.js +2 -2
- package/dist/radio-group/radio-group.d.ts +33 -3
- package/dist/radio-group/radio-group.js +110 -10
- package/dist/radio-group/radio-group.js.map +1 -1
- package/dist/reactions/index.d.ts +2 -0
- package/dist/reactions/index.js +2 -0
- package/dist/reactions/reactions.d.ts +50 -0
- package/dist/reactions/reactions.js +315 -0
- package/dist/reactions/reactions.js.map +1 -0
- package/dist/rich-text-editor/index.d.ts +3 -0
- package/dist/rich-text-editor/index.js +2 -0
- package/dist/rich-text-editor/rich-text-editor.d.ts +70 -0
- package/dist/rich-text-editor/rich-text-editor.js +909 -0
- package/dist/rich-text-editor/rich-text-editor.js.map +1 -0
- package/dist/rich-text-editor/rich-text-engine.d.ts +16 -0
- package/dist/rich-text-editor/rich-text-engine.js +366 -0
- package/dist/rich-text-editor/rich-text-engine.js.map +1 -0
- package/dist/rich-text-editor/rich-text-html.js +174 -0
- package/dist/rich-text-editor/rich-text-html.js.map +1 -0
- package/dist/rich-text-editor/rich-text-icons.js +43 -0
- package/dist/rich-text-editor/rich-text-icons.js.map +1 -0
- package/dist/ridgeline/index.d.ts +2 -0
- package/dist/ridgeline/index.js +2 -0
- package/dist/ridgeline/ridgeline.d.ts +55 -0
- package/dist/ridgeline/ridgeline.js +701 -0
- package/dist/ridgeline/ridgeline.js.map +1 -0
- package/dist/scroll-area/index.d.ts +2 -2
- package/dist/scroll-area/index.js +2 -2
- package/dist/scroll-area/scroll-area.d.ts +68 -31
- package/dist/scroll-area/scroll-area.js +212 -62
- package/dist/scroll-area/scroll-area.js.map +1 -1
- package/dist/scrub-input/evaluate.d.ts +14 -0
- package/dist/scrub-input/evaluate.js +72 -0
- package/dist/scrub-input/evaluate.js.map +1 -0
- package/dist/scrub-input/index.d.ts +3 -0
- package/dist/scrub-input/index.js +3 -0
- package/dist/scrub-input/scrub-input.d.ts +74 -0
- package/dist/scrub-input/scrub-input.js +486 -0
- package/dist/scrub-input/scrub-input.js.map +1 -0
- package/dist/search-field/search-field.d.ts +24 -2
- package/dist/search-field/search-field.js +24 -9
- package/dist/search-field/search-field.js.map +1 -1
- package/dist/select/select.d.ts +3 -1
- package/dist/select/select.js +28 -14
- package/dist/select/select.js.map +1 -1
- package/dist/separator/separator.d.ts +22 -10
- package/dist/separator/separator.js +33 -11
- package/dist/separator/separator.js.map +1 -1
- package/dist/sheet/sheet.js +2 -1
- package/dist/sheet/sheet.js.map +1 -1
- package/dist/shortcut-recorder/index.d.ts +3 -0
- package/dist/shortcut-recorder/index.js +3 -0
- package/dist/shortcut-recorder/shortcut-model.d.ts +27 -0
- package/dist/shortcut-recorder/shortcut-model.js +206 -0
- package/dist/shortcut-recorder/shortcut-model.js.map +1 -0
- package/dist/shortcut-recorder/shortcut-recorder.d.ts +93 -0
- package/dist/shortcut-recorder/shortcut-recorder.js +489 -0
- package/dist/shortcut-recorder/shortcut-recorder.js.map +1 -0
- package/dist/slider/index.d.ts +2 -2
- package/dist/slider/slider.d.ts +46 -14
- package/dist/slider/slider.js +151 -67
- package/dist/slider/slider.js.map +1 -1
- package/dist/slope-chart/index.d.ts +2 -0
- package/dist/slope-chart/index.js +2 -0
- package/dist/slope-chart/slope-chart.d.ts +54 -0
- package/dist/slope-chart/slope-chart.js +568 -0
- package/dist/slope-chart/slope-chart.js.map +1 -0
- package/dist/sparkline/index.d.ts +2 -0
- package/dist/sparkline/index.js +2 -0
- package/dist/sparkline/sparkline.d.ts +46 -0
- package/dist/sparkline/sparkline.js +390 -0
- package/dist/sparkline/sparkline.js.map +1 -0
- package/dist/split-bar/index.d.ts +2 -0
- package/dist/split-bar/index.js +2 -0
- package/dist/split-bar/split-bar.d.ts +62 -0
- package/dist/split-bar/split-bar.js +513 -0
- package/dist/split-bar/split-bar.js.map +1 -0
- package/dist/split-button/split-button.d.ts +1 -1
- package/dist/split-button/split-button.js +12 -11
- package/dist/split-button/split-button.js.map +1 -1
- package/dist/stat-card/index.d.ts +2 -2
- package/dist/stat-card/index.js +2 -2
- package/dist/stat-card/stat-card.d.ts +58 -5
- package/dist/stat-card/stat-card.js +144 -17
- package/dist/stat-card/stat-card.js.map +1 -1
- package/dist/stepper/index.d.ts +2 -0
- package/dist/stepper/index.js +2 -0
- package/dist/stepper/stepper.d.ts +51 -0
- package/dist/stepper/stepper.js +215 -0
- package/dist/stepper/stepper.js.map +1 -0
- package/dist/streamgraph/index.d.ts +2 -0
- package/dist/streamgraph/index.js +2 -0
- package/dist/streamgraph/streamgraph.d.ts +70 -0
- package/dist/streamgraph/streamgraph.js +613 -0
- package/dist/streamgraph/streamgraph.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/swipe-actions/index.d.ts +2 -0
- package/dist/swipe-actions/index.js +2 -0
- package/dist/swipe-actions/swipe-actions.d.ts +67 -0
- package/dist/swipe-actions/swipe-actions.js +552 -0
- package/dist/swipe-actions/swipe-actions.js.map +1 -0
- package/dist/switch/switch.js +2 -2
- package/dist/switch/switch.js.map +1 -1
- package/dist/table/index.d.ts +2 -2
- package/dist/table/index.js +2 -2
- package/dist/table/table.d.ts +55 -3
- package/dist/table/table.js +340 -165
- package/dist/table/table.js.map +1 -1
- package/dist/tabs/tabs.js +2 -2
- package/dist/tabs/tabs.js.map +1 -1
- package/dist/tag-input/index.d.ts +2 -0
- package/dist/tag-input/index.js +2 -0
- package/dist/tag-input/tag-input.d.ts +40 -0
- package/dist/tag-input/tag-input.js +269 -0
- package/dist/tag-input/tag-input.js.map +1 -0
- package/dist/text-morph/index.d.ts +2 -0
- package/dist/text-morph/index.js +2 -0
- package/dist/text-morph/text-morph.d.ts +23 -0
- package/dist/text-morph/text-morph.js +21 -0
- package/dist/text-morph/text-morph.js.map +1 -0
- package/dist/text-reveal/index.d.ts +2 -0
- package/dist/text-reveal/index.js +2 -0
- package/dist/text-reveal/text-reveal.d.ts +27 -0
- package/dist/text-reveal/text-reveal.js +51 -0
- package/dist/text-reveal/text-reveal.js.map +1 -0
- package/dist/text-shimmer/index.d.ts +2 -0
- package/dist/text-shimmer/index.js +2 -0
- package/dist/text-shimmer/text-shimmer.d.ts +29 -0
- package/dist/text-shimmer/text-shimmer.js +29 -0
- package/dist/text-shimmer/text-shimmer.js.map +1 -0
- package/dist/time-picker/time-picker.d.ts +36 -1
- package/dist/time-picker/time-picker.js +35 -7
- package/dist/time-picker/time-picker.js.map +1 -1
- package/dist/toast/index.d.ts +2 -2
- package/dist/toast/index.js +2 -2
- package/dist/toast/toast.d.ts +7 -1
- package/dist/toast/toast.js +82 -40
- package/dist/toast/toast.js.map +1 -1
- package/dist/tooltip/tooltip.d.ts +9 -2
- package/dist/tooltip/tooltip.js +7 -7
- package/dist/tooltip/tooltip.js.map +1 -1
- package/dist/treemap/index.d.ts +2 -0
- package/dist/treemap/index.js +2 -0
- package/dist/treemap/treemap.d.ts +53 -0
- package/dist/treemap/treemap.js +699 -0
- package/dist/treemap/treemap.js.map +1 -0
- package/dist/usage-meter/index.d.ts +2 -0
- package/dist/usage-meter/index.js +2 -0
- package/dist/usage-meter/usage-meter.d.ts +80 -0
- package/dist/usage-meter/usage-meter.js +458 -0
- package/dist/usage-meter/usage-meter.js.map +1 -0
- package/dist/waffle-chart/index.d.ts +2 -0
- package/dist/waffle-chart/index.js +2 -0
- package/dist/waffle-chart/waffle-chart.d.ts +57 -0
- package/dist/waffle-chart/waffle-chart.js +426 -0
- package/dist/waffle-chart/waffle-chart.js.map +1 -0
- package/package.json +165 -3
|
@@ -54,7 +54,7 @@ const breadcrumbLinkVariants = cva([
|
|
|
54
54
|
"data-[focus-visible]:outline-(length:--focus-ring-width)",
|
|
55
55
|
"data-[focus-visible]:outline-offset-(--focus-ring-offset)",
|
|
56
56
|
"data-[focus-visible]:outline-(--color-ring)",
|
|
57
|
-
"data-[current]:text-foreground data-[current]:font-
|
|
57
|
+
"data-[current]:text-foreground data-[current]:font-semibold data-[current]:cursor-default",
|
|
58
58
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
59
59
|
"[&_svg:not([class*='size-'])]:size-(--icon-sm)"
|
|
60
60
|
]);
|
|
@@ -99,8 +99,17 @@ const BreadcrumbItem = forwardRef(function BreadcrumbItem({ className, children,
|
|
|
99
99
|
}), /* @__PURE__ */ jsx("span", {
|
|
100
100
|
"aria-hidden": "true",
|
|
101
101
|
"data-slot": "breadcrumb-separator",
|
|
102
|
-
className: "shrink-0 select-none group-data-[current]:hidden",
|
|
103
|
-
children: "
|
|
102
|
+
className: "inline-flex shrink-0 items-center select-none group-data-[current]:hidden",
|
|
103
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
104
|
+
viewBox: "0 0 16 16",
|
|
105
|
+
fill: "none",
|
|
106
|
+
stroke: "currentColor",
|
|
107
|
+
strokeWidth: "1.5",
|
|
108
|
+
strokeLinecap: "round",
|
|
109
|
+
strokeLinejoin: "round",
|
|
110
|
+
className: "block size-3.5 rtl:-scale-x-100",
|
|
111
|
+
children: /* @__PURE__ */ jsx("path", { d: "m6 3.5 4.5 4.5L6 12.5" })
|
|
112
|
+
})
|
|
104
113
|
})]
|
|
105
114
|
});
|
|
106
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.js","names":["Breadcrumbs","AriaBreadcrumbs","AriaBreadcrumb","AriaLink"],"sources":["../../src/breadcrumb/breadcrumb.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva } from \"class-variance-authority\";\nimport {\n Children,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport {\n Breadcrumb as AriaBreadcrumb,\n Breadcrumbs as AriaBreadcrumbs,\n Link as AriaLink,\n type BreadcrumbProps as AriaBreadcrumbProps,\n type BreadcrumbsProps as AriaBreadcrumbsProps,\n} from \"react-aria-components\";\n\nimport { cn, cnAll } from \"../lib/cn.js\";\nimport { useFlip } from \"../lib/flip.js\";\nimport { mergeRefs } from \"../lib/merge-refs.js\";\n\n/**\n * Breadcrumbs, ported from the legacy shadcn/Radix component onto React\n * Aria's Breadcrumbs collection.\n *\n * SIX LEGACY PARTS COLLAPSE TO TWO, and not for tidiness -- React Aria's\n * `Breadcrumbs` is a real collection, so it knows which item is last:\n *\n * | legacy | uses | fate |\n * | ------------------- | ---- | ------------------------------------------- |\n * | Breadcrumb | 2 | -> `Breadcrumbs` (nav + ol) |\n * | BreadcrumbList | 2 | dropped -- `Breadcrumbs` IS the `<ol>` |\n * | BreadcrumbItem | 6 | -> `BreadcrumbItem` |\n * | BreadcrumbLink | 4 | merged into `BreadcrumbItem` as `href` |\n * | BreadcrumbPage | 2 | dropped -- the last crumb is auto-current |\n * | BreadcrumbSeparator | 4 | dropped -- every non-last crumb draws one |\n * | BreadcrumbEllipsis | 0 | dropped -- zero call sites |\n *\n * The collection is also why the separator CANNOT stay a component: RAC\n * builds its item list from the children, so a `<BreadcrumbSeparator/>`\n * sibling would be a non-item node inside a collection and there is nowhere\n * legal to put it.\n *\n * Every string in the cva blocks below is a STATIC literal. Tailwind scans\n * source text, so a class assembled at runtime is invisible to it and would\n * simply never be emitted -- the component would render unstyled with no\n * error anywhere.\n */\n/** True once the first render is done: a crumb that mounts after that slides in; the ones that were there at first are still. */\nconst TrailReady = createContext(false);\n\nexport const breadcrumbsVariants = cva([\n \"flex flex-wrap items-center gap-2\",\n\n // The user-agent `<ol>`: decimal markers, a 40px inline padding and a 1em\n // block margin. The reset in @seekalfred/styles is OPT-IN, so a consumer\n // may load none -- unreset, the trail renders as a numbered, indented\n // list. The Accordion shipped its panel in the browser's serif for exactly\n // this family of reason.\n \"m-0 list-none p-0\",\n\n // leading-* AFTER text-*: tailwind-merge treats a later text-* as owning\n // line-height and silently strips a leading-* that precedes it.\n \"font-sans text-sm leading-(--leading-normal) text-muted-foreground\",\n\n // box-border: content-box would add any padding a consumer sets on top of\n // a constrained width. The Alert shipped overflowing by 46px that way.\n \"box-border break-words\",\n]);\n\nexport const breadcrumbItemVariants = cva([\n // `group` is load-bearing: the separator hides itself from the current\n // crumb via group-data-[current], and RAC puts data-current on the <li>,\n // which CSS cannot look upward to from the span.\n \"group inline-flex items-center gap-2\",\n]);\n\nexport const breadcrumbLinkVariants = cva([\n \"inline-flex items-center gap-1.5\",\n\n // The user-agent `<a>`: -webkit-link blue and a permanent underline. Left\n // alone, every crumb is blue, and the hover underline below stops being a\n // state cue at all because it is already on.\n \"font-sans text-muted-foreground no-underline\",\n \"rounded-sm cursor-pointer\",\n \"motion-safe:transition-colors motion-safe:duration-(--duration-quick) motion-safe:ease-settle\",\n\n // Hover is NOT colour-only. The legacy component moved muted-foreground to\n // foreground and nothing else; under forced-colors the user's palette\n // overrides both and the cue vanishes entirely (WCAG 1.4.1, and\n // ARCHITECTURE section 5 rule 6). The underline survives any colour mode.\n \"data-[hovered]:text-foreground data-[hovered]:underline\",\n\n // outline-solid is load-bearing, not decoration. `outline-none` sets BOTH\n // outline-style:none and --tw-outline-style:none, and the width utility\n // resolves its style from that same variable -- so a focus variant can\n // apply a width and a colour while faithfully re-applying style:none and\n // painting nothing. Button shipped exactly that: keyboard-focusable with\n // no visible ring, and every gate stayed green because axe has no\n // focus-indicator rule.\n \"outline-none\",\n \"data-[focus-visible]:outline-solid\",\n \"data-[focus-visible]:outline-(length:--focus-ring-width)\",\n \"data-[focus-visible]:outline-offset-(--focus-ring-offset)\",\n \"data-[focus-visible]:outline-(--color-ring)\",\n\n // The current crumb. RAC forces isDisabled on it, so React Aria renders a\n // <span role=\"link\" aria-disabled=\"true\" aria-current=\"page\"> with no\n // tabIndex -- byte for byte the legacy BreadcrumbPage, minus the chance of\n // hand-writing it onto the wrong item.\n \"data-[current]:text-foreground data-[current]:font-normal data-[current]:cursor-default\",\n\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n \"[&_svg:not([class*='size-'])]:size-(--icon-sm)\",\n]);\n\n/**\n * A navigation trail.\n *\n * The last child is the current page: give it no `href`, and React Aria\n * marks it `aria-current=\"page\"` and takes it out of the tab order.\n *\n * @example\n * <Breadcrumbs>\n * <BreadcrumbItem href=\"/\">Home</BreadcrumbItem>\n * <BreadcrumbItem href=\"/design-thinking\">Design Thinking</BreadcrumbItem>\n * <BreadcrumbItem>User Personas</BreadcrumbItem>\n * </Breadcrumbs>\n */\nexport interface BreadcrumbsProps\n extends Omit<\n AriaBreadcrumbsProps<object>,\n \"className\" | \"style\" | \"children\" | \"items\" | \"dependencies\"\n > {\n /**\n * `BreadcrumbItem` elements. Static children only: `items` and the render\n * function are not exposed, because no call site builds a trail from data\n * and the generic they require leaks into every consumer's types.\n */\n children?: ReactNode;\n /**\n * Extra classes, merged last so they win conflicts with ours.\n *\n * They land on the `<ol>`, where our own classes are, so `tailwind-merge`\n * can actually resolve a conflict. The `<nav>` is an unstyled landmark\n * wrapper.\n */\n className?: string;\n /**\n * Accessible name for the navigation landmark. Only worth changing when a\n * page has more than one trail.\n *\n * @default \"Breadcrumb\"\n */\n \"aria-label\"?: string;\n}\n\nexport const Breadcrumbs = forwardRef<HTMLOListElement, BreadcrumbsProps>(function Breadcrumbs(\n { className, children, \"aria-label\": ariaLabel = \"Breadcrumb\", ...props },\n ref,\n) {\n const list = useRef<HTMLOListElement | null>(null);\n const refs = useMemo(() => mergeRefs(ref, list), [ref]);\n const [ready, setReady] = useState(false);\n useEffect(() => setReady(true), []);\n // When the trail changes, the crumbs that stay slide to their new place.\n useFlip(list, Children.toArray(children).map((child) => (child as { key?: string }).key).join(\"/\"));\n return (\n // RAC renders the <ol> and puts its aria-label there; it does NOT render\n // a landmark. Dropping the <nav> would silently remove the thing screen\n // reader users actually navigate by, so it is added back here. Both\n // carry the same name deliberately -- RAC falls back to a localized\n // \"Breadcrumbs\" when aria-label is absent, so the <ol> is named either\n // way and letting the two names diverge would be the worse outcome.\n <nav aria-label={ariaLabel} data-slot=\"breadcrumb\">\n <AriaBreadcrumbs\n // The ref goes on the <ol>, not the <nav>: the nav is this\n // component's OWN added landmark wrapper, not something React Aria\n // renders, so the real list element is one level in.\n ref={refs}\n {...props}\n aria-label={ariaLabel}\n data-slot=\"breadcrumb-list\"\n className={cn(breadcrumbsVariants(), className)}\n >\n <TrailReady.Provider value={ready}>{children}</TrailReady.Provider>\n </AriaBreadcrumbs>\n </nav>\n );\n});\n\n/**\n * One crumb.\n *\n * @example\n * <BreadcrumbItem href=\"/reports\">Reports</BreadcrumbItem>\n */\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbProps, \"className\" | \"style\" | \"children\"> {\n /**\n * The crumb's label.\n *\n * An icon-only crumb has no accessible name, which is an axe `link-name`\n * violation -- both legacy call sites ship one. Pass `aria-label` when the\n * only child is a glyph.\n */\n children?: ReactNode;\n /** Extra classes for the `<li>`, merged last. */\n className?: string;\n /** Destination. Omit it on the last crumb: that one is the current page. */\n href?: string;\n /** Anchor target, forwarded when `href` is set. */\n target?: string;\n /** Anchor rel, forwarded when `href` is set. */\n rel?: string;\n}\n\nexport const BreadcrumbItem = forwardRef<HTMLAnchorElement, BreadcrumbItemProps>(\n function BreadcrumbItem(\n { className, children, href, target, rel, \"aria-label\": ariaLabel, ...props },\n ref,\n ) {\n // Decided once, at this crumb's own mount.\n const [arrivedLater] = useState(useContext(TrailReady));\n return (\n <AriaBreadcrumb\n {...props}\n data-slot=\"breadcrumb-item\"\n data-flip=\"\"\n className={cnAll(\n breadcrumbItemVariants(),\n arrivedLater && \"motion-safe:animate-crumb-in\",\n className,\n )}\n >\n <AriaLink\n // The ref goes on the anchor, not the <li> RAC wraps it in: the list\n // item is the collection's own item container, not the interactive\n // element -- the link is what a call site actually needs to focus.\n ref={ref}\n href={href}\n target={target}\n rel={rel}\n aria-label={ariaLabel}\n data-slot=\"breadcrumb-link\"\n className={breadcrumbLinkVariants()}\n >\n {children}\n </AriaLink>\n {/*\n A real element, not a ::after. Generated content is announced by some\n screen readers, and it cannot be read back from the DOM at all -- a\n separator that stopped rendering would be invisible to the suite.\n\n \"/\" rather than the legacy lucide ChevronRight: this library ships no\n icon dependency, all four legacy separators are the default, and a\n chevron glyph does not mirror in RTL while a slash needs no mirroring\n at all.\n */}\n <span\n aria-hidden=\"true\"\n data-slot=\"breadcrumb-separator\"\n className=\"shrink-0 select-none group-data-[current]:hidden\"\n >\n /\n </span>\n </AriaBreadcrumb>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,aAAa,cAAc,KAAK;AAEtC,MAAa,sBAAsB,IAAI;CACrC;CAOA;CAIA;CAIA;AACF,CAAC;AAED,MAAa,yBAAyB,IAAI,CAIxC,sCACF,CAAC;AAED,MAAa,yBAAyB,IAAI;CACxC;CAKA;CACA;CACA;CAMA;CASA;CACA;CACA;CACA;CACA;CAMA;CAEA;CACA;AACF,CAAC;AA2CD,MAAaA,gBAAc,WAA+C,SAASA,cACjF,EAAE,WAAW,UAAU,cAAc,YAAY,cAAc,GAAG,SAClE,KACA;CACA,MAAM,OAAO,OAAgC,IAAI;CACjD,MAAM,OAAO,cAAc,UAAU,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC;CACtD,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK;CACxC,gBAAgB,SAAS,IAAI,GAAG,CAAC,CAAC;CAElC,QAAQ,MAAM,SAAS,QAAQ,QAAQ,CAAC,CAAC,KAAK,UAAW,MAA2B,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;CAClG,OAOE,oBAAC,OAAD;EAAK,cAAY;EAAW,aAAU;EACpC,UAAA,oBAACC,aAAD;GAIE,KAAK;GACL,GAAI;GACJ,cAAY;GACZ,aAAU;GACV,WAAW,GAAG,oBAAoB,GAAG,SAAS;GAE9C,UAAA,oBAAC,WAAW,UAAZ;IAAqB,OAAO;IAAQ;GAA8B,CAAA;EACnD,CAAA;CACd,CAAA;AAET,CAAC;AA4BD,MAAa,iBAAiB,WAC5B,SAAS,eACP,EAAE,WAAW,UAAU,MAAM,QAAQ,KAAK,cAAc,WAAW,GAAG,SACtE,KACA;CAEA,MAAM,CAAC,gBAAgB,SAAS,WAAW,UAAU,CAAC;CACtD,OACE,qBAACC,YAAD;EACE,GAAI;EACJ,aAAU;EACV,aAAU;EACV,WAAW,MACT,uBAAuB,GACvB,gBAAgB,gCAChB,SACF;EARF,UAAA,CAUE,oBAACC,MAAD;GAIO;GACC;GACE;GACH;GACL,cAAY;GACZ,aAAU;GACV,WAAW,uBAAuB;GAEjC;EACO,CAAA,GAWV,oBAAC,QAAD;GACE,eAAY;GACZ,aAAU;GACV,WAAU;GACX,UAAA;EAEK,CAAA,CACQ;;AAEpB,CACF"}
|
|
1
|
+
{"version":3,"file":"breadcrumb.js","names":["Breadcrumbs","AriaBreadcrumbs","AriaBreadcrumb","AriaLink"],"sources":["../../src/breadcrumb/breadcrumb.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva } from \"class-variance-authority\";\nimport {\n Children,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from \"react\";\nimport {\n Breadcrumb as AriaBreadcrumb,\n Breadcrumbs as AriaBreadcrumbs,\n Link as AriaLink,\n type BreadcrumbProps as AriaBreadcrumbProps,\n type BreadcrumbsProps as AriaBreadcrumbsProps,\n} from \"react-aria-components\";\n\nimport { cn, cnAll } from \"../lib/cn.js\";\nimport { useFlip } from \"../lib/flip.js\";\nimport { mergeRefs } from \"../lib/merge-refs.js\";\n\n/**\n * Breadcrumbs, ported from the legacy shadcn/Radix component onto React\n * Aria's Breadcrumbs collection.\n *\n * SIX LEGACY PARTS COLLAPSE TO TWO, and not for tidiness -- React Aria's\n * `Breadcrumbs` is a real collection, so it knows which item is last:\n *\n * | legacy | uses | fate |\n * | ------------------- | ---- | ------------------------------------------- |\n * | Breadcrumb | 2 | -> `Breadcrumbs` (nav + ol) |\n * | BreadcrumbList | 2 | dropped -- `Breadcrumbs` IS the `<ol>` |\n * | BreadcrumbItem | 6 | -> `BreadcrumbItem` |\n * | BreadcrumbLink | 4 | merged into `BreadcrumbItem` as `href` |\n * | BreadcrumbPage | 2 | dropped -- the last crumb is auto-current |\n * | BreadcrumbSeparator | 4 | dropped -- every non-last crumb draws one |\n * | BreadcrumbEllipsis | 0 | dropped -- zero call sites |\n *\n * The collection is also why the separator CANNOT stay a component: RAC\n * builds its item list from the children, so a `<BreadcrumbSeparator/>`\n * sibling would be a non-item node inside a collection and there is nowhere\n * legal to put it.\n *\n * Every string in the cva blocks below is a STATIC literal. Tailwind scans\n * source text, so a class assembled at runtime is invisible to it and would\n * simply never be emitted -- the component would render unstyled with no\n * error anywhere.\n */\n/** True once the first render is done: a crumb that mounts after that slides in; the ones that were there at first are still. */\nconst TrailReady = createContext(false);\n\nexport const breadcrumbsVariants = cva([\n \"flex flex-wrap items-center gap-2\",\n\n // The user-agent `<ol>`: decimal markers, a 40px inline padding and a 1em\n // block margin. The reset in @seekalfred/styles is OPT-IN, so a consumer\n // may load none -- unreset, the trail renders as a numbered, indented\n // list. The Accordion shipped its panel in the browser's serif for exactly\n // this family of reason.\n \"m-0 list-none p-0\",\n\n // leading-* AFTER text-*: tailwind-merge treats a later text-* as owning\n // line-height and silently strips a leading-* that precedes it.\n \"font-sans text-sm leading-(--leading-normal) text-muted-foreground\",\n\n // box-border: content-box would add any padding a consumer sets on top of\n // a constrained width. The Alert shipped overflowing by 46px that way.\n \"box-border break-words\",\n]);\n\nexport const breadcrumbItemVariants = cva([\n // `group` is load-bearing: the separator hides itself from the current\n // crumb via group-data-[current], and RAC puts data-current on the <li>,\n // which CSS cannot look upward to from the span.\n \"group inline-flex items-center gap-2\",\n]);\n\nexport const breadcrumbLinkVariants = cva([\n \"inline-flex items-center gap-1.5\",\n\n // The user-agent `<a>`: -webkit-link blue and a permanent underline. Left\n // alone, every crumb is blue, and the hover underline below stops being a\n // state cue at all because it is already on.\n \"font-sans text-muted-foreground no-underline\",\n \"rounded-sm cursor-pointer\",\n \"motion-safe:transition-colors motion-safe:duration-(--duration-quick) motion-safe:ease-settle\",\n\n // Hover is NOT colour-only. The legacy component moved muted-foreground to\n // foreground and nothing else; under forced-colors the user's palette\n // overrides both and the cue vanishes entirely (WCAG 1.4.1, and\n // ARCHITECTURE section 5 rule 6). The underline survives any colour mode.\n \"data-[hovered]:text-foreground data-[hovered]:underline\",\n\n // outline-solid is load-bearing, not decoration. `outline-none` sets BOTH\n // outline-style:none and --tw-outline-style:none, and the width utility\n // resolves its style from that same variable -- so a focus variant can\n // apply a width and a colour while faithfully re-applying style:none and\n // painting nothing. Button shipped exactly that: keyboard-focusable with\n // no visible ring, and every gate stayed green because axe has no\n // focus-indicator rule.\n \"outline-none\",\n \"data-[focus-visible]:outline-solid\",\n \"data-[focus-visible]:outline-(length:--focus-ring-width)\",\n \"data-[focus-visible]:outline-offset-(--focus-ring-offset)\",\n \"data-[focus-visible]:outline-(--color-ring)\",\n\n // The current crumb. RAC forces isDisabled on it, so React Aria renders a\n // <span role=\"link\" aria-disabled=\"true\" aria-current=\"page\"> with no\n // tabIndex -- byte for byte the legacy BreadcrumbPage, minus the chance of\n // hand-writing it onto the wrong item.\n \"data-[current]:text-foreground data-[current]:font-semibold data-[current]:cursor-default\",\n\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0\",\n \"[&_svg:not([class*='size-'])]:size-(--icon-sm)\",\n]);\n\n/**\n * A navigation trail.\n *\n * The last child is the current page: give it no `href`, and React Aria\n * marks it `aria-current=\"page\"` and takes it out of the tab order.\n *\n * @example\n * <Breadcrumbs>\n * <BreadcrumbItem href=\"/\">Home</BreadcrumbItem>\n * <BreadcrumbItem href=\"/design-thinking\">Design thinking</BreadcrumbItem>\n * <BreadcrumbItem>User personas</BreadcrumbItem>\n * </Breadcrumbs>\n */\nexport interface BreadcrumbsProps\n extends Omit<\n AriaBreadcrumbsProps<object>,\n \"className\" | \"style\" | \"children\" | \"items\" | \"dependencies\"\n > {\n /**\n * `BreadcrumbItem` elements. Static children only: `items` and the render\n * function are not exposed, because no call site builds a trail from data\n * and the generic they require leaks into every consumer's types.\n */\n children?: ReactNode;\n /**\n * Extra classes, merged last so they win conflicts with ours.\n *\n * They land on the `<ol>`, where our own classes are, so `tailwind-merge`\n * can actually resolve a conflict. The `<nav>` is an unstyled landmark\n * wrapper.\n */\n className?: string;\n /**\n * Accessible name for the navigation landmark. Only worth changing when a\n * page has more than one trail.\n *\n * @default \"Breadcrumb\"\n */\n \"aria-label\"?: string;\n}\n\nexport const Breadcrumbs = forwardRef<HTMLOListElement, BreadcrumbsProps>(function Breadcrumbs(\n { className, children, \"aria-label\": ariaLabel = \"Breadcrumb\", ...props },\n ref,\n) {\n const list = useRef<HTMLOListElement | null>(null);\n const refs = useMemo(() => mergeRefs(ref, list), [ref]);\n const [ready, setReady] = useState(false);\n useEffect(() => setReady(true), []);\n // When the trail changes, the crumbs that stay slide to their new place.\n useFlip(list, Children.toArray(children).map((child) => (child as { key?: string }).key).join(\"/\"));\n return (\n // RAC renders the <ol> and puts its aria-label there; it does NOT render\n // a landmark. Dropping the <nav> would silently remove the thing screen\n // reader users actually navigate by, so it is added back here. Both\n // carry the same name deliberately -- RAC falls back to a localized\n // \"Breadcrumbs\" when aria-label is absent, so the <ol> is named either\n // way and letting the two names diverge would be the worse outcome.\n <nav aria-label={ariaLabel} data-slot=\"breadcrumb\">\n <AriaBreadcrumbs\n // The ref goes on the <ol>, not the <nav>: the nav is this\n // component's OWN added landmark wrapper, not something React Aria\n // renders, so the real list element is one level in.\n ref={refs}\n {...props}\n aria-label={ariaLabel}\n data-slot=\"breadcrumb-list\"\n className={cn(breadcrumbsVariants(), className)}\n >\n <TrailReady.Provider value={ready}>{children}</TrailReady.Provider>\n </AriaBreadcrumbs>\n </nav>\n );\n});\n\n/**\n * One crumb.\n *\n * @example\n * <BreadcrumbItem href=\"/reports\">Reports</BreadcrumbItem>\n */\nexport interface BreadcrumbItemProps\n extends Omit<AriaBreadcrumbProps, \"className\" | \"style\" | \"children\"> {\n /**\n * The crumb's label.\n *\n * An icon-only crumb has no accessible name, which is an axe `link-name`\n * violation -- both legacy call sites ship one. Pass `aria-label` when the\n * only child is a glyph.\n */\n children?: ReactNode;\n /** Extra classes for the `<li>`, merged last. */\n className?: string;\n /** Destination. Omit it on the last crumb: that one is the current page. */\n href?: string;\n /** Anchor target, forwarded when `href` is set. */\n target?: string;\n /** Anchor rel, forwarded when `href` is set. */\n rel?: string;\n}\n\nexport const BreadcrumbItem = forwardRef<HTMLAnchorElement, BreadcrumbItemProps>(\n function BreadcrumbItem(\n { className, children, href, target, rel, \"aria-label\": ariaLabel, ...props },\n ref,\n ) {\n // Decided once, at this crumb's own mount.\n const [arrivedLater] = useState(useContext(TrailReady));\n return (\n <AriaBreadcrumb\n {...props}\n data-slot=\"breadcrumb-item\"\n data-flip=\"\"\n className={cnAll(\n breadcrumbItemVariants(),\n arrivedLater && \"motion-safe:animate-crumb-in\",\n className,\n )}\n >\n <AriaLink\n // The ref goes on the anchor, not the <li> RAC wraps it in: the list\n // item is the collection's own item container, not the interactive\n // element -- the link is what a call site actually needs to focus.\n ref={ref}\n href={href}\n target={target}\n rel={rel}\n aria-label={ariaLabel}\n data-slot=\"breadcrumb-link\"\n className={breadcrumbLinkVariants()}\n >\n {children}\n </AriaLink>\n {/*\n A real element, not a ::after. Generated content is announced by some\n screen readers, and it cannot be read back from the DOM at all -- a\n separator that stopped rendering would be invisible to the suite.\n\n A small inline chevron: this library ships no icon dependency, and the\n chevron is flipped in RTL so it keeps pointing along the reading direction.\n */}\n <span\n aria-hidden=\"true\"\n data-slot=\"breadcrumb-separator\"\n className=\"inline-flex shrink-0 items-center select-none group-data-[current]:hidden\"\n >\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"block size-3.5 rtl:-scale-x-100\"\n >\n <path d=\"m6 3.5 4.5 4.5L6 12.5\" />\n </svg>\n </span>\n </AriaBreadcrumb>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAM,aAAa,cAAc,KAAK;AAEtC,MAAa,sBAAsB,IAAI;CACrC;CAOA;CAIA;CAIA;AACF,CAAC;AAED,MAAa,yBAAyB,IAAI,CAIxC,sCACF,CAAC;AAED,MAAa,yBAAyB,IAAI;CACxC;CAKA;CACA;CACA;CAMA;CASA;CACA;CACA;CACA;CACA;CAMA;CAEA;CACA;AACF,CAAC;AA2CD,MAAaA,gBAAc,WAA+C,SAASA,cACjF,EAAE,WAAW,UAAU,cAAc,YAAY,cAAc,GAAG,SAClE,KACA;CACA,MAAM,OAAO,OAAgC,IAAI;CACjD,MAAM,OAAO,cAAc,UAAU,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC;CACtD,MAAM,CAAC,OAAO,YAAY,SAAS,KAAK;CACxC,gBAAgB,SAAS,IAAI,GAAG,CAAC,CAAC;CAElC,QAAQ,MAAM,SAAS,QAAQ,QAAQ,CAAC,CAAC,KAAK,UAAW,MAA2B,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;CAClG,OAOE,oBAAC,OAAD;EAAK,cAAY;EAAW,aAAU;EACpC,UAAA,oBAACC,aAAD;GAIE,KAAK;GACL,GAAI;GACJ,cAAY;GACZ,aAAU;GACV,WAAW,GAAG,oBAAoB,GAAG,SAAS;GAE9C,UAAA,oBAAC,WAAW,UAAZ;IAAqB,OAAO;IAAQ;GAA8B,CAAA;EACnD,CAAA;CACd,CAAA;AAET,CAAC;AA4BD,MAAa,iBAAiB,WAC5B,SAAS,eACP,EAAE,WAAW,UAAU,MAAM,QAAQ,KAAK,cAAc,WAAW,GAAG,SACtE,KACA;CAEA,MAAM,CAAC,gBAAgB,SAAS,WAAW,UAAU,CAAC;CACtD,OACE,qBAACC,YAAD;EACE,GAAI;EACJ,aAAU;EACV,aAAU;EACV,WAAW,MACT,uBAAuB,GACvB,gBAAgB,gCAChB,SACF;EARF,UAAA,CAUE,oBAACC,MAAD;GAIO;GACC;GACE;GACH;GACL,cAAY;GACZ,aAAU;GACV,WAAW,uBAAuB;GAEjC;EACO,CAAA,GASV,oBAAC,QAAD;GACE,eAAY;GACZ,aAAU;GACV,WAAU;GAEV,UAAA,oBAAC,OAAD;IACE,SAAQ;IACR,MAAK;IACL,QAAO;IACP,aAAY;IACZ,eAAc;IACd,gBAAe;IACf,WAAU;IAEV,UAAA,oBAAC,QAAD,EAAM,GAAE,wBAAyB,CAAA;GAC9B,CAAA;EACD,CAAA,CACQ;;AAEpB,CACF"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region src/brush-chart/brush-chart.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* BrushChart: a long, dense time series, when people need the whole history
|
|
4
|
+
* and a close look at any stretch of it.
|
|
5
|
+
*
|
|
6
|
+
* A main plot shows the window; an overview strip under it shows everything.
|
|
7
|
+
* Drag the window to pan, drag an edge to resize it, drag empty track to draw
|
|
8
|
+
* a new window, tap to recentre, double tap (or Escape) to show it all. Zoomed
|
|
9
|
+
* out, a seven point average and its low to high band replace the raw line so
|
|
10
|
+
* dense weeks read as texture; zoomed in, the raw line fades in. The value
|
|
11
|
+
* axis springs to the tallest point in view. Hover, drag or the arrow keys
|
|
12
|
+
* scrub the plot: a crosshair and a tooltip with the day, the value and the
|
|
13
|
+
* change against a week earlier. Annotations mark events on both charts.
|
|
14
|
+
*
|
|
15
|
+
* Plain SVG and CSS. The window, every path and the markers are written
|
|
16
|
+
* straight to the DOM as the window moves, so a drag never re-renders the
|
|
17
|
+
* chart. The plot and the window, and each edge, are sliders; a visually
|
|
18
|
+
* hidden table carries every point in the window.
|
|
19
|
+
*/
|
|
20
|
+
export interface BrushChartDatum {
|
|
21
|
+
/** A point in time, as a Date or epoch milliseconds. Points must be in ascending order. */
|
|
22
|
+
date: Date | number;
|
|
23
|
+
value: number;
|
|
24
|
+
}
|
|
25
|
+
export interface BrushChartAnnotation {
|
|
26
|
+
date: Date | number;
|
|
27
|
+
/** Short label printed beside the marker, such as "v2 launch". */
|
|
28
|
+
label: string;
|
|
29
|
+
/** Longer note for the tooltip and screen readers. */
|
|
30
|
+
description?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface BrushChartProps {
|
|
33
|
+
data: BrushChartDatum[];
|
|
34
|
+
/** What is measured, such as "Daily active users". Names the chart for assistive technology. */
|
|
35
|
+
label: string;
|
|
36
|
+
/** Unit after each value, such as "users". */
|
|
37
|
+
unit?: string;
|
|
38
|
+
formatValue?: (value: number) => string;
|
|
39
|
+
/** Formats the value axis. Defaults to a compact number, such as 12K. */
|
|
40
|
+
formatTick?: (value: number) => string;
|
|
41
|
+
/** Formats a date in the tooltip and announcements. */
|
|
42
|
+
formatDate?: (date: Date) => string;
|
|
43
|
+
/** Events drawn as markers on both charts. */
|
|
44
|
+
annotations?: BrushChartAnnotation[];
|
|
45
|
+
/** Controlled window as [start, end] epoch milliseconds. A new value glides the window there. */
|
|
46
|
+
range?: [number, number];
|
|
47
|
+
/** Initial window when uncontrolled. Defaults to the whole series. */
|
|
48
|
+
defaultRange?: [number, number];
|
|
49
|
+
/** Called while the window is dragged, resized, stepped, or reset. */
|
|
50
|
+
onRangeChange?: (range: [number, number]) => void;
|
|
51
|
+
/** Smallest window in milliseconds. @default seven days */
|
|
52
|
+
minSpan?: number;
|
|
53
|
+
/** Main plot height in pixels. @default 240 */
|
|
54
|
+
height?: number;
|
|
55
|
+
/** Overview strip height in pixels. @default 52 */
|
|
56
|
+
overviewHeight?: number;
|
|
57
|
+
/** @default "No data yet" */
|
|
58
|
+
emptyLabel?: string;
|
|
59
|
+
/** Extra classes for the root. Merged last. */
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
export declare const BrushChart: import("react").ForwardRefExoticComponent<BrushChartProps & import("react").RefAttributes<HTMLElement>>;
|
|
63
|
+
//#endregion
|
|
64
|
+
//# sourceMappingURL=brush-chart.d.ts.map
|