@leonardaustin/ui 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -2
- package/dist/components/app-shell/AppShell.d.ts +3 -4
- package/dist/components/app-shell/AppShell.js +82 -0
- package/dist/components/app-shell/AuthLayout.d.ts +3 -4
- package/dist/components/app-shell/AuthLayout.js +16 -0
- package/dist/components/app-shell/BackLink.d.ts +3 -4
- package/dist/components/app-shell/BackLink.js +19 -0
- package/dist/components/app-shell/BottomNav.d.ts +3 -3
- package/dist/components/app-shell/BottomNav.js +37 -0
- package/dist/components/app-shell/Breadcrumbs.d.ts +3 -3
- package/dist/components/app-shell/Breadcrumbs.js +46 -0
- package/dist/components/app-shell/CommandPalette.d.ts +3 -3
- package/dist/components/app-shell/CommandPalette.js +119 -0
- package/dist/components/app-shell/MobileDrawer.d.ts +3 -4
- package/dist/components/app-shell/MobileDrawer.js +128 -0
- package/dist/components/app-shell/Sidebar.d.ts +3 -4
- package/dist/components/app-shell/Sidebar.js +355 -0
- package/dist/components/app-shell/ThemeMenu.d.ts +3 -3
- package/dist/components/app-shell/ThemeMenu.js +273 -0
- package/dist/components/app-shell/TopBar.d.ts +3 -4
- package/dist/components/app-shell/TopBar.js +129 -0
- package/dist/components/app-shell/commandPaletteEvents.d.ts +0 -1
- package/dist/components/app-shell/commandPaletteEvents.js +16 -0
- package/dist/components/app-shell/navigation.d.ts +0 -1
- package/dist/components/app-shell/navigation.js +21 -0
- package/dist/components/app-shell/themeMenuEvents.d.ts +0 -1
- package/dist/components/app-shell/themeMenuEvents.js +7 -0
- package/dist/components/app-shell/types.d.ts +0 -1
- package/dist/components/charts/AreaChart.d.ts +4 -4
- package/dist/components/charts/AreaChart.js +217 -0
- package/dist/components/charts/BarChart.d.ts +4 -4
- package/dist/components/charts/BarChart.js +91 -0
- package/dist/components/charts/DonutChart.d.ts +4 -4
- package/dist/components/charts/DonutChart.js +172 -0
- package/dist/components/charts/RadarChart.d.ts +4 -4
- package/dist/components/charts/RadarChart.js +142 -0
- package/dist/components/charts/RadialBarChart.d.ts +4 -4
- package/dist/components/charts/RadialBarChart.js +219 -0
- package/dist/components/charts/SparkLine.d.ts +4 -4
- package/dist/components/charts/SparkLine.js +39 -0
- package/dist/components/charts/StackedBarChart.d.ts +4 -4
- package/dist/components/charts/StackedBarChart.js +249 -0
- package/dist/components/charts/VerticalBarChart.d.ts +4 -4
- package/dist/components/charts/VerticalBarChart.js +143 -0
- package/dist/components/charts/chartUtils.d.ts +0 -1
- package/dist/components/charts/chartUtils.js +68 -0
- package/dist/components/tables/ColumnPicker.d.ts +3 -4
- package/dist/components/tables/ColumnPicker.js +59 -0
- package/dist/components/tables/Pagination.d.ts +3 -5
- package/dist/components/tables/Pagination.js +56 -0
- package/dist/components/tables/ResourceTable.d.ts +3 -4
- package/dist/components/tables/ResourceTable.js +88 -0
- package/dist/components/tables/Table.d.ts +0 -1
- package/dist/components/tables/Table.js +95 -0
- package/dist/components/tables/sortRows.d.ts +0 -1
- package/dist/components/tables/sortRows.js +11 -0
- package/dist/components/ui/Accordion.d.ts +9 -2
- package/dist/components/ui/Accordion.js +35 -0
- package/dist/components/ui/Alert.d.ts +8 -6
- package/dist/components/ui/Alert.js +51 -0
- package/dist/components/ui/AttachmentList.d.ts +5 -6
- package/dist/components/ui/AttachmentList.js +90 -0
- package/dist/components/ui/AudioPlayer.d.ts +7 -4
- package/dist/components/ui/AudioPlayer.js +447 -0
- package/dist/components/ui/AuthCard.d.ts +3 -4
- package/dist/components/ui/AuthCard.js +39 -0
- package/dist/components/ui/AuthorByline.d.ts +5 -6
- package/dist/components/ui/AuthorByline.js +23 -0
- package/dist/components/ui/Avatar.d.ts +5 -4
- package/dist/components/ui/Avatar.js +36 -0
- package/dist/components/ui/Badge.d.ts +3 -3
- package/dist/components/ui/Badge.js +47 -0
- package/dist/components/ui/Button.d.ts +9 -9
- package/dist/components/ui/Button.js +83 -0
- package/dist/components/ui/Calendar.d.ts +3 -4
- package/dist/components/ui/Calendar.js +344 -0
- package/dist/components/ui/CalendarGrid.d.ts +3 -4
- package/dist/components/ui/CalendarGrid.js +136 -0
- package/dist/components/ui/Card.d.ts +6 -6
- package/dist/components/ui/Card.js +53 -0
- package/dist/components/ui/CharacterCount.d.ts +3 -4
- package/dist/components/ui/CharacterCount.js +27 -0
- package/dist/components/ui/Checkbox.d.ts +10 -9
- package/dist/components/ui/Checkbox.js +52 -0
- package/dist/components/ui/CodeInput.d.ts +7 -5
- package/dist/components/ui/CodeInput.js +96 -0
- package/dist/components/ui/Combobox.d.ts +8 -7
- package/dist/components/ui/Combobox.js +213 -0
- package/dist/components/ui/CopyButton.d.ts +6 -2
- package/dist/components/ui/CopyButton.js +57 -0
- package/dist/components/ui/DangerZone.d.ts +3 -5
- package/dist/components/ui/DangerZone.js +23 -0
- package/dist/components/ui/DatePartsInput.d.ts +6 -5
- package/dist/components/ui/DatePartsInput.js +138 -0
- package/dist/components/ui/DatePicker.d.ts +9 -5
- package/dist/components/ui/DatePicker.js +84 -0
- package/dist/components/ui/DateRangePicker.d.ts +7 -6
- package/dist/components/ui/DateRangePicker.js +143 -0
- package/dist/components/ui/DateTimePicker.d.ts +7 -5
- package/dist/components/ui/DateTimePicker.js +267 -0
- package/dist/components/ui/DetailPanel.d.ts +3 -4
- package/dist/components/ui/DetailPanel.js +183 -0
- package/dist/components/ui/Dialog.d.ts +3 -4
- package/dist/components/ui/Dialog.js +411 -0
- package/dist/components/ui/DialogActions.d.ts +3 -4
- package/dist/components/ui/DialogActions.js +35 -0
- package/dist/components/ui/Disclosure.d.ts +7 -4
- package/dist/components/ui/Disclosure.js +45 -0
- package/dist/components/ui/DividerLabel.d.ts +3 -4
- package/dist/components/ui/DividerLabel.js +20 -0
- package/dist/components/ui/DropdownMenu.d.ts +4 -5
- package/dist/components/ui/DropdownMenu.js +229 -0
- package/dist/components/ui/EmptyState.d.ts +3 -5
- package/dist/components/ui/EmptyState.js +31 -0
- package/dist/components/ui/ErrorBoundary.d.ts +3 -3
- package/dist/components/ui/ErrorBoundary.js +46 -0
- package/dist/components/ui/FieldContext.d.ts +0 -1
- package/dist/components/ui/FieldContext.js +8 -0
- package/dist/components/ui/Fieldset.d.ts +2 -3
- package/dist/components/ui/Fieldset.js +39 -0
- package/dist/components/ui/FilterButton.d.ts +4 -9
- package/dist/components/ui/FilterButton.js +17 -0
- package/dist/components/ui/FilterDropdown.d.ts +4 -6
- package/dist/components/ui/FilterDropdown.js +18 -0
- package/dist/components/ui/FormField.d.ts +4 -5
- package/dist/components/ui/FormField.js +68 -0
- package/dist/components/ui/Grid.d.ts +1 -2
- package/dist/components/ui/Grid.js +19 -0
- package/dist/components/ui/GridItem.d.ts +1 -2
- package/dist/components/ui/GridItem.js +16 -0
- package/dist/components/ui/Inline.d.ts +1 -2
- package/dist/components/ui/Inline.js +24 -0
- package/dist/components/ui/Kbd.d.ts +3 -4
- package/dist/components/ui/Kbd.js +13 -0
- package/dist/components/ui/ListItemLink.d.ts +3 -4
- package/dist/components/ui/ListItemLink.js +44 -0
- package/dist/components/ui/LoadingSpinner.d.ts +5 -5
- package/dist/components/ui/LoadingSpinner.js +19 -0
- package/dist/components/ui/MessageBubble.d.ts +5 -3
- package/dist/components/ui/MessageBubble.js +41 -0
- package/dist/components/ui/MetadataGrid.d.ts +5 -4
- package/dist/components/ui/MetadataGrid.js +76 -0
- package/dist/components/ui/MetricCard.d.ts +3 -4
- package/dist/components/ui/MetricCard.js +51 -0
- package/dist/components/ui/NavTabs.d.ts +2 -3
- package/dist/components/ui/NavTabs.js +29 -0
- package/dist/components/ui/OAuthButton.d.ts +2 -3
- package/dist/components/ui/OAuthButton.js +55 -0
- package/dist/components/ui/OverlineLabel.d.ts +3 -4
- package/dist/components/ui/OverlineLabel.js +13 -0
- package/dist/components/ui/PageHeader.d.ts +3 -4
- package/dist/components/ui/PageHeader.js +33 -0
- package/dist/components/ui/PageSection.d.ts +3 -4
- package/dist/components/ui/PageSection.js +31 -0
- package/dist/components/ui/PaginationBar.d.ts +3 -4
- package/dist/components/ui/PaginationBar.js +62 -0
- package/dist/components/ui/PasswordInput.d.ts +3 -5
- package/dist/components/ui/PasswordInput.js +62 -0
- package/dist/components/ui/PasswordRequirements.d.ts +3 -3
- package/dist/components/ui/PasswordRequirements.js +34 -0
- package/dist/components/ui/Popover.d.ts +5 -4
- package/dist/components/ui/Popover.js +53 -0
- package/dist/components/ui/ProfileHeader.d.ts +3 -4
- package/dist/components/ui/ProfileHeader.js +54 -0
- package/dist/components/ui/ProgressBar.d.ts +3 -4
- package/dist/components/ui/ProgressBar.js +42 -0
- package/dist/components/ui/ProseContent.d.ts +3 -4
- package/dist/components/ui/ProseContent.js +13 -0
- package/dist/components/ui/QrCode.d.ts +3 -4
- package/dist/components/ui/QrCode.js +47 -0
- package/dist/components/ui/Radio.d.ts +9 -7
- package/dist/components/ui/Radio.js +58 -0
- package/dist/components/ui/RadioPill.d.ts +10 -8
- package/dist/components/ui/RadioPill.js +53 -0
- package/dist/components/ui/ReorderList.d.ts +3 -4
- package/dist/components/ui/ReorderList.js +123 -0
- package/dist/components/ui/SearchInput.d.ts +7 -6
- package/dist/components/ui/SearchInput.js +49 -0
- package/dist/components/ui/SectionHeader.d.ts +3 -5
- package/dist/components/ui/SectionHeader.js +13 -0
- package/dist/components/ui/Select.d.ts +4 -6
- package/dist/components/ui/Select.js +117 -0
- package/dist/components/ui/SelectDropdown.d.ts +10 -6
- package/dist/components/ui/SelectDropdown.js +206 -0
- package/dist/components/ui/SettingRow.d.ts +5 -7
- package/dist/components/ui/SettingRow.js +25 -0
- package/dist/components/ui/SideSheet.d.ts +3 -4
- package/dist/components/ui/SideSheet.js +164 -0
- package/dist/components/ui/Skeleton.d.ts +3 -4
- package/dist/components/ui/Skeleton.js +18 -0
- package/dist/components/ui/Slider.d.ts +11 -7
- package/dist/components/ui/Slider.js +58 -0
- package/dist/components/ui/SplitPaneLayout.d.ts +6 -6
- package/dist/components/ui/SplitPaneLayout.js +22 -0
- package/dist/components/ui/Stack.d.ts +1 -2
- package/dist/components/ui/Stack.js +18 -0
- package/dist/components/ui/StatusDot.d.ts +3 -3
- package/dist/components/ui/StatusDot.js +24 -0
- package/dist/components/ui/StepProgress.d.ts +3 -3
- package/dist/components/ui/StepProgress.js +33 -0
- package/dist/components/ui/Tabs.d.ts +5 -6
- package/dist/components/ui/Tabs.js +63 -0
- package/dist/components/ui/TextInput.d.ts +3 -5
- package/dist/components/ui/TextInput.js +57 -0
- package/dist/components/ui/Textarea.d.ts +3 -5
- package/dist/components/ui/Textarea.js +59 -0
- package/dist/components/ui/ThemePreview.d.ts +3 -4
- package/dist/components/ui/ThemePreview.js +28 -0
- package/dist/components/ui/TimeInput.d.ts +7 -7
- package/dist/components/ui/TimeInput.js +22 -0
- package/dist/components/ui/Timeline.d.ts +3 -3
- package/dist/components/ui/Timeline.js +29 -0
- package/dist/components/ui/Toast.d.ts +0 -1
- package/dist/components/ui/Toast.js +121 -0
- package/dist/components/ui/Toggle.d.ts +10 -5
- package/dist/components/ui/Toggle.js +34 -0
- package/dist/components/ui/Toolbar.d.ts +3 -4
- package/dist/components/ui/Toolbar.js +70 -0
- package/dist/components/ui/Tooltip.d.ts +0 -1
- package/dist/components/ui/Tooltip.js +91 -0
- package/dist/components/ui/TranscriptLine.d.ts +5 -4
- package/dist/components/ui/TranscriptLine.js +40 -0
- package/dist/components/ui/UploadDropzone.d.ts +3 -6
- package/dist/components/ui/UploadDropzone.js +55 -0
- package/dist/components/ui/badgeColors.d.ts +0 -1
- package/dist/components/ui/badgeColors.js +5 -0
- package/dist/components/ui/calendar/AgendaView.d.ts +0 -1
- package/dist/components/ui/calendar/AgendaView.js +140 -0
- package/dist/components/ui/calendar/MonthView.d.ts +0 -1
- package/dist/components/ui/calendar/MonthView.js +321 -0
- package/dist/components/ui/calendar/TimeGrid.d.ts +0 -1
- package/dist/components/ui/calendar/TimeGrid.js +501 -0
- package/dist/components/ui/calendar/TimelineView.d.ts +0 -1
- package/dist/components/ui/calendar/TimelineView.js +311 -0
- package/dist/components/ui/calendar/context.d.ts +0 -1
- package/dist/components/ui/calendar/context.js +10 -0
- package/dist/components/ui/calendar/items.d.ts +0 -1
- package/dist/components/ui/calendar/items.js +152 -0
- package/dist/components/ui/calendar/types.d.ts +0 -1
- package/dist/components/ui/calendar/types.js +38 -0
- package/dist/components/ui/calendar/useGridInteraction.d.ts +0 -1
- package/dist/components/ui/calendar/useGridInteraction.js +393 -0
- package/dist/components/ui/useFieldControl.d.ts +1 -2
- package/dist/components/ui/useFieldControl.js +17 -0
- package/dist/config/theme.d.ts +0 -1
- package/dist/config/theme.js +219 -0
- package/dist/core.css +2933 -0
- package/dist/hooks/useAnchoredPopup.d.ts +0 -1
- package/dist/hooks/useAnchoredPopup.js +162 -0
- package/dist/hooks/useApplyTheme.d.ts +0 -1
- package/dist/hooks/useApplyTheme.js +16 -0
- package/dist/hooks/useControllableState.d.ts +14 -0
- package/dist/hooks/useControllableState.js +10 -0
- package/dist/hooks/useDismiss.d.ts +0 -1
- package/dist/hooks/useDismiss.js +24 -0
- package/dist/hooks/useFocusTrap.d.ts +0 -1
- package/dist/hooks/useFocusTrap.js +42 -0
- package/dist/hooks/useOverlayStack.d.ts +0 -1
- package/dist/hooks/useOverlayStack.js +23 -0
- package/dist/hooks/usePopover.d.ts +0 -1
- package/dist/hooks/usePopover.js +47 -0
- package/dist/hooks/usePortalContainer.d.ts +0 -1
- package/dist/hooks/usePortalContainer.js +14 -0
- package/dist/hooks/useSettings.d.ts +0 -1
- package/dist/hooks/useSettings.js +8 -0
- package/dist/hooks/useTheme.d.ts +0 -1
- package/dist/hooks/useTheme.js +8 -0
- package/dist/hooks/useTypeahead.d.ts +0 -1
- package/dist/hooks/useTypeahead.js +19 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +133 -12866
- package/dist/lib/anchorPlacement.d.ts +0 -1
- package/dist/lib/anchorPlacement.js +75 -0
- package/dist/lib/calendar.d.ts +0 -1
- package/dist/lib/calendar.js +666 -0
- package/dist/lib/cn.d.ts +0 -1
- package/dist/lib/cn.js +228 -0
- package/dist/lib/codeInput.d.ts +0 -1
- package/dist/lib/codeInput.js +51 -0
- package/dist/lib/dateParts.d.ts +0 -1
- package/dist/lib/dateParts.js +31 -0
- package/dist/lib/dialogDrag.d.ts +0 -1
- package/dist/lib/dialogDrag.js +45 -0
- package/dist/lib/dialogResize.d.ts +0 -1
- package/dist/lib/dialogResize.js +47 -0
- package/dist/lib/formatDate.d.ts +0 -1
- package/dist/lib/formatDate.js +29 -0
- package/dist/lib/formatMediaTime.d.ts +0 -1
- package/dist/lib/formatMediaTime.js +7 -0
- package/dist/lib/keyboardStep.d.ts +0 -1
- package/dist/lib/layout.d.ts +0 -1
- package/dist/lib/layout.js +29 -0
- package/dist/lib/math.d.ts +0 -1
- package/dist/lib/math.js +6 -0
- package/dist/lib/mergeRefs.d.ts +6 -0
- package/dist/lib/mergeRefs.js +17 -0
- package/dist/lib/months.d.ts +0 -1
- package/dist/lib/months.js +30 -0
- package/dist/lib/overlayStack.d.ts +0 -1
- package/dist/lib/overlayStack.js +47 -0
- package/dist/lib/panelResize.d.ts +0 -1
- package/dist/lib/panelResize.js +8 -0
- package/dist/lib/passwordRequirements.d.ts +0 -1
- package/dist/lib/passwordRequirements.js +23 -0
- package/dist/lib/qrCode.d.ts +0 -1
- package/dist/lib/qrCode.js +570 -0
- package/dist/lib/rect.d.ts +0 -1
- package/dist/lib/tones.d.ts +0 -1
- package/dist/lib/tones.js +104 -0
- package/dist/lib/typeahead.d.ts +0 -1
- package/dist/lib/typeahead.js +31 -0
- package/dist/providers/ControlSizeContext.d.ts +0 -1
- package/dist/providers/ControlSizeContext.js +9 -0
- package/dist/providers/ControlSizeProvider.d.ts +0 -1
- package/dist/providers/ControlSizeProvider.js +11 -0
- package/dist/providers/SettingsContext.d.ts +0 -1
- package/dist/providers/SettingsContext.js +53 -0
- package/dist/providers/SettingsProvider.d.ts +0 -1
- package/dist/providers/SettingsProvider.js +249 -0
- package/dist/providers/ThemeContext.d.ts +0 -1
- package/dist/providers/ThemeContext.js +5 -0
- package/dist/providers/ThemeProvider.d.ts +0 -1
- package/dist/providers/ThemeProvider.js +17 -0
- package/dist/providers/accentColors.d.ts +0 -1
- package/dist/providers/accentColors.js +75 -0
- package/dist/providers/themeClasses.d.ts +1 -1
- package/dist/providers/themeClasses.js +20 -0
- package/dist/styles.css +263 -176
- package/dist/themes/cyber-brutal-dark.css +53 -0
- package/dist/themes/cyber-brutal-light.css +75 -0
- package/dist/themes/glass-dark.css +217 -0
- package/dist/themes/glass-light.css +215 -0
- package/dist/themes/hashi.css +66 -0
- package/dist/themes/light-inverted.css +32 -0
- package/dist/themes/light.css +1 -0
- package/dist/themes/monokai.css +51 -0
- package/dist/themes/solarized.css +55 -0
- package/package.json +3 -1
- package/dist/components/app-shell/AppShell.d.ts.map +0 -1
- package/dist/components/app-shell/AuthLayout.d.ts.map +0 -1
- package/dist/components/app-shell/BackLink.d.ts.map +0 -1
- package/dist/components/app-shell/BottomNav.d.ts.map +0 -1
- package/dist/components/app-shell/Breadcrumbs.d.ts.map +0 -1
- package/dist/components/app-shell/CommandPalette.d.ts.map +0 -1
- package/dist/components/app-shell/MobileDrawer.d.ts.map +0 -1
- package/dist/components/app-shell/Sidebar.d.ts.map +0 -1
- package/dist/components/app-shell/ThemeMenu.d.ts.map +0 -1
- package/dist/components/app-shell/TopBar.d.ts.map +0 -1
- package/dist/components/app-shell/commandPaletteEvents.d.ts.map +0 -1
- package/dist/components/app-shell/navigation.d.ts.map +0 -1
- package/dist/components/app-shell/themeMenuEvents.d.ts.map +0 -1
- package/dist/components/app-shell/types.d.ts.map +0 -1
- package/dist/components/charts/AreaChart.d.ts.map +0 -1
- package/dist/components/charts/BarChart.d.ts.map +0 -1
- package/dist/components/charts/DonutChart.d.ts.map +0 -1
- package/dist/components/charts/RadarChart.d.ts.map +0 -1
- package/dist/components/charts/RadialBarChart.d.ts.map +0 -1
- package/dist/components/charts/SparkLine.d.ts.map +0 -1
- package/dist/components/charts/StackedBarChart.d.ts.map +0 -1
- package/dist/components/charts/VerticalBarChart.d.ts.map +0 -1
- package/dist/components/charts/chartUtils.d.ts.map +0 -1
- package/dist/components/tables/ColumnPicker.d.ts.map +0 -1
- package/dist/components/tables/Pagination.d.ts.map +0 -1
- package/dist/components/tables/ResourceTable.d.ts.map +0 -1
- package/dist/components/tables/Table.d.ts.map +0 -1
- package/dist/components/tables/sortRows.d.ts.map +0 -1
- package/dist/components/ui/Accordion.d.ts.map +0 -1
- package/dist/components/ui/Alert.d.ts.map +0 -1
- package/dist/components/ui/AttachmentList.d.ts.map +0 -1
- package/dist/components/ui/AudioPlayer.d.ts.map +0 -1
- package/dist/components/ui/AuthCard.d.ts.map +0 -1
- package/dist/components/ui/AuthorByline.d.ts.map +0 -1
- package/dist/components/ui/Avatar.d.ts.map +0 -1
- package/dist/components/ui/Badge.d.ts.map +0 -1
- package/dist/components/ui/Button.d.ts.map +0 -1
- package/dist/components/ui/Calendar.d.ts.map +0 -1
- package/dist/components/ui/CalendarGrid.d.ts.map +0 -1
- package/dist/components/ui/Card.d.ts.map +0 -1
- package/dist/components/ui/CharacterCount.d.ts.map +0 -1
- package/dist/components/ui/Checkbox.d.ts.map +0 -1
- package/dist/components/ui/CodeInput.d.ts.map +0 -1
- package/dist/components/ui/Combobox.d.ts.map +0 -1
- package/dist/components/ui/CopyButton.d.ts.map +0 -1
- package/dist/components/ui/DangerZone.d.ts.map +0 -1
- package/dist/components/ui/DatePartsInput.d.ts.map +0 -1
- package/dist/components/ui/DatePicker.d.ts.map +0 -1
- package/dist/components/ui/DateRangePicker.d.ts.map +0 -1
- package/dist/components/ui/DateTimePicker.d.ts.map +0 -1
- package/dist/components/ui/DetailPanel.d.ts.map +0 -1
- package/dist/components/ui/Dialog.d.ts.map +0 -1
- package/dist/components/ui/DialogActions.d.ts.map +0 -1
- package/dist/components/ui/Disclosure.d.ts.map +0 -1
- package/dist/components/ui/DividerLabel.d.ts.map +0 -1
- package/dist/components/ui/DropdownMenu.d.ts.map +0 -1
- package/dist/components/ui/EmptyState.d.ts.map +0 -1
- package/dist/components/ui/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/ui/FieldContext.d.ts.map +0 -1
- package/dist/components/ui/Fieldset.d.ts.map +0 -1
- package/dist/components/ui/FilterButton.d.ts.map +0 -1
- package/dist/components/ui/FilterDropdown.d.ts.map +0 -1
- package/dist/components/ui/FormField.d.ts.map +0 -1
- package/dist/components/ui/Grid.d.ts.map +0 -1
- package/dist/components/ui/GridItem.d.ts.map +0 -1
- package/dist/components/ui/Inline.d.ts.map +0 -1
- package/dist/components/ui/Kbd.d.ts.map +0 -1
- package/dist/components/ui/ListItemLink.d.ts.map +0 -1
- package/dist/components/ui/LoadingSpinner.d.ts.map +0 -1
- package/dist/components/ui/MessageBubble.d.ts.map +0 -1
- package/dist/components/ui/MetadataGrid.d.ts.map +0 -1
- package/dist/components/ui/MetricCard.d.ts.map +0 -1
- package/dist/components/ui/NavTabs.d.ts.map +0 -1
- package/dist/components/ui/OAuthButton.d.ts.map +0 -1
- package/dist/components/ui/OverlineLabel.d.ts.map +0 -1
- package/dist/components/ui/PageHeader.d.ts.map +0 -1
- package/dist/components/ui/PageSection.d.ts.map +0 -1
- package/dist/components/ui/PaginationBar.d.ts.map +0 -1
- package/dist/components/ui/PasswordInput.d.ts.map +0 -1
- package/dist/components/ui/PasswordRequirements.d.ts.map +0 -1
- package/dist/components/ui/Popover.d.ts.map +0 -1
- package/dist/components/ui/ProfileHeader.d.ts.map +0 -1
- package/dist/components/ui/ProgressBar.d.ts.map +0 -1
- package/dist/components/ui/ProseContent.d.ts.map +0 -1
- package/dist/components/ui/QrCode.d.ts.map +0 -1
- package/dist/components/ui/Radio.d.ts.map +0 -1
- package/dist/components/ui/RadioPill.d.ts.map +0 -1
- package/dist/components/ui/ReorderList.d.ts.map +0 -1
- package/dist/components/ui/SearchInput.d.ts.map +0 -1
- package/dist/components/ui/SectionHeader.d.ts.map +0 -1
- package/dist/components/ui/Select.d.ts.map +0 -1
- package/dist/components/ui/SelectDropdown.d.ts.map +0 -1
- package/dist/components/ui/SettingRow.d.ts.map +0 -1
- package/dist/components/ui/SideSheet.d.ts.map +0 -1
- package/dist/components/ui/Skeleton.d.ts.map +0 -1
- package/dist/components/ui/Slider.d.ts.map +0 -1
- package/dist/components/ui/SplitPaneLayout.d.ts.map +0 -1
- package/dist/components/ui/Stack.d.ts.map +0 -1
- package/dist/components/ui/StatusDot.d.ts.map +0 -1
- package/dist/components/ui/StepProgress.d.ts.map +0 -1
- package/dist/components/ui/Tabs.d.ts.map +0 -1
- package/dist/components/ui/TextInput.d.ts.map +0 -1
- package/dist/components/ui/Textarea.d.ts.map +0 -1
- package/dist/components/ui/ThemePreview.d.ts.map +0 -1
- package/dist/components/ui/TimeInput.d.ts.map +0 -1
- package/dist/components/ui/Timeline.d.ts.map +0 -1
- package/dist/components/ui/Toast.d.ts.map +0 -1
- package/dist/components/ui/Toggle.d.ts.map +0 -1
- package/dist/components/ui/Toolbar.d.ts.map +0 -1
- package/dist/components/ui/Tooltip.d.ts.map +0 -1
- package/dist/components/ui/TranscriptLine.d.ts.map +0 -1
- package/dist/components/ui/UploadDropzone.d.ts.map +0 -1
- package/dist/components/ui/badgeColors.d.ts.map +0 -1
- package/dist/components/ui/calendar/AgendaView.d.ts.map +0 -1
- package/dist/components/ui/calendar/MonthView.d.ts.map +0 -1
- package/dist/components/ui/calendar/TimeGrid.d.ts.map +0 -1
- package/dist/components/ui/calendar/TimelineView.d.ts.map +0 -1
- package/dist/components/ui/calendar/context.d.ts.map +0 -1
- package/dist/components/ui/calendar/items.d.ts.map +0 -1
- package/dist/components/ui/calendar/types.d.ts.map +0 -1
- package/dist/components/ui/calendar/useGridInteraction.d.ts.map +0 -1
- package/dist/components/ui/useFieldControl.d.ts.map +0 -1
- package/dist/config/theme.d.ts.map +0 -1
- package/dist/hooks/useAnchoredPopup.d.ts.map +0 -1
- package/dist/hooks/useApplyTheme.d.ts.map +0 -1
- package/dist/hooks/useDismiss.d.ts.map +0 -1
- package/dist/hooks/useFocusTrap.d.ts.map +0 -1
- package/dist/hooks/useOverlayStack.d.ts.map +0 -1
- package/dist/hooks/usePopover.d.ts.map +0 -1
- package/dist/hooks/usePortalContainer.d.ts.map +0 -1
- package/dist/hooks/useSettings.d.ts.map +0 -1
- package/dist/hooks/useTheme.d.ts.map +0 -1
- package/dist/hooks/useTypeahead.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib/anchorPlacement.d.ts.map +0 -1
- package/dist/lib/calendar.d.ts.map +0 -1
- package/dist/lib/cn.d.ts.map +0 -1
- package/dist/lib/codeInput.d.ts.map +0 -1
- package/dist/lib/dateParts.d.ts.map +0 -1
- package/dist/lib/dialogDrag.d.ts.map +0 -1
- package/dist/lib/dialogResize.d.ts.map +0 -1
- package/dist/lib/formatDate.d.ts.map +0 -1
- package/dist/lib/formatMediaTime.d.ts.map +0 -1
- package/dist/lib/keyboardStep.d.ts.map +0 -1
- package/dist/lib/layout.d.ts.map +0 -1
- package/dist/lib/math.d.ts.map +0 -1
- package/dist/lib/months.d.ts.map +0 -1
- package/dist/lib/overlayStack.d.ts.map +0 -1
- package/dist/lib/panelResize.d.ts.map +0 -1
- package/dist/lib/passwordRequirements.d.ts.map +0 -1
- package/dist/lib/qrCode.d.ts.map +0 -1
- package/dist/lib/rect.d.ts.map +0 -1
- package/dist/lib/tones.d.ts.map +0 -1
- package/dist/lib/typeahead.d.ts.map +0 -1
- package/dist/providers/ControlSizeContext.d.ts.map +0 -1
- package/dist/providers/ControlSizeProvider.d.ts.map +0 -1
- package/dist/providers/SettingsContext.d.ts.map +0 -1
- package/dist/providers/SettingsProvider.d.ts.map +0 -1
- package/dist/providers/ThemeContext.d.ts.map +0 -1
- package/dist/providers/ThemeProvider.d.ts.map +0 -1
- package/dist/providers/accentColors.d.ts.map +0 -1
- package/dist/providers/themeClasses.d.ts.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
1
2
|
export interface RadialSegment {
|
|
2
3
|
label: string;
|
|
3
4
|
value: number;
|
|
4
5
|
max: number;
|
|
5
6
|
color: string;
|
|
6
7
|
}
|
|
7
|
-
export interface RadialBarChartProps {
|
|
8
|
+
export interface RadialBarChartProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
8
9
|
/** Concentric rings drawn outside in; each has a `label`, `value`, `max` it is measured against, and `color`. */
|
|
9
10
|
segments: RadialSegment[];
|
|
10
11
|
/** Width and height of the chart in px. Defaults to 200. */
|
|
@@ -20,9 +21,8 @@ export interface RadialBarChartProps {
|
|
|
20
21
|
/** Show the legend with each ring's percentage below the chart. Defaults to `true`. */
|
|
21
22
|
showLegend?: boolean;
|
|
22
23
|
/** Accessible label for the chart. Defaults to "Radial bar chart". */
|
|
23
|
-
|
|
24
|
+
"aria-label"?: string;
|
|
24
25
|
/** Extra classes for the wrapper element. */
|
|
25
26
|
className?: string;
|
|
26
27
|
}
|
|
27
|
-
export declare function RadialBarChart({ segments, size, strokeWidth, gap, valueFormatter, percentageFormatter, showLegend, ariaLabel, className, }: RadialBarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
//# sourceMappingURL=RadialBarChart.d.ts.map
|
|
28
|
+
export declare function RadialBarChart({ segments, size, strokeWidth, gap, valueFormatter, percentageFormatter, showLegend, "aria-label": ariaLabel, className, ref, ...rest }: RadialBarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { clamp as t } from "../../lib/math.js";
|
|
3
|
+
import { estimateTooltipWidth as n, getFloatingTooltipStyle as r, getPositiveValue as i, resolveChartColor as a } from "./chartUtils.js";
|
|
4
|
+
import { useRef as o, useState as s } from "react";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/charts/RadialBarChart.tsx
|
|
7
|
+
function u({ segments: u, size: d = 200, strokeWidth: f = 14, gap: p = 6, valueFormatter: m, percentageFormatter: h, showLegend: g = !0, "aria-label": _ = "Radial bar chart", className: v, ref: y, ...b }) {
|
|
8
|
+
let [x, S] = s(null), [C, w] = s({
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0
|
|
11
|
+
}), T = o(null), E = x?.index ?? null, D = Math.max(1, d), O = Math.max(1, Math.min(f, D)), k = Math.max(0, p), A = D / 2, j = Math.max(0, (D - 40) / 2), M = m ?? String, N = h ?? ((e) => `${Math.round(e)}%`), P = u.reduce((e, t, n) => j - n * (O + k) > 0 ? n : e, -1);
|
|
12
|
+
function F(e) {
|
|
13
|
+
let t = T.current?.getBoundingClientRect();
|
|
14
|
+
t && w({
|
|
15
|
+
x: e.clientX - t.left,
|
|
16
|
+
y: e.clientY - t.top
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function I(e) {
|
|
20
|
+
w({
|
|
21
|
+
x: A,
|
|
22
|
+
y: A
|
|
23
|
+
}), S({
|
|
24
|
+
index: e,
|
|
25
|
+
source: "chart"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function L(e) {
|
|
29
|
+
let n = i(e.max);
|
|
30
|
+
return n <= 0 ? 0 : t(i(e.value) / n, 0, 1);
|
|
31
|
+
}
|
|
32
|
+
function R(e) {
|
|
33
|
+
return L(e) * 100;
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ l("div", {
|
|
36
|
+
ref: y,
|
|
37
|
+
...b,
|
|
38
|
+
className: e("flex flex-col items-center gap-4", v),
|
|
39
|
+
children: [/* @__PURE__ */ l("div", {
|
|
40
|
+
className: "relative",
|
|
41
|
+
ref: T,
|
|
42
|
+
onPointerMove: F,
|
|
43
|
+
children: [/* @__PURE__ */ l("svg", {
|
|
44
|
+
width: D,
|
|
45
|
+
height: D,
|
|
46
|
+
viewBox: `0 0 ${D} ${D}`,
|
|
47
|
+
className: "select-none",
|
|
48
|
+
role: "img",
|
|
49
|
+
"aria-label": _,
|
|
50
|
+
children: [u.map((e, t) => {
|
|
51
|
+
let n = j - t * (O + k);
|
|
52
|
+
if (n <= 0) return null;
|
|
53
|
+
let r = 2 * Math.PI * n, i = r * L(e), o = r - i, s = a(e.color), u = E === t, d = R(e);
|
|
54
|
+
return /* @__PURE__ */ l("g", {
|
|
55
|
+
onMouseEnter: () => S({
|
|
56
|
+
index: t,
|
|
57
|
+
source: "chart"
|
|
58
|
+
}),
|
|
59
|
+
onMouseLeave: () => S(null),
|
|
60
|
+
onPointerEnter: () => S({
|
|
61
|
+
index: t,
|
|
62
|
+
source: "chart"
|
|
63
|
+
}),
|
|
64
|
+
onPointerDown: () => S({
|
|
65
|
+
index: t,
|
|
66
|
+
source: "chart"
|
|
67
|
+
}),
|
|
68
|
+
onPointerLeave: () => S(null),
|
|
69
|
+
onFocus: () => I(t),
|
|
70
|
+
onBlur: () => S(null),
|
|
71
|
+
className: "cursor-pointer",
|
|
72
|
+
tabIndex: 0,
|
|
73
|
+
role: "button",
|
|
74
|
+
"aria-label": `${e.label}: ${N(d)} (${M(e.value)}/${M(e.max)})`,
|
|
75
|
+
children: [/* @__PURE__ */ c("circle", {
|
|
76
|
+
cx: A,
|
|
77
|
+
cy: A,
|
|
78
|
+
r: n,
|
|
79
|
+
fill: "none",
|
|
80
|
+
stroke: "var(--border)",
|
|
81
|
+
strokeWidth: O,
|
|
82
|
+
opacity: .3
|
|
83
|
+
}), /* @__PURE__ */ c("circle", {
|
|
84
|
+
cx: A,
|
|
85
|
+
cy: A,
|
|
86
|
+
r: n,
|
|
87
|
+
fill: "none",
|
|
88
|
+
stroke: s,
|
|
89
|
+
strokeWidth: u ? O + 4 : O,
|
|
90
|
+
strokeDasharray: `${i} ${o}`,
|
|
91
|
+
strokeLinecap: "round",
|
|
92
|
+
transform: `rotate(-90 ${A} ${A})`,
|
|
93
|
+
opacity: E !== null && !u ? .4 : 1,
|
|
94
|
+
className: "pointer-events-none",
|
|
95
|
+
style: { transition: "all 150ms ease-out" }
|
|
96
|
+
})]
|
|
97
|
+
}, e.label);
|
|
98
|
+
}), P >= 0 && (() => {
|
|
99
|
+
let e = j - P * (O + k) - O / 2;
|
|
100
|
+
return /* @__PURE__ */ c("circle", {
|
|
101
|
+
cx: A,
|
|
102
|
+
cy: A,
|
|
103
|
+
r: Math.max(0, e),
|
|
104
|
+
fill: "transparent",
|
|
105
|
+
onMouseEnter: () => S({
|
|
106
|
+
index: P,
|
|
107
|
+
source: "chart"
|
|
108
|
+
}),
|
|
109
|
+
onMouseLeave: () => S(null),
|
|
110
|
+
onPointerEnter: () => S({
|
|
111
|
+
index: P,
|
|
112
|
+
source: "chart"
|
|
113
|
+
}),
|
|
114
|
+
onPointerDown: () => S({
|
|
115
|
+
index: P,
|
|
116
|
+
source: "chart"
|
|
117
|
+
}),
|
|
118
|
+
onPointerLeave: () => S(null),
|
|
119
|
+
onFocus: () => I(P),
|
|
120
|
+
onBlur: () => S(null),
|
|
121
|
+
tabIndex: 0,
|
|
122
|
+
role: "button",
|
|
123
|
+
"aria-label": `${u[P].label}: ${N(R(u[P]))}`,
|
|
124
|
+
className: "cursor-pointer"
|
|
125
|
+
});
|
|
126
|
+
})()]
|
|
127
|
+
}), E !== null && x?.source === "chart" && (() => {
|
|
128
|
+
let e = u[E];
|
|
129
|
+
if (!e) return null;
|
|
130
|
+
let t = R(e), i = a(e.color), o = N(t), s = `${M(e.value)}/${M(e.max)}`;
|
|
131
|
+
return /* @__PURE__ */ c("div", {
|
|
132
|
+
className: "ui-glass ui-glass-popover bg-bg-tertiary border-border pointer-events-none absolute z-10 rounded-md border px-2.5 py-1.5 shadow-lg",
|
|
133
|
+
style: r({
|
|
134
|
+
anchorX: C.x,
|
|
135
|
+
anchorY: C.y,
|
|
136
|
+
boundsHeight: D,
|
|
137
|
+
boundsWidth: D,
|
|
138
|
+
height: 30,
|
|
139
|
+
margin: 4,
|
|
140
|
+
offset: 8,
|
|
141
|
+
width: n([`${e.label} ${o} ${s}`], {
|
|
142
|
+
maxWidth: 220,
|
|
143
|
+
minWidth: 112
|
|
144
|
+
})
|
|
145
|
+
}),
|
|
146
|
+
children: /* @__PURE__ */ l("div", {
|
|
147
|
+
className: "flex items-center gap-2",
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ c("span", {
|
|
150
|
+
className: "h-2 w-2 shrink-0 rounded-full",
|
|
151
|
+
style: { backgroundColor: i }
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ c("span", {
|
|
154
|
+
className: "text-text-secondary text-xs whitespace-nowrap",
|
|
155
|
+
children: e.label
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ c("span", {
|
|
158
|
+
className: "text-text-primary text-xs font-semibold",
|
|
159
|
+
children: o
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ l("span", {
|
|
162
|
+
className: "text-text-tertiary text-2xs",
|
|
163
|
+
children: [
|
|
164
|
+
"(",
|
|
165
|
+
s,
|
|
166
|
+
")"
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
})()]
|
|
173
|
+
}), g && /* @__PURE__ */ c("div", {
|
|
174
|
+
className: "flex flex-wrap justify-center gap-x-4 gap-y-1.5",
|
|
175
|
+
children: u.map((t, n) => {
|
|
176
|
+
let r = R(t);
|
|
177
|
+
return /* @__PURE__ */ l("button", {
|
|
178
|
+
type: "button",
|
|
179
|
+
onMouseEnter: () => S({
|
|
180
|
+
index: n,
|
|
181
|
+
source: "legend"
|
|
182
|
+
}),
|
|
183
|
+
onMouseLeave: () => S(null),
|
|
184
|
+
onPointerEnter: () => S({
|
|
185
|
+
index: n,
|
|
186
|
+
source: "legend"
|
|
187
|
+
}),
|
|
188
|
+
onPointerDown: () => S({
|
|
189
|
+
index: n,
|
|
190
|
+
source: "legend"
|
|
191
|
+
}),
|
|
192
|
+
onPointerLeave: () => S(null),
|
|
193
|
+
onFocus: () => S({
|
|
194
|
+
index: n,
|
|
195
|
+
source: "legend"
|
|
196
|
+
}),
|
|
197
|
+
onBlur: () => S(null),
|
|
198
|
+
className: e("flex cursor-pointer items-center gap-1.5 transition-opacity duration-[100ms]", E !== null && E !== n && "opacity-50"),
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ c("span", {
|
|
201
|
+
className: "h-2 w-2 rounded-full",
|
|
202
|
+
style: { backgroundColor: a(t.color) }
|
|
203
|
+
}),
|
|
204
|
+
/* @__PURE__ */ c("span", {
|
|
205
|
+
className: "text-text-secondary text-xs",
|
|
206
|
+
children: t.label
|
|
207
|
+
}),
|
|
208
|
+
/* @__PURE__ */ c("span", {
|
|
209
|
+
className: "text-text-primary text-xs font-semibold",
|
|
210
|
+
children: N(r)
|
|
211
|
+
})
|
|
212
|
+
]
|
|
213
|
+
}, t.label);
|
|
214
|
+
})
|
|
215
|
+
})]
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
export { u as RadialBarChart };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ComponentPropsWithRef } from "react";
|
|
2
|
+
export interface SparkLineProps extends Omit<ComponentPropsWithRef<"svg">, "children" | "viewBox"> {
|
|
2
3
|
/** Values to plot left to right. Renders nothing with fewer than two points. */
|
|
3
4
|
data: number[];
|
|
4
5
|
/** Width in px. Defaults to 60. */
|
|
@@ -27,9 +28,8 @@ export interface SparkLineProps {
|
|
|
27
28
|
/** Opacity of the area fill when `area` is on. Defaults to 0.15. */
|
|
28
29
|
areaOpacity?: number;
|
|
29
30
|
/** Accessible label for the chart. Defaults to "Sparkline chart". */
|
|
30
|
-
|
|
31
|
+
"aria-label"?: string;
|
|
31
32
|
/** Extra classes for the `<svg>`. */
|
|
32
33
|
className?: string;
|
|
33
34
|
}
|
|
34
|
-
export declare function SparkLine({ data, width, height, minValue, maxValue, strokeWidth, padding, color, area, areaOpacity, ariaLabel, className, }: SparkLineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
35
|
-
//# sourceMappingURL=SparkLine.d.ts.map
|
|
35
|
+
export declare function SparkLine({ data, width, height, minValue, maxValue, strokeWidth, padding, color, area, areaOpacity, "aria-label": ariaLabel, className, ref, ...rest }: SparkLineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { clamp as t } from "../../lib/math.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/charts/SparkLine.tsx
|
|
5
|
+
function i({ data: i, width: a = 60, height: o = 20, minValue: s, maxValue: c, strokeWidth: l = 1.5, padding: u = 1, color: d = "var(--accent)", area: f = !1, areaOpacity: p = .15, "aria-label": m = "Sparkline chart", className: h, ref: g, ..._ }) {
|
|
6
|
+
if (i.length < 2) return null;
|
|
7
|
+
let v = Math.max(1, a), y = Math.max(1, o), b = Math.max(0, Math.min(u, y / 2, v / 2)), x = s ?? Math.min(...i), S = c ?? Math.max(...i), C = Math.min(x, S), w = Math.max(x, S), T = w - C, E = Math.max(1, v - b * 2), D = Math.max(1, y - b * 2), O = i.map((e, n) => ({
|
|
8
|
+
x: b + n / (i.length - 1) * E,
|
|
9
|
+
y: T === 0 ? y / 2 : b + D - (t(e, C, w) - C) / T * D
|
|
10
|
+
})), k = O.map(({ x: e, y: t }) => `${e},${t}`).join(" "), A = O.length > 0 ? [
|
|
11
|
+
`${O[0].x},${y - b}`,
|
|
12
|
+
...O.map(({ x: e, y: t }) => `${e},${t}`),
|
|
13
|
+
`${O[O.length - 1].x},${y - b}`
|
|
14
|
+
].join(" ") : "";
|
|
15
|
+
return /* @__PURE__ */ r("svg", {
|
|
16
|
+
ref: g,
|
|
17
|
+
..._,
|
|
18
|
+
width: v,
|
|
19
|
+
height: y,
|
|
20
|
+
viewBox: `0 0 ${v} ${y}`,
|
|
21
|
+
className: e("inline-block", h),
|
|
22
|
+
role: "img",
|
|
23
|
+
"aria-label": m,
|
|
24
|
+
children: [f && /* @__PURE__ */ n("polygon", {
|
|
25
|
+
points: A,
|
|
26
|
+
fill: d,
|
|
27
|
+
opacity: p
|
|
28
|
+
}), /* @__PURE__ */ n("polyline", {
|
|
29
|
+
points: k,
|
|
30
|
+
fill: "none",
|
|
31
|
+
stroke: d,
|
|
32
|
+
strokeWidth: l,
|
|
33
|
+
strokeLinecap: "round",
|
|
34
|
+
strokeLinejoin: "round"
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { i as SparkLine };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
1
2
|
export interface StackedBarChartDatum {
|
|
2
3
|
date: string;
|
|
3
4
|
[key: string]: number | string;
|
|
@@ -13,7 +14,7 @@ export interface StackedBarChartTooltipRow {
|
|
|
13
14
|
label: string;
|
|
14
15
|
value: number;
|
|
15
16
|
}
|
|
16
|
-
export interface StackedBarChartProps {
|
|
17
|
+
export interface StackedBarChartProps extends Omit<ComponentPropsWithRef<"svg">, "children" | "viewBox" | "width"> {
|
|
17
18
|
/** One entry per bar, with a `date` label and a numeric value for each segment `key`. */
|
|
18
19
|
data: StackedBarChartDatum[];
|
|
19
20
|
/** Stack layers in order; each maps a `key` in `data` to a `label`, `color`, and optional `opacity`. */
|
|
@@ -21,7 +22,7 @@ export interface StackedBarChartProps {
|
|
|
21
22
|
/** Chart height in SVG units; the width scales to the container. Defaults to 220. */
|
|
22
23
|
height?: number;
|
|
23
24
|
/** Accessible label for the chart. Defaults to "Stacked bar chart". */
|
|
24
|
-
|
|
25
|
+
"aria-label"?: string;
|
|
25
26
|
/** Build custom hover tooltip rows for a bar. Defaults to one row per segment. */
|
|
26
27
|
tooltipRows?: (item: StackedBarChartDatum) => StackedBarChartTooltipRow[];
|
|
27
28
|
/** Format Y-axis labels. Defaults to compact `k`/`M` formatting. */
|
|
@@ -37,5 +38,4 @@ export interface StackedBarChartProps {
|
|
|
37
38
|
/** Extra classes for the `<svg>`. */
|
|
38
39
|
className?: string;
|
|
39
40
|
}
|
|
40
|
-
export declare function StackedBarChart({ data, segments, height, ariaLabel, tooltipRows, valueFormatter, tooltipValueFormatter, xLabelCount, barGap, minBarWidth, className, }: StackedBarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
//# sourceMappingURL=StackedBarChart.d.ts.map
|
|
41
|
+
export declare function StackedBarChart({ data, segments, height, "aria-label": ariaLabel, tooltipRows, valueFormatter, tooltipValueFormatter, xLabelCount, barGap, minBarWidth, className, ref, ...rest }: StackedBarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/cn.js";
|
|
2
|
+
import { estimateTooltipWidth as t, formatCompactValue as n, getLabelIndices as r, getSvgTooltipPosition as i } from "./chartUtils.js";
|
|
3
|
+
import { useState as a } from "react";
|
|
4
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/charts/StackedBarChart.tsx
|
|
6
|
+
var l = {
|
|
7
|
+
top: 20,
|
|
8
|
+
right: 12,
|
|
9
|
+
bottom: 30,
|
|
10
|
+
left: 48
|
|
11
|
+
}, u = 600, d = 4;
|
|
12
|
+
function f(e) {
|
|
13
|
+
let t = /^(\d{4})-(\d{2})-(\d{2})T(\d{2})/.exec(e);
|
|
14
|
+
if (t) {
|
|
15
|
+
let [, e, n, r, i] = t;
|
|
16
|
+
return new Date(Date.UTC(Number(e), Number(n) - 1, Number(r), Number(i))).toLocaleString(void 0, {
|
|
17
|
+
month: "short",
|
|
18
|
+
day: "numeric",
|
|
19
|
+
hour: "numeric",
|
|
20
|
+
timeZone: "UTC"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
let n = /^(\d{4})-(\d{2})-(\d{2})/.exec(e);
|
|
24
|
+
if (!n) return e;
|
|
25
|
+
let [, r, i, a] = n;
|
|
26
|
+
return new Date(Date.UTC(Number(r), Number(i) - 1, Number(a))).toLocaleDateString(void 0, {
|
|
27
|
+
month: "short",
|
|
28
|
+
day: "numeric",
|
|
29
|
+
timeZone: "UTC"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function p(e, t) {
|
|
33
|
+
let n = e[t];
|
|
34
|
+
if (typeof n == "number") return Number.isFinite(n) ? n : 0;
|
|
35
|
+
if (typeof n == "string") {
|
|
36
|
+
let e = Number(n);
|
|
37
|
+
return Number.isFinite(e) ? e : 0;
|
|
38
|
+
}
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
function m(e, t) {
|
|
42
|
+
return t.reduce((t, n) => t + Math.max(0, p(e, n.key)), 0);
|
|
43
|
+
}
|
|
44
|
+
function h(e, t, n, r, i) {
|
|
45
|
+
let a = Math.min(i, Math.max(0, n / 2), Math.max(0, r));
|
|
46
|
+
return a <= 0 ? `M ${e} ${t} H ${e + n} V ${t + r} H ${e} Z` : [
|
|
47
|
+
`M ${e} ${t + r}`,
|
|
48
|
+
`V ${t + a}`,
|
|
49
|
+
`Q ${e} ${t} ${e + a} ${t}`,
|
|
50
|
+
`H ${e + n - a}`,
|
|
51
|
+
`Q ${e + n} ${t} ${e + n} ${t + a}`,
|
|
52
|
+
`V ${t + r}`,
|
|
53
|
+
"Z"
|
|
54
|
+
].join(" ");
|
|
55
|
+
}
|
|
56
|
+
function g({ data: g, segments: _, height: v = 220, "aria-label": y = "Stacked bar chart", tooltipRows: b, valueFormatter: x, tooltipValueFormatter: S, xLabelCount: C = 6, barGap: w, minBarWidth: T = 1, className: E, ref: D, ...O }) {
|
|
57
|
+
let [k, A] = a(null), j = Math.max(l.top + l.bottom + 1, v), M = u - l.left - l.right, N = Math.max(1, j - l.top - l.bottom), P = g.reduce((e, t) => Math.max(e, m(t, _)), 1), F = Math.ceil(P / 2), I = F > 0 && F < P, L = w ?? (g.length > 60 ? 2 : g.length > 30 ? 3 : 6), R = Math.max(1, T), z = g.length > 1 ? Math.max(0, (M - g.length * R) / Math.max(g.length - 1, 1)) : 0, B = g.length > 1 ? Math.min(Math.max(0, L), z) : 0, V = g.length > 0 ? (M - B * Math.max(g.length - 1, 0)) / g.length : 0, H = new Set(r(g.length, C)), U = k === null ? null : g[k], W = x ?? n, G = S ?? ((e) => e.toLocaleString());
|
|
58
|
+
function K(e) {
|
|
59
|
+
return l.left + e * (V + B);
|
|
60
|
+
}
|
|
61
|
+
function q(e) {
|
|
62
|
+
return e / P * N;
|
|
63
|
+
}
|
|
64
|
+
return /* @__PURE__ */ c("svg", {
|
|
65
|
+
ref: D,
|
|
66
|
+
...O,
|
|
67
|
+
width: "100%",
|
|
68
|
+
viewBox: `0 0 ${u} ${j}`,
|
|
69
|
+
className: e("select-none", E),
|
|
70
|
+
role: "img",
|
|
71
|
+
"aria-label": y,
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ s("text", {
|
|
74
|
+
x: l.left - 8,
|
|
75
|
+
y: l.top,
|
|
76
|
+
textAnchor: "end",
|
|
77
|
+
dominantBaseline: "central",
|
|
78
|
+
fill: "var(--text-tertiary)",
|
|
79
|
+
fontSize: 10,
|
|
80
|
+
children: W(P)
|
|
81
|
+
}),
|
|
82
|
+
I && /* @__PURE__ */ s("text", {
|
|
83
|
+
x: l.left - 8,
|
|
84
|
+
y: l.top + N / 2,
|
|
85
|
+
textAnchor: "end",
|
|
86
|
+
dominantBaseline: "central",
|
|
87
|
+
fill: "var(--text-tertiary)",
|
|
88
|
+
fontSize: 10,
|
|
89
|
+
children: W(F)
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ s("text", {
|
|
92
|
+
x: l.left - 8,
|
|
93
|
+
y: l.top + N,
|
|
94
|
+
textAnchor: "end",
|
|
95
|
+
dominantBaseline: "central",
|
|
96
|
+
fill: "var(--text-tertiary)",
|
|
97
|
+
fontSize: 10,
|
|
98
|
+
children: "0"
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ s("line", {
|
|
101
|
+
x1: l.left,
|
|
102
|
+
y1: l.top + N,
|
|
103
|
+
x2: l.left + M,
|
|
104
|
+
y2: l.top + N,
|
|
105
|
+
stroke: "var(--border)",
|
|
106
|
+
strokeWidth: 1
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ s("line", {
|
|
109
|
+
x1: l.left,
|
|
110
|
+
y1: l.top + N / 2,
|
|
111
|
+
x2: l.left + M,
|
|
112
|
+
y2: l.top + N / 2,
|
|
113
|
+
stroke: "var(--border)",
|
|
114
|
+
strokeWidth: 1,
|
|
115
|
+
strokeDasharray: "3 3",
|
|
116
|
+
opacity: .5
|
|
117
|
+
}),
|
|
118
|
+
g.map((e, t) => {
|
|
119
|
+
let n = K(t), r = k === t, i = 0, a = _.map((t) => ({
|
|
120
|
+
segment: t,
|
|
121
|
+
value: Math.max(0, p(e, t.key))
|
|
122
|
+
})).filter(({ value: e }) => e > 0);
|
|
123
|
+
return /* @__PURE__ */ c("g", {
|
|
124
|
+
onMouseEnter: () => A(t),
|
|
125
|
+
onMouseLeave: () => A(null),
|
|
126
|
+
onPointerEnter: () => A(t),
|
|
127
|
+
onPointerDown: () => A(t),
|
|
128
|
+
onPointerLeave: () => A(null),
|
|
129
|
+
onFocus: () => A(t),
|
|
130
|
+
onBlur: () => A(null),
|
|
131
|
+
tabIndex: 0,
|
|
132
|
+
role: "button",
|
|
133
|
+
"aria-label": `${f(e.date)}: ${G(m(e, _))}`,
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ s("rect", {
|
|
136
|
+
x: n,
|
|
137
|
+
y: l.top,
|
|
138
|
+
width: V,
|
|
139
|
+
height: N,
|
|
140
|
+
fill: "transparent"
|
|
141
|
+
}),
|
|
142
|
+
a.map(({ segment: e, value: t }, o) => {
|
|
143
|
+
let c = q(t), u = l.top + N - i - c, f = o === a.length - 1;
|
|
144
|
+
return i += c, f ? /* @__PURE__ */ s("path", {
|
|
145
|
+
d: h(n, u, V, c, d),
|
|
146
|
+
fill: e.color,
|
|
147
|
+
opacity: r ? 1 : e.opacity ?? .9
|
|
148
|
+
}, e.key) : /* @__PURE__ */ s("rect", {
|
|
149
|
+
x: n,
|
|
150
|
+
y: u,
|
|
151
|
+
width: V,
|
|
152
|
+
height: c,
|
|
153
|
+
fill: e.color,
|
|
154
|
+
opacity: r ? 1 : e.opacity ?? .9
|
|
155
|
+
}, e.key);
|
|
156
|
+
}),
|
|
157
|
+
H.has(t) && /* @__PURE__ */ s("text", {
|
|
158
|
+
x: n + V / 2,
|
|
159
|
+
y: j - 5,
|
|
160
|
+
textAnchor: "middle",
|
|
161
|
+
fill: "var(--text-tertiary)",
|
|
162
|
+
fontSize: 10,
|
|
163
|
+
children: f(e.date)
|
|
164
|
+
})
|
|
165
|
+
]
|
|
166
|
+
}, `${e.date}-${t}`);
|
|
167
|
+
}),
|
|
168
|
+
U && k !== null && /* @__PURE__ */ s("g", {
|
|
169
|
+
pointerEvents: "none",
|
|
170
|
+
children: (() => {
|
|
171
|
+
let e = K(k) + V / 2, n = b?.(U) ?? _.map((e) => ({
|
|
172
|
+
color: e.color,
|
|
173
|
+
label: e.label,
|
|
174
|
+
value: p(U, e.key)
|
|
175
|
+
})), r = m(U, _), a = i(e, l.top + N - q(r), {
|
|
176
|
+
boundsHeight: j,
|
|
177
|
+
boundsWidth: u,
|
|
178
|
+
height: 28 + n.length * 15,
|
|
179
|
+
offset: 8,
|
|
180
|
+
width: t([f(U.date), ...n.map((e) => `${e.label} ${G(e.value)}`)], {
|
|
181
|
+
maxWidth: 240,
|
|
182
|
+
minWidth: 150
|
|
183
|
+
})
|
|
184
|
+
}), d = a.x + 10, h = a.x + a.width - 10;
|
|
185
|
+
return /* @__PURE__ */ c(o, { children: [
|
|
186
|
+
/* @__PURE__ */ s("line", {
|
|
187
|
+
x1: e,
|
|
188
|
+
y1: l.top,
|
|
189
|
+
x2: e,
|
|
190
|
+
y2: l.top + N,
|
|
191
|
+
stroke: "var(--border-strong)",
|
|
192
|
+
strokeWidth: 1,
|
|
193
|
+
strokeDasharray: "3 3"
|
|
194
|
+
}),
|
|
195
|
+
/* @__PURE__ */ s("rect", {
|
|
196
|
+
x: a.x,
|
|
197
|
+
y: a.y,
|
|
198
|
+
width: a.width,
|
|
199
|
+
height: a.height,
|
|
200
|
+
rx: 4,
|
|
201
|
+
fill: "var(--bg-tooltip, var(--bg-tertiary))",
|
|
202
|
+
stroke: "var(--border)",
|
|
203
|
+
strokeWidth: 1
|
|
204
|
+
}),
|
|
205
|
+
/* @__PURE__ */ s("text", {
|
|
206
|
+
x: d,
|
|
207
|
+
y: a.y + 14,
|
|
208
|
+
fill: "var(--text-primary)",
|
|
209
|
+
fontSize: 10,
|
|
210
|
+
fontWeight: 600,
|
|
211
|
+
children: f(U.date)
|
|
212
|
+
}),
|
|
213
|
+
n.map((e, t) => {
|
|
214
|
+
let n = a.y + 30 + t * 15;
|
|
215
|
+
return /* @__PURE__ */ c("g", { children: [
|
|
216
|
+
e.color && /* @__PURE__ */ s("rect", {
|
|
217
|
+
x: d,
|
|
218
|
+
y: n - 6,
|
|
219
|
+
width: 6,
|
|
220
|
+
height: 6,
|
|
221
|
+
rx: 1,
|
|
222
|
+
fill: e.color
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ s("text", {
|
|
225
|
+
x: e.color ? d + 12 : d,
|
|
226
|
+
y: n,
|
|
227
|
+
fill: "var(--text-secondary)",
|
|
228
|
+
fontSize: 10,
|
|
229
|
+
children: e.label
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ s("text", {
|
|
232
|
+
x: h,
|
|
233
|
+
y: n,
|
|
234
|
+
textAnchor: "end",
|
|
235
|
+
fill: "var(--text-primary)",
|
|
236
|
+
fontSize: 10,
|
|
237
|
+
fontWeight: 600,
|
|
238
|
+
children: G(e.value)
|
|
239
|
+
})
|
|
240
|
+
] }, e.label);
|
|
241
|
+
})
|
|
242
|
+
] });
|
|
243
|
+
})()
|
|
244
|
+
})
|
|
245
|
+
]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
export { g as StackedBarChart };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type ComponentPropsWithRef } from "react";
|
|
1
2
|
export interface VerticalBarChartDatum {
|
|
2
3
|
color?: string;
|
|
3
4
|
label: string;
|
|
4
5
|
value: number;
|
|
5
6
|
}
|
|
6
|
-
export interface VerticalBarChartProps {
|
|
7
|
+
export interface VerticalBarChartProps extends Omit<ComponentPropsWithRef<"svg">, "children" | "viewBox" | "width"> {
|
|
7
8
|
/** Bars to draw left to right, each with a `label`, numeric `value`, and optional `color`. */
|
|
8
9
|
data: VerticalBarChartDatum[];
|
|
9
10
|
/** Chart height in SVG units; the width scales to the container. Defaults to 180. */
|
|
@@ -25,9 +26,8 @@ export interface VerticalBarChartProps {
|
|
|
25
26
|
/** Minimum bar width before the gap is reduced. */
|
|
26
27
|
minBarWidth?: number;
|
|
27
28
|
/** Accessible label for the chart. Defaults to "Vertical bar chart". */
|
|
28
|
-
|
|
29
|
+
"aria-label"?: string;
|
|
29
30
|
/** Extra classes for the `<svg>`. */
|
|
30
31
|
className?: string;
|
|
31
32
|
}
|
|
32
|
-
export declare function VerticalBarChart({ data, height, maxValue, valueFormatter, tooltipValueFormatter, labelFormatter, maxLabelLength, xLabelCount, barGap, minBarWidth, ariaLabel, className, }: VerticalBarChartProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
//# sourceMappingURL=VerticalBarChart.d.ts.map
|
|
33
|
+
export declare function VerticalBarChart({ data, height, maxValue, valueFormatter, tooltipValueFormatter, labelFormatter, maxLabelLength, xLabelCount, barGap, minBarWidth, "aria-label": ariaLabel, className, ref, ...rest }: VerticalBarChartProps): import("react/jsx-runtime").JSX.Element;
|