neba 1.6.0 → 1.8.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 +37 -6
- package/dist/components/accordion/Accordion.d.ts +1 -1
- package/dist/components/accordion/Accordion.js +1 -1
- package/dist/components/accordion/index.d.ts +2 -2
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/alert/Alert.d.ts +1 -1
- package/dist/components/alert/Alert.js +1 -1
- package/dist/components/alert/index.d.ts +2 -2
- package/dist/components/alert/index.js +1 -1
- package/dist/components/animate-appear/AnimateAppear.d.ts +1 -1
- package/dist/components/animate-appear/AnimateAppear.js +1 -1
- package/dist/components/animate-appear/index.d.ts +2 -2
- package/dist/components/animate-appear/index.js +1 -1
- package/dist/components/animate-blink/AnimateBlink.d.ts +1 -1
- package/dist/components/animate-blink/AnimateBlink.js +1 -1
- package/dist/components/animate-blink/index.d.ts +2 -2
- package/dist/components/animate-blink/index.js +1 -1
- package/dist/components/animate-fade/AnimateFade.d.ts +1 -1
- package/dist/components/animate-fade/AnimateFade.js +1 -1
- package/dist/components/animate-fade/index.d.ts +2 -2
- package/dist/components/animate-fade/index.js +1 -1
- package/dist/components/animate-grow/AnimateGrow.d.ts +1 -1
- package/dist/components/animate-grow/AnimateGrow.js +1 -1
- package/dist/components/animate-grow/index.d.ts +2 -2
- package/dist/components/animate-grow/index.js +1 -1
- package/dist/components/animate-headline/AnimateHeadline.d.ts +1 -1
- package/dist/components/animate-headline/AnimateHeadline.js +1 -1
- package/dist/components/animate-headline/index.d.ts +2 -2
- package/dist/components/animate-headline/index.js +1 -1
- package/dist/components/animate-lighting/AnimateLighting.d.ts +1 -1
- package/dist/components/animate-lighting/AnimateLighting.js +1 -1
- package/dist/components/animate-lighting/index.d.ts +2 -2
- package/dist/components/animate-lighting/index.js +1 -1
- package/dist/components/animate-marquee/AnimateMarquee.d.ts +1 -1
- package/dist/components/animate-marquee/AnimateMarquee.js +1 -1
- package/dist/components/animate-marquee/index.d.ts +2 -2
- package/dist/components/animate-marquee/index.js +1 -1
- package/dist/components/animate-rotate/AnimateRotate.d.ts +1 -1
- package/dist/components/animate-rotate/AnimateRotate.js +1 -1
- package/dist/components/animate-rotate/index.d.ts +2 -2
- package/dist/components/animate-rotate/index.js +1 -1
- package/dist/components/animate-slide/AnimateSlide.d.ts +1 -1
- package/dist/components/animate-slide/AnimateSlide.js +1 -1
- package/dist/components/animate-slide/index.d.ts +2 -2
- package/dist/components/animate-slide/index.js +1 -1
- package/dist/components/animate-typing/AnimateTyping.d.ts +1 -1
- package/dist/components/animate-typing/AnimateTyping.js +1 -1
- package/dist/components/animate-typing/index.d.ts +2 -2
- package/dist/components/animate-typing/index.js +1 -1
- package/dist/components/animate-zoom/AnimateZoom.d.ts +1 -1
- package/dist/components/animate-zoom/AnimateZoom.js +1 -1
- package/dist/components/animate-zoom/index.d.ts +2 -2
- package/dist/components/animate-zoom/index.js +1 -1
- package/dist/components/app-logo/AppLogo.d.ts +148 -0
- package/dist/components/app-logo/AppLogo.js +1 -0
- package/dist/components/app-logo/index.d.ts +2 -0
- package/dist/components/app-logo/index.js +1 -0
- package/dist/components/area-chart/AreaChart.d.ts +3 -3
- package/dist/components/area-chart/AreaChart.js +1 -1
- package/dist/components/area-chart/index.d.ts +2 -2
- package/dist/components/area-chart/index.js +1 -1
- package/dist/components/aspect-ratio/AspectRatio.d.ts +1 -1
- package/dist/components/aspect-ratio/AspectRatio.js +1 -1
- package/dist/components/aspect-ratio/index.d.ts +2 -2
- package/dist/components/aspect-ratio/index.js +1 -1
- package/dist/components/avatar/Avatar.d.ts +1 -1
- package/dist/components/avatar/Avatar.js +1 -1
- package/dist/components/avatar/index.d.ts +2 -2
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/badge/Badge.d.ts +1 -1
- package/dist/components/badge/Badge.js +1 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +1 -1
- package/dist/components/bar-chart/BarChart.d.ts +2 -2
- package/dist/components/bar-chart/BarChart.js +1 -1
- package/dist/components/bar-chart/index.d.ts +2 -2
- package/dist/components/bar-chart/index.js +1 -1
- package/dist/components/blockquote/Blockquote.d.ts +1 -1
- package/dist/components/blockquote/Blockquote.js +1 -1
- package/dist/components/blockquote/index.d.ts +2 -2
- package/dist/components/blockquote/index.js +1 -1
- package/dist/components/bottom-navigation/BottomNavigation.d.ts +3 -3
- package/dist/components/bottom-navigation/BottomNavigation.js +1 -1
- package/dist/components/bottom-navigation/index.d.ts +1 -1
- package/dist/components/bottom-navigation/index.js +1 -1
- package/dist/components/box/Box.d.ts +1 -1
- package/dist/components/box/Box.js +1 -1
- package/dist/components/box/index.d.ts +2 -2
- package/dist/components/box/index.js +1 -1
- package/dist/components/breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/components/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/breadcrumb/index.d.ts +2 -2
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.js +1 -1
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +1 -1
- package/dist/components/button-group/ButtonGroup.d.ts +1 -1
- package/dist/components/button-group/ButtonGroup.js +1 -1
- package/dist/components/button-group/index.d.ts +2 -2
- package/dist/components/button-group/index.js +1 -1
- package/dist/components/card/Card.d.ts +1 -1
- package/dist/components/card/Card.js +1 -1
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/card/index.js +1 -1
- package/dist/components/carousel/Carousel.d.ts +1 -1
- package/dist/components/carousel/Carousel.js +1 -1
- package/dist/components/carousel/index.d.ts +2 -2
- package/dist/components/carousel/index.js +1 -1
- package/dist/components/chat-bubble/ChatBubble.d.ts +1 -1
- package/dist/components/chat-bubble/ChatBubble.js +1 -1
- package/dist/components/chat-bubble/index.d.ts +2 -2
- package/dist/components/chat-bubble/index.js +1 -1
- package/dist/components/checkbox/Checkbox.d.ts +1 -1
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/Chip.d.ts +1 -1
- package/dist/components/chip/Chip.js +1 -1
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/index.js +1 -1
- package/dist/components/code-block/CodeBlock.d.ts +170 -0
- package/dist/components/code-block/CodeBlock.js +1 -0
- package/dist/components/code-block/index.d.ts +2 -0
- package/dist/components/code-block/index.js +1 -0
- package/dist/components/collapsible/Collapsible.d.ts +1 -1
- package/dist/components/collapsible/Collapsible.js +1 -1
- package/dist/components/collapsible/index.d.ts +1 -1
- package/dist/components/collapsible/index.js +1 -1
- package/dist/components/color-picker/ColorPicker.d.ts +3 -3
- package/dist/components/color-picker/ColorPicker.js +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/color-picker/index.js +1 -1
- package/dist/components/combobox/Combobox.d.ts +1 -1
- package/dist/components/combobox/Combobox.js +1 -1
- package/dist/components/combobox/index.d.ts +2 -2
- package/dist/components/combobox/index.js +1 -1
- package/dist/components/container/Container.d.ts +1 -1
- package/dist/components/container/Container.js +1 -1
- package/dist/components/container/index.d.ts +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/data-table/DataTable.d.ts +1 -1
- package/dist/components/data-table/DataTable.js +1 -1
- package/dist/components/data-table/index.d.ts +2 -2
- package/dist/components/data-table/index.js +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +3 -3
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.js +1 -1
- package/dist/components/date-range-picker/DateRangePicker.d.ts +3 -3
- package/dist/components/date-range-picker/DateRangePicker.js +1 -1
- package/dist/components/date-range-picker/index.d.ts +2 -2
- package/dist/components/date-range-picker/index.js +1 -1
- package/dist/components/date-time-picker/DateTimePicker.d.ts +4 -4
- package/dist/components/date-time-picker/DateTimePicker.js +1 -1
- package/dist/components/date-time-picker/index.d.ts +2 -2
- package/dist/components/date-time-picker/index.js +1 -1
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/divider/Divider.d.ts +1 -1
- package/dist/components/divider/Divider.js +1 -1
- package/dist/components/divider/index.d.ts +2 -2
- package/dist/components/divider/index.js +1 -1
- package/dist/components/drawer/Drawer.d.ts +1 -1
- package/dist/components/drawer/Drawer.js +1 -1
- package/dist/components/drawer/index.d.ts +2 -2
- package/dist/components/drawer/index.js +1 -1
- package/dist/components/empty/Empty.d.ts +1 -1
- package/dist/components/empty/Empty.js +1 -1
- package/dist/components/empty/index.d.ts +2 -2
- package/dist/components/empty/index.js +1 -1
- package/dist/components/file-picker/FilePicker.d.ts +1 -1
- package/dist/components/file-picker/FilePicker.js +1 -1
- package/dist/components/file-picker/index.d.ts +2 -2
- package/dist/components/file-picker/index.js +1 -1
- package/dist/components/floating-action-button/FloatingActionButton.d.ts +1 -1
- package/dist/components/floating-action-button/FloatingActionButton.js +1 -1
- package/dist/components/floating-action-button/index.d.ts +1 -1
- package/dist/components/floating-action-button/index.js +1 -1
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.d.ts +2 -2
- package/dist/components/floating-bottom-navigation/FloatingBottomNavigation.js +1 -1
- package/dist/components/floating-bottom-navigation/index.d.ts +2 -2
- package/dist/components/floating-bottom-navigation/index.js +1 -1
- package/dist/components/footer/Footer.d.ts +85 -0
- package/dist/components/footer/Footer.js +1 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/footer/index.js +1 -0
- package/dist/components/grid/Grid.d.ts +1 -1
- package/dist/components/grid/Grid.js +1 -1
- package/dist/components/grid/index.d.ts +2 -2
- package/dist/components/grid/index.js +1 -1
- package/dist/components/grid-container/GridContainer.d.ts +1 -1
- package/dist/components/grid-container/GridContainer.js +1 -1
- package/dist/components/grid-container/index.d.ts +2 -2
- package/dist/components/grid-container/index.js +1 -1
- package/dist/components/header/Header.d.ts +114 -0
- package/dist/components/header/Header.js +1 -0
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/heatmap-chart/HeatmapChart.d.ts +3 -3
- package/dist/components/heatmap-chart/HeatmapChart.js +1 -1
- package/dist/components/heatmap-chart/index.d.ts +2 -2
- package/dist/components/heatmap-chart/index.js +1 -1
- package/dist/components/highlight/Highlight.d.ts +2 -2
- package/dist/components/highlight/Highlight.js +1 -1
- package/dist/components/highlight/index.d.ts +2 -2
- package/dist/components/highlight/index.js +1 -1
- package/dist/components/how-to-steps/HowToSteps.d.ts +167 -0
- package/dist/components/how-to-steps/HowToSteps.js +1 -0
- package/dist/components/how-to-steps/index.d.ts +2 -0
- package/dist/components/how-to-steps/index.js +1 -0
- package/dist/components/icon/Icon.d.ts +1 -1
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/icon/index.d.ts +2 -2
- package/dist/components/icon/index.js +1 -1
- package/dist/components/icon-button/IconButton.d.ts +1 -1
- package/dist/components/icon-button/IconButton.js +1 -1
- package/dist/components/icon-button/index.d.ts +2 -2
- package/dist/components/icon-button/index.js +1 -1
- package/dist/components/line-chart/LineChart.d.ts +3 -3
- package/dist/components/line-chart/LineChart.js +1 -1
- package/dist/components/line-chart/index.d.ts +2 -2
- package/dist/components/line-chart/index.js +1 -1
- package/dist/components/list/List.d.ts +1 -1
- package/dist/components/list/List.js +1 -1
- package/dist/components/list/index.d.ts +2 -2
- package/dist/components/list/index.js +1 -1
- package/dist/components/menu/Menu.d.ts +1 -1
- package/dist/components/menu/Menu.js +1 -1
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/index.js +1 -1
- package/dist/components/mockup/Mockup.d.ts +3 -3
- package/dist/components/mockup/Mockup.js +1 -1
- package/dist/components/mockup/index.d.ts +2 -2
- package/dist/components/mockup/index.js +1 -1
- package/dist/components/number-field/NumberField.d.ts +1 -1
- package/dist/components/number-field/NumberField.js +1 -1
- package/dist/components/number-field/index.d.ts +2 -2
- package/dist/components/number-field/index.js +1 -1
- package/dist/components/otp-field/OtpField.d.ts +1 -1
- package/dist/components/otp-field/OtpField.js +1 -1
- package/dist/components/otp-field/index.d.ts +2 -2
- package/dist/components/otp-field/index.js +1 -1
- package/dist/components/overlay/Overlay.d.ts +1 -1
- package/dist/components/overlay/Overlay.js +1 -1
- package/dist/components/overlay/index.d.ts +2 -2
- package/dist/components/overlay/index.js +1 -1
- package/dist/components/page-layout/PageLayout.d.ts +144 -0
- package/dist/components/page-layout/PageLayout.js +1 -0
- package/dist/components/page-layout/index.d.ts +2 -0
- package/dist/components/page-layout/index.js +1 -0
- package/dist/components/pagination/Pagination.d.ts +1 -1
- package/dist/components/pagination/Pagination.js +1 -1
- package/dist/components/pagination/index.d.ts +2 -2
- package/dist/components/pagination/index.js +1 -1
- package/dist/components/panes/Panes.d.ts +1 -1
- package/dist/components/panes/Panes.js +1 -1
- package/dist/components/panes/index.d.ts +2 -2
- package/dist/components/panes/index.js +1 -1
- package/dist/components/pie-chart/PieChart.d.ts +2 -2
- package/dist/components/pie-chart/PieChart.js +1 -1
- package/dist/components/pie-chart/index.d.ts +2 -2
- package/dist/components/pie-chart/index.js +1 -1
- package/dist/components/pill/Pill.d.ts +1 -1
- package/dist/components/pill/Pill.js +1 -1
- package/dist/components/pill/index.d.ts +2 -2
- package/dist/components/pill/index.js +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/Popover.js +1 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +1 -1
- package/dist/components/progress-box/ProgressBox.d.ts +2 -2
- package/dist/components/progress-box/ProgressBox.js +1 -1
- package/dist/components/progress-box/index.d.ts +2 -2
- package/dist/components/progress-box/index.js +1 -1
- package/dist/components/progress-circular/ProgressCircular.d.ts +2 -2
- package/dist/components/progress-circular/ProgressCircular.js +1 -1
- package/dist/components/progress-circular/index.d.ts +2 -2
- package/dist/components/progress-circular/index.js +1 -1
- package/dist/components/progress-linear/ProgressLinear.d.ts +2 -2
- package/dist/components/progress-linear/ProgressLinear.js +1 -1
- package/dist/components/progress-linear/index.d.ts +2 -2
- package/dist/components/progress-linear/index.js +1 -1
- package/dist/components/radio-group/RadioGroup.d.ts +1 -1
- package/dist/components/radio-group/RadioGroup.js +1 -1
- package/dist/components/radio-group/index.d.ts +2 -2
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rating/Rating.d.ts +1 -1
- package/dist/components/rating/Rating.js +1 -1
- package/dist/components/rating/index.d.ts +1 -1
- package/dist/components/rating/index.js +1 -1
- package/dist/components/scatter-chart/ScatterChart.d.ts +2 -2
- package/dist/components/scatter-chart/ScatterChart.js +1 -1
- package/dist/components/scatter-chart/index.d.ts +2 -2
- package/dist/components/scatter-chart/index.js +1 -1
- package/dist/components/scroll-zone/ScrollZone.d.ts +1 -1
- package/dist/components/scroll-zone/ScrollZone.js +1 -1
- package/dist/components/scroll-zone/index.d.ts +2 -2
- package/dist/components/scroll-zone/index.js +1 -1
- package/dist/components/segmented-button/SegmentedButton.d.ts +1 -1
- package/dist/components/segmented-button/SegmentedButton.js +1 -1
- package/dist/components/segmented-button/index.d.ts +2 -2
- package/dist/components/segmented-button/index.js +1 -1
- package/dist/components/select/Select.d.ts +1 -1
- package/dist/components/select/Select.js +1 -1
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/index.js +1 -1
- package/dist/components/shortcut/Shortcut.d.ts +1 -1
- package/dist/components/shortcut/Shortcut.js +1 -1
- package/dist/components/shortcut/index.d.ts +2 -2
- package/dist/components/shortcut/index.js +1 -1
- package/dist/components/sidebar/Sidebar.d.ts +144 -0
- package/dist/components/sidebar/Sidebar.js +1 -0
- package/dist/components/sidebar/SidebarTrigger.d.ts +36 -0
- package/dist/components/sidebar/SidebarTrigger.js +1 -0
- package/dist/components/sidebar/index.d.ts +4 -0
- package/dist/components/sidebar/index.js +1 -0
- package/dist/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/components/skeleton/Skeleton.js +1 -1
- package/dist/components/skeleton/index.d.ts +2 -2
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/slider/Slider.d.ts +1 -1
- package/dist/components/slider/Slider.js +1 -1
- package/dist/components/slider/index.d.ts +2 -2
- package/dist/components/slider/index.js +1 -1
- package/dist/components/sparkline/Sparkline.d.ts +1 -1
- package/dist/components/sparkline/Sparkline.js +1 -1
- package/dist/components/sparkline/index.d.ts +2 -2
- package/dist/components/sparkline/index.js +1 -1
- package/dist/components/spoiler/Spoiler.d.ts +1 -1
- package/dist/components/spoiler/Spoiler.js +1 -1
- package/dist/components/spoiler/index.d.ts +2 -2
- package/dist/components/spoiler/index.js +1 -1
- package/dist/components/statistic/Statistic.d.ts +2 -2
- package/dist/components/statistic/Statistic.js +1 -1
- package/dist/components/statistic/index.d.ts +2 -2
- package/dist/components/statistic/index.js +1 -1
- package/dist/components/switch/Switch.d.ts +1 -1
- package/dist/components/switch/Switch.js +1 -1
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/table/Table.d.ts +2 -2
- package/dist/components/table/Table.js +1 -1
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +1 -1
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/Tabs.js +1 -1
- package/dist/components/tabs/index.d.ts +2 -2
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/text-field/TextField.d.ts +1 -1
- package/dist/components/text-field/TextField.js +1 -1
- package/dist/components/text-field/index.d.ts +2 -2
- package/dist/components/text-field/index.js +1 -1
- package/dist/components/text-link/TextLink.d.ts +1 -1
- package/dist/components/text-link/TextLink.js +1 -1
- package/dist/components/text-link/index.d.ts +2 -2
- package/dist/components/text-link/index.js +1 -1
- package/dist/components/time-picker/TimePicker.d.ts +2 -2
- package/dist/components/time-picker/TimePicker.js +1 -1
- package/dist/components/time-picker/index.d.ts +2 -2
- package/dist/components/time-picker/index.js +1 -1
- package/dist/components/timeline/Timeline.d.ts +1 -1
- package/dist/components/timeline/Timeline.js +1 -1
- package/dist/components/timeline/index.d.ts +2 -2
- package/dist/components/timeline/index.js +1 -1
- package/dist/components/timeline-chart/TimelineChart.d.ts +2 -2
- package/dist/components/timeline-chart/TimelineChart.js +1 -1
- package/dist/components/timeline-chart/index.d.ts +2 -2
- package/dist/components/timeline-chart/index.js +1 -1
- package/dist/components/toast/Toast.d.ts +1 -1
- package/dist/components/toast/Toast.js +1 -1
- package/dist/components/toast/index.d.ts +2 -2
- package/dist/components/toast/index.js +1 -1
- package/dist/components/toolbar/Toolbar.d.ts +1 -1
- package/dist/components/toolbar/Toolbar.js +1 -1
- package/dist/components/toolbar/index.d.ts +2 -2
- package/dist/components/toolbar/index.js +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +1 -1
- package/dist/components/tooltip/Tooltip.js +1 -1
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tree-view/TreeView.d.ts +1 -1
- package/dist/components/tree-view/TreeView.js +1 -1
- package/dist/components/tree-view/index.d.ts +2 -2
- package/dist/components/tree-view/index.js +1 -1
- package/dist/components/typography/Typography.d.ts +1 -1
- package/dist/components/typography/Typography.js +1 -1
- package/dist/components/typography/index.d.ts +2 -2
- package/dist/components/typography/index.js +1 -1
- package/dist/components/window-pane/WindowPane.d.ts +3 -3
- package/dist/components/window-pane/WindowPane.js +1 -1
- package/dist/components/window-pane/index.d.ts +2 -2
- package/dist/components/window-pane/index.js +1 -1
- package/dist/index.d.ts +99 -92
- package/dist/index.js +1 -1
- package/dist/internal/animate.d.ts +1 -1
- package/dist/internal/bottom-navigation.d.ts +5 -4
- package/dist/internal/bottom-navigation.js +1 -1
- package/dist/internal/button-group.d.ts +1 -1
- package/dist/internal/button-group.js +1 -1
- package/dist/internal/calendar.d.ts +2 -2
- package/dist/internal/calendar.js +1 -1
- package/dist/internal/chart-frame.d.ts +3 -3
- package/dist/internal/chart-frame.js +1 -1
- package/dist/internal/chart-line.d.ts +2 -2
- package/dist/internal/chart-line.js +1 -1
- package/dist/internal/chart.d.ts +4 -3
- package/dist/internal/chart.js +1 -1
- package/dist/internal/color.d.ts +2 -2
- package/dist/internal/data-table.d.ts +1 -1
- package/dist/internal/date.d.ts +4 -5
- package/dist/internal/date.js +1 -1
- package/dist/internal/grid.d.ts +1 -1
- package/dist/internal/highlight.d.ts +97 -0
- package/dist/internal/highlight.js +1 -0
- package/dist/internal/i18n.d.ts +427 -229
- package/dist/internal/i18n.js +1 -1
- package/dist/internal/icons.d.ts +38 -2
- package/dist/internal/icons.js +1 -1
- package/dist/internal/initials.d.ts +24 -0
- package/dist/internal/initials.js +1 -0
- package/dist/internal/menu.d.ts +1 -1
- package/dist/internal/menu.js +1 -1
- package/dist/internal/mockup.d.ts +1 -1
- package/dist/internal/page-layout.d.ts +143 -0
- package/dist/internal/page-layout.js +1 -0
- package/dist/internal/picker.d.ts +2 -2
- package/dist/internal/picker.js +1 -1
- package/dist/internal/progress.d.ts +1 -1
- package/dist/internal/styles.d.ts +12 -1
- package/dist/internal/styles.js +1 -1
- package/dist/internal/window.d.ts +1 -1
- package/dist/internal/window.js +1 -1
- package/dist/locales/ar.d.ts +14 -0
- package/dist/locales/ar.js +1 -0
- package/dist/locales/de.d.ts +14 -0
- package/dist/locales/de.js +1 -0
- package/dist/locales/es.d.ts +14 -0
- package/dist/locales/es.js +1 -0
- package/dist/locales/fr.d.ts +14 -0
- package/dist/locales/fr.js +1 -0
- package/dist/locales/hi.d.ts +14 -0
- package/dist/locales/hi.js +1 -0
- package/dist/locales/id.d.ts +14 -0
- package/dist/locales/id.js +1 -0
- package/dist/locales/index.d.ts +45 -0
- package/dist/locales/index.js +1 -0
- package/dist/locales/it.d.ts +14 -0
- package/dist/locales/it.js +1 -0
- package/dist/locales/ja.d.ts +14 -0
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ko.d.ts +14 -0
- package/dist/locales/ko.js +1 -0
- package/dist/locales/nl.d.ts +14 -0
- package/dist/locales/nl.js +1 -0
- package/dist/locales/pl.d.ts +14 -0
- package/dist/locales/pl.js +1 -0
- package/dist/locales/pt.d.ts +14 -0
- package/dist/locales/pt.js +1 -0
- package/dist/locales/ru.d.ts +14 -0
- package/dist/locales/ru.js +1 -0
- package/dist/locales/th.d.ts +14 -0
- package/dist/locales/th.js +1 -0
- package/dist/locales/tr.d.ts +14 -0
- package/dist/locales/tr.js +1 -0
- package/dist/locales/vi.d.ts +14 -0
- package/dist/locales/vi.js +1 -0
- package/dist/locales/zh-hans.d.ts +17 -0
- package/dist/locales/zh-hans.js +1 -0
- package/dist/locales/zh-hant.d.ts +17 -0
- package/dist/locales/zh-hant.js +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +473 -0
- package/package.json +40 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Typography } from './Typography';
|
|
2
|
-
export type { TypographyAlign, TypographyLevel, TypographyProps, TypographyWeight } from './Typography';
|
|
1
|
+
export { Typography } from './Typography.js';
|
|
2
|
+
export type { TypographyAlign, TypographyLevel, TypographyProps, TypographyWeight } from './Typography.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{Typography}from"./Typography";
|
|
1
|
+
export{Typography}from"./Typography.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
|
-
import type { NebaWindowControl, NebaWindowOffset, NebaWindowOs } from '../../internal/window';
|
|
4
|
-
import type { NebaColor, NebaElevation, NebaSize } from '../../types';
|
|
5
|
-
export type { NebaWindowControl, NebaWindowOffset, NebaWindowOs } from '../../internal/window';
|
|
3
|
+
import type { NebaWindowControl, NebaWindowOffset, NebaWindowOs } from '../../internal/window.js';
|
|
4
|
+
import type { NebaColor, NebaElevation, NebaSize } from '../../types.js';
|
|
5
|
+
export type { NebaWindowControl, NebaWindowOffset, NebaWindowOs } from '../../internal/window.js';
|
|
6
6
|
/** The three CSS positions a window can be laid out with. */
|
|
7
7
|
export type WindowPanePosition = 'static' | 'absolute' | 'fixed';
|
|
8
8
|
/** What a resize reports: the window's size in pixels. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as i from"react";import{useRender as r}from"@base-ui/react/use-render";import{actionMessages as o,useMessages as s,windowMessages as a}from"../../internal/i18n.js";import{cx as l,hasContent as d,iconClasses as c,surfaceClasses as u}from"../../internal/styles.js";import{WindowControls as m,orderControls as h,windowChrome as g,windowMetrics as w,windowSlots as f}from"../../internal/window.js";function p(e,t,n){const[r,o]=i.useState(t),s=void 0!==e;return[s?e:r,i.useCallback(e=>{s||o(e),n?.(e)},[s,n])]}const b=[{edge:"n",className:"inset-x-3 top-0 h-1.5 cursor-ns-resize"},{edge:"s",className:"inset-x-3 bottom-0 h-1.5 cursor-ns-resize"},{edge:"w",className:"inset-y-3 left-0 w-1.5 cursor-ew-resize"},{edge:"e",className:"inset-y-3 right-0 w-1.5 cursor-ew-resize"},{edge:"nw",className:"top-0 left-0 size-3 cursor-nwse-resize"},{edge:"ne",className:"top-0 right-0 size-3 cursor-nesw-resize"},{edge:"sw",className:"bottom-0 left-0 size-3 cursor-nesw-resize"},{edge:"se",className:"right-0 bottom-0 size-3 cursor-nwse-resize"}];export const WindowPane=/*@__PURE__*/i.forwardRef(function({os:v="macos",title:x,icon:y,actions:z,controls:E=!0,size:N="md",color:k="primary",accent:C=!1,transparency:L=0,active:M,elevation:S=2,position:P="static",draggable:R=!1,resizable:I=!1,width:j,height:B,minWidth:D=180,minHeight:A,offset:T,defaultOffset:H,onOffsetChange:W,onResize:O,open:X,defaultOpen:$=!0,onOpenChange:F,minimized:Y,defaultMinimized:_=!1,onMinimizedChange:q,maximized:K,defaultMaximized:U=!1,onMaximizedChange:V,scroll:G=!0,locale:J,minimizeLabel:Q,maximizeLabel:Z,restoreLabel:ee,closeLabel:te,resizeLabel:ne,render:ie,className:re,style:oe,children:se,...ae},le){const de=s(a,J),ce=s(o,J),ue=g(v),me=w(v,N),he=i.useId(),[ge,we]=p(X,$,F),[fe,pe]=p(Y,_,q),[be,ve]=p(K,U,V),[xe,ye]=p(T,H??{x:0,y:0},W),[ze,Ee]=i.useState(null),[Ne,ke]=i.useState(!0),Ce=M??Ne,[Le,Me]=i.useState(null),[Se,Pe]=i.useState(null),[Re,Ie]=i.useState(!1),[je,Be]=i.useState(!1),[De,Ae]=i.useState(ge);De!==ge&&(Ae(ge),Be(!ge)),i.useEffect(()=>{if(!je)return;const e=window.setTimeout(()=>Be(!1),260);return()=>window.clearTimeout(e)},[je]);const Te=i.useRef(null),He=i.useCallback(e=>{Te.current=e,"function"==typeof le?le(e):le&&(le.current=e)},[le]);i.useEffect(()=>{if(void 0!==M)return;const e=Te.current;if(!e)return;const t=t=>{const n=t.target;if(!(n instanceof Node))return;if(e.contains(n))return void ke(!0);const i=n instanceof Element?n:n.parentElement;i?.closest(".neba-window")&&ke(!1)};return document.addEventListener("pointerdown",t,!0),document.addEventListener("focusin",t,!0),()=>{document.removeEventListener("pointerdown",t,!0),document.removeEventListener("focusin",t,!0)}},[M]);const We=i.useRef(null);function Oe(e,t){if(0!==e.button)return;We.current?.();const n=e.currentTarget;n.setPointerCapture(e.pointerId),n.dataset.dragging="true",Ie(!0);const i=e.clientX,r=e.clientY,o=document.body.style.getPropertyValue("-webkit-user-select");document.body.style.setProperty("-webkit-user-select","none");const s=e=>{t(e.clientX-i,e.clientY-r)},a=()=>{We.current=null,Ie(!1),n.removeEventListener("pointermove",s),n.removeEventListener("pointerup",a),n.removeEventListener("pointercancel",a),delete n.dataset.dragging,o?document.body.style.setProperty("-webkit-user-select",o):document.body.style.removeProperty("-webkit-user-select")};We.current=a,n.addEventListener("pointermove",s),n.addEventListener("pointerup",a),n.addEventListener("pointercancel",a)}i.useEffect(()=>()=>We.current?.(),[]);const Xe={width:Math.max(0,D),height:Math.max(me.bar,A??me.bar)};function $e(e){Ee(e),O?.(e)}const Fe=h(v,!0===E?["minimize","maximize","close"]:!1===E?[]:E),Ye=Fe.includes("maximize");i.useEffect(()=>{if(fe||null===Se)return;const e=window.setTimeout(()=>Pe(null),400);return()=>window.clearTimeout(e)},[fe,Se]);const _e={minimize:Q??de.minimize,maximize:Z??de.maximize,restore:ee??de.restore,close:te??ce.close},qe=e(m,{os:v,metrics:me,controls:Fe,maximized:be,active:Ce,labels:_e,onCommand:function(e){"close"===e?we(!1):"minimize"===e?function(e){const t=Te.current,n=t?.firstElementChild;if(t&&n instanceof HTMLElement&&Me(n.offsetHeight+(t.offsetHeight-t.clientHeight)),e&&void 0===(ze?.height??B)&&t)return Pe(t.getBoundingClientRect().height),void requestAnimationFrame(()=>pe(!0));pe(e)}(!fe):ve(!be)}}),Ke=d(x)?e("span",{id:he,className:"min-w-0 truncate",children:x}):null,Ue=d(y)?e("span",{className:"flex shrink-0 items-center",children:y}):null,Ve=t("div",{className:l("relative flex shrink-0 items-center select-none",c,R&&!be?"cursor-grab active:cursor-grabbing":""),style:{height:me.bar,textShadow:"var(--n-window-bar-shadow)",fontWeight:me.weight,paddingInlineStart:me.padX,paddingInlineEnd:me.padEnd,gap:Math.round(.7*me.title),fontSize:me.title,backgroundColor:"var(--n-window-bar)",backgroundImage:"var(--n-window-bar-image)",color:"var(--n-window-bar-fg)",borderBlockEnd:ue.rule?"1px solid var(--n-window-line)":void 0},onPointerDown:function(e){if(!R||be)return;const t={...xe};Oe(e,(e,n)=>ye({x:t.x+e,y:t.y+n}))},onDoubleClick:Ye?()=>ve(!be):void 0,children:["start"===ue.controlsSide?qe:null,"center"===ue.titleAlign?e("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 flex items-center justify-center",style:{paddingInline:me.controlsWidth(Fe.length)+2*me.padX},children:t("span",{className:"flex min-w-0 items-center",style:{gap:Math.round(.5*me.title)},children:[Ue,Ke]})}):t(n,{children:[Ue,Ke]}),e("span",{className:"flex-1"}),d(z)?e("span",{className:"flex shrink-0 items-center",style:{gap:Math.round(.5*me.title)},onPointerDown:e=>e.stopPropagation(),children:z}):null,"end"===ue.controlsSide?qe:null]}),Ge=be?{left:0,top:0,width:"100%",height:"100%"}:{left:xe.x,top:xe.y,width:ze?.width??j,height:fe?Le??me.bar:ze?.height??B??Se??void 0},Je=r({render:ie,ref:He,props:{role:"group","aria-labelledby":Ke?he:void 0,className:l("neba-window relative flex min-w-0 flex-col overflow-hidden",L>0?u:"",ue.glass&&0===L?"[backdrop-filter:var(--neba-blur)]":"","[transition-property:left,top,width,height,opacity,box-shadow,background-color,border-color,border-radius]","[transition-duration:var(--neba-duration-window)]","[transition-timing-function:var(--neba-ease)]","motion-reduce:[transition-duration:0ms]","data-[gesture]:[transition-property:none]",re),"data-gesture":Re?"":void 0,inert:!ge||void 0,style:{opacity:ge?void 0:0,...f({os:v,color:k,accent:C,transparency:L,active:Ce,elevation:S}),position:"static"===P?"relative":P,...Ge,borderRadius:be?0:`${me.radius}px ${me.radius}px ${me.radiusBottom}px ${me.radiusBottom}px`,borderStyle:"solid",borderWidth:me.frame,borderColor:"var(--n-window-line)",backgroundColor:"var(--n-window-band)",boxShadow:"var(--n-window-shadow), var(--neba-plate-glass)",...oe},children:t(n,{children:[Ve,e("div",{className:l("min-h-0 flex-1",G?"overflow-auto":"overflow-hidden"),style:{backgroundColor:"var(--n-window-body)",marginInline:me.band.side,marginBottom:me.band.bottom,boxShadow:me.band.side>0?"inset 0 0 0 1px rgb(0 0 0 / 0.12)":void 0},inert:fe,children:se}),!I||be||fe?null:b.map(t=>{const n="se"===t.edge;return e("div",{role:n?"button":void 0,tabIndex:n?0:void 0,"aria-label":n?ne??de.resize:void 0,"aria-hidden":n?void 0:"true",className:l("absolute z-10 touch-none",t.className,n?"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]":""),onPointerDown:e=>function(e,t){const n=Te.current;if(!n||be)return;const i=n.getBoundingClientRect(),r={width:i.width,height:i.height,x:xe.x,y:xe.y},o=e.includes("e"),s=e.includes("w"),a=e.includes("n"),l=e.includes("s");Oe(t,(e,t)=>{let{width:n,height:i}=r,{x:d,y:c}=r;o&&(n=Math.max(Xe.width,r.width+e)),l&&(i=Math.max(Xe.height,r.height+t)),s&&(n=Math.max(Xe.width,r.width-e),d=r.x+(r.width-n)),a&&(i=Math.max(Xe.height,r.height-t),c=r.y+(r.height-i)),$e({width:n,height:i}),(s||a)&&ye({x:d,y:c})})}(t.edge,e),onKeyDown:n?e=>{const t={ArrowRight:[16,0],ArrowLeft:[-16,0],ArrowDown:[0,16],ArrowUp:[0,-16]}[e.key];t&&(e.preventDefault(),function(e,t){const n=Te.current;if(!n)return;const i=n.getBoundingClientRect();$e({width:Math.max(Xe.width,i.width+e),height:Math.max(Xe.height,i.height+t)})}(t[0],t[1]))}:void 0},t.edge)})]}),...ae}});return ge||je?Je:null});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { WindowPane } from './WindowPane';
|
|
2
|
-
export type { NebaWindowControl, NebaWindowOffset, NebaWindowOs, WindowPanePosition, WindowPaneProps, WindowPaneSize } from './WindowPane';
|
|
1
|
+
export { WindowPane } from './WindowPane.js';
|
|
2
|
+
export type { NebaWindowControl, NebaWindowOffset, NebaWindowOs, WindowPanePosition, WindowPaneProps, WindowPaneSize } from './WindowPane.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{WindowPane}from"./WindowPane";
|
|
1
|
+
export{WindowPane}from"./WindowPane.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,92 +1,99 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './components/accordion';
|
|
3
|
-
export * from './components/alert';
|
|
4
|
-
export * from './components/animate-appear';
|
|
5
|
-
export * from './components/
|
|
6
|
-
export * from './components/animate-
|
|
7
|
-
export * from './components/animate-
|
|
8
|
-
export * from './components/animate-
|
|
9
|
-
export * from './components/animate-
|
|
10
|
-
export * from './components/animate-
|
|
11
|
-
export * from './components/animate-
|
|
12
|
-
export * from './components/animate-
|
|
13
|
-
export * from './components/animate-
|
|
14
|
-
export * from './components/animate-
|
|
15
|
-
export * from './components/
|
|
16
|
-
export * from './components/
|
|
17
|
-
export * from './components/
|
|
18
|
-
export * from './components/
|
|
19
|
-
export * from './components/
|
|
20
|
-
export * from './components/
|
|
21
|
-
export * from './components/
|
|
22
|
-
export * from './components/
|
|
23
|
-
export * from './components/
|
|
24
|
-
export * from './components/
|
|
25
|
-
export * from './components/button
|
|
26
|
-
export * from './components/
|
|
27
|
-
export * from './components/
|
|
28
|
-
export * from './components/
|
|
29
|
-
export * from './components/
|
|
30
|
-
export * from './components/
|
|
31
|
-
export * from './components/
|
|
32
|
-
export * from './components/
|
|
33
|
-
export * from './components/
|
|
34
|
-
export * from './components/
|
|
35
|
-
export * from './components/
|
|
36
|
-
export * from './components/
|
|
37
|
-
export * from './components/
|
|
38
|
-
export * from './components/date-
|
|
39
|
-
export * from './components/
|
|
40
|
-
export * from './components/
|
|
41
|
-
export * from './components/
|
|
42
|
-
export * from './components/
|
|
43
|
-
export * from './components/
|
|
44
|
-
export * from './components/
|
|
45
|
-
export * from './components/
|
|
46
|
-
export * from './components/
|
|
47
|
-
export * from './components/
|
|
48
|
-
export * from './components/
|
|
49
|
-
export * from './components/
|
|
50
|
-
export * from './components/
|
|
51
|
-
export * from './components/
|
|
52
|
-
export * from './components/
|
|
53
|
-
export * from './components/
|
|
54
|
-
export * from './components/
|
|
55
|
-
export * from './components/
|
|
56
|
-
export * from './components/
|
|
57
|
-
export * from './components/
|
|
58
|
-
export * from './components/
|
|
59
|
-
export * from './components/
|
|
60
|
-
export * from './components/
|
|
61
|
-
export * from './components/
|
|
62
|
-
export * from './components/
|
|
63
|
-
export * from './components/
|
|
64
|
-
export * from './components/
|
|
65
|
-
export * from './components/
|
|
66
|
-
export * from './components/
|
|
67
|
-
export * from './components/
|
|
68
|
-
export * from './components/
|
|
69
|
-
export * from './components/
|
|
70
|
-
export * from './components/
|
|
71
|
-
export * from './components/
|
|
72
|
-
export * from './components/
|
|
73
|
-
export * from './components/
|
|
74
|
-
export * from './components/
|
|
75
|
-
export * from './components/
|
|
76
|
-
export * from './components/
|
|
77
|
-
export * from './components/
|
|
78
|
-
export * from './components/
|
|
79
|
-
export * from './components/
|
|
80
|
-
export * from './components/
|
|
81
|
-
export * from './components/
|
|
82
|
-
export * from './components/
|
|
83
|
-
export * from './components/
|
|
84
|
-
export * from './components/
|
|
85
|
-
export * from './components/
|
|
86
|
-
export * from './components/
|
|
87
|
-
export * from './components/
|
|
88
|
-
export * from './components/
|
|
89
|
-
export * from './components/
|
|
90
|
-
export * from './components/
|
|
91
|
-
export * from './components/
|
|
92
|
-
export * from './components/
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './components/accordion/index.js';
|
|
3
|
+
export * from './components/alert/index.js';
|
|
4
|
+
export * from './components/animate-appear/index.js';
|
|
5
|
+
export * from './components/app-logo/index.js';
|
|
6
|
+
export * from './components/animate-blink/index.js';
|
|
7
|
+
export * from './components/animate-fade/index.js';
|
|
8
|
+
export * from './components/animate-grow/index.js';
|
|
9
|
+
export * from './components/animate-headline/index.js';
|
|
10
|
+
export * from './components/animate-lighting/index.js';
|
|
11
|
+
export * from './components/animate-marquee/index.js';
|
|
12
|
+
export * from './components/animate-rotate/index.js';
|
|
13
|
+
export * from './components/animate-slide/index.js';
|
|
14
|
+
export * from './components/animate-typing/index.js';
|
|
15
|
+
export * from './components/animate-zoom/index.js';
|
|
16
|
+
export * from './components/area-chart/index.js';
|
|
17
|
+
export * from './components/aspect-ratio/index.js';
|
|
18
|
+
export * from './components/avatar/index.js';
|
|
19
|
+
export * from './components/badge/index.js';
|
|
20
|
+
export * from './components/bar-chart/index.js';
|
|
21
|
+
export * from './components/blockquote/index.js';
|
|
22
|
+
export * from './components/bottom-navigation/index.js';
|
|
23
|
+
export * from './components/box/index.js';
|
|
24
|
+
export * from './components/breadcrumb/index.js';
|
|
25
|
+
export * from './components/button/index.js';
|
|
26
|
+
export * from './components/button-group/index.js';
|
|
27
|
+
export * from './components/card/index.js';
|
|
28
|
+
export * from './components/carousel/index.js';
|
|
29
|
+
export * from './components/chat-bubble/index.js';
|
|
30
|
+
export * from './components/checkbox/index.js';
|
|
31
|
+
export * from './components/chip/index.js';
|
|
32
|
+
export * from './components/code-block/index.js';
|
|
33
|
+
export * from './components/collapsible/index.js';
|
|
34
|
+
export * from './components/color-picker/index.js';
|
|
35
|
+
export * from './components/combobox/index.js';
|
|
36
|
+
export * from './components/container/index.js';
|
|
37
|
+
export * from './components/data-table/index.js';
|
|
38
|
+
export * from './components/date-picker/index.js';
|
|
39
|
+
export * from './components/date-range-picker/index.js';
|
|
40
|
+
export * from './components/date-time-picker/index.js';
|
|
41
|
+
export * from './components/dialog/index.js';
|
|
42
|
+
export * from './components/divider/index.js';
|
|
43
|
+
export * from './components/drawer/index.js';
|
|
44
|
+
export * from './components/empty/index.js';
|
|
45
|
+
export * from './components/file-picker/index.js';
|
|
46
|
+
export * from './components/grid/index.js';
|
|
47
|
+
export * from './components/floating-action-button/index.js';
|
|
48
|
+
export * from './components/floating-bottom-navigation/index.js';
|
|
49
|
+
export * from './components/footer/index.js';
|
|
50
|
+
export * from './components/grid-container/index.js';
|
|
51
|
+
export * from './components/header/index.js';
|
|
52
|
+
export * from './components/heatmap-chart/index.js';
|
|
53
|
+
export * from './components/highlight/index.js';
|
|
54
|
+
export * from './components/how-to-steps/index.js';
|
|
55
|
+
export * from './components/icon/index.js';
|
|
56
|
+
export * from './components/icon-button/index.js';
|
|
57
|
+
export * from './components/line-chart/index.js';
|
|
58
|
+
export * from './components/list/index.js';
|
|
59
|
+
export * from './components/menu/index.js';
|
|
60
|
+
export * from './components/mockup/index.js';
|
|
61
|
+
export * from './components/number-field/index.js';
|
|
62
|
+
export * from './components/otp-field/index.js';
|
|
63
|
+
export * from './components/overlay/index.js';
|
|
64
|
+
export * from './components/page-layout/index.js';
|
|
65
|
+
export * from './components/pagination/index.js';
|
|
66
|
+
export * from './components/panes/index.js';
|
|
67
|
+
export * from './components/pie-chart/index.js';
|
|
68
|
+
export * from './components/pill/index.js';
|
|
69
|
+
export * from './components/popover/index.js';
|
|
70
|
+
export * from './components/progress-box/index.js';
|
|
71
|
+
export * from './components/progress-circular/index.js';
|
|
72
|
+
export * from './components/progress-linear/index.js';
|
|
73
|
+
export * from './components/radio-group/index.js';
|
|
74
|
+
export * from './components/rating/index.js';
|
|
75
|
+
export * from './components/scatter-chart/index.js';
|
|
76
|
+
export * from './components/scroll-zone/index.js';
|
|
77
|
+
export * from './components/segmented-button/index.js';
|
|
78
|
+
export * from './components/select/index.js';
|
|
79
|
+
export * from './components/shortcut/index.js';
|
|
80
|
+
export * from './components/sidebar/index.js';
|
|
81
|
+
export * from './components/skeleton/index.js';
|
|
82
|
+
export * from './components/slider/index.js';
|
|
83
|
+
export * from './components/sparkline/index.js';
|
|
84
|
+
export * from './components/spoiler/index.js';
|
|
85
|
+
export * from './components/statistic/index.js';
|
|
86
|
+
export * from './components/switch/index.js';
|
|
87
|
+
export * from './components/table/index.js';
|
|
88
|
+
export * from './components/tabs/index.js';
|
|
89
|
+
export * from './components/text-field/index.js';
|
|
90
|
+
export * from './components/text-link/index.js';
|
|
91
|
+
export * from './components/time-picker/index.js';
|
|
92
|
+
export * from './components/timeline/index.js';
|
|
93
|
+
export * from './components/timeline-chart/index.js';
|
|
94
|
+
export * from './components/toast/index.js';
|
|
95
|
+
export * from './components/toolbar/index.js';
|
|
96
|
+
export * from './components/tooltip/index.js';
|
|
97
|
+
export * from './components/tree-view/index.js';
|
|
98
|
+
export * from './components/typography/index.js';
|
|
99
|
+
export * from './components/window-pane/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./types";export*from"./components/accordion";export*from"./components/alert";export*from"./components/animate-appear";export*from"./components/animate-blink";export*from"./components/animate-fade";export*from"./components/animate-grow";export*from"./components/animate-headline";export*from"./components/animate-lighting";export*from"./components/animate-marquee";export*from"./components/animate-rotate";export*from"./components/animate-slide";export*from"./components/animate-typing";export*from"./components/animate-zoom";export*from"./components/area-chart";export*from"./components/aspect-ratio";export*from"./components/avatar";export*from"./components/badge";export*from"./components/bar-chart";export*from"./components/blockquote";export*from"./components/bottom-navigation";export*from"./components/box";export*from"./components/breadcrumb";export*from"./components/button";export*from"./components/button-group";export*from"./components/card";export*from"./components/carousel";export*from"./components/chat-bubble";export*from"./components/checkbox";export*from"./components/chip";export*from"./components/collapsible";export*from"./components/color-picker";export*from"./components/combobox";export*from"./components/container";export*from"./components/data-table";export*from"./components/date-picker";export*from"./components/date-range-picker";export*from"./components/date-time-picker";export*from"./components/dialog";export*from"./components/divider";export*from"./components/drawer";export*from"./components/empty";export*from"./components/file-picker";export*from"./components/grid";export*from"./components/floating-action-button";export*from"./components/floating-bottom-navigation";export*from"./components/grid-container";export*from"./components/heatmap-chart";export*from"./components/highlight";export*from"./components/icon";export*from"./components/icon-button";export*from"./components/line-chart";export*from"./components/list";export*from"./components/menu";export*from"./components/mockup";export*from"./components/number-field";export*from"./components/otp-field";export*from"./components/overlay";export*from"./components/pagination";export*from"./components/panes";export*from"./components/pie-chart";export*from"./components/pill";export*from"./components/popover";export*from"./components/progress-box";export*from"./components/progress-circular";export*from"./components/progress-linear";export*from"./components/radio-group";export*from"./components/rating";export*from"./components/scatter-chart";export*from"./components/scroll-zone";export*from"./components/segmented-button";export*from"./components/select";export*from"./components/shortcut";export*from"./components/skeleton";export*from"./components/slider";export*from"./components/sparkline";export*from"./components/spoiler";export*from"./components/statistic";export*from"./components/switch";export*from"./components/table";export*from"./components/tabs";export*from"./components/text-field";export*from"./components/text-link";export*from"./components/time-picker";export*from"./components/timeline";export*from"./components/timeline-chart";export*from"./components/toast";export*from"./components/toolbar";export*from"./components/tooltip";export*from"./components/tree-view";export*from"./components/typography";export*from"./components/window-pane";
|
|
1
|
+
export*from"./types.js";export*from"./components/accordion/index.js";export*from"./components/alert/index.js";export*from"./components/animate-appear/index.js";export*from"./components/app-logo/index.js";export*from"./components/animate-blink/index.js";export*from"./components/animate-fade/index.js";export*from"./components/animate-grow/index.js";export*from"./components/animate-headline/index.js";export*from"./components/animate-lighting/index.js";export*from"./components/animate-marquee/index.js";export*from"./components/animate-rotate/index.js";export*from"./components/animate-slide/index.js";export*from"./components/animate-typing/index.js";export*from"./components/animate-zoom/index.js";export*from"./components/area-chart/index.js";export*from"./components/aspect-ratio/index.js";export*from"./components/avatar/index.js";export*from"./components/badge/index.js";export*from"./components/bar-chart/index.js";export*from"./components/blockquote/index.js";export*from"./components/bottom-navigation/index.js";export*from"./components/box/index.js";export*from"./components/breadcrumb/index.js";export*from"./components/button/index.js";export*from"./components/button-group/index.js";export*from"./components/card/index.js";export*from"./components/carousel/index.js";export*from"./components/chat-bubble/index.js";export*from"./components/checkbox/index.js";export*from"./components/chip/index.js";export*from"./components/code-block/index.js";export*from"./components/collapsible/index.js";export*from"./components/color-picker/index.js";export*from"./components/combobox/index.js";export*from"./components/container/index.js";export*from"./components/data-table/index.js";export*from"./components/date-picker/index.js";export*from"./components/date-range-picker/index.js";export*from"./components/date-time-picker/index.js";export*from"./components/dialog/index.js";export*from"./components/divider/index.js";export*from"./components/drawer/index.js";export*from"./components/empty/index.js";export*from"./components/file-picker/index.js";export*from"./components/grid/index.js";export*from"./components/floating-action-button/index.js";export*from"./components/floating-bottom-navigation/index.js";export*from"./components/footer/index.js";export*from"./components/grid-container/index.js";export*from"./components/header/index.js";export*from"./components/heatmap-chart/index.js";export*from"./components/highlight/index.js";export*from"./components/how-to-steps/index.js";export*from"./components/icon/index.js";export*from"./components/icon-button/index.js";export*from"./components/line-chart/index.js";export*from"./components/list/index.js";export*from"./components/menu/index.js";export*from"./components/mockup/index.js";export*from"./components/number-field/index.js";export*from"./components/otp-field/index.js";export*from"./components/overlay/index.js";export*from"./components/page-layout/index.js";export*from"./components/pagination/index.js";export*from"./components/panes/index.js";export*from"./components/pie-chart/index.js";export*from"./components/pill/index.js";export*from"./components/popover/index.js";export*from"./components/progress-box/index.js";export*from"./components/progress-circular/index.js";export*from"./components/progress-linear/index.js";export*from"./components/radio-group/index.js";export*from"./components/rating/index.js";export*from"./components/scatter-chart/index.js";export*from"./components/scroll-zone/index.js";export*from"./components/segmented-button/index.js";export*from"./components/select/index.js";export*from"./components/shortcut/index.js";export*from"./components/sidebar/index.js";export*from"./components/skeleton/index.js";export*from"./components/slider/index.js";export*from"./components/sparkline/index.js";export*from"./components/spoiler/index.js";export*from"./components/statistic/index.js";export*from"./components/switch/index.js";export*from"./components/table/index.js";export*from"./components/tabs/index.js";export*from"./components/text-field/index.js";export*from"./components/text-link/index.js";export*from"./components/time-picker/index.js";export*from"./components/timeline/index.js";export*from"./components/timeline-chart/index.js";export*from"./components/toast/index.js";export*from"./components/toolbar/index.js";export*from"./components/tooltip/index.js";export*from"./components/tree-view/index.js";export*from"./components/typography/index.js";export*from"./components/window-pane/index.js";
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* components, and their logic stays in their own files.
|
|
29
29
|
*/
|
|
30
30
|
import * as React from 'react';
|
|
31
|
-
import type { NebaAnimateRepeat, NebaAnimateTrigger, NebaAnimation, NebaSide, NebaTransition } from '../types';
|
|
31
|
+
import type { NebaAnimateRepeat, NebaAnimateTrigger, NebaAnimation, NebaSide, NebaTransition } from '../types.js';
|
|
32
32
|
/**
|
|
33
33
|
* Which keyframe an effect runs.
|
|
34
34
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { NebaDensity, NebaSize } from '../types';
|
|
2
|
+
import type { NebaDensity, NebaSize } from '../types.js';
|
|
3
3
|
/** A destination's value. The same restraint Tabs and SegmentedButton put on theirs. */
|
|
4
4
|
export type BottomNavigationValue = string | number;
|
|
5
5
|
/**
|
|
@@ -9,9 +9,10 @@ export type BottomNavigationValue = string | number;
|
|
|
9
9
|
* who has not used the app before, and the default on the bar that spans an
|
|
10
10
|
* edge of the window.
|
|
11
11
|
* - `selected` — only the destination that is current. The bar keeps its height
|
|
12
|
-
* either way
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* either way: every item holds a line open for its name whether or not the
|
|
13
|
+
* name is drawn there, so what travels when the reader moves between two
|
|
14
|
+
* destinations is width and nothing else. The names the other items lose are
|
|
15
|
+
* still in the document for a screen reader.
|
|
15
16
|
* - `none` — glyphs only, with every name read out but never drawn.
|
|
16
17
|
*/
|
|
17
18
|
export type BottomNavigationLabels = 'all' | 'selected' | 'none';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";export const BottomNavigationContext
|
|
1
|
+
import*as t from"react";export const BottomNavigationContext=/*@__PURE__*/t.createContext({value:null,change:()=>{},size:"md",density:"default",labels:"all",disabled:!1,floating:!1});export const barMinHeightClasses={xs:"min-h-10",sm:"min-h-12",md:"min-h-14",lg:"min-h-16",xl:"min-h-18"};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { NebaColor, NebaDensity, NebaElevation, NebaSize, NebaVariant } from '../types';
|
|
2
|
+
import type { NebaColor, NebaDensity, NebaElevation, NebaSize, NebaVariant } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* What a Button inherits from the ButtonGroup around it.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as t from"react";export const ButtonGroupContext
|
|
1
|
+
import*as t from"react";export const ButtonGroupContext=/*@__PURE__*/t.createContext(null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { type TimeUnit } from './date';
|
|
3
|
-
import type { NebaColor, NebaDensity, NebaSize, NebaWeekday } from '../types';
|
|
2
|
+
import { type TimeUnit } from './date.js';
|
|
3
|
+
import type { NebaColor, NebaDensity, NebaSize, NebaWeekday } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The calendar grid and the clock columns, written once for the four pickers.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{Button as r}from"../components/button/Button";import{ChevronIcon as a}from"./icons";import{controlHeightClasses as l,controlTextClasses as s,cx as i,gapClasses as c,metaTextClasses as u,pressTransitionClasses as d,srOnlyClasses as m,transitionClasses as h}from"./styles";import{addDays as g,addMonths as f,addYears as b,calendarWeeks as p,compareDay as v,daysInMonth as x,isDayOutside as w,isMonthBeforeYear as y,isSameDay as D,isSameMonth as N,isValidDate as S,makeDate as M,meridiemLabels as P,monthLabels as C,startOfDay as k,startOfMonth as Y,today as z,weekdayLabels as A,withTime as F,YEAR_PAGE_SIZE as E,yearPageStart as T}from"./date";import{dateFormatter as j}from"./format";export const defaultPickerLabels={previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function usePickerLabels(e){return o.useMemo(()=>e?{...defaultPickerLabels,...e}:defaultPickerLabels,[e])}const R={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},B={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-xs)",md:"rounded-(--neba-radius-sm)",lg:"rounded-(--neba-radius-md)",xl:"rounded-(--neba-radius-lg)"},H={xs:"rounded-s-(--neba-radius-xs)",sm:"rounded-s-(--neba-radius-xs)",md:"rounded-s-(--neba-radius-sm)",lg:"rounded-s-(--neba-radius-md)",xl:"rounded-s-(--neba-radius-lg)"},L={xs:"rounded-e-(--neba-radius-xs)",sm:"rounded-e-(--neba-radius-xs)",md:"rounded-e-(--neba-radius-sm)",lg:"rounded-e-(--neba-radius-md)",xl:"rounded-e-(--neba-radius-lg)"},K=["relative flex select-none items-center justify-center tabular-nums","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",h,d,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--n-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function O({children:n,label:o,selected:r,inRange:a=!1,rangeEdge:l=null,current:s=!1,muted:c=!1,disabled:u=!1,focused:d=!1,size:m,className:h,onClick:g,onPointerEnter:f,onKeyDown:b}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":u||void 0,tabIndex:d?0:-1,"data-focus-target":d?"true":void 0,className:i(K,"start"===l?H[m]:"end"===l?L[m]:"middle"===l?"rounded-none":B[m],u?"cursor-not-allowed text-(--neba-disabled-fg)":r?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":a?"cursor-pointer bg-(--n-soft) text-(--neba-fg) hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)":s?"cursor-pointer font-semibold text-(--n-accent) hover:bg-(--n-soft) active:bg-(--n-soft-press)":c?"cursor-pointer text-(--neba-muted-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)",h),onClick:()=>{u||g()},onPointerEnter:f,onKeyDown:b,children:[n,s?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function U({size:o,color:u,view:d,month:m,locale:h,labels:g,showPreviousButton:f,showNextButton:b,onStep:p,onViewChange:v}){const x=C(h,"long")[m.getMonth()],w=String(m.getFullYear()),D=y(h),N="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],S=(t,n)=>n?e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":N[-1===t?0:1],onClick:()=>p(t),startIcon:e("span",{className:i("flex items-center",-1===t?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(a,{})})}):e("span",{"aria-hidden":"true",className:i(l[o],"w-(--n-cell)")}),M=t=>e("span",{className:i("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",t&&"rotate-180"),children:e(a,{})}),P=e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":g.chooseMonth,"aria-expanded":"month"===d,onClick:()=>v("month"===d?"day":"month"),endIcon:M("month"===d),children:x},"month"),k=e(r,{variant:"text",size:o,color:u,density:"compact",className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,onClick:()=>v("year"===d?"day":"year"),endIcon:M("year"===d),children:w},"year"),Y=T(m.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[S(-1,f),e("div",{className:i("flex min-w-0 flex-1 items-center justify-center",c[o]),children:"year"===d?e("span",{className:i("flex items-center font-medium tabular-nums text-(--neba-fg)",l[o],s[o]),children:`${Y}–${Y+E-1}`}):"month"===d?k:t(n,D?{children:[P,k]}:{children:[k,P]})}),S(1,b)]})}export function Calendar({size:n,color:r,locale:a,weekStartsOn:l,month:s,onMonthChange:u,selected:d,rangeStart:m=null,rangeEnd:h=null,onSelect:g,onPreviewChange:p,minDate:v,maxDate:x,shouldDisableDate:y,showOutsideDays:D=!0,autoFocus:P=!1,showPreviousButton:C=!0,showNextButton:A=!0,labels:F,className:T}){const[j,B]=o.useState("day"),H=o.useMemo(()=>d.filter(S),[d]),[L,K]=o.useState(()=>{const e=H.find(e=>N(e,s));return e?k(e):N(z(),s)?z():Y(s)}),O=o.useRef(P),_=o.useRef(null);o.useEffect(()=>{K(e=>N(e,s)?e:Y(s))},[s]),o.useLayoutEffect(()=>{O.current&&(O.current=!1,_.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const V=o.useCallback(e=>w(e,v,x)||(y?.(e)??!1),[v,x,y]),G=e=>{O.current=!0,B(e)},J=e=>{O.current=!0,u(e)};return t("div",{ref:_,className:i("flex flex-col",c[n],T),style:{"--n-cell":R[n]},onPointerLeave:()=>p?.(null),children:[e(U,{size:n,color:r,view:j,month:s,locale:a,labels:F,showPreviousButton:C,showNextButton:A,onStep:e=>{u("day"===j?f(s,e):b(s,"month"===j?e:e*E))},onViewChange:G}),e("div",{className:"h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*7)]",children:"day"===j?e(q,{size:n,locale:a,weekStartsOn:l,month:s,chosen:H,rangeStart:m,rangeEnd:h,focusedDate:L,showOutsideDays:D,isDisabled:V,onSelect:e=>{K(e),g(e)},onPreviewChange:p,onMoveFocus:e=>{O.current=!0,K(e),N(e,s)||u(Y(e))}}):"month"===j?e(I,{size:n,locale:a,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(s.getFullYear(),e,1)),G("day")}}):e($,{size:n,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(e,s.getMonth(),1)),G("month")}})})]})}function q({size:n,locale:o,weekStartsOn:r,month:a,chosen:l,rangeStart:c,rangeEnd:d,focusedDate:m,showOutsideDays:h,isDisabled:b,onSelect:x,onPreviewChange:w,onMoveFocus:y}){const M=p(a,r),P=A(o,r,"short"),C=A(o,r,"long"),k=j(o,{dateStyle:"full"}),Y=(E=d,S(F=c)&&S(E)?v(F,E)<=0?[F,E]:[E,F]:null);var F,E;const T=z();return t("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:P.map((t,o)=>e("span",{role:"columnheader","aria-label":C[o],className:i("flex h-(--n-cell) items-center justify-center font-medium text-(--neba-muted-fg) select-none",u[n]),children:t},o))}),M.map((t,o)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(t=>{const o=!N(t,a);if(o&&!h)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--n-cell)"},t.getTime());const c=l.some(e=>D(e,t)),u=null!==Y&&v(t,Y[0])>=0&&v(t,Y[1])<=0,d=null!==Y&&u&&D(t,Y[0]),p=null!==Y&&u&&D(t,Y[1]);return e(O,{size:n,label:k.format(t),selected:c,inRange:u&&!c,rangeEdge:u?d&&p?"both":d?"start":p?"end":"middle":null,current:D(t,T)&&!c,muted:o,disabled:b(t),focused:D(t,m),className:i("size-(--n-cell)",s[n]),onClick:()=>x(t),onPointerEnter:()=>w?.(t),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-r+7)%7,o={ArrowLeft:()=>g(t,-1),ArrowRight:()=>g(t,1),ArrowUp:()=>g(t,-7),ArrowDown:()=>g(t,7),Home:()=>g(t,-n),End:()=>g(t,6-n),PageUp:()=>f(t,e.shiftKey?-12:-1),PageDown:()=>f(t,e.shiftKey?12:1)}[e.key];o&&(e.preventDefault(),y(o()))})(e,t),children:t.getDate()},t.getTime())})},o))]})}function I({size:t,locale:n,month:o,chosen:r,minDate:a,maxDate:l,onMoveCursor:c,onPick:u}){const d=C(n,"short"),m=C(n,"long"),h=o.getFullYear(),g=new Date,b=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==t&&(e.preventDefault(),c(f(Y(o),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(c=>{const f=3*n+c,p=M(h,f,1),w=M(h,f,x(h,f));return e(O,{size:t,label:`${m[f]} ${h}`,selected:r.some(e=>e.getFullYear()===h&&e.getMonth()===f),current:g.getFullYear()===h&&g.getMonth()===f,disabled:S(a)&&v(w,a)<0||S(l)&&v(p,l)>0,focused:f===o.getMonth(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>u(f),onKeyDown:b,children:d[f]},f)})},n))})}function $({size:t,month:n,chosen:o,minDate:r,maxDate:a,onMoveCursor:l,onPick:c}){const u=T(n.getFullYear()),d=(new Date).getFullYear(),m=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-E,PageDown:E}[e.key];void 0!==t&&(e.preventDefault(),l(b(Y(n),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(l=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(h=>{const g=u+4*l+h;return e(O,{size:t,label:String(g),selected:o.some(e=>e.getFullYear()===g),current:g===d,disabled:S(r)&&g<r.getFullYear()||S(a)&&g>a.getFullYear(),focused:g===n.getFullYear(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>c(g),onKeyDown:m,children:g},g)})},l))})}function _(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,a=r+n.height;r<t.scrollTop?t.scrollTop=r:a>t.scrollTop+t.clientHeight&&(t.scrollTop=a-t.clientHeight)}export function TimeGrid({size:n,density:r,locale:a,value:c,referenceDate:u,onChange:d,hour12:h,showSeconds:g,hourStep:f,minuteStep:b,secondStep:p,shouldDisableTime:v,autoFocus:x=!1,labels:w,className:y}){const D=c??u,N=o.useRef(null),[S,M]=o.useMemo(()=>P(a),[a]);o.useEffect(()=>{const e=N.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(_),x){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[x]);const C=o.useMemo(()=>{const e=Math.ceil((h?12:24)/f),t=Array.from({length:e},(e,t)=>t*f);return h?t.map(e=>0===e?12:e):t},[h,f]),k=o.useMemo(()=>Array.from({length:Math.ceil(60/b)},(e,t)=>t*b),[b]),Y=o.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,t)=>t*p),[p]),z=e=>String(e).padStart(2,"0"),A=h?D.getHours()%12||12:D.getHours(),E=(t,o,r,a,u)=>e("div",{role:"listbox","aria-label":o,className:i("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*2)]","scroll-py-0.5 [scrollbar-width:thin]"),children:r.map(o=>{const r=((e,t)=>F(D,"hour"===e?{hours:h?t%12+(D.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:D.getHours()%12+12*t}))(t,o),m=null!==c&&a(o),g=v?.(r,t)??!1;return e("button",{type:"button",role:"option","aria-selected":m,"aria-disabled":g||void 0,"data-chosen":m?"true":void 0,className:i(K,B[n],l[n],s[n],"w-full shrink-0",g?"cursor-not-allowed text-(--neba-disabled-fg)":m?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)"),onClick:()=>{g||d(r)},children:u(o)},o)})},t);return t("div",{ref:N,className:i("flex","compact"===r?"gap-0.5":"gap-1",y),style:{"--n-cell":R[n]},children:[E("hour",w.hour,C,e=>e===A,e=>h?String(e):z(e)),E("minute",w.minute,k,e=>e===D.getMinutes(),z),g?E("second",w.second,Y,e=>e===D.getSeconds(),z):null,h?E("meridiem",w.meridiem,[0,1],e=>(D.getHours()>=12?1:0)===e,e=>0===e?S:M):null,e("span",{className:m,"aria-live":"polite",children:null===c?"":j(a,{hour:"numeric",minute:"2-digit",...g?{second:"2-digit"}:{}}).format(c)})]})}
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from"react";import{Button as r}from"../components/button/Button.js";import{ChevronIcon as a}from"./icons.js";import{controlHeightClasses as l,controlTextClasses as s,cx as i,gapClasses as c,metaTextClasses as u,pressTransitionClasses as d,srOnlyClasses as m,transitionClasses as h}from"./styles.js";import{addDays as g,addMonths as f,addYears as b,calendarWeeks as p,compareDay as v,daysInMonth as x,isDayOutside as w,isMonthBeforeYear as y,isSameDay as D,isSameMonth as N,isValidDate as S,makeDate as M,meridiemLabels as P,monthLabels as C,startOfDay as k,startOfMonth as Y,today as z,weekdayLabels as A,withTime as F,YEAR_PAGE_SIZE as j,yearPageStart as E}from"./date.js";import{dateFormatter as T}from"./format.js";export const defaultPickerLabels={previousMonth:"Previous month",nextMonth:"Next month",previousYear:"Previous year",nextYear:"Next year",previousYears:"Previous years",nextYears:"Next years",chooseMonth:"Choose a month",chooseYear:"Choose a year",today:"Today",now:"Now",clear:"Clear",done:"Done",hour:"Hour",minute:"Minute",second:"Second",meridiem:"AM/PM",start:"Start",end:"End"};export function usePickerLabels(e){return o.useMemo(()=>e?{...defaultPickerLabels,...e}:defaultPickerLabels,[e])}const R={xs:"1.375rem",sm:"1.625rem",md:"2rem",lg:"2.5rem",xl:"3rem"},B={xs:"rounded-(--neba-radius-xs)",sm:"rounded-(--neba-radius-xs)",md:"rounded-(--neba-radius-sm)",lg:"rounded-(--neba-radius-md)",xl:"rounded-(--neba-radius-lg)"},H={xs:"rounded-s-(--neba-radius-xs)",sm:"rounded-s-(--neba-radius-xs)",md:"rounded-s-(--neba-radius-sm)",lg:"rounded-s-(--neba-radius-md)",xl:"rounded-s-(--neba-radius-lg)"},L={xs:"rounded-e-(--neba-radius-xs)",sm:"rounded-e-(--neba-radius-xs)",md:"rounded-e-(--neba-radius-sm)",lg:"rounded-e-(--neba-radius-md)",xl:"rounded-e-(--neba-radius-lg)"},K=["relative flex select-none items-center justify-center tabular-nums","[-webkit-tap-highlight-color:transparent] [touch-action:manipulation]",h,d,"focus-visible:z-10 focus-visible:[outline:2px_solid_var(--n-ring)]","focus-visible:[outline-offset:-2px]"].join(" ");function O({children:n,label:o,selected:r,inRange:a=!1,rangeEdge:l=null,current:s=!1,muted:c=!1,disabled:u=!1,focused:d=!1,size:m,className:h,onClick:g,onPointerEnter:f,onKeyDown:b}){return t("button",{type:"button",role:"gridcell","aria-label":o,"aria-selected":r,"aria-current":s?"date":void 0,"aria-disabled":u||void 0,tabIndex:d?0:-1,"data-focus-target":d?"true":void 0,className:i(K,"start"===l?H[m]:"end"===l?L[m]:"middle"===l?"rounded-none":B[m],u?"cursor-not-allowed text-(--neba-disabled-fg)":r?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":a?"cursor-pointer bg-(--n-soft) text-(--neba-fg) hover:bg-(--n-soft-hover) active:bg-(--n-soft-press)":s?"cursor-pointer font-semibold text-(--n-accent) hover:bg-(--n-soft) active:bg-(--n-soft-press)":c?"cursor-pointer text-(--neba-muted-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)",h),onClick:()=>{u||g()},onPointerEnter:f,onKeyDown:b,children:[n,s?e("span",{"aria-hidden":"true",className:"absolute bottom-[0.18em] size-[0.22em] rounded-full bg-current"}):null]})}function U({size:o,color:u,view:d,month:m,locale:h,labels:g,showPreviousButton:f,showNextButton:b,onStep:p,onViewChange:v}){const x=C(h,"long")[m.getMonth()],w=String(m.getFullYear()),D=y(h),N="day"===d?[g.previousMonth,g.nextMonth]:"month"===d?[g.previousYear,g.nextYear]:[g.previousYears,g.nextYears],S=(t,n)=>n?e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":N[-1===t?0:1],onClick:()=>p(t),startIcon:e("span",{className:i("flex items-center",-1===t?"rotate-90 rtl:-rotate-90":"-rotate-90 rtl:rotate-90"),children:e(a,{})})}):e("span",{"aria-hidden":"true",className:i(l[o],"w-(--n-cell)")}),M=t=>e("span",{className:i("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",t&&"rotate-180"),children:e(a,{})}),P=e(r,{variant:"text",size:o,color:u,density:"compact","aria-label":g.chooseMonth,"aria-expanded":"month"===d,onClick:()=>v("month"===d?"day":"month"),endIcon:M("month"===d),children:x},"month"),k=e(r,{variant:"text",size:o,color:u,density:"compact",className:"tabular-nums","aria-label":g.chooseYear,"aria-expanded":"year"===d,onClick:()=>v("year"===d?"day":"year"),endIcon:M("year"===d),children:w},"year"),Y=E(m.getFullYear());return t("div",{className:"flex items-center justify-between gap-1",children:[S(-1,f),e("div",{className:i("flex min-w-0 flex-1 items-center justify-center",c[o]),children:"year"===d?e("span",{className:i("flex items-center font-medium tabular-nums text-(--neba-fg)",l[o],s[o]),children:`${Y}–${Y+j-1}`}):"month"===d?k:t(n,D?{children:[P,k]}:{children:[k,P]})}),S(1,b)]})}export function Calendar({size:n,color:r,locale:a,weekStartsOn:l,month:s,onMonthChange:u,selected:d,rangeStart:m=null,rangeEnd:h=null,onSelect:g,onPreviewChange:p,minDate:v,maxDate:x,shouldDisableDate:y,showOutsideDays:D=!0,autoFocus:P=!1,showPreviousButton:C=!0,showNextButton:A=!0,labels:F,className:E}){const[T,B]=o.useState("day"),H=o.useMemo(()=>d.filter(S),[d]),[L,K]=o.useState(()=>{const e=H.find(e=>N(e,s));return e?k(e):N(z(),s)?z():Y(s)}),O=o.useRef(P),_=o.useRef(null);o.useEffect(()=>{K(e=>N(e,s)?e:Y(s))},[s]),o.useLayoutEffect(()=>{O.current&&(O.current=!1,_.current?.querySelector('[data-focus-target="true"]')?.focus({preventScroll:!0}))});const V=o.useCallback(e=>w(e,v,x)||(y?.(e)??!1),[v,x,y]),G=e=>{O.current=!0,B(e)},J=e=>{O.current=!0,u(e)};return t("div",{ref:_,className:i("flex flex-col",c[n],E),style:{"--n-cell":R[n]},onPointerLeave:()=>p?.(null),children:[e(U,{size:n,color:r,view:T,month:s,locale:a,labels:F,showPreviousButton:C,showNextButton:A,onStep:e=>{u("day"===T?f(s,e):b(s,"month"===T?e:e*j))},onViewChange:G}),e("div",{className:"h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*7)]",children:"day"===T?e(q,{size:n,locale:a,weekStartsOn:l,month:s,chosen:H,rangeStart:m,rangeEnd:h,focusedDate:L,showOutsideDays:D,isDisabled:V,onSelect:e=>{K(e),g(e)},onPreviewChange:p,onMoveFocus:e=>{O.current=!0,K(e),N(e,s)||u(Y(e))}}):"month"===T?e(I,{size:n,locale:a,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(s.getFullYear(),e,1)),G("day")}}):e($,{size:n,month:s,chosen:H,minDate:v,maxDate:x,onMoveCursor:J,onPick:e=>{u(M(e,s.getMonth(),1)),G("month")}})})]})}function q({size:n,locale:o,weekStartsOn:r,month:a,chosen:l,rangeStart:c,rangeEnd:d,focusedDate:m,showOutsideDays:h,isDisabled:b,onSelect:x,onPreviewChange:w,onMoveFocus:y}){const M=p(a,r),P=A(o,r,"short"),C=A(o,r,"long"),k=T(o,{dateStyle:"full"}),Y=(j=d,S(F=c)&&S(j)?v(F,j)<=0?[F,j]:[j,F]:null);var F,j;const E=z();return t("div",{role:"grid",className:"flex h-full flex-col",children:[e("div",{role:"row",className:"grid grid-cols-7",children:P.map((t,o)=>e("span",{role:"columnheader","aria-label":C[o],className:i("flex h-(--n-cell) items-center justify-center font-medium text-(--neba-muted-fg) select-none",u[n]),children:t},o))}),M.map((t,o)=>e("div",{role:"row",className:"grid grid-cols-7",children:t.map(t=>{const o=!N(t,a);if(o&&!h)return e("span",{role:"gridcell","aria-hidden":"true",className:"size-(--n-cell)"},t.getTime());const c=l.some(e=>D(e,t)),u=null!==Y&&v(t,Y[0])>=0&&v(t,Y[1])<=0,d=null!==Y&&u&&D(t,Y[0]),p=null!==Y&&u&&D(t,Y[1]);return e(O,{size:n,label:k.format(t),selected:c,inRange:u&&!c,rangeEdge:u?d&&p?"both":d?"start":p?"end":"middle":null,current:D(t,E)&&!c,muted:o,disabled:b(t),focused:D(t,m),className:i("size-(--n-cell)",s[n]),onClick:()=>x(t),onPointerEnter:()=>w?.(t),onKeyDown:e=>((e,t)=>{const n=(t.getDay()-r+7)%7,o={ArrowLeft:()=>g(t,-1),ArrowRight:()=>g(t,1),ArrowUp:()=>g(t,-7),ArrowDown:()=>g(t,7),Home:()=>g(t,-n),End:()=>g(t,6-n),PageUp:()=>f(t,e.shiftKey?-12:-1),PageDown:()=>f(t,e.shiftKey?12:1)}[e.key];o&&(e.preventDefault(),y(o()))})(e,t),children:t.getDate()},t.getTime())})},o))]})}function I({size:t,locale:n,month:o,chosen:r,minDate:a,maxDate:l,onMoveCursor:c,onPick:u}){const d=C(n,"short"),m=C(n,"long"),h=o.getFullYear(),g=new Date,b=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-3,ArrowDown:3,PageUp:-12,PageDown:12}[e.key];void 0!==t&&(e.preventDefault(),c(f(Y(o),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2,3].map(n=>e("div",{role:"row",className:"grid grid-cols-3 gap-1",children:[0,1,2].map(c=>{const f=3*n+c,p=M(h,f,1),w=M(h,f,x(h,f));return e(O,{size:t,label:`${m[f]} ${h}`,selected:r.some(e=>e.getFullYear()===h&&e.getMonth()===f),current:g.getFullYear()===h&&g.getMonth()===f,disabled:S(a)&&v(w,a)<0||S(l)&&v(p,l)>0,focused:f===o.getMonth(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>u(f),onKeyDown:b,children:d[f]},f)})},n))})}function $({size:t,month:n,chosen:o,minDate:r,maxDate:a,onMoveCursor:l,onPick:c}){const u=E(n.getFullYear()),d=(new Date).getFullYear(),m=e=>{const t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-4,ArrowDown:4,PageUp:-j,PageDown:j}[e.key];void 0!==t&&(e.preventDefault(),l(b(Y(n),t)))};return e("div",{role:"grid",className:"flex h-full flex-col justify-evenly",children:[0,1,2].map(l=>e("div",{role:"row",className:"grid grid-cols-4 gap-1",children:[0,1,2,3].map(h=>{const g=u+4*l+h;return e(O,{size:t,label:String(g),selected:o.some(e=>e.getFullYear()===g),current:g===d,disabled:S(r)&&g<r.getFullYear()||S(a)&&g>a.getFullYear(),focused:g===n.getFullYear(),className:i("h-(--n-cell) w-full",s[t]),onClick:()=>c(g),onKeyDown:m,children:g},g)})},l))})}function _(e){const t=e.parentElement;if(!t)return;const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r=n.top-o.top-t.clientTop+t.scrollTop,a=r+n.height;r<t.scrollTop?t.scrollTop=r:a>t.scrollTop+t.clientHeight&&(t.scrollTop=a-t.clientHeight)}export function TimeGrid({size:n,density:r,locale:a,value:c,referenceDate:u,onChange:d,hour12:h,showSeconds:g,hourStep:f,minuteStep:b,secondStep:p,shouldDisableTime:v,autoFocus:x=!1,labels:w,className:y}){const D=c??u,N=o.useRef(null),[S,M]=o.useMemo(()=>P(a),[a]);o.useEffect(()=>{const e=N.current;if(e?.querySelectorAll('[data-chosen="true"]').forEach(_),x){const t=e?.querySelector('[role="listbox"]');(t?.querySelector('[data-chosen="true"]')??t?.querySelector('[role="option"]'))?.focus({preventScroll:!0})}},[x]);const C=o.useMemo(()=>{const e=Math.ceil((h?12:24)/f),t=Array.from({length:e},(e,t)=>t*f);return h?t.map(e=>0===e?12:e):t},[h,f]),k=o.useMemo(()=>Array.from({length:Math.ceil(60/b)},(e,t)=>t*b),[b]),Y=o.useMemo(()=>Array.from({length:Math.ceil(60/p)},(e,t)=>t*p),[p]),z=e=>String(e).padStart(2,"0"),A=h?D.getHours()%12||12:D.getHours(),j=(t,o,r,a,u)=>e("div",{role:"listbox","aria-label":o,className:i("flex flex-col gap-0.5 overflow-y-auto overscroll-contain","h-[calc(var(--n-cell)*7)] w-[calc(var(--n-cell)*2)]","scroll-py-0.5 [scrollbar-width:thin]"),children:r.map(o=>{const r=((e,t)=>F(D,"hour"===e?{hours:h?t%12+(D.getHours()>=12?12:0):t}:"minute"===e?{minutes:t}:"second"===e?{seconds:t}:{hours:D.getHours()%12+12*t}))(t,o),m=null!==c&&a(o),g=v?.(r,t)??!1;return e("button",{type:"button",role:"option","aria-selected":m,"aria-disabled":g||void 0,"data-chosen":m?"true":void 0,className:i(K,B[n],l[n],s[n],"w-full shrink-0",g?"cursor-not-allowed text-(--neba-disabled-fg)":m?"cursor-pointer bg-(--n-fill) font-semibold text-(--n-on-solid) hover:bg-(--n-fill-hover) active:bg-(--n-fill-active)":"cursor-pointer text-(--neba-fg) hover:bg-(--n-soft) active:bg-(--n-soft-press)"),onClick:()=>{g||d(r)},children:u(o)},o)})},t);return t("div",{ref:N,className:i("flex","compact"===r?"gap-0.5":"gap-1",y),style:{"--n-cell":R[n]},children:[j("hour",w.hour,C,e=>e===A,e=>h?String(e):z(e)),j("minute",w.minute,k,e=>e===D.getMinutes(),z),g?j("second",w.second,Y,e=>e===D.getSeconds(),z):null,h?j("meridiem",w.meridiem,[0,1],e=>(D.getHours()>=12?1:0)===e,e=>0===e?S:M):null,e("span",{className:m,"aria-live":"polite",children:null===c?"":T(a,{hour:"numeric",minute:"2-digit",...g?{second:"2-digit"}:{}}).format(c)})]})}
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
* element is, and nothing in here does arithmetic that is not layout.
|
|
17
17
|
*/
|
|
18
18
|
import * as React from 'react';
|
|
19
|
-
import { type BoxProps } from '../components/box/Box';
|
|
20
|
-
import { type BandScale, type ChartValue, type PlotBox, type ValueScale } from './chart';
|
|
21
|
-
import type { NebaChartAxis, NebaChartCategory, NebaChartLegend, NebaChartSeries, NebaChartTooltip, NebaSize } from '../types';
|
|
19
|
+
import { type BoxProps } from '../components/box/Box.js';
|
|
20
|
+
import { type BandScale, type ChartValue, type PlotBox, type ValueScale } from './chart.js';
|
|
21
|
+
import type { NebaChartAxis, NebaChartCategory, NebaChartLegend, NebaChartSeries, NebaChartTooltip, NebaSize } from '../types.js';
|
|
22
22
|
/**
|
|
23
23
|
* How wide the chart actually is, in pixels.
|
|
24
24
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Box as l}from"../components/box/Box";import{bandScale as i,categoryAt as r,categoryCount as s,categoryExtent as o,chartFontSizes as c,compactNumber as d,extentOf as u,fitsLast as h,formatCategory as m,markerRadii as f,plotHeights as x,seriesColor as p,showsTick as g,textWidth as b,tickStride as v,toValues as y,truncate as k,valueScale as w}from"./chart";import{numberFormatter as M}from"./format";import{useMessages as N}from"./i18n";import{cx as z,metaTextClasses as S,srOnlyClasses as C,transitionClasses as A}from"./styles";const P="undefined"==typeof document?a.useEffect:a.useLayoutEffect,W=[];function B(e){const[t,n]=a.useState(0);return P(()=>{const t=e.current;if(!t)return;const a=()=>n(t.clientWidth);if(a(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(a);return l.observe(t),()=>l.disconnect()},[e]),t}function R(e){const[t,n]=a.useState(()=>{const t=new Set;return e.forEach((e,n)=>{e.hidden&&t.add(n)}),t}),[l,i]=a.useState(null),r=a.useCallback(e=>{n(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return{visible:e.map((e,n)=>!t.has(n)),hovered:l,toggle:r,setHovered:i}}const j={top:"flex-col-reverse",bottom:"flex-col",left:"flex-row-reverse",right:"flex-row"},F={start:"justify-start",center:"justify-center",end:"justify-end"};function E({series:a,colors:l,options:i,visibility:r,size:s,values:o,swatch:c}){const d=!1!==i.interactive,u="left"===i.side||"right"===i.side;return e("ul",{className:z("flex list-none flex-wrap items-center gap-x-3 gap-y-1 p-0",u?"min-w-0 flex-col items-start":"",F[i.align??"center"],S[s]),children:a.map((a,i)=>{const s=r.visible[i],u=null!==r.hovered&&r.hovered!==i,h=a.name??`${i+1}`,m=s?l[i]:"var(--neba-disabled-fg)",f=n(t,{children:[e("span",c?{"aria-hidden":"true",className:"flex size-2.5 shrink-0 items-center justify-center",children:c(i,m)}:{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-[0.1875rem]",style:{backgroundColor:m}}),e("span",{className:"min-w-0 truncate",children:h}),o?.[i]?e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:o[i]}):null]});return e("li",{className:"min-w-0",children:d?e("button",{type:"button","aria-pressed":s,onClick:()=>r.toggle(i),onPointerEnter:()=>r.setHovered(i),onPointerLeave:()=>r.setHovered(null),onFocus:()=>r.setHovered(i),onBlur:()=>r.setHovered(null),className:z("flex min-w-0 cursor-pointer items-center gap-1.5 rounded-(--neba-radius-xs)","px-1 py-0.5 text-(--neba-fg)",A,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1",s?"":"text-(--neba-disabled-fg)",u?"opacity-55":""),children:f}):e("span",{className:z("flex min-w-0 items-center gap-1.5 px-1 py-0.5 text-(--neba-fg)",s?"":"text-(--neba-disabled-fg)"),children:f})},a.name??i)})})}function H({steps:a,from:l,to:i,middle:r,align:s,vertical:o,size:c}){return e("div",{className:z("flex",o?"":F[s]),children:n("div",{className:z("grid grid-cols-[auto_auto_auto] items-center gap-x-2",S[c]),children:[e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:l}),e("span",{"aria-hidden":"true",className:z("flex h-2.5 overflow-hidden rounded-[0.1875rem]",o?"w-20":"w-24"),children:a.map(t=>e("span",{className:"h-full flex-1",style:{backgroundColor:t}},t))}),e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:i}),r?n(t,{children:[e("span",{}),e("span",{className:"text-center tabular-nums text-(--neba-muted-fg)",children:r}),e("span",{})]}):null]})})}function I({heading:t,items:a,x:l,y:i,flip:r,size:s}){return n("div",{role:"status","aria-live":"polite",className:z("pointer-events-none absolute z-10 max-w-56 min-w-24","rounded-(--neba-radius-sm) border p-2","[background-image:var(--neba-grain),var(--neba-sheen)]","[background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]","bg-(--neba-panel-press) [border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-2),var(--neba-plate-glass)]",S[s]),style:r?{right:`calc(100% - ${l}px + 10px)`,top:i}:{left:l+10,top:i},children:[e("div",{className:"mb-1 font-medium text-(--neba-fg)",children:t}),e("ul",{className:"flex list-none flex-col gap-0.5 p-0",children:a.map(t=>n("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:"size-2 shrink-0 rounded-[0.125rem]",style:{backgroundColor:t.color}}),t.name?e("span",{className:"min-w-0 flex-1 truncate text-(--neba-muted-fg)",children:t.name}):null,e("span",{className:"ms-auto shrink-0 font-medium tabular-nums text-(--neba-fg)",children:t.label??t.formatted})]},t.seriesIndex))})]})}function _({id:t,caption:a,corner:l,categories:i,series:r,values:s,format:o,locale:c}){return n("table",{id:t,className:C,children:[a?e("caption",{children:a}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:l??""}),r.map((t,n)=>e("th",{scope:"col",children:t.name??n+1},t.name??n))]})}),e("tbody",{children:i.map((t,a)=>n("tr",{children:[e("th",{scope:"row",children:m(t,c)}),r.map((t,n)=>{const l=s[n]?.[a];return e("td",void 0!==l?.label?{children:l.label}:{children:null==l?.value?"":o(l.value)},t.name??n)})]},a))})]})}function T({legend:t,legendSide:a,children:i,table:r,className:s,...o}){return n(l,{...o,className:z("relative flex gap-3",j[a],s??void 0),children:[e("div",{className:"relative min-w-0 flex-1",children:i}),t,r]})}export function CartesianChart({series:t,categories:l,xAxis:h,yAxis:g,horizontal:v=!1,stacked:C=!1,includeZero:A=!0,bandRatio:P=1,inset:j=!1,headroom:F=0,markInset:H=0,xScale:L="band",marks:V,markRadius:D=24,table:X,swatch:Y,scale:Z,markTooltip:O,height:K,format:U,locale:q,label:G,legend:J,tooltip:Q,empty:ee,size:te="md",variant:ne="text",padded:ae=!1,className:le,children:ie,...re}){const se=a.useRef(null),oe=B(se),ce=N(q),de=a.useId(),ue=R(t),[he,me]=a.useState(null),[fe,xe]=a.useState(null),[pe,ge]=a.useState(null),be=a.useCallback(e=>U?M(q,U).format(e):d(e,q),[U,q]),ve=a.useMemo(()=>y(t),[t]),ye=a.useMemo(()=>t.map((e,t)=>p(e,t)),[t]),ke=s(t),we=a.useMemo(()=>Array.from({length:ke},(e,t)=>r(t,l,ve)),[ke,l,ve]),Me=ve.filter((e,t)=>ue.visible[t]),Ne=u(Me,C),ze="number"==typeof K?K:void 0===K?x[te]:null,Se=c[te],Ce=g,Ae=h,Pe=Z??w(Ne,{min:Ce?.min,max:Ce?.max,tickCount:Ce?.tickCount,includeZero:A}),We="value"===L?o(Me,l):null,Be="value"===L?w(We,{min:Ae?.min,max:Ae?.max,tickCount:Ae?.tickCount,includeZero:!1}):null,Re=Pe.ticks.map((e,t)=>Ce?.tickFormat?String(Ce.tickFormat(e,t)):be(e)),je=Be?Be.ticks.map((e,t)=>Ae?.tickFormat?String(Ae.tickFormat(e,t)):d(e,q)):we.map((e,t)=>Ae?.tickFormat?String(Ae.tickFormat(e,t)):m(e,q)),Fe=Re.reduce((e,t)=>Math.max(e,b(t,Se)),0),Ee=Se+6,He=Ce?.hidden?0:Fe+10+(Ce?.label?Ee:0),Ie=(oe-(v?0:He)-16)/Math.max(1,ke),_e=Be?je:v||Ie-6>=2.4*Se?je.map(e=>k(e,v?150:Ie-6,Se)):je,Te=_e.reduce((e,t)=>Math.max(e,b(t,Se)),0),$e=v?Ae?.hidden?0:Te+10+(Ae?.label?Ee:0):He,Le=v?Ce?.hidden?0:Se+12+(Ce?.label?Ee:0):Ae?.hidden?0:Se+12+(Ae?.label?Ee:0),Ve=(v?Ae:Ce)?.thickness??$e,De=(v?Ce:Ae)?.thickness??Le,Xe=(v||Be?12:Math.max(8,_e.length?Te/2:8))+H,Ye=f[te]+4+F+H,Ze=ze??0,Oe={left:Ve+H,top:Ye,width:Math.max(0,oe-Ve-H-Xe),height:Math.max(0,Ze-Ye-De-H)},Ke=v?Oe.height:Oe.width,Ue=i(j?Math.max(1,ke-1):ke,Ke,P),qe=a.useCallback(e=>j?ke<=1?Ke/2:Ke*e/(ke-1):Ue.centre(e),[j,ke,Ke,Ue]),Ge=a.useCallback(e=>v?Oe.left+Pe.fraction(e)*Oe.width:Oe.top+(1-Pe.fraction(e))*Oe.height,[v,Oe.left,Oe.top,Oe.width,Oe.height,Pe]),Je=a.useCallback((e,t)=>v?{x:Ge(t),y:Oe.top+qe(e)}:{x:Oe.left+qe(e),y:Ge(t)},[v,Ge,qe,Oe.left,Oe.top]),Qe=a.useCallback(e=>v?Oe.top+(1-(Be?.fraction(e)??0))*Oe.height:Oe.left+(Be?.fraction(e)??0)*Oe.width,[v,Oe.left,Oe.top,Oe.width,Oe.height,Be]),et=Ge(Math.min(Math.max(0,Pe.min),Pe.max)),tt={plot:Oe,values:ve,visible:ue.visible,colors:ye,scale:Pe,band:Ue,horizontal:v,valuePx:Ge,categoryPx:qe,point:Je,categoryScale:Be,categoryValuePx:Qe,zeroPx:et,categories:we,format:be,size:te},nt=V?V(tt):W,at=!1===Q?{mode:"none"}:!0===Q||void 0===Q?{}:Q,lt=at.mode??(V?"item":"index"),it=null===fe?null:nt[fe]??null,rt=V?it?it.index:null:he,st=V?nt.length:ke,ot=()=>{me(null),xe(null),ge(null)},ct=e=>{const t=null===e?null:Math.min(st-1,Math.max(0,e));V?xe(t):me(t)},dt=e=>{ge(null);ct(((V?fe:he)??(e>0?-1:st))+e)},ut=null===rt?[]:t.flatMap((e,t)=>{if(!ue.visible[t]||it&&it.series!==t)return[];const n=ve[t]?.[rt];return n&&null!==n.value?[{seriesIndex:t,name:e.name,color:n.color??ye[t],value:n.value,formatted:be(n.value),label:n.label}]:[]}),ht=it&&O?O(it):null,mt=ht?ht.items:"item"===lt&&ut.length>1&&null!==pe?[ut.reduce((e,t)=>Math.abs(Ge(t.value??0)-pe)<Math.abs(Ge(e.value??0)-pe)?t:e)]:ut,ft=it?ve[it.series]?.[it.index]?.x??l?.[it.index]??it.index:void 0,xt=it?it.x:v?Ge(mt[0]?.value??0):Oe.left+qe(rt??0),pt=it?it.y:v?Oe.top+qe(rt??0):Oe.top,gt=it?(it.x-Oe.left)/Math.max(1,Oe.width)>.6:(v?Pe.fraction(mt[0]?.value??0):qe(rt??0)/Math.max(1,Ke))>.6,bt=!1===J?{interactive:!1}:!0===J||void 0===J?{}:J,vt=!0===J||!1!==J&&t.length>1,yt=bt.side??"bottom",kt={...tt,hovered:ue.hovered,activeIndex:rt,marks:nt,activeMark:it},wt=0===ke||null===Ne||"value"===L&&null===We;return e(T,{...re,size:te,variant:ne,padded:ae,className:le,legendSide:yt,legend:vt?e(E,{series:t,colors:ye,options:bt,visibility:ue,size:te,swatch:Y,values:bt.showValue&&null!==rt?t.map((e,t)=>{const n=ve[t]?.[rt]?.value;return null==n?void 0:be(n)}):void 0}):null,table:wt?null:X?.(de)??e(_,{id:de,caption:G,corner:Ae?.label,categories:we,series:t,values:ve,format:be,locale:q}),children:n("div",{ref:se,role:"img",tabIndex:wt?void 0:0,"aria-label":G,"aria-describedby":wt?void 0:de,onPointerMove:e=>{"none"!==lt&&(V?xe(((e,t)=>{const n=se.current;if(!n||0===nt.length)return null;const a=n.getBoundingClientRect(),l=e-a.left,i=t-a.top;let r=null,s=1/0,o=1/0;return nt.forEach((e,t)=>{const n=Math.hypot(e.x-l,e.y-i),a=void 0===e.rx?Math.max(0,n-e.r):Math.hypot(Math.max(0,Math.abs(e.x-l)-e.rx),Math.max(0,Math.abs(e.y-i)-(e.ry??e.rx)));a<=D&&(a<s||a===s&&n<o)&&(s=a,o=n,r=t)}),r})(e.clientX,e.clientY)):me(((e,t)=>{const n=se.current;if(!n||0===ke)return null;const a=n.getBoundingClientRect(),l=v?t-a.top-Oe.top:e-a.left-Oe.left;if(l<-Ue.step||l>Ke+Ue.step)return null;const i=j?ke<=1?0:Math.round(l/Ke*(ke-1)):Math.floor(l/Ue.step);return Math.min(ke-1,Math.max(0,i))})(e.clientX,e.clientY)),"item"===lt&&ge(((e,t)=>{const n=se.current;if(!n)return null;const a=n.getBoundingClientRect();return v?e-a.left:t-a.top})(e.clientX,e.clientY)))},onPointerLeave:ot,onKeyDown:"none"===lt?void 0:e=>{const t=v?"ArrowDown":"ArrowRight",n=v?"ArrowUp":"ArrowLeft";if(e.key===t)dt(1);else if(e.key===n)dt(-1);else if("Home"===e.key)ct(0);else if("End"===e.key)ct(st-1);else{if("Escape"!==e.key)return;ot()}e.preventDefault()},onBlur:ot,className:z("relative w-full","rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:ze??K},children:[wt?e("div",{className:z("flex h-full items-center justify-center text-(--neba-muted-fg)",S[te]),children:ee??ce.empty.title}):oe>0?n("svg",{width:oe,height:Ze||"100%",viewBox:`0 0 ${oe} ${Ze}`,"aria-hidden":"true",className:"block overflow-visible",children:[e($,{plot:Oe,scale:Pe,band:Ue,horizontal:v,inset:j,categoryPx:qe,valuePx:Ge,tickTexts:Re,categoryTexts:_e,categoryScale:Be,categoryValuePx:Qe,valueAxis:Ce,categoryAxis:Ae,fontSize:Se,zeroPx:et}),null===rt||V||"index"!==lt||!1===at.crosshair?null:(()=>{const t=qe(rt);return e("line",v?{x1:Oe.left,x2:Oe.left+Oe.width,y1:Oe.top+t,y2:Oe.top+t,stroke:"var(--neba-chart-baseline)",strokeWidth:1}:{x1:Oe.left+t,x2:Oe.left+t,y1:Oe.top,y2:Oe.top+Oe.height,stroke:"var(--neba-chart-baseline)",strokeWidth:1})})(),ie(kt)]}):null,null!==rt&&mt.length>0&&"none"!==lt?at.render?e("div",{className:"pointer-events-none absolute z-10",style:gt?{right:`calc(100% - ${xt}px + 10px)`,top:pt}:{left:xt+10,top:pt},children:at.render({index:rt,category:ft??we[rt],items:mt})}):e(I,{heading:ht?ht.heading:m(ft??we[rt],q),items:mt,x:xt,y:pt,flip:gt,size:te}):null]})})}function $({plot:a,scale:l,horizontal:i,categoryPx:r,valuePx:s,tickTexts:o,categoryTexts:c,categoryScale:d,categoryValuePx:u,valueAxis:m,categoryAxis:f,fontSize:x,zeroPx:p}){const y=!1!==m?.grid&&!m?.hidden,k=!f?.hidden&&(f?.grid??null!==d),w=e=>d?u(d.ticks[e]):(i?a.top:a.left)+r(e),M=v(c.length,i?a.height:a.width,i?1.8*x:Math.max(...c.map(e=>b(e,x)),1)+12),N=v(l.ticks.length,i?a.width:a.height,i?Math.max(...o.map(e=>b(e,x)),1)+16:2*x),z=c.length>1?Math.abs(w(1)-w(0)):a.width,S=l.ticks.length>1?Math.abs(s(l.ticks[1])-s(l.ticks[0])):a.height,C=h(c.length,M,z,i?1.8*x:b(c[c.length-1]??"",x)),A=h(l.ticks.length,N,S,i?b(o[o.length-1]??"",x):1.6*x);return n("g",{children:[l.ticks.map((t,r)=>{const c=s(t),d=Math.abs(t)<1e-9;return n("g",{children:[y?e("line",i?{x1:c,x2:c,y1:a.top,y2:a.top+a.height,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:c,y2:c,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}):null,m?.hidden||!g(r,l.ticks.length,N,A)?null:e("text",i?{x:c,y:a.top+a.height+x+6,textAnchor:0===r?"start":r===l.ticks.length-1?"end":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]}:{x:a.left-8,y:c,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]})]},t)}),f?.hidden?null:n(t,{children:[e("line",i?{x1:p,x2:p,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-axis)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:p,y2:p,stroke:"var(--neba-chart-axis)",strokeWidth:1}),c.map((t,l)=>{const r=w(l),s=g(l,c.length,M,C);return i?s?e("text",{x:a.left-8,y:r,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t},l):null:n("g",{children:[k?e("line",{x1:r,x2:r,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-grid)",strokeWidth:1}):null,s?e("text",{x:r,y:a.top+a.height+x+6,textAnchor:d?0===l?"start":l===c.length-1?"end":"middle":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t}):null]},l)})]}),m?.label?e("text",{x:i?a.left+a.width:a.left,y:i?a.top+a.height+2*x+12:a.top-8,textAnchor:i?"end":"start",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:m.label}):null,f?.label&&!i?e("text",{x:a.left+a.width,y:a.top+a.height+2*x+12,textAnchor:"end",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:f.label}):null]})}export{_ as ChartDataTable,E as ChartLegendBar,H as ChartScaleLegend,T as ChartSurface,I as ChartTooltipPanel,B as useMeasuredWidth,R as useVisibility};
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as n}from"react/jsx-runtime";import*as a from"react";import{Box as l}from"../components/box/Box.js";import{bandScale as i,categoryAt as r,categoryCount as s,categoryExtent as o,chartFontSizes as c,compactNumber as d,extentOf as u,fitsLast as h,formatCategory as m,markerRadii as f,plotHeights as x,seriesColor as p,showsTick as g,textWidth as b,tickStride as v,toValues as y,truncate as k,valueScale as w}from"./chart.js";import{numberFormatter as M}from"./format.js";import{emptyMessages as N,useMessages as z}from"./i18n.js";import{cx as S,metaTextClasses as C,srOnlyClasses as A,transitionClasses as P}from"./styles.js";const j="undefined"==typeof document?a.useEffect:a.useLayoutEffect,W=[];function B(e){const[t,n]=a.useState(0);return j(()=>{const t=e.current;if(!t)return;const a=()=>n(t.clientWidth);if(a(),"undefined"==typeof ResizeObserver)return;const l=new ResizeObserver(a);return l.observe(t),()=>l.disconnect()},[e]),t}function R(e){const[t,n]=a.useState(()=>{const t=new Set;return e.forEach((e,n)=>{e.hidden&&t.add(n)}),t}),[l,i]=a.useState(null),r=a.useCallback(e=>{n(t=>{const n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return{visible:e.map((e,n)=>!t.has(n)),hovered:l,toggle:r,setHovered:i}}const F={top:"flex-col-reverse",bottom:"flex-col",left:"flex-row-reverse",right:"flex-row"},E={start:"justify-start",center:"justify-center",end:"justify-end"};function H({series:a,colors:l,options:i,visibility:r,size:s,values:o,swatch:c}){const d=!1!==i.interactive,u="left"===i.side||"right"===i.side;return e("ul",{className:S("flex list-none flex-wrap items-center gap-x-3 gap-y-1 p-0",u?"min-w-0 flex-col items-start":"",E[i.align??"center"],C[s]),children:a.map((a,i)=>{const s=r.visible[i],u=null!==r.hovered&&r.hovered!==i,h=a.name??`${i+1}`,m=s?l[i]:"var(--neba-disabled-fg)",f=n(t,{children:[e("span",c?{"aria-hidden":"true",className:"flex size-2.5 shrink-0 items-center justify-center",children:c(i,m)}:{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-[0.1875rem]",style:{backgroundColor:m}}),e("span",{className:"min-w-0 truncate",children:h}),o?.[i]?e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:o[i]}):null]});return e("li",{className:"min-w-0",children:d?e("button",{type:"button","aria-pressed":s,onClick:()=>r.toggle(i),onPointerEnter:()=>r.setHovered(i),onPointerLeave:()=>r.setHovered(null),onFocus:()=>r.setHovered(i),onBlur:()=>r.setHovered(null),className:S("flex min-w-0 cursor-pointer items-center gap-1.5 rounded-(--neba-radius-xs)","px-1 py-0.5 text-(--neba-fg)",P,"hover:bg-(--n-soft)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1",s?"":"text-(--neba-disabled-fg)",u?"opacity-55":""),children:f}):e("span",{className:S("flex min-w-0 items-center gap-1.5 px-1 py-0.5 text-(--neba-fg)",s?"":"text-(--neba-disabled-fg)"),children:f})},a.name??i)})})}function I({steps:a,from:l,to:i,middle:r,align:s,vertical:o,size:c}){return e("div",{className:S("flex",o?"":E[s]),children:n("div",{className:S("grid grid-cols-[auto_auto_auto] items-center gap-x-2",C[c]),children:[e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:l}),e("span",{"aria-hidden":"true",className:S("flex h-2.5 overflow-hidden rounded-[0.1875rem]",o?"w-20":"w-24"),children:a.map(t=>e("span",{className:"h-full flex-1",style:{backgroundColor:t}},t))}),e("span",{className:"shrink-0 tabular-nums text-(--neba-muted-fg)",children:i}),r?n(t,{children:[e("span",{}),e("span",{className:"text-center tabular-nums text-(--neba-muted-fg)",children:r}),e("span",{})]}):null]})})}function _({heading:t,items:a,x:l,y:i,flip:r,size:s}){return n("div",{role:"status","aria-live":"polite",className:S("pointer-events-none absolute z-10 max-w-56 min-w-24","rounded-(--neba-radius-sm) border p-2","[background-image:var(--neba-grain),var(--neba-sheen)]","[background-blend-mode:overlay,normal] [backdrop-filter:var(--neba-blur)]","bg-(--neba-panel-press) [border-color:var(--n-line)]","[box-shadow:var(--neba-shadow-2),var(--neba-plate-glass)]",C[s]),style:r?{right:`calc(100% - ${l}px + 10px)`,top:i}:{left:l+10,top:i},children:[e("div",{className:"mb-1 font-medium text-(--neba-fg)",children:t}),e("ul",{className:"flex list-none flex-col gap-0.5 p-0",children:a.map(t=>n("li",{className:"flex items-center gap-1.5",children:[e("span",{"aria-hidden":"true",className:"size-2 shrink-0 rounded-[0.125rem]",style:{backgroundColor:t.color}}),t.name?e("span",{className:"min-w-0 flex-1 truncate text-(--neba-muted-fg)",children:t.name}):null,e("span",{className:"ms-auto shrink-0 font-medium tabular-nums text-(--neba-fg)",children:t.label??t.formatted})]},t.seriesIndex))})]})}function T({id:t,caption:a,corner:l,categories:i,series:r,values:s,format:o,locale:c}){return n("table",{id:t,className:A,children:[a?e("caption",{children:a}):null,e("thead",{children:n("tr",{children:[e("th",{scope:"col",children:l??""}),r.map((t,n)=>e("th",{scope:"col",children:t.name??n+1},t.name??n))]})}),e("tbody",{children:i.map((t,a)=>n("tr",{children:[e("th",{scope:"row",children:m(t,c)}),r.map((t,n)=>{const l=s[n]?.[a];return e("td",void 0!==l?.label?{children:l.label}:{children:null==l?.value?"":o(l.value)},t.name??n)})]},a))})]})}function $({legend:t,legendSide:a,children:i,table:r,className:s,...o}){return n(l,{...o,className:S("relative flex gap-3",F[a],s??void 0),children:[e("div",{className:"relative min-w-0 flex-1",children:i}),t,r]})}export function CartesianChart({series:t,categories:l,xAxis:h,yAxis:g,horizontal:v=!1,stacked:A=!1,includeZero:P=!0,bandRatio:j=1,inset:F=!1,headroom:E=0,markInset:I=0,xScale:V="band",marks:D,markRadius:X=24,table:Y,swatch:Z,scale:O,markTooltip:K,height:U,format:q,locale:G,label:J,legend:Q,tooltip:ee,empty:te,size:ne="md",variant:ae="text",padded:le=!1,className:ie,children:re,...se}){const oe=a.useRef(null),ce=B(oe),de=z(N,G),ue=a.useId(),he=R(t),[me,fe]=a.useState(null),[xe,pe]=a.useState(null),[ge,be]=a.useState(null),ve=a.useCallback(e=>q?M(G,q).format(e):d(e,G),[q,G]),ye=a.useMemo(()=>y(t),[t]),ke=a.useMemo(()=>t.map((e,t)=>p(e,t)),[t]),we=s(t),Me=a.useMemo(()=>Array.from({length:we},(e,t)=>r(t,l,ye)),[we,l,ye]),Ne=ye.filter((e,t)=>he.visible[t]),ze=u(Ne,A),Se="number"==typeof U?U:void 0===U?x[ne]:null,Ce=c[ne],Ae=g,Pe=h,je=O??w(ze,{min:Ae?.min,max:Ae?.max,tickCount:Ae?.tickCount,includeZero:P}),We="value"===V?o(Ne,l):null,Be="value"===V?w(We,{min:Pe?.min,max:Pe?.max,tickCount:Pe?.tickCount,includeZero:!1}):null,Re=je.ticks.map((e,t)=>Ae?.tickFormat?String(Ae.tickFormat(e,t)):ve(e)),Fe=Be?Be.ticks.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):d(e,G)):Me.map((e,t)=>Pe?.tickFormat?String(Pe.tickFormat(e,t)):m(e,G)),Ee=Re.reduce((e,t)=>Math.max(e,b(t,Ce)),0),He=Ce+6,Ie=Ae?.hidden?0:Ee+10+(Ae?.label?He:0),_e=(ce-(v?0:Ie)-16)/Math.max(1,we),Te=Be?Fe:v||_e-6>=2.4*Ce?Fe.map(e=>k(e,v?150:_e-6,Ce)):Fe,$e=Te.reduce((e,t)=>Math.max(e,b(t,Ce)),0),Le=v?Pe?.hidden?0:$e+10+(Pe?.label?He:0):Ie,Ve=v?Ae?.hidden?0:Ce+12+(Ae?.label?He:0):Pe?.hidden?0:Ce+12+(Pe?.label?He:0),De=(v?Pe:Ae)?.thickness??Le,Xe=(v?Ae:Pe)?.thickness??Ve,Ye=(v||Be?12:Math.max(8,Te.length?$e/2:8))+I,Ze=f[ne]+4+E+I,Oe=Se??0,Ke={left:De+I,top:Ze,width:Math.max(0,ce-De-I-Ye),height:Math.max(0,Oe-Ze-Xe-I)},Ue=v?Ke.height:Ke.width,qe=i(F?Math.max(1,we-1):we,Ue,j),Ge=a.useCallback(e=>F?we<=1?Ue/2:Ue*e/(we-1):qe.centre(e),[F,we,Ue,qe]),Je=a.useCallback(e=>v?Ke.left+je.fraction(e)*Ke.width:Ke.top+(1-je.fraction(e))*Ke.height,[v,Ke.left,Ke.top,Ke.width,Ke.height,je]),Qe=a.useCallback((e,t)=>v?{x:Je(t),y:Ke.top+Ge(e)}:{x:Ke.left+Ge(e),y:Je(t)},[v,Je,Ge,Ke.left,Ke.top]),et=a.useCallback(e=>v?Ke.top+(1-(Be?.fraction(e)??0))*Ke.height:Ke.left+(Be?.fraction(e)??0)*Ke.width,[v,Ke.left,Ke.top,Ke.width,Ke.height,Be]),tt=Je(Math.min(Math.max(0,je.min),je.max)),nt={plot:Ke,values:ye,visible:he.visible,colors:ke,scale:je,band:qe,horizontal:v,valuePx:Je,categoryPx:Ge,point:Qe,categoryScale:Be,categoryValuePx:et,zeroPx:tt,categories:Me,format:ve,size:ne},at=D?D(nt):W,lt=!1===ee?{mode:"none"}:!0===ee||void 0===ee?{}:ee,it=lt.mode??(D?"item":"index"),rt=null===xe?null:at[xe]??null,st=D?rt?rt.index:null:me,ot=D?at.length:we,ct=()=>{fe(null),pe(null),be(null)},dt=e=>{const t=null===e?null:Math.min(ot-1,Math.max(0,e));D?pe(t):fe(t)},ut=e=>{be(null);dt(((D?xe:me)??(e>0?-1:ot))+e)},ht=null===st?[]:t.flatMap((e,t)=>{if(!he.visible[t]||rt&&rt.series!==t)return[];const n=ye[t]?.[st];return n&&null!==n.value?[{seriesIndex:t,name:e.name,color:n.color??ke[t],value:n.value,formatted:ve(n.value),label:n.label}]:[]}),mt=rt&&K?K(rt):null,ft=mt?mt.items:"item"===it&&ht.length>1&&null!==ge?[ht.reduce((e,t)=>Math.abs(Je(t.value??0)-ge)<Math.abs(Je(e.value??0)-ge)?t:e)]:ht,xt=rt?ye[rt.series]?.[rt.index]?.x??l?.[rt.index]??rt.index:void 0,pt=rt?rt.x:v?Je(ft[0]?.value??0):Ke.left+Ge(st??0),gt=rt?rt.y:v?Ke.top+Ge(st??0):Ke.top,bt=rt?(rt.x-Ke.left)/Math.max(1,Ke.width)>.6:(v?je.fraction(ft[0]?.value??0):Ge(st??0)/Math.max(1,Ue))>.6,vt=!1===Q?{interactive:!1}:!0===Q||void 0===Q?{}:Q,yt=!0===Q||!1!==Q&&t.length>1,kt=vt.side??"bottom",wt={...nt,hovered:he.hovered,activeIndex:st,marks:at,activeMark:rt},Mt=0===we||null===ze||"value"===V&&null===We;return e($,{...se,size:ne,variant:ae,padded:le,className:ie,legendSide:kt,legend:yt?e(H,{series:t,colors:ke,options:vt,visibility:he,size:ne,swatch:Z,values:vt.showValue&&null!==st?t.map((e,t)=>{const n=ye[t]?.[st]?.value;return null==n?void 0:ve(n)}):void 0}):null,table:Mt?null:Y?.(ue)??e(T,{id:ue,caption:J,corner:Pe?.label,categories:Me,series:t,values:ye,format:ve,locale:G}),children:n("div",{ref:oe,role:"img",tabIndex:Mt?void 0:0,"aria-label":J,"aria-describedby":Mt?void 0:ue,onPointerMove:e=>{"none"!==it&&(D?pe(((e,t)=>{const n=oe.current;if(!n||0===at.length)return null;const a=n.getBoundingClientRect(),l=e-a.left,i=t-a.top;let r=null,s=1/0,o=1/0;return at.forEach((e,t)=>{const n=Math.hypot(e.x-l,e.y-i),a=void 0===e.rx?Math.max(0,n-e.r):Math.hypot(Math.max(0,Math.abs(e.x-l)-e.rx),Math.max(0,Math.abs(e.y-i)-(e.ry??e.rx)));a<=X&&(a<s||a===s&&n<o)&&(s=a,o=n,r=t)}),r})(e.clientX,e.clientY)):fe(((e,t)=>{const n=oe.current;if(!n||0===we)return null;const a=n.getBoundingClientRect(),l=v?t-a.top-Ke.top:e-a.left-Ke.left;if(l<-qe.step||l>Ue+qe.step)return null;const i=F?we<=1?0:Math.round(l/Ue*(we-1)):Math.floor(l/qe.step);return Math.min(we-1,Math.max(0,i))})(e.clientX,e.clientY)),"item"===it&&be(((e,t)=>{const n=oe.current;if(!n)return null;const a=n.getBoundingClientRect();return v?e-a.left:t-a.top})(e.clientX,e.clientY)))},onPointerLeave:ct,onKeyDown:"none"===it?void 0:e=>{const t=v?"ArrowDown":"ArrowRight",n=v?"ArrowUp":"ArrowLeft";if(e.key===t)ut(1);else if(e.key===n)ut(-1);else if("Home"===e.key)dt(0);else if("End"===e.key)dt(ot-1);else{if("Escape"!==e.key)return;ct()}e.preventDefault()},onBlur:ct,className:S("relative w-full","rounded-(--neba-radius-xs)","focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2"),style:{height:Se??U},children:[Mt?e("div",{className:S("flex h-full items-center justify-center text-(--neba-muted-fg)",C[ne]),children:te??de.title}):ce>0?n("svg",{width:ce,height:Oe||"100%",viewBox:`0 0 ${ce} ${Oe}`,"aria-hidden":"true",className:"block overflow-visible",children:[e(L,{plot:Ke,scale:je,band:qe,horizontal:v,inset:F,categoryPx:Ge,valuePx:Je,tickTexts:Re,categoryTexts:Te,categoryScale:Be,categoryValuePx:et,valueAxis:Ae,categoryAxis:Pe,fontSize:Ce,zeroPx:tt}),null===st||D||"index"!==it||!1===lt.crosshair?null:(()=>{const t=Ge(st);return e("line",v?{x1:Ke.left,x2:Ke.left+Ke.width,y1:Ke.top+t,y2:Ke.top+t,stroke:"var(--neba-chart-baseline)",strokeWidth:1}:{x1:Ke.left+t,x2:Ke.left+t,y1:Ke.top,y2:Ke.top+Ke.height,stroke:"var(--neba-chart-baseline)",strokeWidth:1})})(),re(wt)]}):null,null!==st&&ft.length>0&&"none"!==it?lt.render?e("div",{className:"pointer-events-none absolute z-10",style:bt?{right:`calc(100% - ${pt}px + 10px)`,top:gt}:{left:pt+10,top:gt},children:lt.render({index:st,category:xt??Me[st],items:ft})}):e(_,{heading:mt?mt.heading:m(xt??Me[st],G),items:ft,x:pt,y:gt,flip:bt,size:ne}):null]})})}function L({plot:a,scale:l,horizontal:i,categoryPx:r,valuePx:s,tickTexts:o,categoryTexts:c,categoryScale:d,categoryValuePx:u,valueAxis:m,categoryAxis:f,fontSize:x,zeroPx:p}){const y=!1!==m?.grid&&!m?.hidden,k=!f?.hidden&&(f?.grid??null!==d),w=e=>d?u(d.ticks[e]):(i?a.top:a.left)+r(e),M=v(c.length,i?a.height:a.width,i?1.8*x:Math.max(...c.map(e=>b(e,x)),1)+12),N=v(l.ticks.length,i?a.width:a.height,i?Math.max(...o.map(e=>b(e,x)),1)+16:2*x),z=c.length>1?Math.abs(w(1)-w(0)):a.width,S=l.ticks.length>1?Math.abs(s(l.ticks[1])-s(l.ticks[0])):a.height,C=h(c.length,M,z,i?1.8*x:b(c[c.length-1]??"",x)),A=h(l.ticks.length,N,S,i?b(o[o.length-1]??"",x):1.6*x);return n("g",{children:[l.ticks.map((t,r)=>{const c=s(t),d=Math.abs(t)<1e-9;return n("g",{children:[y?e("line",i?{x1:c,x2:c,y1:a.top,y2:a.top+a.height,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:c,y2:c,stroke:d?"var(--neba-chart-baseline)":"var(--neba-chart-grid)",strokeWidth:1}):null,m?.hidden||!g(r,l.ticks.length,N,A)?null:e("text",i?{x:c,y:a.top+a.height+x+6,textAnchor:0===r?"start":r===l.ticks.length-1?"end":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]}:{x:a.left-8,y:c,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:"tabular-nums",children:o[r]})]},t)}),f?.hidden?null:n(t,{children:[e("line",i?{x1:p,x2:p,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-axis)",strokeWidth:1}:{x1:a.left,x2:a.left+a.width,y1:p,y2:p,stroke:"var(--neba-chart-axis)",strokeWidth:1}),c.map((t,l)=>{const r=w(l),s=g(l,c.length,M,C);return i?s?e("text",{x:a.left-8,y:r,textAnchor:"end",dominantBaseline:"central",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t},l):null:n("g",{children:[k?e("line",{x1:r,x2:r,y1:a.top,y2:a.top+a.height,stroke:"var(--neba-chart-grid)",strokeWidth:1}):null,s?e("text",{x:r,y:a.top+a.height+x+6,textAnchor:d?0===l?"start":l===c.length-1?"end":"middle":"middle",fontSize:x,fill:"var(--neba-muted-fg)",className:d?"tabular-nums":void 0,children:t}):null]},l)})]}),m?.label?e("text",{x:i?a.left+a.width:a.left,y:i?a.top+a.height+2*x+12:a.top-8,textAnchor:i?"end":"start",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:m.label}):null,f?.label&&!i?e("text",{x:a.left+a.width,y:a.top+a.height+2*x+12,textAnchor:"end",fontSize:x,fill:"var(--neba-muted-fg)",fontWeight:500,children:f.label}):null]})}export{T as ChartDataTable,H as ChartLegendBar,I as ChartScaleLegend,$ as ChartSurface,_ as ChartTooltipPanel,B as useMeasuredWidth,R as useVisibility};
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* the thing that makes it a sparkline.
|
|
14
14
|
*/
|
|
15
15
|
import * as React from 'react';
|
|
16
|
-
import type { CartesianContext } from './chart-frame';
|
|
17
|
-
import type { NebaChartCurve, NebaChartValueLabels } from '../types';
|
|
16
|
+
import type { CartesianContext } from './chart-frame.js';
|
|
17
|
+
import type { NebaChartCurve, NebaChartValueLabels } from '../types.js';
|
|
18
18
|
/** Whether a point gets a dot on it. */
|
|
19
19
|
export type ChartMarkers = 'none' | 'auto' | 'all';
|
|
20
20
|
export interface LineSeriesProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as l,jsxs as e}from"react/jsx-runtime";import{areaPath as t,chartFontSizes as r,linePath as n,lineWidths as o,markerRadii as a,markGap as i}from"./chart";export function LineSeries({context:
|
|
1
|
+
import{jsx as l,jsxs as e}from"react/jsx-runtime";import{areaPath as t,chartFontSizes as r,linePath as n,lineWidths as o,markerRadii as a,markGap as i}from"./chart.js";export function LineSeries({context:s,curve:u,filled:f,stacked:c,markers:p,valueLabels:d,connectNulls:x,gradient:h,idPrefix:m}){const{values:v,visible:k,colors:$,hovered:b,activeIndex:y,plot:g,point:j,zeroPx:C,size:L,format:W}=s,z=o[L],B=a[L],E=k.indexOf(!0),G=[],M=[];return v.forEach((l,e)=>{const t=l.map((l,e)=>M[e]??0);G.push(t),c&&k[e]&&l.forEach((l,e)=>{M[e]=(M[e]??0)+(l.value??0)})}),e("g",{children:[e("defs",{children:[h?$.map((t,r)=>e("linearGradient",{id:`${m}-stroke-${r}`,x1:"0",y1:"0",x2:"1",y2:"0",children:[l("stop",{offset:"0%",stopColor:`color-mix(in oklab, ${t} 45%, transparent)`}),l("stop",{offset:"100%",stopColor:t})]},`stroke-${r}`)):null,f&&!c?$.map((t,r)=>e("linearGradient",{id:`${m}-fill-${r}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[l("stop",{offset:"0%",stopColor:`color-mix(in oklab, ${t} 28%, transparent)`}),l("stop",{offset:"100%",stopColor:`color-mix(in oklab, ${t} 2%, transparent)`})]},`fill-${r}`)):null]}),v.map((o,a)=>{if(!k[a])return null;const s=$[a],v=null!==b&&b!==a,M=o.map((l,e)=>{if(null===l.value)return null;const t=c?G[a][e]+l.value:l.value;return j(e,t)}),N=x?M.filter(Boolean):M,P=o.map((l,e)=>null===l.value?null:c?j(e,G[a][e]):{x:j(e,l.value).x,y:C}),S=f&&c,w=function(l,e){if("all"===e)return()=>!0;if("last"===e){let e=-1;for(let t=l.length-1;t>=0;t--)if(null!==l[t].value){e=t;break}return l=>l===e}let t=1/0,r=-1/0;for(const e of l)null!==e.value&&(t=Math.min(t,e.value),r=Math.max(r,e.value));return e=>{const n=l[e].value;return null!==n&&(n===t||n===r)}}(o,d);return e("g",{opacity:v?.28:1,children:[f?l("path",{d:t(N,x?P.filter(Boolean):P,u),fill:c?`color-mix(in oklab, ${s} 70%, transparent)`:`url(#${m}-fill-${a})`,stroke:"none"}):null,S&&a!==E?l("path",{d:n(x?P.filter(Boolean):P,u),fill:"none",stroke:"var(--neba-chart-gap)",strokeWidth:i}):null,S?null:l("path",{d:n(N,u),fill:"none",stroke:h?`url(#${m}-stroke-${a})`:s,strokeWidth:z,strokeLinecap:"round",strokeLinejoin:"round"}),M.map((e,t)=>{if(!e)return null;return"all"===p||"auto"===p&&o.length<=14||t===y?l("circle",{cx:e.x,cy:e.y,r:t===y?B+1:B,fill:o[t].color??s,stroke:"var(--neba-chart-gap)",strokeWidth:i},t):null}),"none"===d?null:M.map((e,t)=>{const n=o[t].value;return e&&null!==n&&w(t)?l("text",{x:e.x,y:e.y-B-5,textAnchor:e.x>g.left+g.width-24?"end":e.x<g.left+24?"start":"middle",fontSize:r[L],fontWeight:500,fill:"var(--neba-fg)",className:"tabular-nums",children:o[t].label??W(n)},`label-${t}`):null})]},a)})]})}
|