@plenustech/design-system 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/actions/ButtonTile/ButtonTile.cjs +2 -0
- package/dist/components/actions/ButtonTile/ButtonTile.cjs.map +1 -0
- package/dist/components/actions/ButtonTile/ButtonTile.js +23 -0
- package/dist/components/actions/ButtonTile/ButtonTile.js.map +1 -0
- package/dist/components/actions/ButtonTile/ButtonTile.module.css.cjs +2 -0
- package/dist/components/actions/ButtonTile/ButtonTile.module.css.cjs.map +1 -0
- package/dist/components/actions/ButtonTile/ButtonTile.module.css.js +16 -0
- package/dist/components/actions/ButtonTile/ButtonTile.module.css.js.map +1 -0
- package/dist/components/actions/Toolbar/Toolbar.cjs +2 -0
- package/dist/components/actions/Toolbar/Toolbar.cjs.map +1 -0
- package/dist/components/actions/Toolbar/Toolbar.js +118 -0
- package/dist/components/actions/Toolbar/Toolbar.js.map +1 -0
- package/dist/components/actions/Toolbar/Toolbar.module.css.cjs +2 -0
- package/dist/components/actions/Toolbar/Toolbar.module.css.cjs.map +1 -0
- package/dist/components/actions/Toolbar/Toolbar.module.css.js +20 -0
- package/dist/components/actions/Toolbar/Toolbar.module.css.js.map +1 -0
- package/dist/components/charts/ChartArea/ChartArea.cjs +1 -1
- package/dist/components/charts/ChartArea/ChartArea.cjs.map +1 -1
- package/dist/components/charts/ChartArea/ChartArea.js +196 -148
- package/dist/components/charts/ChartArea/ChartArea.js.map +1 -1
- package/dist/components/charts/ChartArea/ChartArea.module.css.cjs +1 -1
- package/dist/components/charts/ChartArea/ChartArea.module.css.js +12 -10
- package/dist/components/charts/ChartArea/ChartArea.module.css.js.map +1 -1
- package/dist/components/charts/ChartBar/ChartBar.cjs +1 -1
- package/dist/components/charts/ChartBar/ChartBar.cjs.map +1 -1
- package/dist/components/charts/ChartBar/ChartBar.js +168 -145
- package/dist/components/charts/ChartBar/ChartBar.js.map +1 -1
- package/dist/components/charts/ChartBar/ChartBar.module.css.cjs +1 -1
- package/dist/components/charts/ChartBar/ChartBar.module.css.js +12 -10
- package/dist/components/charts/ChartBar/ChartBar.module.css.js.map +1 -1
- package/dist/components/charts/ChartCombo/ChartCombo.cjs +1 -1
- package/dist/components/charts/ChartCombo/ChartCombo.cjs.map +1 -1
- package/dist/components/charts/ChartCombo/ChartCombo.js +179 -154
- package/dist/components/charts/ChartCombo/ChartCombo.js.map +1 -1
- package/dist/components/charts/ChartCombo/ChartCombo.module.css.cjs +1 -1
- package/dist/components/charts/ChartCombo/ChartCombo.module.css.js +16 -14
- package/dist/components/charts/ChartCombo/ChartCombo.module.css.js.map +1 -1
- package/dist/components/charts/ChartDonut/ChartDonut.cjs +1 -1
- package/dist/components/charts/ChartDonut/ChartDonut.cjs.map +1 -1
- package/dist/components/charts/ChartDonut/ChartDonut.js +72 -61
- package/dist/components/charts/ChartDonut/ChartDonut.js.map +1 -1
- package/dist/components/charts/ChartLine/ChartLine.cjs +1 -1
- package/dist/components/charts/ChartLine/ChartLine.cjs.map +1 -1
- package/dist/components/charts/ChartLine/ChartLine.js +196 -143
- package/dist/components/charts/ChartLine/ChartLine.js.map +1 -1
- package/dist/components/charts/ChartLine/ChartLine.module.css.cjs +1 -1
- package/dist/components/charts/ChartLine/ChartLine.module.css.js +16 -14
- package/dist/components/charts/ChartLine/ChartLine.module.css.js.map +1 -1
- package/dist/components/charts/ChartPie/ChartPie.cjs +1 -1
- package/dist/components/charts/ChartPie/ChartPie.cjs.map +1 -1
- package/dist/components/charts/ChartPie/ChartPie.js +71 -60
- package/dist/components/charts/ChartPie/ChartPie.js.map +1 -1
- package/dist/components/charts/ChartRadial/ChartRadial.cjs +1 -1
- package/dist/components/charts/ChartRadial/ChartRadial.cjs.map +1 -1
- package/dist/components/charts/ChartRadial/ChartRadial.js +101 -84
- package/dist/components/charts/ChartRadial/ChartRadial.js.map +1 -1
- package/dist/components/charts/ChartSankey/ChartSankey.cjs +1 -1
- package/dist/components/charts/ChartSankey/ChartSankey.cjs.map +1 -1
- package/dist/components/charts/ChartSankey/ChartSankey.js +148 -125
- package/dist/components/charts/ChartSankey/ChartSankey.js.map +1 -1
- package/dist/components/charts/ChartScatter/ChartScatter.cjs +1 -1
- package/dist/components/charts/ChartScatter/ChartScatter.cjs.map +1 -1
- package/dist/components/charts/ChartScatter/ChartScatter.js +138 -106
- package/dist/components/charts/ChartScatter/ChartScatter.js.map +1 -1
- package/dist/components/charts/ChartScatter/ChartScatter.module.css.cjs +1 -1
- package/dist/components/charts/ChartScatter/ChartScatter.module.css.js +3 -3
- package/dist/components/charts/ChartSunburst/ChartSunburst.cjs +1 -1
- package/dist/components/charts/ChartSunburst/ChartSunburst.cjs.map +1 -1
- package/dist/components/charts/ChartSunburst/ChartSunburst.js +115 -100
- package/dist/components/charts/ChartSunburst/ChartSunburst.js.map +1 -1
- package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +1 -1
- package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -1
- package/dist/components/charts/ChartTooltip/ChartTooltip.js +1 -1
- package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -1
- package/dist/components/charts/ChartTreemap/ChartTreemap.cjs +1 -1
- package/dist/components/charts/ChartTreemap/ChartTreemap.cjs.map +1 -1
- package/dist/components/charts/ChartTreemap/ChartTreemap.js +100 -89
- package/dist/components/charts/ChartTreemap/ChartTreemap.js.map +1 -1
- package/dist/components/charts/ChartWaterfall/ChartWaterfall.cjs +1 -1
- package/dist/components/charts/ChartWaterfall/ChartWaterfall.cjs.map +1 -1
- package/dist/components/charts/ChartWaterfall/ChartWaterfall.js +125 -105
- package/dist/components/charts/ChartWaterfall/ChartWaterfall.js.map +1 -1
- package/dist/components/charts/ChartWaterfall/ChartWaterfall.module.css.cjs +1 -1
- package/dist/components/charts/ChartWaterfall/ChartWaterfall.module.css.js +8 -6
- package/dist/components/charts/ChartWaterfall/ChartWaterfall.module.css.js.map +1 -1
- package/dist/components/charts/core/CartesianFrame.cjs +1 -1
- package/dist/components/charts/core/CartesianFrame.cjs.map +1 -1
- package/dist/components/charts/core/CartesianFrame.js +61 -96
- package/dist/components/charts/core/CartesianFrame.js.map +1 -1
- package/dist/components/charts/core/Chart.module.css.cjs +1 -1
- package/dist/components/charts/core/Chart.module.css.js +52 -54
- package/dist/components/charts/core/Chart.module.css.js.map +1 -1
- package/dist/components/charts/core/ChartFrame.cjs +1 -1
- package/dist/components/charts/core/ChartFrame.cjs.map +1 -1
- package/dist/components/charts/core/ChartFrame.js +53 -47
- package/dist/components/charts/core/ChartFrame.js.map +1 -1
- package/dist/components/charts/core/PointBands.cjs +2 -0
- package/dist/components/charts/core/PointBands.cjs.map +1 -0
- package/dist/components/charts/core/PointBands.js +41 -0
- package/dist/components/charts/core/PointBands.js.map +1 -0
- package/dist/components/charts/core/cartesianLayout.cjs +1 -1
- package/dist/components/charts/core/cartesianLayout.cjs.map +1 -1
- package/dist/components/charts/core/cartesianLayout.js +49 -41
- package/dist/components/charts/core/cartesianLayout.js.map +1 -1
- package/dist/components/charts/core/hoverPath.cjs +2 -0
- package/dist/components/charts/core/hoverPath.cjs.map +1 -0
- package/dist/components/charts/core/hoverPath.js +7 -0
- package/dist/components/charts/core/hoverPath.js.map +1 -0
- package/dist/components/charts/core/pointLabels.cjs +2 -0
- package/dist/components/charts/core/pointLabels.cjs.map +1 -0
- package/dist/components/charts/core/pointLabels.js +12 -0
- package/dist/components/charts/core/pointLabels.js.map +1 -0
- package/dist/components/charts/core/tooltips.cjs +2 -0
- package/dist/components/charts/core/tooltips.cjs.map +1 -0
- package/dist/components/charts/core/tooltips.js +48 -0
- package/dist/components/charts/core/tooltips.js.map +1 -0
- package/dist/components/charts/core/useCartesianLayout.cjs +2 -0
- package/dist/components/charts/core/useCartesianLayout.cjs.map +1 -0
- package/dist/components/charts/core/useCartesianLayout.js +38 -0
- package/dist/components/charts/core/useCartesianLayout.js.map +1 -0
- package/dist/components/charts/core/useSeriesToggle.cjs +1 -1
- package/dist/components/charts/core/useSeriesToggle.cjs.map +1 -1
- package/dist/components/charts/core/useSeriesToggle.js +19 -12
- package/dist/components/charts/core/useSeriesToggle.js.map +1 -1
- package/dist/components/data-display/Accordion/Accordion.cjs +1 -1
- package/dist/components/data-display/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/data-display/Accordion/Accordion.js +56 -46
- package/dist/components/data-display/Accordion/Accordion.js.map +1 -1
- package/dist/components/data-display/Accordion/Accordion.module.css.cjs +1 -1
- package/dist/components/data-display/Accordion/Accordion.module.css.js +16 -16
- package/dist/components/data-display/SortableList/SortableList.cjs +2 -0
- package/dist/components/data-display/SortableList/SortableList.cjs.map +1 -0
- package/dist/components/data-display/SortableList/SortableList.js +168 -0
- package/dist/components/data-display/SortableList/SortableList.js.map +1 -0
- package/dist/components/data-display/SortableList/SortableList.module.css.cjs +2 -0
- package/dist/components/data-display/SortableList/SortableList.module.css.cjs.map +1 -0
- package/dist/components/data-display/SortableList/SortableList.module.css.js +34 -0
- package/dist/components/data-display/SortableList/SortableList.module.css.js.map +1 -0
- package/dist/components/data-display/Table/Table.cjs +1 -1
- package/dist/components/data-display/Table/Table.cjs.map +1 -1
- package/dist/components/data-display/Table/Table.js +86 -85
- package/dist/components/data-display/Table/Table.js.map +1 -1
- package/dist/components/data-display/Table/Table.module.css.cjs +1 -1
- package/dist/components/data-display/Table/Table.module.css.js +50 -51
- package/dist/components/data-display/Table/Table.module.css.js.map +1 -1
- package/dist/components/data-display/Tag/Tag.cjs +2 -0
- package/dist/components/data-display/Tag/Tag.cjs.map +1 -0
- package/dist/components/data-display/Tag/Tag.js +50 -0
- package/dist/components/data-display/Tag/Tag.js.map +1 -0
- package/dist/components/data-display/Tag/Tag.module.css.cjs +2 -0
- package/dist/components/data-display/Tag/Tag.module.css.cjs.map +1 -0
- package/dist/components/data-display/Tag/Tag.module.css.js +22 -0
- package/dist/components/data-display/Tag/Tag.module.css.js.map +1 -0
- package/dist/components/data-display/Timeline/Timeline.cjs +2 -0
- package/dist/components/data-display/Timeline/Timeline.cjs.map +1 -0
- package/dist/components/data-display/Timeline/Timeline.js +31 -0
- package/dist/components/data-display/Timeline/Timeline.js.map +1 -0
- package/dist/components/data-display/Timeline/Timeline.module.css.cjs +2 -0
- package/dist/components/data-display/Timeline/Timeline.module.css.cjs.map +1 -0
- package/dist/components/data-display/Timeline/Timeline.module.css.js +30 -0
- package/dist/components/data-display/Timeline/Timeline.module.css.js.map +1 -0
- package/dist/components/feedback/Skeleton/Skeleton.cjs +2 -0
- package/dist/components/feedback/Skeleton/Skeleton.cjs.map +1 -0
- package/dist/components/feedback/Skeleton/Skeleton.js +17 -0
- package/dist/components/feedback/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/feedback/Skeleton/Skeleton.module.css.cjs +2 -0
- package/dist/components/feedback/Skeleton/Skeleton.module.css.cjs.map +1 -0
- package/dist/components/feedback/Skeleton/Skeleton.module.css.js +15 -0
- package/dist/components/feedback/Skeleton/Skeleton.module.css.js.map +1 -0
- package/dist/components/feedback/Toast/Toast.module.css.cjs +2 -0
- package/dist/components/feedback/Toast/Toast.module.css.cjs.map +1 -0
- package/dist/components/feedback/Toast/Toast.module.css.js +31 -0
- package/dist/components/feedback/Toast/Toast.module.css.js.map +1 -0
- package/dist/components/feedback/Toast/ToastRegion.cjs +2 -0
- package/dist/components/feedback/Toast/ToastRegion.cjs.map +1 -0
- package/dist/components/feedback/Toast/ToastRegion.js +62 -0
- package/dist/components/feedback/Toast/ToastRegion.js.map +1 -0
- package/dist/components/feedback/Toast/toastStore.cjs +2 -0
- package/dist/components/feedback/Toast/toastStore.cjs.map +1 -0
- package/dist/components/feedback/Toast/toastStore.js +33 -0
- package/dist/components/feedback/Toast/toastStore.js.map +1 -0
- package/dist/components/forms/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/forms/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/forms/Checkbox/Checkbox.js +43 -31
- package/dist/components/forms/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/forms/Checkbox/Checkbox.module.css.cjs +1 -1
- package/dist/components/forms/Checkbox/Checkbox.module.css.js +1 -1
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.cjs +2 -0
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.cjs.map +1 -0
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.js +54 -0
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.module.css.cjs +2 -0
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.module.css.cjs.map +1 -0
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.module.css.js +22 -0
- package/dist/components/forms/CheckboxGroup/CheckboxGroup.module.css.js.map +1 -0
- package/dist/components/forms/ColorPicker/ColorPicker.cjs +2 -0
- package/dist/components/forms/ColorPicker/ColorPicker.cjs.map +1 -0
- package/dist/components/forms/ColorPicker/ColorPicker.js +57 -0
- package/dist/components/forms/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/components/forms/ColorPicker/ColorPicker.module.css.cjs +2 -0
- package/dist/components/forms/ColorPicker/ColorPicker.module.css.cjs.map +1 -0
- package/dist/components/forms/ColorPicker/ColorPicker.module.css.js +22 -0
- package/dist/components/forms/ColorPicker/ColorPicker.module.css.js.map +1 -0
- package/dist/components/forms/ComboBox/ComboBox.module.css.cjs +1 -1
- package/dist/components/forms/ComboBox/ComboBox.module.css.js +20 -20
- package/dist/components/forms/Field/Field.cjs +1 -1
- package/dist/components/forms/Field/Field.cjs.map +1 -1
- package/dist/components/forms/Field/Field.js +21 -20
- package/dist/components/forms/Field/Field.js.map +1 -1
- package/dist/components/forms/Field/Field.module.css.cjs +1 -1
- package/dist/components/forms/Field/Field.module.css.js +18 -12
- package/dist/components/forms/Field/Field.module.css.js.map +1 -1
- package/dist/components/forms/FileUpload/FileUpload.cjs +2 -0
- package/dist/components/forms/FileUpload/FileUpload.cjs.map +1 -0
- package/dist/components/forms/FileUpload/FileUpload.js +142 -0
- package/dist/components/forms/FileUpload/FileUpload.js.map +1 -0
- package/dist/components/forms/FileUpload/FileUpload.module.css.cjs +2 -0
- package/dist/components/forms/FileUpload/FileUpload.module.css.cjs.map +1 -0
- package/dist/components/forms/FileUpload/FileUpload.module.css.js +46 -0
- package/dist/components/forms/FileUpload/FileUpload.module.css.js.map +1 -0
- package/dist/components/forms/InputPassword/InputPassword.module.css.cjs +1 -1
- package/dist/components/forms/InputPassword/InputPassword.module.css.js +12 -12
- package/dist/components/forms/InputText/InputText.cjs +1 -1
- package/dist/components/forms/InputText/InputText.cjs.map +1 -1
- package/dist/components/forms/InputText/InputText.js +55 -47
- package/dist/components/forms/InputText/InputText.js.map +1 -1
- package/dist/components/forms/InputText/InputText.module.css.cjs +1 -1
- package/dist/components/forms/InputText/InputText.module.css.js +10 -10
- package/dist/components/forms/RadioGroup/RadioGroup.module.css.cjs +1 -1
- package/dist/components/forms/RadioGroup/RadioGroup.module.css.js +4 -4
- package/dist/components/forms/SegmentedControl/SegmentedControl.cjs +2 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.cjs.map +1 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.js +52 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.js.map +1 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.cjs +2 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.cjs.map +1 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.js +22 -0
- package/dist/components/forms/SegmentedControl/SegmentedControl.module.css.js.map +1 -0
- package/dist/components/forms/Select/Select.module.css.cjs +1 -1
- package/dist/components/forms/Select/Select.module.css.js +13 -13
- package/dist/components/forms/Switch/Switch.module.css.cjs +1 -1
- package/dist/components/forms/Switch/Switch.module.css.js +2 -2
- package/dist/components/icons/icons.cjs +1 -1
- package/dist/components/icons/icons.cjs.map +1 -1
- package/dist/components/icons/icons.js +198 -40
- package/dist/components/icons/icons.js.map +1 -1
- package/dist/components/navigation/SkipLink/SkipLink.cjs +2 -0
- package/dist/components/navigation/SkipLink/SkipLink.cjs.map +1 -0
- package/dist/components/navigation/SkipLink/SkipLink.js +9 -0
- package/dist/components/navigation/SkipLink/SkipLink.js.map +1 -0
- package/dist/components/navigation/SkipLink/SkipLink.module.css.cjs +2 -0
- package/dist/components/navigation/SkipLink/SkipLink.module.css.cjs.map +1 -0
- package/dist/components/navigation/SkipLink/SkipLink.module.css.js +8 -0
- package/dist/components/navigation/SkipLink/SkipLink.module.css.js.map +1 -0
- package/dist/components/navigation/Steps/Steps.cjs +2 -0
- package/dist/components/navigation/Steps/Steps.cjs.map +1 -0
- package/dist/components/navigation/Steps/Steps.js +30 -0
- package/dist/components/navigation/Steps/Steps.js.map +1 -0
- package/dist/components/navigation/Steps/Steps.module.css.cjs +2 -0
- package/dist/components/navigation/Steps/Steps.module.css.cjs.map +1 -0
- package/dist/components/navigation/Steps/Steps.module.css.js +26 -0
- package/dist/components/navigation/Steps/Steps.module.css.js.map +1 -0
- package/dist/components/navigation/Tabs/Tabs.cjs +1 -1
- package/dist/components/navigation/Tabs/Tabs.cjs.map +1 -1
- package/dist/components/navigation/Tabs/Tabs.js +88 -79
- package/dist/components/navigation/Tabs/Tabs.js.map +1 -1
- package/dist/components/navigation/Tabs/Tabs.module.css.cjs +1 -1
- package/dist/components/navigation/Tabs/Tabs.module.css.js +18 -14
- package/dist/components/navigation/Tabs/Tabs.module.css.js.map +1 -1
- package/dist/components/overlays/Dialog/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog/Dialog.js +11 -58
- package/dist/components/overlays/Dialog/Dialog.js.map +1 -1
- package/dist/components/overlays/Dialog/DialogFrame.cjs +2 -0
- package/dist/components/overlays/Dialog/DialogFrame.cjs.map +1 -0
- package/dist/components/overlays/Dialog/DialogFrame.js +65 -0
- package/dist/components/overlays/Dialog/DialogFrame.js.map +1 -0
- package/dist/components/overlays/Drawer/Drawer.cjs +2 -0
- package/dist/components/overlays/Drawer/Drawer.cjs.map +1 -0
- package/dist/components/overlays/Drawer/Drawer.js +17 -0
- package/dist/components/overlays/Drawer/Drawer.js.map +1 -0
- package/dist/components/overlays/Drawer/Drawer.module.css.cjs +2 -0
- package/dist/components/overlays/Drawer/Drawer.module.css.cjs.map +1 -0
- package/dist/components/overlays/Drawer/Drawer.module.css.js +23 -0
- package/dist/components/overlays/Drawer/Drawer.module.css.js.map +1 -0
- package/dist/components/overlays/Menu/Menu.cjs +1 -1
- package/dist/components/overlays/Menu/Menu.cjs.map +1 -1
- package/dist/components/overlays/Menu/Menu.js +105 -86
- package/dist/components/overlays/Menu/Menu.js.map +1 -1
- package/dist/components/overlays/Menu/Menu.module.css.cjs +1 -1
- package/dist/components/overlays/Menu/Menu.module.css.js +24 -6
- package/dist/components/overlays/Menu/Menu.module.css.js.map +1 -1
- package/dist/design-system.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +184 -122
- package/dist/index.js.map +1 -1
- package/dist/types/components/actions/ButtonTile/ButtonTile.d.ts +14 -0
- package/dist/types/components/actions/ButtonTile/index.d.ts +2 -0
- package/dist/types/components/actions/Toolbar/Toolbar.d.ts +27 -0
- package/dist/types/components/actions/Toolbar/index.d.ts +2 -0
- package/dist/types/components/charts/ChartArea/ChartArea.d.ts +15 -4
- package/dist/types/components/charts/ChartBar/ChartBar.d.ts +11 -4
- package/dist/types/components/charts/ChartCombo/ChartCombo.d.ts +16 -4
- package/dist/types/components/charts/ChartDonut/ChartDonut.d.ts +5 -1
- package/dist/types/components/charts/ChartLine/ChartLine.d.ts +15 -4
- package/dist/types/components/charts/ChartPie/ChartPie.d.ts +5 -1
- package/dist/types/components/charts/ChartRadial/ChartRadial.d.ts +5 -1
- package/dist/types/components/charts/ChartSankey/ChartSankey.d.ts +5 -1
- package/dist/types/components/charts/ChartScatter/ChartScatter.d.ts +7 -1
- package/dist/types/components/charts/ChartSunburst/ChartSunburst.d.ts +11 -2
- package/dist/types/components/charts/ChartTooltip/ChartTooltip.d.ts +2 -0
- package/dist/types/components/charts/ChartTreemap/ChartTreemap.d.ts +11 -2
- package/dist/types/components/charts/ChartWaterfall/ChartWaterfall.d.ts +8 -3
- package/dist/types/components/charts/core/CartesianFrame.d.ts +6 -1
- package/dist/types/components/charts/core/ChartFrame.d.ts +7 -1
- package/dist/types/components/charts/core/PointBands.d.ts +22 -0
- package/dist/types/components/charts/core/cartesianLayout.d.ts +10 -4
- package/dist/types/components/charts/core/hoverPath.d.ts +10 -0
- package/dist/types/components/charts/core/index.d.ts +13 -3
- package/dist/types/components/charts/core/pointLabels.d.ts +13 -0
- package/dist/types/components/charts/core/tooltips.d.ts +49 -0
- package/dist/types/components/charts/core/useCartesianLayout.d.ts +20 -0
- package/dist/types/components/charts/core/useSeriesToggle.d.ts +15 -1
- package/dist/types/components/data-display/Accordion/Accordion.d.ts +6 -1
- package/dist/types/components/data-display/Accordion/index.d.ts +1 -1
- package/dist/types/components/data-display/SortableList/SortableList.d.ts +22 -0
- package/dist/types/components/data-display/SortableList/index.d.ts +2 -0
- package/dist/types/components/data-display/Tag/Tag.d.ts +13 -0
- package/dist/types/components/data-display/Tag/index.d.ts +2 -0
- package/dist/types/components/data-display/Timeline/Timeline.d.ts +15 -0
- package/dist/types/components/data-display/Timeline/index.d.ts +2 -0
- package/dist/types/components/feedback/Skeleton/Skeleton.d.ts +13 -0
- package/dist/types/components/feedback/Skeleton/index.d.ts +2 -0
- package/dist/types/components/feedback/Toast/ToastRegion.d.ts +2 -0
- package/dist/types/components/feedback/Toast/index.d.ts +3 -0
- package/dist/types/components/feedback/Toast/toastStore.d.ts +24 -0
- package/dist/types/components/forms/CheckboxGroup/CheckboxGroup.d.ts +28 -0
- package/dist/types/components/forms/CheckboxGroup/index.d.ts +2 -0
- package/dist/types/components/forms/ColorPicker/ColorPicker.d.ts +26 -0
- package/dist/types/components/forms/ColorPicker/index.d.ts +2 -0
- package/dist/types/components/forms/Field/Field.d.ts +6 -2
- package/dist/types/components/forms/Field/index.d.ts +1 -1
- package/dist/types/components/forms/FileUpload/FileUpload.d.ts +37 -0
- package/dist/types/components/forms/FileUpload/index.d.ts +2 -0
- package/dist/types/components/forms/InputText/InputText.d.ts +4 -2
- package/dist/types/components/forms/SegmentedControl/SegmentedControl.d.ts +23 -0
- package/dist/types/components/forms/SegmentedControl/index.d.ts +2 -0
- package/dist/types/components/icons/icons.d.ts +29 -0
- package/dist/types/components/icons/index.d.ts +1 -1
- package/dist/types/components/navigation/SkipLink/SkipLink.d.ts +7 -0
- package/dist/types/components/navigation/SkipLink/index.d.ts +2 -0
- package/dist/types/components/navigation/Steps/Steps.d.ts +16 -0
- package/dist/types/components/navigation/Steps/index.d.ts +2 -0
- package/dist/types/components/navigation/Tabs/Tabs.d.ts +5 -1
- package/dist/types/components/overlays/Dialog/Dialog.d.ts +2 -2
- package/dist/types/components/overlays/Dialog/DialogFrame.d.ts +7 -0
- package/dist/types/components/overlays/Drawer/Drawer.d.ts +9 -0
- package/dist/types/components/overlays/Drawer/index.d.ts +2 -0
- package/dist/types/components/overlays/Menu/Menu.d.ts +16 -2
- package/dist/types/components/overlays/Menu/index.d.ts +1 -1
- package/dist/types/index.d.ts +35 -7
- package/dist/types/utils/formatters/formatarNumero.d.ts +6 -1
- package/dist/types/utils/formatters/formatarTamanhoDeArquivo.d.ts +7 -0
- package/dist/types/utils/formatters/index.d.ts +3 -1
- package/dist/utils/formatters/formatarNumero.cjs +1 -1
- package/dist/utils/formatters/formatarNumero.cjs.map +1 -1
- package/dist/utils/formatters/formatarNumero.js +42 -17
- package/dist/utils/formatters/formatarNumero.js.map +1 -1
- package/dist/utils/formatters/formatarTamanhoDeArquivo.cjs +2 -0
- package/dist/utils/formatters/formatarTamanhoDeArquivo.cjs.map +1 -0
- package/dist/utils/formatters/formatarTamanhoDeArquivo.js +17 -0
- package/dist/utils/formatters/formatarTamanhoDeArquivo.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import m from "./Chart.module.css.js";
|
|
3
|
+
function M({ onHover: r, onPointerY: t, plot: u, positions: a }) {
|
|
4
|
+
return /* @__PURE__ */ n("g", { children: a.map((h, l) => {
|
|
5
|
+
const s = l === 0 ? 0 : (a[l - 1] + h) / 2, c = l === a.length - 1 ? u.width : (h + a[l + 1]) / 2;
|
|
6
|
+
return /* @__PURE__ */ n(
|
|
7
|
+
"rect",
|
|
8
|
+
{
|
|
9
|
+
className: m.hoverBand,
|
|
10
|
+
height: u.height,
|
|
11
|
+
onMouseEnter: () => r(l),
|
|
12
|
+
onMouseLeave: () => {
|
|
13
|
+
r(null), t == null || t(null);
|
|
14
|
+
},
|
|
15
|
+
onMouseMove: (e) => t == null ? void 0 : t(e.clientY - e.currentTarget.getBoundingClientRect().top),
|
|
16
|
+
width: Math.max(0, c - s),
|
|
17
|
+
x: s,
|
|
18
|
+
y: 0
|
|
19
|
+
},
|
|
20
|
+
l
|
|
21
|
+
);
|
|
22
|
+
}) });
|
|
23
|
+
}
|
|
24
|
+
function y({ plot: r, position: t }) {
|
|
25
|
+
return /* @__PURE__ */ n("line", { className: m.pointCursor, x1: t, x2: t, y1: 0, y2: r.height });
|
|
26
|
+
}
|
|
27
|
+
function B(r, t, u, a) {
|
|
28
|
+
if (t === null || u === null)
|
|
29
|
+
return null;
|
|
30
|
+
let h = null, l = 1 / 0;
|
|
31
|
+
return r.forEach((s, c) => {
|
|
32
|
+
const e = s[t];
|
|
33
|
+
e && !a(c) && Math.abs(e.y - u) < l && (l = Math.abs(e.y - u), h = c);
|
|
34
|
+
}), h;
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
M as PointBands,
|
|
38
|
+
y as PointCursor,
|
|
39
|
+
B as nearestSeriesAt
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=PointBands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointBands.js","sources":["../../../../src/components/charts/core/PointBands.tsx"],"sourcesContent":["import type { ChartPlot } from './cartesianLayout';\nimport type { ChartPoint } from './shapes';\nimport styles from './Chart.module.css';\n\nexport interface PointBandsProps {\n onHover: (index: number | null) => void;\n /** Altura do ponteiro na area de desenho, para quem escolhe a serie mais proxima dele. */\n onPointerY?: (y: number | null) => void;\n plot: ChartPlot;\n /** Posicao de cada categoria no eixo, na ordem das categorias. */\n positions: readonly number[];\n}\n\n/**\n * Faixas invisiveis sobre a area de desenho, uma por categoria, que vao do ponto\n * ate o meio do caminho para cada vizinho: o ponteiro sempre cai no ponto mais proximo.\n */\nexport function PointBands({ onHover, onPointerY, plot, positions }: PointBandsProps) {\n return (\n <g>\n {positions.map((position, index) => {\n const start = index === 0 ? 0 : (positions[index - 1] + position) / 2;\n const end = index === positions.length - 1 ? plot.width : (position + positions[index + 1]) / 2;\n\n return (\n <rect\n className={styles.hoverBand}\n height={plot.height}\n key={index}\n onMouseEnter={() => onHover(index)}\n onMouseLeave={() => {\n onHover(null);\n onPointerY?.(null);\n }}\n onMouseMove={(evento) => onPointerY?.(evento.clientY - evento.currentTarget.getBoundingClientRect().top)}\n width={Math.max(0, end - start)}\n x={start}\n y={0}\n />\n );\n })}\n </g>\n );\n}\n\n/** Guia vertical no ponto sob o ponteiro, atras das marcas. */\nexport function PointCursor({ plot, position }: { plot: ChartPlot; position: number }) {\n return <line className={styles.pointCursor} x1={position} x2={position} y1={0} y2={plot.height} />;\n}\n\n/** A serie visivel com ponto na categoria cujo ponto fica mais perto da altura do ponteiro. */\nexport function nearestSeriesAt(\n pointsBySeries: readonly (readonly (ChartPoint | null)[])[],\n category: number | null,\n y: number | null,\n isHidden: (seriesIndex: number) => boolean,\n) {\n if (category === null || y === null) {\n return null;\n }\n\n let maisPerto: number | null = null;\n let menorDistancia = Infinity;\n\n pointsBySeries.forEach((pontos, indice) => {\n const ponto = pontos[category];\n\n if (ponto && !isHidden(indice) && Math.abs(ponto.y - y) < menorDistancia) {\n menorDistancia = Math.abs(ponto.y - y);\n maisPerto = indice;\n }\n });\n\n return maisPerto;\n}\n"],"names":["PointBands","onHover","onPointerY","plot","positions","position","index","start","end","jsx","styles","evento","PointCursor","nearestSeriesAt","pointsBySeries","category","y","isHidden","maisPerto","menorDistancia","pontos","indice","ponto"],"mappings":";;AAiBO,SAASA,EAAW,EAAE,SAAAC,GAAS,YAAAC,GAAY,MAAAC,GAAM,WAAAC,KAA8B;AACpF,2BACG,KAAA,EACE,UAAAA,EAAU,IAAI,CAACC,GAAUC,MAAU;AAClC,UAAMC,IAAQD,MAAU,IAAI,KAAKF,EAAUE,IAAQ,CAAC,IAAID,KAAY,GAC9DG,IAAMF,MAAUF,EAAU,SAAS,IAAID,EAAK,SAASE,IAAWD,EAAUE,IAAQ,CAAC,KAAK;AAE9F,WACE,gBAAAG;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWC,EAAO;AAAA,QAClB,QAAQP,EAAK;AAAA,QAEb,cAAc,MAAMF,EAAQK,CAAK;AAAA,QACjC,cAAc,MAAM;AAClB,UAAAL,EAAQ,IAAI,GACZC,KAAA,QAAAA,EAAa;AAAA,QACf;AAAA,QACA,aAAa,CAACS,MAAWT,KAAA,gBAAAA,EAAaS,EAAO,UAAUA,EAAO,cAAc,sBAAA,EAAwB;AAAA,QACpG,OAAO,KAAK,IAAI,GAAGH,IAAMD,CAAK;AAAA,QAC9B,GAAGA;AAAA,QACH,GAAG;AAAA,MAAA;AAAA,MATED;AAAA,IAAA;AAAA,EAYX,CAAC,EAAA,CACH;AAEJ;AAGO,SAASM,EAAY,EAAE,MAAAT,GAAM,UAAAE,KAAmD;AACrF,SAAO,gBAAAI,EAAC,QAAA,EAAK,WAAWC,EAAO,aAAa,IAAIL,GAAU,IAAIA,GAAU,IAAI,GAAG,IAAIF,EAAK,QAAQ;AAClG;AAGO,SAASU,EACdC,GACAC,GACAC,GACAC,GACA;AACA,MAAIF,MAAa,QAAQC,MAAM;AAC7B,WAAO;AAGT,MAAIE,IAA2B,MAC3BC,IAAiB;AAErB,SAAAL,EAAe,QAAQ,CAACM,GAAQC,MAAW;AACzC,UAAMC,IAAQF,EAAOL,CAAQ;AAE7B,IAAIO,KAAS,CAACL,EAASI,CAAM,KAAK,KAAK,IAAIC,EAAM,IAAIN,CAAC,IAAIG,MACxDA,IAAiB,KAAK,IAAIG,EAAM,IAAIN,CAAC,GACrCE,IAAYG;AAAA,EAEhB,CAAC,GAEMH;AACT;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./measureText.cjs"),n=require("./spacing.cjs"),E=require("../scales/scales.cjs");function b(t,a){return t==="visible"||t==="onHover"&&a}function d(t,a){return{fillHeight:t==="fill",value:t==="fill"?a:t}}function l(t,a){return t==="visible"||t==="onHover"&&a}function M(t,a,e){return t?u.widestLabel(a,e)+n.CHART_LABEL_OFFSET:0}function T(t,a,e){return t.length===0||e<=0||u.widestLabel(t,a)+n.CHART_LABEL_OFFSET<=e?0:e*Math.SQRT1_2>=a.lineHeight?45:90}function C(t,a,e,r){if(!r)return 0;if(e===0)return a.lineHeight+n.CHART_LABEL_OFFSET;const i=e*Math.PI/180;return u.widestLabel(t,a)*Math.sin(i)+a.lineHeight*Math.cos(i)+n.CHART_LABEL_OFFSET}function p({bottomLabels:t,font:a,height:e,labelAngle:r,leftLabels:i,revealed:c=!1,rightLabels:f,topRoom:g,width:h,xAxis:x,yAxis:A,yAxisRight:R}){const m=l(x,c),F=m?u.widestLabel(t,a)/2:0,L=Math.max(M(l(A,c),i,a),n.CHART_EDGE_GAP),H=Math.max(M(l(R,c),f,a),n.CHART_EDGE_GAP),S=Math.max(h-L-H,0),s=r==="auto"?T(t,a,S/Math.max(t.length,1)):r,_=s===0?F:0,o={bottom:C(t,a,s,m),left:Math.max(L,_),right:Math.max(H,_),top:Math.max(g,n.CHART_EDGE_GAP)};return{margins:o,plot:{width:Math.max(h-o.left-o.right,0),height:Math.max(e-o.top-o.bottom,0)},rotation:s}}function w(t,a,e){const r=E.linearScale({domain:t,range:[a,0]});return E.ticksFor(r,a).map(e)}exports.bottomLabelRotation=T;exports.cartesianLayout=p;exports.chartHeight=d;exports.markShown=b;exports.valueLabelsFor=w;
|
|
2
2
|
//# sourceMappingURL=cartesianLayout.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cartesianLayout.cjs","sources":["../../../../src/components/charts/core/cartesianLayout.ts"],"sourcesContent":["import { widestLabel, type LabelFont } from './measureText';\nimport { CHART_EDGE_GAP, CHART_LABEL_OFFSET } from './spacing';\nimport { linearScale, ticksFor, type NumericRange } from '../scales';\n\nexport type AxisLabelRotation = 0 | 45 | 90;\nexport type AxisLabelAngle = AxisLabelRotation | 'auto';\n\n/**\n * Como o eixo se mostra. `onHover` reserva a calha
|
|
1
|
+
{"version":3,"file":"cartesianLayout.cjs","sources":["../../../../src/components/charts/core/cartesianLayout.ts"],"sourcesContent":["import { widestLabel, type LabelFont } from './measureText';\nimport { CHART_EDGE_GAP, CHART_LABEL_OFFSET } from './spacing';\nimport { linearScale, ticksFor, type NumericRange } from '../scales';\n\nexport type AxisLabelRotation = 0 | 45 | 90;\nexport type AxisLabelAngle = AxisLabelRotation | 'auto';\n\n/**\n * Como o eixo se mostra. `onHover` nao reserva a calha: o desenho ocupa o espaco\n * todo e, depois de um instante com o ponteiro sobre o grafico, encolhe para o\n * eixo entrar; `hidden` dispensa o eixo de vez.\n */\nexport type AxisVisibility = 'visible' | 'hidden' | 'onHover';\n\n/** Como pontos e rotulos de valor se mostram. `onHover` mostra os da serie sob o ponteiro, e so eles. */\nexport type MarkVisibility = 'visible' | 'hidden' | 'onHover';\n\n/** Se a marca da serie aparece: sempre, nunca, ou so com a serie sob o ponteiro. */\nexport function markShown(visibility: MarkVisibility, seriesFocused: boolean) {\n return visibility === 'visible' || (visibility === 'onHover' && seriesFocused);\n}\n\n/** Altura do desenho: um numero fixa, `fill` entrega a decisao ao contêiner. */\nexport type ChartHeight = number | 'fill';\n\nexport interface ResolvedHeight {\n fillHeight: boolean;\n value: number;\n}\n\n/**\n * Altura efetiva do desenho. Com `fill`, ela vem da medida do contêiner, o que\n * permite ao grafico ocupar a celula de um painel sem que ninguem repita a\n * medida em JavaScript.\n */\nexport function chartHeight(height: ChartHeight, measured: number): ResolvedHeight {\n return { fillHeight: height === 'fill', value: height === 'fill' ? measured : height };\n}\n\nexport interface ChartMargins {\n bottom: number;\n left: number;\n right: number;\n top: number;\n}\n\nexport interface ChartPlot {\n height: number;\n width: number;\n}\n\nexport interface CartesianLayoutOptions {\n bottomLabels: readonly string[];\n font: LabelFont;\n height: number;\n labelAngle: AxisLabelAngle;\n leftLabels: readonly string[];\n /** Os eixos `onHover` estao a vista e ocupam a calha. */\n revealed?: boolean;\n rightLabels: readonly string[];\n topRoom: number;\n width: number;\n xAxis: AxisVisibility;\n yAxis: AxisVisibility;\n yAxisRight: AxisVisibility;\n}\n\nexport interface CartesianLayout {\n margins: ChartMargins;\n plot: ChartPlot;\n rotation: AxisLabelRotation;\n}\n\n/** Se o eixo ocupa a calha agora: o `onHover` so enquanto revelado. */\nfunction ocupa(visibility: AxisVisibility, revealed: boolean) {\n return visibility === 'visible' || (visibility === 'onHover' && revealed);\n}\n\nfunction calha(ocupada: boolean, labels: readonly string[], font: LabelFont) {\n return ocupada ? widestLabel(labels, font) + CHART_LABEL_OFFSET : 0;\n}\n\n/**\n * Angulo dos rotulos do eixo de baixo. Em zero grau, dois rotulos vizinhos nao\n * podem se tocar. Girados, o que precisa caber e a distancia perpendicular\n * entre duas linhas de base vizinhas, que vale o passo vezes o seno do angulo.\n */\nexport function bottomLabelRotation(\n labels: readonly string[],\n font: LabelFont,\n step: number,\n): AxisLabelRotation {\n if (labels.length === 0 || step <= 0) {\n return 0;\n }\n\n if (widestLabel(labels, font) + CHART_LABEL_OFFSET <= step) {\n return 0;\n }\n\n return step * Math.SQRT1_2 >= font.lineHeight ? 45 : 90;\n}\n\n/** Altura que os rotulos de baixo ocupam, que e a caixa do texto ja girado. */\nfunction alturaDosRotulos(\n labels: readonly string[],\n font: LabelFont,\n rotation: AxisLabelRotation,\n ocupada: boolean,\n) {\n if (!ocupada) {\n return 0;\n }\n\n if (rotation === 0) {\n return font.lineHeight + CHART_LABEL_OFFSET;\n }\n\n const radianos = (rotation * Math.PI) / 180;\n const caixa = widestLabel(labels, font) * Math.sin(radianos) + font.lineHeight * Math.cos(radianos);\n\n return caixa + CHART_LABEL_OFFSET;\n}\n\n/**\n * Margens derivadas do conteudo, e nao de constantes. A ordem resolve sozinha a\n * dependencia entre elas: as calhas laterais definem a largura util, a largura\n * util define o passo entre categorias, o passo define o angulo dos rotulos e o\n * angulo define a altura que eles ocupam embaixo.\n */\nexport function cartesianLayout({\n bottomLabels,\n font,\n height,\n labelAngle,\n leftLabels,\n revealed = false,\n rightLabels,\n topRoom,\n width,\n xAxis,\n yAxis,\n yAxisRight,\n}: CartesianLayoutOptions): CartesianLayout {\n const embaixo = ocupa(xAxis, revealed);\n const meioRotulo = embaixo ? widestLabel(bottomLabels, font) / 2 : 0;\n\n const left = Math.max(calha(ocupa(yAxis, revealed), leftLabels, font), CHART_EDGE_GAP);\n const right = Math.max(calha(ocupa(yAxisRight, revealed), rightLabels, font), CHART_EDGE_GAP);\n const plotWidth = Math.max(width - left - right, 0);\n\n const rotation =\n labelAngle === 'auto'\n ? bottomLabelRotation(bottomLabels, font, plotWidth / Math.max(bottomLabels.length, 1))\n : labelAngle;\n\n // Sem rotacao o rotulo das pontas transborda meia largura para cada lado; a\n // folga so precisa cobrir o que a calha lateral ainda nao cobre.\n const bordaLateral = rotation === 0 ? meioRotulo : 0;\n const margins: ChartMargins = {\n bottom: alturaDosRotulos(bottomLabels, font, rotation, embaixo),\n left: Math.max(left, bordaLateral),\n right: Math.max(right, bordaLateral),\n top: Math.max(topRoom, CHART_EDGE_GAP),\n };\n\n return {\n margins,\n plot: {\n width: Math.max(width - margins.left - margins.right, 0),\n height: Math.max(height - margins.top - margins.bottom, 0),\n },\n rotation,\n };\n}\n\n/**\n * Rotulos de valor usados apenas para medir a calha do eixo, antes de a area de\n * desenho existir. Eles saem da altura total em vez da altura util, o que pode\n * render uma marca a mais ou a menos: a largura do rotulo mais largo nao muda\n * por isso, e e so ela que a medida precisa.\n */\nexport function valueLabelsFor(\n domain: NumericRange,\n length: number,\n format: (value: number) => string,\n) {\n const escala = linearScale({ domain, range: [length, 0] });\n\n return ticksFor(escala, length).map(format);\n}\n"],"names":["markShown","visibility","seriesFocused","chartHeight","height","measured","ocupa","revealed","calha","ocupada","labels","font","widestLabel","CHART_LABEL_OFFSET","bottomLabelRotation","step","alturaDosRotulos","rotation","radianos","cartesianLayout","bottomLabels","labelAngle","leftLabels","rightLabels","topRoom","width","xAxis","yAxis","yAxisRight","embaixo","meioRotulo","left","CHART_EDGE_GAP","right","plotWidth","bordaLateral","margins","valueLabelsFor","domain","length","format","escala","linearScale","ticksFor"],"mappings":"kLAkBO,SAASA,EAAUC,EAA4BC,EAAwB,CAC5E,OAAOD,IAAe,WAAcA,IAAe,WAAaC,CAClE,CAeO,SAASC,EAAYC,EAAqBC,EAAkC,CACjF,MAAO,CAAE,WAAYD,IAAW,OAAQ,MAAOA,IAAW,OAASC,EAAWD,CAAA,CAChF,CAqCA,SAASE,EAAML,EAA4BM,EAAmB,CAC5D,OAAON,IAAe,WAAcA,IAAe,WAAaM,CAClE,CAEA,SAASC,EAAMC,EAAkBC,EAA2BC,EAAiB,CAC3E,OAAOF,EAAUG,EAAAA,YAAYF,EAAQC,CAAI,EAAIE,EAAAA,mBAAqB,CACpE,CAOO,SAASC,EACdJ,EACAC,EACAI,EACmB,CAKnB,OAJIL,EAAO,SAAW,GAAKK,GAAQ,GAI/BH,EAAAA,YAAYF,EAAQC,CAAI,EAAIE,EAAAA,oBAAsBE,EAC7C,EAGFA,EAAO,KAAK,SAAWJ,EAAK,WAAa,GAAK,EACvD,CAGA,SAASK,EACPN,EACAC,EACAM,EACAR,EACA,CACA,GAAI,CAACA,EACH,MAAO,GAGT,GAAIQ,IAAa,EACf,OAAON,EAAK,WAAaE,EAAAA,mBAG3B,MAAMK,EAAYD,EAAW,KAAK,GAAM,IAGxC,OAFcL,EAAAA,YAAYF,EAAQC,CAAI,EAAI,KAAK,IAAIO,CAAQ,EAAIP,EAAK,WAAa,KAAK,IAAIO,CAAQ,EAEnFL,EAAAA,kBACjB,CAQO,SAASM,EAAgB,CAC9B,aAAAC,EACA,KAAAT,EACA,OAAAP,EACA,WAAAiB,EACA,WAAAC,EACA,SAAAf,EAAW,GACX,YAAAgB,EACA,QAAAC,EACA,MAAAC,EACA,MAAAC,EACA,MAAAC,EACA,WAAAC,CACF,EAA4C,CAC1C,MAAMC,EAAUvB,EAAMoB,EAAOnB,CAAQ,EAC/BuB,EAAaD,EAAUjB,EAAAA,YAAYQ,EAAcT,CAAI,EAAI,EAAI,EAE7DoB,EAAO,KAAK,IAAIvB,EAAMF,EAAMqB,EAAOpB,CAAQ,EAAGe,EAAYX,CAAI,EAAGqB,EAAAA,cAAc,EAC/EC,EAAQ,KAAK,IAAIzB,EAAMF,EAAMsB,EAAYrB,CAAQ,EAAGgB,EAAaZ,CAAI,EAAGqB,EAAAA,cAAc,EACtFE,EAAY,KAAK,IAAIT,EAAQM,EAAOE,EAAO,CAAC,EAE5ChB,EACJI,IAAe,OACXP,EAAoBM,EAAcT,EAAMuB,EAAY,KAAK,IAAId,EAAa,OAAQ,CAAC,CAAC,EACpFC,EAIAc,EAAelB,IAAa,EAAIa,EAAa,EAC7CM,EAAwB,CAC5B,OAAQpB,EAAiBI,EAAcT,EAAMM,EAAUY,CAAO,EAC9D,KAAM,KAAK,IAAIE,EAAMI,CAAY,EACjC,MAAO,KAAK,IAAIF,EAAOE,CAAY,EACnC,IAAK,KAAK,IAAIX,EAASQ,EAAAA,cAAc,CAAA,EAGvC,MAAO,CACL,QAAAI,EACA,KAAM,CACJ,MAAO,KAAK,IAAIX,EAAQW,EAAQ,KAAOA,EAAQ,MAAO,CAAC,EACvD,OAAQ,KAAK,IAAIhC,EAASgC,EAAQ,IAAMA,EAAQ,OAAQ,CAAC,CAAA,EAE3D,SAAAnB,CAAA,CAEJ,CAQO,SAASoB,EACdC,EACAC,EACAC,EACA,CACA,MAAMC,EAASC,EAAAA,YAAY,CAAE,OAAAJ,EAAQ,MAAO,CAACC,EAAQ,CAAC,EAAG,EAEzD,OAAOI,EAAAA,SAASF,EAAQF,CAAM,EAAE,IAAIC,CAAM,CAC5C"}
|
|
@@ -1,59 +1,67 @@
|
|
|
1
|
-
import { widestLabel as
|
|
2
|
-
import { CHART_EDGE_GAP as
|
|
3
|
-
import { linearScale as
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { widestLabel as u } from "./measureText.js";
|
|
2
|
+
import { CHART_EDGE_GAP as m, CHART_LABEL_OFFSET as e } from "./spacing.js";
|
|
3
|
+
import { linearScale as T, ticksFor as A } from "../scales/scales.js";
|
|
4
|
+
function D(t, a) {
|
|
5
|
+
return t === "visible" || t === "onHover" && a;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function G(t, a) {
|
|
8
|
+
return { fillHeight: t === "fill", value: t === "fill" ? a : t };
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function l(t, a) {
|
|
11
|
+
return t === "visible" || t === "onHover" && a;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function H(t, a, r) {
|
|
14
|
+
return t ? u(a, r) + e : 0;
|
|
15
|
+
}
|
|
16
|
+
function d(t, a, r) {
|
|
17
|
+
return t.length === 0 || r <= 0 || u(t, a) + e <= r ? 0 : r * Math.SQRT1_2 >= a.lineHeight ? 45 : 90;
|
|
18
|
+
}
|
|
19
|
+
function k(t, a, r, n) {
|
|
20
|
+
if (!n)
|
|
15
21
|
return 0;
|
|
16
22
|
if (r === 0)
|
|
17
|
-
return
|
|
18
|
-
const
|
|
19
|
-
return
|
|
23
|
+
return a.lineHeight + e;
|
|
24
|
+
const i = r * Math.PI / 180;
|
|
25
|
+
return u(t, a) * Math.sin(i) + a.lineHeight * Math.cos(i) + e;
|
|
20
26
|
}
|
|
21
|
-
function
|
|
22
|
-
bottomLabels:
|
|
23
|
-
font:
|
|
27
|
+
function P({
|
|
28
|
+
bottomLabels: t,
|
|
29
|
+
font: a,
|
|
24
30
|
height: r,
|
|
25
|
-
labelAngle:
|
|
26
|
-
leftLabels:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
labelAngle: n,
|
|
32
|
+
leftLabels: i,
|
|
33
|
+
revealed: c = !1,
|
|
34
|
+
rightLabels: p,
|
|
35
|
+
topRoom: R,
|
|
36
|
+
width: s,
|
|
37
|
+
xAxis: _,
|
|
38
|
+
yAxis: E,
|
|
39
|
+
yAxisRight: F
|
|
33
40
|
}) {
|
|
34
|
-
const
|
|
35
|
-
bottom:
|
|
36
|
-
left: Math.max(
|
|
37
|
-
right: Math.max(
|
|
38
|
-
top: Math.max(
|
|
41
|
+
const f = l(_, c), L = f ? u(t, a) / 2 : 0, x = Math.max(H(l(E, c), i, a), m), M = Math.max(H(l(F, c), p, a), m), S = Math.max(s - x - M, 0), h = n === "auto" ? d(t, a, S / Math.max(t.length, 1)) : n, g = h === 0 ? L : 0, o = {
|
|
42
|
+
bottom: k(t, a, h, f),
|
|
43
|
+
left: Math.max(x, g),
|
|
44
|
+
right: Math.max(M, g),
|
|
45
|
+
top: Math.max(R, m)
|
|
39
46
|
};
|
|
40
47
|
return {
|
|
41
|
-
margins:
|
|
48
|
+
margins: o,
|
|
42
49
|
plot: {
|
|
43
|
-
width: Math.max(
|
|
44
|
-
height: Math.max(r -
|
|
50
|
+
width: Math.max(s - o.left - o.right, 0),
|
|
51
|
+
height: Math.max(r - o.top - o.bottom, 0)
|
|
45
52
|
},
|
|
46
|
-
rotation:
|
|
53
|
+
rotation: h
|
|
47
54
|
};
|
|
48
55
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
return
|
|
56
|
+
function B(t, a, r) {
|
|
57
|
+
const n = T({ domain: t, range: [a, 0] });
|
|
58
|
+
return A(n, a).map(r);
|
|
52
59
|
}
|
|
53
60
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
d as bottomLabelRotation,
|
|
62
|
+
P as cartesianLayout,
|
|
63
|
+
G as chartHeight,
|
|
64
|
+
D as markShown,
|
|
65
|
+
B as valueLabelsFor
|
|
58
66
|
};
|
|
59
67
|
//# sourceMappingURL=cartesianLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cartesianLayout.js","sources":["../../../../src/components/charts/core/cartesianLayout.ts"],"sourcesContent":["import { widestLabel, type LabelFont } from './measureText';\nimport { CHART_EDGE_GAP, CHART_LABEL_OFFSET } from './spacing';\nimport { linearScale, ticksFor, type NumericRange } from '../scales';\n\nexport type AxisLabelRotation = 0 | 45 | 90;\nexport type AxisLabelAngle = AxisLabelRotation | 'auto';\n\n/**\n * Como o eixo se mostra. `onHover` reserva a calha
|
|
1
|
+
{"version":3,"file":"cartesianLayout.js","sources":["../../../../src/components/charts/core/cartesianLayout.ts"],"sourcesContent":["import { widestLabel, type LabelFont } from './measureText';\nimport { CHART_EDGE_GAP, CHART_LABEL_OFFSET } from './spacing';\nimport { linearScale, ticksFor, type NumericRange } from '../scales';\n\nexport type AxisLabelRotation = 0 | 45 | 90;\nexport type AxisLabelAngle = AxisLabelRotation | 'auto';\n\n/**\n * Como o eixo se mostra. `onHover` nao reserva a calha: o desenho ocupa o espaco\n * todo e, depois de um instante com o ponteiro sobre o grafico, encolhe para o\n * eixo entrar; `hidden` dispensa o eixo de vez.\n */\nexport type AxisVisibility = 'visible' | 'hidden' | 'onHover';\n\n/** Como pontos e rotulos de valor se mostram. `onHover` mostra os da serie sob o ponteiro, e so eles. */\nexport type MarkVisibility = 'visible' | 'hidden' | 'onHover';\n\n/** Se a marca da serie aparece: sempre, nunca, ou so com a serie sob o ponteiro. */\nexport function markShown(visibility: MarkVisibility, seriesFocused: boolean) {\n return visibility === 'visible' || (visibility === 'onHover' && seriesFocused);\n}\n\n/** Altura do desenho: um numero fixa, `fill` entrega a decisao ao contêiner. */\nexport type ChartHeight = number | 'fill';\n\nexport interface ResolvedHeight {\n fillHeight: boolean;\n value: number;\n}\n\n/**\n * Altura efetiva do desenho. Com `fill`, ela vem da medida do contêiner, o que\n * permite ao grafico ocupar a celula de um painel sem que ninguem repita a\n * medida em JavaScript.\n */\nexport function chartHeight(height: ChartHeight, measured: number): ResolvedHeight {\n return { fillHeight: height === 'fill', value: height === 'fill' ? measured : height };\n}\n\nexport interface ChartMargins {\n bottom: number;\n left: number;\n right: number;\n top: number;\n}\n\nexport interface ChartPlot {\n height: number;\n width: number;\n}\n\nexport interface CartesianLayoutOptions {\n bottomLabels: readonly string[];\n font: LabelFont;\n height: number;\n labelAngle: AxisLabelAngle;\n leftLabels: readonly string[];\n /** Os eixos `onHover` estao a vista e ocupam a calha. */\n revealed?: boolean;\n rightLabels: readonly string[];\n topRoom: number;\n width: number;\n xAxis: AxisVisibility;\n yAxis: AxisVisibility;\n yAxisRight: AxisVisibility;\n}\n\nexport interface CartesianLayout {\n margins: ChartMargins;\n plot: ChartPlot;\n rotation: AxisLabelRotation;\n}\n\n/** Se o eixo ocupa a calha agora: o `onHover` so enquanto revelado. */\nfunction ocupa(visibility: AxisVisibility, revealed: boolean) {\n return visibility === 'visible' || (visibility === 'onHover' && revealed);\n}\n\nfunction calha(ocupada: boolean, labels: readonly string[], font: LabelFont) {\n return ocupada ? widestLabel(labels, font) + CHART_LABEL_OFFSET : 0;\n}\n\n/**\n * Angulo dos rotulos do eixo de baixo. Em zero grau, dois rotulos vizinhos nao\n * podem se tocar. Girados, o que precisa caber e a distancia perpendicular\n * entre duas linhas de base vizinhas, que vale o passo vezes o seno do angulo.\n */\nexport function bottomLabelRotation(\n labels: readonly string[],\n font: LabelFont,\n step: number,\n): AxisLabelRotation {\n if (labels.length === 0 || step <= 0) {\n return 0;\n }\n\n if (widestLabel(labels, font) + CHART_LABEL_OFFSET <= step) {\n return 0;\n }\n\n return step * Math.SQRT1_2 >= font.lineHeight ? 45 : 90;\n}\n\n/** Altura que os rotulos de baixo ocupam, que e a caixa do texto ja girado. */\nfunction alturaDosRotulos(\n labels: readonly string[],\n font: LabelFont,\n rotation: AxisLabelRotation,\n ocupada: boolean,\n) {\n if (!ocupada) {\n return 0;\n }\n\n if (rotation === 0) {\n return font.lineHeight + CHART_LABEL_OFFSET;\n }\n\n const radianos = (rotation * Math.PI) / 180;\n const caixa = widestLabel(labels, font) * Math.sin(radianos) + font.lineHeight * Math.cos(radianos);\n\n return caixa + CHART_LABEL_OFFSET;\n}\n\n/**\n * Margens derivadas do conteudo, e nao de constantes. A ordem resolve sozinha a\n * dependencia entre elas: as calhas laterais definem a largura util, a largura\n * util define o passo entre categorias, o passo define o angulo dos rotulos e o\n * angulo define a altura que eles ocupam embaixo.\n */\nexport function cartesianLayout({\n bottomLabels,\n font,\n height,\n labelAngle,\n leftLabels,\n revealed = false,\n rightLabels,\n topRoom,\n width,\n xAxis,\n yAxis,\n yAxisRight,\n}: CartesianLayoutOptions): CartesianLayout {\n const embaixo = ocupa(xAxis, revealed);\n const meioRotulo = embaixo ? widestLabel(bottomLabels, font) / 2 : 0;\n\n const left = Math.max(calha(ocupa(yAxis, revealed), leftLabels, font), CHART_EDGE_GAP);\n const right = Math.max(calha(ocupa(yAxisRight, revealed), rightLabels, font), CHART_EDGE_GAP);\n const plotWidth = Math.max(width - left - right, 0);\n\n const rotation =\n labelAngle === 'auto'\n ? bottomLabelRotation(bottomLabels, font, plotWidth / Math.max(bottomLabels.length, 1))\n : labelAngle;\n\n // Sem rotacao o rotulo das pontas transborda meia largura para cada lado; a\n // folga so precisa cobrir o que a calha lateral ainda nao cobre.\n const bordaLateral = rotation === 0 ? meioRotulo : 0;\n const margins: ChartMargins = {\n bottom: alturaDosRotulos(bottomLabels, font, rotation, embaixo),\n left: Math.max(left, bordaLateral),\n right: Math.max(right, bordaLateral),\n top: Math.max(topRoom, CHART_EDGE_GAP),\n };\n\n return {\n margins,\n plot: {\n width: Math.max(width - margins.left - margins.right, 0),\n height: Math.max(height - margins.top - margins.bottom, 0),\n },\n rotation,\n };\n}\n\n/**\n * Rotulos de valor usados apenas para medir a calha do eixo, antes de a area de\n * desenho existir. Eles saem da altura total em vez da altura util, o que pode\n * render uma marca a mais ou a menos: a largura do rotulo mais largo nao muda\n * por isso, e e so ela que a medida precisa.\n */\nexport function valueLabelsFor(\n domain: NumericRange,\n length: number,\n format: (value: number) => string,\n) {\n const escala = linearScale({ domain, range: [length, 0] });\n\n return ticksFor(escala, length).map(format);\n}\n"],"names":["markShown","visibility","seriesFocused","chartHeight","height","measured","ocupa","revealed","calha","ocupada","labels","font","widestLabel","CHART_LABEL_OFFSET","bottomLabelRotation","step","alturaDosRotulos","rotation","radianos","cartesianLayout","bottomLabels","labelAngle","leftLabels","rightLabels","topRoom","width","xAxis","yAxis","yAxisRight","embaixo","meioRotulo","left","CHART_EDGE_GAP","right","plotWidth","bordaLateral","margins","valueLabelsFor","domain","length","format","escala","linearScale","ticksFor"],"mappings":";;;AAkBO,SAASA,EAAUC,GAA4BC,GAAwB;AAC5E,SAAOD,MAAe,aAAcA,MAAe,aAAaC;AAClE;AAeO,SAASC,EAAYC,GAAqBC,GAAkC;AACjF,SAAO,EAAE,YAAYD,MAAW,QAAQ,OAAOA,MAAW,SAASC,IAAWD,EAAA;AAChF;AAqCA,SAASE,EAAML,GAA4BM,GAAmB;AAC5D,SAAON,MAAe,aAAcA,MAAe,aAAaM;AAClE;AAEA,SAASC,EAAMC,GAAkBC,GAA2BC,GAAiB;AAC3E,SAAOF,IAAUG,EAAYF,GAAQC,CAAI,IAAIE,IAAqB;AACpE;AAOO,SAASC,EACdJ,GACAC,GACAI,GACmB;AAKnB,SAJIL,EAAO,WAAW,KAAKK,KAAQ,KAI/BH,EAAYF,GAAQC,CAAI,IAAIE,KAAsBE,IAC7C,IAGFA,IAAO,KAAK,WAAWJ,EAAK,aAAa,KAAK;AACvD;AAGA,SAASK,EACPN,GACAC,GACAM,GACAR,GACA;AACA,MAAI,CAACA;AACH,WAAO;AAGT,MAAIQ,MAAa;AACf,WAAON,EAAK,aAAaE;AAG3B,QAAMK,IAAYD,IAAW,KAAK,KAAM;AAGxC,SAFcL,EAAYF,GAAQC,CAAI,IAAI,KAAK,IAAIO,CAAQ,IAAIP,EAAK,aAAa,KAAK,IAAIO,CAAQ,IAEnFL;AACjB;AAQO,SAASM,EAAgB;AAAA,EAC9B,cAAAC;AAAA,EACA,MAAAT;AAAA,EACA,QAAAP;AAAA,EACA,YAAAiB;AAAA,EACA,YAAAC;AAAA,EACA,UAAAf,IAAW;AAAA,EACX,aAAAgB;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AACF,GAA4C;AAC1C,QAAMC,IAAUvB,EAAMoB,GAAOnB,CAAQ,GAC/BuB,IAAaD,IAAUjB,EAAYQ,GAAcT,CAAI,IAAI,IAAI,GAE7DoB,IAAO,KAAK,IAAIvB,EAAMF,EAAMqB,GAAOpB,CAAQ,GAAGe,GAAYX,CAAI,GAAGqB,CAAc,GAC/EC,IAAQ,KAAK,IAAIzB,EAAMF,EAAMsB,GAAYrB,CAAQ,GAAGgB,GAAaZ,CAAI,GAAGqB,CAAc,GACtFE,IAAY,KAAK,IAAIT,IAAQM,IAAOE,GAAO,CAAC,GAE5ChB,IACJI,MAAe,SACXP,EAAoBM,GAAcT,GAAMuB,IAAY,KAAK,IAAId,EAAa,QAAQ,CAAC,CAAC,IACpFC,GAIAc,IAAelB,MAAa,IAAIa,IAAa,GAC7CM,IAAwB;AAAA,IAC5B,QAAQpB,EAAiBI,GAAcT,GAAMM,GAAUY,CAAO;AAAA,IAC9D,MAAM,KAAK,IAAIE,GAAMI,CAAY;AAAA,IACjC,OAAO,KAAK,IAAIF,GAAOE,CAAY;AAAA,IACnC,KAAK,KAAK,IAAIX,GAASQ,CAAc;AAAA,EAAA;AAGvC,SAAO;AAAA,IACL,SAAAI;AAAA,IACA,MAAM;AAAA,MACJ,OAAO,KAAK,IAAIX,IAAQW,EAAQ,OAAOA,EAAQ,OAAO,CAAC;AAAA,MACvD,QAAQ,KAAK,IAAIhC,IAASgC,EAAQ,MAAMA,EAAQ,QAAQ,CAAC;AAAA,IAAA;AAAA,IAE3D,UAAAnB;AAAA,EAAA;AAEJ;AAQO,SAASoB,EACdC,GACAC,GACAC,GACA;AACA,QAAMC,IAASC,EAAY,EAAE,QAAAJ,GAAQ,OAAO,CAACC,GAAQ,CAAC,GAAG;AAEzD,SAAOI,EAASF,GAAQF,CAAM,EAAE,IAAIC,CAAM;AAC5C;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoverPath.cjs","sources":["../../../../src/components/charts/core/hoverPath.ts"],"sourcesContent":["import type { HierarchyNode } from 'd3-hierarchy';\n\n/** Um nivel do caminho ate o no sob o ponteiro, com o valor somado daquele nivel. */\nexport interface ChartHoveredNode {\n label: string;\n value: number;\n}\n\n/** Caminho do grupo de topo ate o no, sem a raiz que o layout cria por fora. */\nexport function hoverPath(node: HierarchyNode<{ label: string }>): ChartHoveredNode[] {\n return node\n .ancestors()\n .reverse()\n .slice(1)\n .map((ancestor) => ({ label: ancestor.data.label, value: ancestor.value ?? 0 }));\n}\n"],"names":["hoverPath","node","ancestor"],"mappings":"gFASO,SAASA,EAAUC,EAA4D,CACpF,OAAOA,EACJ,YACA,QAAA,EACA,MAAM,CAAC,EACP,IAAKC,IAAc,CAAE,MAAOA,EAAS,KAAK,MAAO,MAAOA,EAAS,OAAS,GAAI,CACnF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoverPath.js","sources":["../../../../src/components/charts/core/hoverPath.ts"],"sourcesContent":["import type { HierarchyNode } from 'd3-hierarchy';\n\n/** Um nivel do caminho ate o no sob o ponteiro, com o valor somado daquele nivel. */\nexport interface ChartHoveredNode {\n label: string;\n value: number;\n}\n\n/** Caminho do grupo de topo ate o no, sem a raiz que o layout cria por fora. */\nexport function hoverPath(node: HierarchyNode<{ label: string }>): ChartHoveredNode[] {\n return node\n .ancestors()\n .reverse()\n .slice(1)\n .map((ancestor) => ({ label: ancestor.data.label, value: ancestor.value ?? 0 }));\n}\n"],"names":["hoverPath","node","ancestor"],"mappings":"AASO,SAASA,EAAUC,GAA4D;AACpF,SAAOA,EACJ,YACA,QAAA,EACA,MAAM,CAAC,EACP,IAAI,CAACC,OAAc,EAAE,OAAOA,EAAS,KAAK,OAAO,OAAOA,EAAS,SAAS,IAAI;AACnF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A={end:-6,middle:0,start:6},b=14;function f(c,n,t,d,m){const l=c[n][t],i=c[n].length-1,a=t===0?"start":t===i?"end":"middle";return{below:l!==null&&c.some((u,e)=>{const o=u[t];return e===n||m(e)||!o?!1:(o.y<l.y||o.y===l.y&&e<n)&&l.y-o.y<d+b}),dx:A[a],textAnchor:a}}exports.pointLabelPlacement=f;
|
|
2
|
+
//# sourceMappingURL=pointLabels.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointLabels.cjs","sources":["../../../../src/components/charts/core/pointLabels.ts"],"sourcesContent":["import type { ChartPoint } from './shapes';\n\nexport interface PointLabelPlacement {\n /** Abaixo do ponto, quando outra serie tem ponto logo acima na mesma categoria. */\n below: boolean;\n /** Afastamento horizontal do ponto: nas pontas, o rotulo sai de lado para nao encostar no marcador. */\n dx: number;\n textAnchor: 'start' | 'middle' | 'end';\n}\n\nconst AFASTAMENTO = { end: -6, middle: 0, start: 6 } as const;\n\n/** O rotulo acima fica 10px sobre o ponto; o marcador tem 4px de raio. */\nconst FOLGA_ACIMA = 14;\n\n/**\n * Onde vai o rotulo de um ponto. Nas pontas ele se alinha para dentro, para nao cobrir os numeros do eixo; e,\n * quando o rotulo de uma serie alcancaria o ponto de outra logo acima, na mesma categoria, ele desce para baixo do ponto.\n */\nexport function pointLabelPlacement(\n pointsBySeries: readonly (readonly (ChartPoint | null)[])[],\n series: number,\n category: number,\n lineHeight: number,\n isHidden: (seriesIndex: number) => boolean,\n): PointLabelPlacement {\n const ponto = pointsBySeries[series][category];\n const ultima = pointsBySeries[series].length - 1;\n const textAnchor = category === 0 ? 'start' : category === ultima ? 'end' : 'middle';\n\n const below =\n ponto !== null &&\n pointsBySeries.some((pontos, outra) => {\n const vizinho = pontos[category];\n\n if (outra === series || isHidden(outra) || !vizinho) {\n return false;\n }\n\n const acima = vizinho.y < ponto.y || (vizinho.y === ponto.y && outra < series);\n\n return acima && ponto.y - vizinho.y < lineHeight + FOLGA_ACIMA;\n });\n\n return { below, dx: AFASTAMENTO[textAnchor], textAnchor };\n}\n"],"names":["AFASTAMENTO","FOLGA_ACIMA","pointLabelPlacement","pointsBySeries","series","category","lineHeight","isHidden","ponto","ultima","textAnchor","pontos","outra","vizinho"],"mappings":"gFAUA,MAAMA,EAAc,CAAE,IAAK,GAAI,OAAQ,EAAG,MAAO,CAAA,EAG3CC,EAAc,GAMb,SAASC,EACdC,EACAC,EACAC,EACAC,EACAC,EACqB,CACrB,MAAMC,EAAQL,EAAeC,CAAM,EAAEC,CAAQ,EACvCI,EAASN,EAAeC,CAAM,EAAE,OAAS,EACzCM,EAAaL,IAAa,EAAI,QAAUA,IAAaI,EAAS,MAAQ,SAgB5E,MAAO,CAAE,MAbPD,IAAU,MACVL,EAAe,KAAK,CAACQ,EAAQC,IAAU,CACrC,MAAMC,EAAUF,EAAON,CAAQ,EAE/B,OAAIO,IAAUR,GAAUG,EAASK,CAAK,GAAK,CAACC,EACnC,IAGKA,EAAQ,EAAIL,EAAM,GAAMK,EAAQ,IAAML,EAAM,GAAKI,EAAQR,IAEvDI,EAAM,EAAIK,EAAQ,EAAIP,EAAaL,CACrD,CAAC,EAEa,GAAID,EAAYU,CAAU,EAAG,WAAAA,CAAA,CAC/C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const b = { end: -6, middle: 0, start: 6 }, f = 14;
|
|
2
|
+
function x(c, n, t, A, a) {
|
|
3
|
+
const l = c[n][t], e = c[n].length - 1, m = t === 0 ? "start" : t === e ? "end" : "middle";
|
|
4
|
+
return { below: l !== null && c.some((u, d) => {
|
|
5
|
+
const o = u[t];
|
|
6
|
+
return d === n || a(d) || !o ? !1 : (o.y < l.y || o.y === l.y && d < n) && l.y - o.y < A + f;
|
|
7
|
+
}), dx: b[m], textAnchor: m };
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
x as pointLabelPlacement
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=pointLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pointLabels.js","sources":["../../../../src/components/charts/core/pointLabels.ts"],"sourcesContent":["import type { ChartPoint } from './shapes';\n\nexport interface PointLabelPlacement {\n /** Abaixo do ponto, quando outra serie tem ponto logo acima na mesma categoria. */\n below: boolean;\n /** Afastamento horizontal do ponto: nas pontas, o rotulo sai de lado para nao encostar no marcador. */\n dx: number;\n textAnchor: 'start' | 'middle' | 'end';\n}\n\nconst AFASTAMENTO = { end: -6, middle: 0, start: 6 } as const;\n\n/** O rotulo acima fica 10px sobre o ponto; o marcador tem 4px de raio. */\nconst FOLGA_ACIMA = 14;\n\n/**\n * Onde vai o rotulo de um ponto. Nas pontas ele se alinha para dentro, para nao cobrir os numeros do eixo; e,\n * quando o rotulo de uma serie alcancaria o ponto de outra logo acima, na mesma categoria, ele desce para baixo do ponto.\n */\nexport function pointLabelPlacement(\n pointsBySeries: readonly (readonly (ChartPoint | null)[])[],\n series: number,\n category: number,\n lineHeight: number,\n isHidden: (seriesIndex: number) => boolean,\n): PointLabelPlacement {\n const ponto = pointsBySeries[series][category];\n const ultima = pointsBySeries[series].length - 1;\n const textAnchor = category === 0 ? 'start' : category === ultima ? 'end' : 'middle';\n\n const below =\n ponto !== null &&\n pointsBySeries.some((pontos, outra) => {\n const vizinho = pontos[category];\n\n if (outra === series || isHidden(outra) || !vizinho) {\n return false;\n }\n\n const acima = vizinho.y < ponto.y || (vizinho.y === ponto.y && outra < series);\n\n return acima && ponto.y - vizinho.y < lineHeight + FOLGA_ACIMA;\n });\n\n return { below, dx: AFASTAMENTO[textAnchor], textAnchor };\n}\n"],"names":["AFASTAMENTO","FOLGA_ACIMA","pointLabelPlacement","pointsBySeries","series","category","lineHeight","isHidden","ponto","ultima","textAnchor","pontos","outra","vizinho"],"mappings":"AAUA,MAAMA,IAAc,EAAE,KAAK,IAAI,QAAQ,GAAG,OAAO,EAAA,GAG3CC,IAAc;AAMb,SAASC,EACdC,GACAC,GACAC,GACAC,GACAC,GACqB;AACrB,QAAMC,IAAQL,EAAeC,CAAM,EAAEC,CAAQ,GACvCI,IAASN,EAAeC,CAAM,EAAE,SAAS,GACzCM,IAAaL,MAAa,IAAI,UAAUA,MAAaI,IAAS,QAAQ;AAgB5E,SAAO,EAAE,OAbPD,MAAU,QACVL,EAAe,KAAK,CAACQ,GAAQC,MAAU;AACrC,UAAMC,IAAUF,EAAON,CAAQ;AAE/B,WAAIO,MAAUR,KAAUG,EAASK,CAAK,KAAK,CAACC,IACnC,MAGKA,EAAQ,IAAIL,EAAM,KAAMK,EAAQ,MAAML,EAAM,KAAKI,IAAQR,MAEvDI,EAAM,IAAIK,EAAQ,IAAIP,IAAaL;AAAA,EACrD,CAAC,GAEa,IAAID,EAAYU,CAAU,GAAG,YAAAA,EAAA;AAC/C;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m({categories:r,colors:c,format:u,index:l,isHidden:e,series:t,showTotal:a=!1}){const o=l===null?[]:t.flatMap((n,s)=>{const i=n.values[l];return e(n.label)||i===null||i===void 0||!Number.isFinite(i)?[]:[{color:c[s],format:n.format,label:n.label,values:[i]}]});return{columns:[{format:u}],computed:"none",rows:o,showTotal:a&&o.length>1,title:l===null?void 0:r[l]}}function p({colors:r,formatPercent:c,formatValue:u,index:l,slices:e,total:t}){const a=l===null?void 0:e[l];return{columns:[{format:u}],computed:{compute:o=>t>0?o/t:0,format:c},rows:a&&l!==null?[{color:r[l],label:a.label,values:[Math.max(a.value,0)]}]:[]}}function f({color:r,format:c,formatPercent:u,path:l,total:e=0}){var a;const t=l??[];return{columns:[{format:c}],computed:u?{compute:o=>e>0?o/e:0,format:u}:"none",rows:t.map((o,n)=>{const s=n===t.length-1;return{color:s?r:void 0,emphasis:s,label:o.label,values:[o.value]}}),title:(a=t.at(-1))==null?void 0:a.label}}exports.categoryTooltip=m;exports.pathTooltip=f;exports.sliceTooltip=p;
|
|
2
|
+
//# sourceMappingURL=tooltips.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.cjs","sources":["../../../../src/components/charts/core/tooltips.ts"],"sourcesContent":["import type { ChartFrameProps } from './ChartFrame';\nimport type { ChartHoveredNode } from './hoverPath';\n\nexport type ChartFrameTooltip = NonNullable<ChartFrameProps['tooltip']>;\n\nexport interface CategoryTooltipSeries {\n /** Formato desta serie, quando difere do grafico, como a do eixo da direita. */\n format?: (value: number) => string;\n label: string;\n values: readonly (number | null)[];\n}\n\nexport interface CategoryTooltipOptions {\n categories: readonly string[];\n colors: readonly string[];\n format: (value: number) => string;\n /** Categoria sob o ponteiro; `null` deixa o balao sem linhas, e ele nao aparece. */\n index: number | null;\n isHidden: (label: string) => boolean;\n series: readonly CategoryTooltipSeries[];\n /** Soma das series na ultima linha, para a pilha. */\n showTotal?: boolean;\n}\n\n/** Balao dos graficos de categoria: uma linha por serie visivel, com a cor dela e o valor naquela categoria. */\nexport function categoryTooltip({\n categories,\n colors,\n format,\n index,\n isHidden,\n series,\n showTotal = false,\n}: CategoryTooltipOptions): ChartFrameTooltip {\n const rows =\n index === null\n ? []\n : series.flatMap((serie, ordem) => {\n const valor = serie.values[index];\n\n if (isHidden(serie.label) || valor === null || valor === undefined || !Number.isFinite(valor)) {\n return [];\n }\n\n return [{ color: colors[ordem], format: serie.format, label: serie.label, values: [valor] }];\n });\n\n return {\n columns: [{ format }],\n computed: 'none',\n rows,\n showTotal: showTotal && rows.length > 1,\n title: index === null ? undefined : categories[index],\n };\n}\n\nexport interface SliceTooltipOptions {\n colors: readonly string[];\n formatPercent: (ratio: number) => string;\n formatValue: (value: number) => string;\n /** Fatia sob o ponteiro; `null` deixa o balao sem linhas. */\n index: number | null;\n slices: readonly { label: string; value: number }[];\n /** Soma das fatias ligadas, base da porcentagem. */\n total: number;\n}\n\n/** Balao do anel: a fatia sob o ponteiro, com o valor e a parte do total. */\nexport function sliceTooltip({ colors, formatPercent, formatValue, index, slices, total }: SliceTooltipOptions): ChartFrameTooltip {\n const fatia = index === null ? undefined : slices[index];\n\n return {\n columns: [{ format: formatValue }],\n computed: { compute: (valor) => (total > 0 ? valor / total : 0), format: formatPercent },\n rows: fatia && index !== null ? [{ color: colors[index], label: fatia.label, values: [Math.max(fatia.value, 0)] }] : [],\n };\n}\n\nexport interface PathTooltipOptions {\n /** Cor do no sob o ponteiro. */\n color?: string;\n format: (value: number) => string;\n /** Com ele, cada nivel mostra tambem a parte do total. */\n formatPercent?: (ratio: number) => string;\n /** Caminho do grupo ate o no; `null` deixa o balao sem linhas. */\n path: readonly ChartHoveredNode[] | null;\n total?: number;\n}\n\n/** Balao dos hierarquicos: uma linha por nivel do caminho, com o no sob o ponteiro em destaque. */\nexport function pathTooltip({ color, format, formatPercent, path, total = 0 }: PathTooltipOptions): ChartFrameTooltip {\n const niveis = path ?? [];\n\n return {\n columns: [{ format }],\n computed: formatPercent ? { compute: (valor) => (total > 0 ? valor / total : 0), format: formatPercent } : 'none',\n rows: niveis.map((nivel, indice) => {\n const ultimo = indice === niveis.length - 1;\n return { color: ultimo ? color : undefined, emphasis: ultimo, label: nivel.label, values: [nivel.value] };\n }),\n title: niveis.at(-1)?.label,\n };\n}\n"],"names":["categoryTooltip","categories","colors","format","index","isHidden","series","showTotal","rows","serie","ordem","valor","sliceTooltip","formatPercent","formatValue","slices","total","fatia","pathTooltip","color","path","niveis","nivel","indice","ultimo","_a"],"mappings":"gFAyBO,SAASA,EAAgB,CAC9B,WAAAC,EACA,OAAAC,EACA,OAAAC,EACA,MAAAC,EACA,SAAAC,EACA,OAAAC,EACA,UAAAC,EAAY,EACd,EAA8C,CAC5C,MAAMC,EACJJ,IAAU,KACN,CAAA,EACAE,EAAO,QAAQ,CAACG,EAAOC,IAAU,CAC/B,MAAMC,EAAQF,EAAM,OAAOL,CAAK,EAEhC,OAAIC,EAASI,EAAM,KAAK,GAAKE,IAAU,MAAQA,IAAU,QAAa,CAAC,OAAO,SAASA,CAAK,EACnF,CAAA,EAGF,CAAC,CAAE,MAAOT,EAAOQ,CAAK,EAAG,OAAQD,EAAM,OAAQ,MAAOA,EAAM,MAAO,OAAQ,CAACE,CAAK,EAAG,CAC7F,CAAC,EAEP,MAAO,CACL,QAAS,CAAC,CAAE,OAAAR,EAAQ,EACpB,SAAU,OACV,KAAAK,EACA,UAAWD,GAAaC,EAAK,OAAS,EACtC,MAAOJ,IAAU,KAAO,OAAYH,EAAWG,CAAK,CAAA,CAExD,CAcO,SAASQ,EAAa,CAAE,OAAAV,EAAQ,cAAAW,EAAe,YAAAC,EAAa,MAAAV,EAAO,OAAAW,EAAQ,MAAAC,GAAiD,CACjI,MAAMC,EAAQb,IAAU,KAAO,OAAYW,EAAOX,CAAK,EAEvD,MAAO,CACL,QAAS,CAAC,CAAE,OAAQU,EAAa,EACjC,SAAU,CAAE,QAAUH,GAAWK,EAAQ,EAAIL,EAAQK,EAAQ,EAAI,OAAQH,CAAA,EACzE,KAAMI,GAASb,IAAU,KAAO,CAAC,CAAE,MAAOF,EAAOE,CAAK,EAAG,MAAOa,EAAM,MAAO,OAAQ,CAAC,KAAK,IAAIA,EAAM,MAAO,CAAC,CAAC,CAAA,CAAG,EAAI,CAAA,CAAC,CAE1H,CAcO,SAASC,EAAY,CAAE,MAAAC,EAAO,OAAAhB,EAAQ,cAAAU,EAAe,KAAAO,EAAM,MAAAJ,EAAQ,GAA4C,OACpH,MAAMK,EAASD,GAAQ,CAAA,EAEvB,MAAO,CACL,QAAS,CAAC,CAAE,OAAAjB,EAAQ,EACpB,SAAUU,EAAgB,CAAE,QAAUF,GAAWK,EAAQ,EAAIL,EAAQK,EAAQ,EAAI,OAAQH,GAAkB,OAC3G,KAAMQ,EAAO,IAAI,CAACC,EAAOC,IAAW,CAClC,MAAMC,EAASD,IAAWF,EAAO,OAAS,EAC1C,MAAO,CAAE,MAAOG,EAASL,EAAQ,OAAW,SAAUK,EAAQ,MAAOF,EAAM,MAAO,OAAQ,CAACA,EAAM,KAAK,CAAA,CACxG,CAAC,EACD,OAAOG,EAAAJ,EAAO,GAAG,EAAE,IAAZ,YAAAI,EAAe,KAAA,CAE1B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function p({
|
|
2
|
+
categories: r,
|
|
3
|
+
colors: c,
|
|
4
|
+
format: u,
|
|
5
|
+
index: l,
|
|
6
|
+
isHidden: n,
|
|
7
|
+
series: t,
|
|
8
|
+
showTotal: a = !1
|
|
9
|
+
}) {
|
|
10
|
+
const o = l === null ? [] : t.flatMap((e, s) => {
|
|
11
|
+
const m = e.values[l];
|
|
12
|
+
return n(e.label) || m === null || m === void 0 || !Number.isFinite(m) ? [] : [{ color: c[s], format: e.format, label: e.label, values: [m] }];
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
columns: [{ format: u }],
|
|
16
|
+
computed: "none",
|
|
17
|
+
rows: o,
|
|
18
|
+
showTotal: a && o.length > 1,
|
|
19
|
+
title: l === null ? void 0 : r[l]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function i({ colors: r, formatPercent: c, formatValue: u, index: l, slices: n, total: t }) {
|
|
23
|
+
const a = l === null ? void 0 : n[l];
|
|
24
|
+
return {
|
|
25
|
+
columns: [{ format: u }],
|
|
26
|
+
computed: { compute: (o) => t > 0 ? o / t : 0, format: c },
|
|
27
|
+
rows: a && l !== null ? [{ color: r[l], label: a.label, values: [Math.max(a.value, 0)] }] : []
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function f({ color: r, format: c, formatPercent: u, path: l, total: n = 0 }) {
|
|
31
|
+
var a;
|
|
32
|
+
const t = l ?? [];
|
|
33
|
+
return {
|
|
34
|
+
columns: [{ format: c }],
|
|
35
|
+
computed: u ? { compute: (o) => n > 0 ? o / n : 0, format: u } : "none",
|
|
36
|
+
rows: t.map((o, e) => {
|
|
37
|
+
const s = e === t.length - 1;
|
|
38
|
+
return { color: s ? r : void 0, emphasis: s, label: o.label, values: [o.value] };
|
|
39
|
+
}),
|
|
40
|
+
title: (a = t.at(-1)) == null ? void 0 : a.label
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
p as categoryTooltip,
|
|
45
|
+
f as pathTooltip,
|
|
46
|
+
i as sliceTooltip
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=tooltips.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tooltips.js","sources":["../../../../src/components/charts/core/tooltips.ts"],"sourcesContent":["import type { ChartFrameProps } from './ChartFrame';\nimport type { ChartHoveredNode } from './hoverPath';\n\nexport type ChartFrameTooltip = NonNullable<ChartFrameProps['tooltip']>;\n\nexport interface CategoryTooltipSeries {\n /** Formato desta serie, quando difere do grafico, como a do eixo da direita. */\n format?: (value: number) => string;\n label: string;\n values: readonly (number | null)[];\n}\n\nexport interface CategoryTooltipOptions {\n categories: readonly string[];\n colors: readonly string[];\n format: (value: number) => string;\n /** Categoria sob o ponteiro; `null` deixa o balao sem linhas, e ele nao aparece. */\n index: number | null;\n isHidden: (label: string) => boolean;\n series: readonly CategoryTooltipSeries[];\n /** Soma das series na ultima linha, para a pilha. */\n showTotal?: boolean;\n}\n\n/** Balao dos graficos de categoria: uma linha por serie visivel, com a cor dela e o valor naquela categoria. */\nexport function categoryTooltip({\n categories,\n colors,\n format,\n index,\n isHidden,\n series,\n showTotal = false,\n}: CategoryTooltipOptions): ChartFrameTooltip {\n const rows =\n index === null\n ? []\n : series.flatMap((serie, ordem) => {\n const valor = serie.values[index];\n\n if (isHidden(serie.label) || valor === null || valor === undefined || !Number.isFinite(valor)) {\n return [];\n }\n\n return [{ color: colors[ordem], format: serie.format, label: serie.label, values: [valor] }];\n });\n\n return {\n columns: [{ format }],\n computed: 'none',\n rows,\n showTotal: showTotal && rows.length > 1,\n title: index === null ? undefined : categories[index],\n };\n}\n\nexport interface SliceTooltipOptions {\n colors: readonly string[];\n formatPercent: (ratio: number) => string;\n formatValue: (value: number) => string;\n /** Fatia sob o ponteiro; `null` deixa o balao sem linhas. */\n index: number | null;\n slices: readonly { label: string; value: number }[];\n /** Soma das fatias ligadas, base da porcentagem. */\n total: number;\n}\n\n/** Balao do anel: a fatia sob o ponteiro, com o valor e a parte do total. */\nexport function sliceTooltip({ colors, formatPercent, formatValue, index, slices, total }: SliceTooltipOptions): ChartFrameTooltip {\n const fatia = index === null ? undefined : slices[index];\n\n return {\n columns: [{ format: formatValue }],\n computed: { compute: (valor) => (total > 0 ? valor / total : 0), format: formatPercent },\n rows: fatia && index !== null ? [{ color: colors[index], label: fatia.label, values: [Math.max(fatia.value, 0)] }] : [],\n };\n}\n\nexport interface PathTooltipOptions {\n /** Cor do no sob o ponteiro. */\n color?: string;\n format: (value: number) => string;\n /** Com ele, cada nivel mostra tambem a parte do total. */\n formatPercent?: (ratio: number) => string;\n /** Caminho do grupo ate o no; `null` deixa o balao sem linhas. */\n path: readonly ChartHoveredNode[] | null;\n total?: number;\n}\n\n/** Balao dos hierarquicos: uma linha por nivel do caminho, com o no sob o ponteiro em destaque. */\nexport function pathTooltip({ color, format, formatPercent, path, total = 0 }: PathTooltipOptions): ChartFrameTooltip {\n const niveis = path ?? [];\n\n return {\n columns: [{ format }],\n computed: formatPercent ? { compute: (valor) => (total > 0 ? valor / total : 0), format: formatPercent } : 'none',\n rows: niveis.map((nivel, indice) => {\n const ultimo = indice === niveis.length - 1;\n return { color: ultimo ? color : undefined, emphasis: ultimo, label: nivel.label, values: [nivel.value] };\n }),\n title: niveis.at(-1)?.label,\n };\n}\n"],"names":["categoryTooltip","categories","colors","format","index","isHidden","series","showTotal","rows","serie","ordem","valor","sliceTooltip","formatPercent","formatValue","slices","total","fatia","pathTooltip","color","path","_a","niveis","nivel","indice","ultimo"],"mappings":"AAyBO,SAASA,EAAgB;AAAA,EAC9B,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC,IAAY;AACd,GAA8C;AAC5C,QAAMC,IACJJ,MAAU,OACN,CAAA,IACAE,EAAO,QAAQ,CAACG,GAAOC,MAAU;AAC/B,UAAMC,IAAQF,EAAM,OAAOL,CAAK;AAEhC,WAAIC,EAASI,EAAM,KAAK,KAAKE,MAAU,QAAQA,MAAU,UAAa,CAAC,OAAO,SAASA,CAAK,IACnF,CAAA,IAGF,CAAC,EAAE,OAAOT,EAAOQ,CAAK,GAAG,QAAQD,EAAM,QAAQ,OAAOA,EAAM,OAAO,QAAQ,CAACE,CAAK,GAAG;AAAA,EAC7F,CAAC;AAEP,SAAO;AAAA,IACL,SAAS,CAAC,EAAE,QAAAR,GAAQ;AAAA,IACpB,UAAU;AAAA,IACV,MAAAK;AAAA,IACA,WAAWD,KAAaC,EAAK,SAAS;AAAA,IACtC,OAAOJ,MAAU,OAAO,SAAYH,EAAWG,CAAK;AAAA,EAAA;AAExD;AAcO,SAASQ,EAAa,EAAE,QAAAV,GAAQ,eAAAW,GAAe,aAAAC,GAAa,OAAAV,GAAO,QAAAW,GAAQ,OAAAC,KAAiD;AACjI,QAAMC,IAAQb,MAAU,OAAO,SAAYW,EAAOX,CAAK;AAEvD,SAAO;AAAA,IACL,SAAS,CAAC,EAAE,QAAQU,GAAa;AAAA,IACjC,UAAU,EAAE,SAAS,CAACH,MAAWK,IAAQ,IAAIL,IAAQK,IAAQ,GAAI,QAAQH,EAAA;AAAA,IACzE,MAAMI,KAASb,MAAU,OAAO,CAAC,EAAE,OAAOF,EAAOE,CAAK,GAAG,OAAOa,EAAM,OAAO,QAAQ,CAAC,KAAK,IAAIA,EAAM,OAAO,CAAC,CAAC,EAAA,CAAG,IAAI,CAAA;AAAA,EAAC;AAE1H;AAcO,SAASC,EAAY,EAAE,OAAAC,GAAO,QAAAhB,GAAQ,eAAAU,GAAe,MAAAO,GAAM,OAAAJ,IAAQ,KAA4C;AAjE/G,MAAAK;AAkEL,QAAMC,IAASF,KAAQ,CAAA;AAEvB,SAAO;AAAA,IACL,SAAS,CAAC,EAAE,QAAAjB,GAAQ;AAAA,IACpB,UAAUU,IAAgB,EAAE,SAAS,CAACF,MAAWK,IAAQ,IAAIL,IAAQK,IAAQ,GAAI,QAAQH,MAAkB;AAAA,IAC3G,MAAMS,EAAO,IAAI,CAACC,GAAOC,MAAW;AAClC,YAAMC,IAASD,MAAWF,EAAO,SAAS;AAC1C,aAAO,EAAE,OAAOG,IAASN,IAAQ,QAAW,UAAUM,GAAQ,OAAOF,EAAM,OAAO,QAAQ,CAACA,EAAM,KAAK,EAAA;AAAA,IACxG,CAAC;AAAA,IACD,QAAOF,IAAAC,EAAO,GAAG,EAAE,MAAZ,gBAAAD,EAAe;AAAA,EAAA;AAE1B;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),l=require("./cartesianLayout.cjs"),g=require("./useTweenedNumbers.cjs"),h=600,A=240;function f(e,t,r){return{bottom:e.bottom+(t.bottom-e.bottom)*r,left:e.left+(t.left-e.left)*r,right:e.right+(t.right-e.right)*r,top:e.top+(t.top-e.top)*r}}function v(e){const t=[e.xAxis,e.yAxis,e.yAxisRight].includes("onHover"),[r,u]=s.useState(!1),a=s.useRef(void 0),i=t&&r,[m=0]=g.useTweenedNumbers([i?1:0],{duration:A});s.useEffect(()=>()=>clearTimeout(a.current),[]);const n=l.cartesianLayout({...e,revealed:!1}),c=t?l.cartesianLayout({...e,revealed:!0}):n,o=f(n.margins,c.margins,m);return{axisReveal:{onPointerEnter:()=>{t&&(clearTimeout(a.current),a.current=setTimeout(()=>u(!0),h))},onPointerLeave:()=>{clearTimeout(a.current),u(!1)},revealed:i},margins:o,plot:{height:Math.max(e.height-o.top-o.bottom,0),width:Math.max(e.width-o.left-o.right,0)},rotation:(i?c:n).rotation}}exports.useCartesianLayout=v;
|
|
2
|
+
//# sourceMappingURL=useCartesianLayout.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCartesianLayout.cjs","sources":["../../../../src/components/charts/core/useCartesianLayout.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { cartesianLayout, type CartesianLayoutOptions, type ChartMargins } from './cartesianLayout';\nimport { useTweenedNumbers } from './useTweenedNumbers';\n\n/** Ponteiro parado sobre o grafico ate os eixos `onHover` entrarem: so atravessar o grafico nao o faz encolher. */\nconst ATRASO_DA_REVELACAO = 600;\nconst DURACAO_DA_REVELACAO = 240;\n\nexport interface AxisReveal {\n onPointerEnter: () => void;\n onPointerLeave: () => void;\n revealed: boolean;\n}\n\nfunction interpolar(de: ChartMargins, ate: ChartMargins, fator: number): ChartMargins {\n return {\n bottom: de.bottom + (ate.bottom - de.bottom) * fator,\n left: de.left + (ate.left - de.left) * fator,\n right: de.right + (ate.right - de.right) * fator,\n top: de.top + (ate.top - de.top) * fator,\n };\n}\n\n/**\n * Layout cartesiano com os eixos `onHover`. Sem eles revelados, o desenho ocupa\n * o espaco todo; revelados, ele encolhe ate as calhas, numa transicao so. Dado\n * ou tamanho que mudam reposicionam na hora: o que anima e a revelacao.\n */\nexport function useCartesianLayout(options: Omit<CartesianLayoutOptions, 'revealed'>) {\n const dinamico = [options.xAxis, options.yAxis, options.yAxisRight].includes('onHover');\n const [revelado, setRevelado] = useState(false);\n const relogio = useRef<ReturnType<typeof setTimeout>>(undefined);\n const revealed = dinamico && revelado;\n const [progresso = 0] = useTweenedNumbers([revealed ? 1 : 0], { duration: DURACAO_DA_REVELACAO });\n\n useEffect(() => () => clearTimeout(relogio.current), []);\n\n const recolhido = cartesianLayout({ ...options, revealed: false });\n const aberto = dinamico ? cartesianLayout({ ...options, revealed: true }) : recolhido;\n const margins = interpolar(recolhido.margins, aberto.margins, progresso);\n\n const axisReveal: AxisReveal = {\n onPointerEnter: () => {\n if (dinamico) {\n clearTimeout(relogio.current);\n relogio.current = setTimeout(() => setRevelado(true), ATRASO_DA_REVELACAO);\n }\n },\n onPointerLeave: () => {\n clearTimeout(relogio.current);\n setRevelado(false);\n },\n revealed,\n };\n\n return {\n axisReveal,\n margins,\n plot: {\n height: Math.max(options.height - margins.top - margins.bottom, 0),\n width: Math.max(options.width - margins.left - margins.right, 0),\n },\n rotation: (revealed ? aberto : recolhido).rotation,\n };\n}\n"],"names":["ATRASO_DA_REVELACAO","DURACAO_DA_REVELACAO","interpolar","de","ate","fator","useCartesianLayout","options","dinamico","revelado","setRevelado","useState","relogio","useRef","revealed","progresso","useTweenedNumbers","useEffect","recolhido","cartesianLayout","aberto","margins"],"mappings":"iLAKMA,EAAsB,IACtBC,EAAuB,IAQ7B,SAASC,EAAWC,EAAkBC,EAAmBC,EAA6B,CACpF,MAAO,CACL,OAAQF,EAAG,QAAUC,EAAI,OAASD,EAAG,QAAUE,EAC/C,KAAMF,EAAG,MAAQC,EAAI,KAAOD,EAAG,MAAQE,EACvC,MAAOF,EAAG,OAASC,EAAI,MAAQD,EAAG,OAASE,EAC3C,IAAKF,EAAG,KAAOC,EAAI,IAAMD,EAAG,KAAOE,CAAA,CAEvC,CAOO,SAASC,EAAmBC,EAAmD,CACpF,MAAMC,EAAW,CAACD,EAAQ,MAAOA,EAAQ,MAAOA,EAAQ,UAAU,EAAE,SAAS,SAAS,EAChF,CAACE,EAAUC,CAAW,EAAIC,EAAAA,SAAS,EAAK,EACxCC,EAAUC,EAAAA,OAAsC,MAAS,EACzDC,EAAWN,GAAYC,EACvB,CAACM,EAAY,CAAC,EAAIC,EAAAA,kBAAkB,CAACF,EAAW,EAAI,CAAC,EAAG,CAAE,SAAUb,EAAsB,EAEhGgB,EAAAA,UAAU,IAAM,IAAM,aAAaL,EAAQ,OAAO,EAAG,CAAA,CAAE,EAEvD,MAAMM,EAAYC,EAAAA,gBAAgB,CAAE,GAAGZ,EAAS,SAAU,GAAO,EAC3Da,EAASZ,EAAWW,kBAAgB,CAAE,GAAGZ,EAAS,SAAU,EAAA,CAAM,EAAIW,EACtEG,EAAUnB,EAAWgB,EAAU,QAASE,EAAO,QAASL,CAAS,EAgBvE,MAAO,CACL,WAf6B,CAC7B,eAAgB,IAAM,CAChBP,IACF,aAAaI,EAAQ,OAAO,EAC5BA,EAAQ,QAAU,WAAW,IAAMF,EAAY,EAAI,EAAGV,CAAmB,EAE7E,EACA,eAAgB,IAAM,CACpB,aAAaY,EAAQ,OAAO,EAC5BF,EAAY,EAAK,CACnB,EACA,SAAAI,CAAA,EAKA,QAAAO,EACA,KAAM,CACJ,OAAQ,KAAK,IAAId,EAAQ,OAASc,EAAQ,IAAMA,EAAQ,OAAQ,CAAC,EACjE,MAAO,KAAK,IAAId,EAAQ,MAAQc,EAAQ,KAAOA,EAAQ,MAAO,CAAC,CAAA,EAEjE,UAAWP,EAAWM,EAASF,GAAW,QAAA,CAE9C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useState as m, useRef as h, useEffect as f } from "react";
|
|
2
|
+
import { cartesianLayout as u } from "./cartesianLayout.js";
|
|
3
|
+
import { useTweenedNumbers as g } from "./useTweenedNumbers.js";
|
|
4
|
+
const A = 600, v = 240;
|
|
5
|
+
function x(t, e, o) {
|
|
6
|
+
return {
|
|
7
|
+
bottom: t.bottom + (e.bottom - t.bottom) * o,
|
|
8
|
+
left: t.left + (e.left - t.left) * o,
|
|
9
|
+
right: t.right + (e.right - t.right) * o,
|
|
10
|
+
top: t.top + (e.top - t.top) * o
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function E(t) {
|
|
14
|
+
const e = [t.xAxis, t.yAxis, t.yAxisRight].includes("onHover"), [o, s] = m(!1), i = h(void 0), n = e && o, [l = 0] = g([n ? 1 : 0], { duration: v });
|
|
15
|
+
f(() => () => clearTimeout(i.current), []);
|
|
16
|
+
const a = u({ ...t, revealed: !1 }), c = e ? u({ ...t, revealed: !0 }) : a, r = x(a.margins, c.margins, l);
|
|
17
|
+
return {
|
|
18
|
+
axisReveal: {
|
|
19
|
+
onPointerEnter: () => {
|
|
20
|
+
e && (clearTimeout(i.current), i.current = setTimeout(() => s(!0), A));
|
|
21
|
+
},
|
|
22
|
+
onPointerLeave: () => {
|
|
23
|
+
clearTimeout(i.current), s(!1);
|
|
24
|
+
},
|
|
25
|
+
revealed: n
|
|
26
|
+
},
|
|
27
|
+
margins: r,
|
|
28
|
+
plot: {
|
|
29
|
+
height: Math.max(t.height - r.top - r.bottom, 0),
|
|
30
|
+
width: Math.max(t.width - r.left - r.right, 0)
|
|
31
|
+
},
|
|
32
|
+
rotation: (n ? c : a).rotation
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
E as useCartesianLayout
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=useCartesianLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCartesianLayout.js","sources":["../../../../src/components/charts/core/useCartesianLayout.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { cartesianLayout, type CartesianLayoutOptions, type ChartMargins } from './cartesianLayout';\nimport { useTweenedNumbers } from './useTweenedNumbers';\n\n/** Ponteiro parado sobre o grafico ate os eixos `onHover` entrarem: so atravessar o grafico nao o faz encolher. */\nconst ATRASO_DA_REVELACAO = 600;\nconst DURACAO_DA_REVELACAO = 240;\n\nexport interface AxisReveal {\n onPointerEnter: () => void;\n onPointerLeave: () => void;\n revealed: boolean;\n}\n\nfunction interpolar(de: ChartMargins, ate: ChartMargins, fator: number): ChartMargins {\n return {\n bottom: de.bottom + (ate.bottom - de.bottom) * fator,\n left: de.left + (ate.left - de.left) * fator,\n right: de.right + (ate.right - de.right) * fator,\n top: de.top + (ate.top - de.top) * fator,\n };\n}\n\n/**\n * Layout cartesiano com os eixos `onHover`. Sem eles revelados, o desenho ocupa\n * o espaco todo; revelados, ele encolhe ate as calhas, numa transicao so. Dado\n * ou tamanho que mudam reposicionam na hora: o que anima e a revelacao.\n */\nexport function useCartesianLayout(options: Omit<CartesianLayoutOptions, 'revealed'>) {\n const dinamico = [options.xAxis, options.yAxis, options.yAxisRight].includes('onHover');\n const [revelado, setRevelado] = useState(false);\n const relogio = useRef<ReturnType<typeof setTimeout>>(undefined);\n const revealed = dinamico && revelado;\n const [progresso = 0] = useTweenedNumbers([revealed ? 1 : 0], { duration: DURACAO_DA_REVELACAO });\n\n useEffect(() => () => clearTimeout(relogio.current), []);\n\n const recolhido = cartesianLayout({ ...options, revealed: false });\n const aberto = dinamico ? cartesianLayout({ ...options, revealed: true }) : recolhido;\n const margins = interpolar(recolhido.margins, aberto.margins, progresso);\n\n const axisReveal: AxisReveal = {\n onPointerEnter: () => {\n if (dinamico) {\n clearTimeout(relogio.current);\n relogio.current = setTimeout(() => setRevelado(true), ATRASO_DA_REVELACAO);\n }\n },\n onPointerLeave: () => {\n clearTimeout(relogio.current);\n setRevelado(false);\n },\n revealed,\n };\n\n return {\n axisReveal,\n margins,\n plot: {\n height: Math.max(options.height - margins.top - margins.bottom, 0),\n width: Math.max(options.width - margins.left - margins.right, 0),\n },\n rotation: (revealed ? aberto : recolhido).rotation,\n };\n}\n"],"names":["ATRASO_DA_REVELACAO","DURACAO_DA_REVELACAO","interpolar","de","ate","fator","useCartesianLayout","options","dinamico","revelado","setRevelado","useState","relogio","useRef","revealed","progresso","useTweenedNumbers","useEffect","recolhido","cartesianLayout","aberto","margins"],"mappings":";;;AAKA,MAAMA,IAAsB,KACtBC,IAAuB;AAQ7B,SAASC,EAAWC,GAAkBC,GAAmBC,GAA6B;AACpF,SAAO;AAAA,IACL,QAAQF,EAAG,UAAUC,EAAI,SAASD,EAAG,UAAUE;AAAA,IAC/C,MAAMF,EAAG,QAAQC,EAAI,OAAOD,EAAG,QAAQE;AAAA,IACvC,OAAOF,EAAG,SAASC,EAAI,QAAQD,EAAG,SAASE;AAAA,IAC3C,KAAKF,EAAG,OAAOC,EAAI,MAAMD,EAAG,OAAOE;AAAA,EAAA;AAEvC;AAOO,SAASC,EAAmBC,GAAmD;AACpF,QAAMC,IAAW,CAACD,EAAQ,OAAOA,EAAQ,OAAOA,EAAQ,UAAU,EAAE,SAAS,SAAS,GAChF,CAACE,GAAUC,CAAW,IAAIC,EAAS,EAAK,GACxCC,IAAUC,EAAsC,MAAS,GACzDC,IAAWN,KAAYC,GACvB,CAACM,IAAY,CAAC,IAAIC,EAAkB,CAACF,IAAW,IAAI,CAAC,GAAG,EAAE,UAAUb,GAAsB;AAEhG,EAAAgB,EAAU,MAAM,MAAM,aAAaL,EAAQ,OAAO,GAAG,CAAA,CAAE;AAEvD,QAAMM,IAAYC,EAAgB,EAAE,GAAGZ,GAAS,UAAU,IAAO,GAC3Da,IAASZ,IAAWW,EAAgB,EAAE,GAAGZ,GAAS,UAAU,GAAA,CAAM,IAAIW,GACtEG,IAAUnB,EAAWgB,EAAU,SAASE,EAAO,SAASL,CAAS;AAgBvE,SAAO;AAAA,IACL,YAf6B;AAAA,MAC7B,gBAAgB,MAAM;AACpB,QAAIP,MACF,aAAaI,EAAQ,OAAO,GAC5BA,EAAQ,UAAU,WAAW,MAAMF,EAAY,EAAI,GAAGV,CAAmB;AAAA,MAE7E;AAAA,MACA,gBAAgB,MAAM;AACpB,qBAAaY,EAAQ,OAAO,GAC5BF,EAAY,EAAK;AAAA,MACnB;AAAA,MACA,UAAAI;AAAA,IAAA;AAAA,IAKA,SAAAO;AAAA,IACA,MAAM;AAAA,MACJ,QAAQ,KAAK,IAAId,EAAQ,SAASc,EAAQ,MAAMA,EAAQ,QAAQ,CAAC;AAAA,MACjE,OAAO,KAAK,IAAId,EAAQ,QAAQc,EAAQ,OAAOA,EAAQ,OAAO,CAAC;AAAA,IAAA;AAAA,IAEjE,WAAWP,IAAWM,IAASF,GAAW;AAAA,EAAA;AAE9C;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");function m({defaultHiddenSeries:l=[],hiddenSeries:o,labels:t,onHiddenSeriesChange:u}){const[f,v]=e.useState(l),[i,O]=e.useState(null),c=o??f,r=t!==void 0&&t.length>0&&t.every(s=>c.includes(s))&&i?i:c,g=e.useCallback(s=>{const a=c.includes(s)?c.filter(n=>n!==s):[...c,s];o===void 0&&v(a),O(t!=null&&t.every(n=>a.includes(n))?c:null),u==null||u(a)},[o,t,c,u]);return{isHidden:e.useCallback(s=>c.includes(s),[c]),isOutOfScale:e.useCallback(s=>r.includes(s),[r]),toggle:g}}function y(l,o){const t=l.filter(u=>!o(u.label));return t.length>0?t:l}exports.seriesInScale=y;exports.useSeriesToggle=m;
|
|
2
2
|
//# sourceMappingURL=useSeriesToggle.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSeriesToggle.cjs","sources":["../../../../src/components/charts/core/useSeriesToggle.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport interface UseSeriesToggleOptions {\n defaultHiddenSeries?: readonly string[];\n hiddenSeries?: readonly string[];\n onHiddenSeriesChange?: (hidden: readonly string[]) => void;\n}\n\nexport interface SeriesToggle {\n isHidden: (label: string) => boolean;\n toggle: (label: string) => void;\n}\n\n/**\n * Quais series estao ocultas. Controlado quando o produto informa\n * `hiddenSeries`, nao controlado em caso contrario, conforme `COMPONENTS.md`\n * secao 6. Trabalha com rotulos porque e o rotulo que a legenda exibe e o que\n * o produto reconhece; indices mudariam de significado ao reordenar as series.\n */\nexport function useSeriesToggle({\n defaultHiddenSeries = [],\n hiddenSeries,\n onHiddenSeriesChange,\n}: UseSeriesToggleOptions): SeriesToggle {\n const [internas, setInternas] = useState<readonly string[]>(defaultHiddenSeries);\n const ocultas = hiddenSeries ?? internas;\n\n const toggle = useCallback(\n (label: string) => {\n const proximas = ocultas.includes(label)\n ? ocultas.filter((oculta) => oculta !== label)\n : [...ocultas, label];\n\n if (hiddenSeries === undefined) {\n setInternas(proximas);\n }\n\n onHiddenSeriesChange?.(proximas);\n },\n [hiddenSeries, ocultas, onHiddenSeriesChange],\n );\n\n return {\n isHidden: useCallback((label: string) => ocultas.includes(label), [ocultas]),\n toggle,\n };\n}\n"],"names":["useSeriesToggle","defaultHiddenSeries","hiddenSeries","onHiddenSeriesChange","internas","setInternas","useState","
|
|
1
|
+
{"version":3,"file":"useSeriesToggle.cjs","sources":["../../../../src/components/charts/core/useSeriesToggle.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport interface UseSeriesToggleOptions {\n defaultHiddenSeries?: readonly string[];\n hiddenSeries?: readonly string[];\n /** Todos os rotulos; com eles, desligar a ultima serie mantem a escala de antes. */\n labels?: readonly string[];\n onHiddenSeriesChange?: (hidden: readonly string[]) => void;\n}\n\nexport interface SeriesToggle {\n isHidden: (label: string) => boolean;\n /**\n * Se a serie fica fora da escala de valores. E o `isHidden` enquanto alguma esta ligada; com todas desligadas\n * pela legenda, vale o que estava ligado antes da ultima sair, e a escala nao se mexe enquanto ela some.\n */\n isOutOfScale: (label: string) => boolean;\n toggle: (label: string) => void;\n}\n\n/**\n * Quais series estao ocultas. Controlado quando o produto informa\n * `hiddenSeries`, nao controlado em caso contrario, conforme `COMPONENTS.md`\n * secao 6. Trabalha com rotulos porque e o rotulo que a legenda exibe e o que\n * o produto reconhece; indices mudariam de significado ao reordenar as series.\n */\nexport function useSeriesToggle({\n defaultHiddenSeries = [],\n hiddenSeries,\n labels,\n onHiddenSeriesChange,\n}: UseSeriesToggleOptions): SeriesToggle {\n const [internas, setInternas] = useState<readonly string[]>(defaultHiddenSeries);\n const [ocultasAntesDaUltima, setOcultasAntesDaUltima] = useState<readonly string[] | null>(null);\n const ocultas = hiddenSeries ?? internas;\n const todasOcultas = labels !== undefined && labels.length > 0 && labels.every((label) => ocultas.includes(label));\n const ocultasDaEscala = todasOcultas && ocultasAntesDaUltima ? ocultasAntesDaUltima : ocultas;\n\n const toggle = useCallback(\n (label: string) => {\n const proximas = ocultas.includes(label)\n ? ocultas.filter((oculta) => oculta !== label)\n : [...ocultas, label];\n\n if (hiddenSeries === undefined) {\n setInternas(proximas);\n }\n\n setOcultasAntesDaUltima(labels?.every((rotulo) => proximas.includes(rotulo)) ? ocultas : null);\n\n onHiddenSeriesChange?.(proximas);\n },\n [hiddenSeries, labels, ocultas, onHiddenSeriesChange],\n );\n\n return {\n isHidden: useCallback((label: string) => ocultas.includes(label), [ocultas]),\n isOutOfScale: useCallback((label: string) => ocultasDaEscala.includes(label), [ocultasDaEscala]),\n toggle,\n };\n}\n\n/**\n * Series que entram na escala de valores, ou todas quando nenhuma entra. Sem isso a escala desabava ao\n * desligar a ultima, e ela saia esticada para fora do grafico em vez de encolher no lugar.\n */\nexport function seriesInScale<T extends { label: string }>(series: readonly T[], isHidden: (label: string) => boolean) {\n const visiveis = series.filter((serie) => !isHidden(serie.label));\n\n return visiveis.length > 0 ? visiveis : series;\n}\n"],"names":["useSeriesToggle","defaultHiddenSeries","hiddenSeries","labels","onHiddenSeriesChange","internas","setInternas","useState","ocultasAntesDaUltima","setOcultasAntesDaUltima","ocultas","ocultasDaEscala","label","toggle","useCallback","proximas","oculta","rotulo","seriesInScale","series","isHidden","visiveis","serie"],"mappings":"yGA0BO,SAASA,EAAgB,CAC9B,oBAAAC,EAAsB,CAAA,EACtB,aAAAC,EACA,OAAAC,EACA,qBAAAC,CACF,EAAyC,CACvC,KAAM,CAACC,EAAUC,CAAW,EAAIC,EAAAA,SAA4BN,CAAmB,EACzE,CAACO,EAAsBC,CAAuB,EAAIF,EAAAA,SAAmC,IAAI,EACzFG,EAAUR,GAAgBG,EAE1BM,EADeR,IAAW,QAAaA,EAAO,OAAS,GAAKA,EAAO,MAAOS,GAAUF,EAAQ,SAASE,CAAK,CAAC,GACzEJ,EAAuBA,EAAuBE,EAEhFG,EAASC,EAAAA,YACZF,GAAkB,CACjB,MAAMG,EAAWL,EAAQ,SAASE,CAAK,EACnCF,EAAQ,OAAQM,GAAWA,IAAWJ,CAAK,EAC3C,CAAC,GAAGF,EAASE,CAAK,EAElBV,IAAiB,QACnBI,EAAYS,CAAQ,EAGtBN,EAAwBN,GAAA,MAAAA,EAAQ,MAAOc,GAAWF,EAAS,SAASE,CAAM,GAAKP,EAAU,IAAI,EAE7FN,GAAA,MAAAA,EAAuBW,EACzB,EACA,CAACb,EAAcC,EAAQO,EAASN,CAAoB,CAAA,EAGtD,MAAO,CACL,SAAUU,EAAAA,YAAaF,GAAkBF,EAAQ,SAASE,CAAK,EAAG,CAACF,CAAO,CAAC,EAC3E,aAAcI,EAAAA,YAAaF,GAAkBD,EAAgB,SAASC,CAAK,EAAG,CAACD,CAAe,CAAC,EAC/F,OAAAE,CAAA,CAEJ,CAMO,SAASK,EAA2CC,EAAsBC,EAAsC,CACrH,MAAMC,EAAWF,EAAO,OAAQG,GAAU,CAACF,EAASE,EAAM,KAAK,CAAC,EAEhE,OAAOD,EAAS,OAAS,EAAIA,EAAWF,CAC1C"}
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
function
|
|
3
|
-
defaultHiddenSeries:
|
|
1
|
+
import { useState as v, useCallback as a } from "react";
|
|
2
|
+
function A({
|
|
3
|
+
defaultHiddenSeries: n = [],
|
|
4
4
|
hiddenSeries: o,
|
|
5
|
-
|
|
5
|
+
labels: t,
|
|
6
|
+
onHiddenSeriesChange: u
|
|
6
7
|
}) {
|
|
7
|
-
const [m, p] =
|
|
8
|
-
(
|
|
9
|
-
const
|
|
10
|
-
o === void 0 && p(
|
|
8
|
+
const [m, O] = v(n), [r, p] = v(null), c = o ?? m, f = t !== void 0 && t.length > 0 && t.every((s) => c.includes(s)) && r ? r : c, D = a(
|
|
9
|
+
(s) => {
|
|
10
|
+
const i = c.includes(s) ? c.filter((l) => l !== s) : [...c, s];
|
|
11
|
+
o === void 0 && O(i), p(t != null && t.every((l) => i.includes(l)) ? c : null), u == null || u(i);
|
|
11
12
|
},
|
|
12
|
-
[o, t,
|
|
13
|
+
[o, t, c, u]
|
|
13
14
|
);
|
|
14
15
|
return {
|
|
15
|
-
isHidden:
|
|
16
|
-
|
|
16
|
+
isHidden: a((s) => c.includes(s), [c]),
|
|
17
|
+
isOutOfScale: a((s) => f.includes(s), [f]),
|
|
18
|
+
toggle: D
|
|
17
19
|
};
|
|
18
20
|
}
|
|
21
|
+
function I(n, o) {
|
|
22
|
+
const t = n.filter((u) => !o(u.label));
|
|
23
|
+
return t.length > 0 ? t : n;
|
|
24
|
+
}
|
|
19
25
|
export {
|
|
20
|
-
I as
|
|
26
|
+
I as seriesInScale,
|
|
27
|
+
A as useSeriesToggle
|
|
21
28
|
};
|
|
22
29
|
//# sourceMappingURL=useSeriesToggle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSeriesToggle.js","sources":["../../../../src/components/charts/core/useSeriesToggle.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport interface UseSeriesToggleOptions {\n defaultHiddenSeries?: readonly string[];\n hiddenSeries?: readonly string[];\n onHiddenSeriesChange?: (hidden: readonly string[]) => void;\n}\n\nexport interface SeriesToggle {\n isHidden: (label: string) => boolean;\n toggle: (label: string) => void;\n}\n\n/**\n * Quais series estao ocultas. Controlado quando o produto informa\n * `hiddenSeries`, nao controlado em caso contrario, conforme `COMPONENTS.md`\n * secao 6. Trabalha com rotulos porque e o rotulo que a legenda exibe e o que\n * o produto reconhece; indices mudariam de significado ao reordenar as series.\n */\nexport function useSeriesToggle({\n defaultHiddenSeries = [],\n hiddenSeries,\n onHiddenSeriesChange,\n}: UseSeriesToggleOptions): SeriesToggle {\n const [internas, setInternas] = useState<readonly string[]>(defaultHiddenSeries);\n const ocultas = hiddenSeries ?? internas;\n\n const toggle = useCallback(\n (label: string) => {\n const proximas = ocultas.includes(label)\n ? ocultas.filter((oculta) => oculta !== label)\n : [...ocultas, label];\n\n if (hiddenSeries === undefined) {\n setInternas(proximas);\n }\n\n onHiddenSeriesChange?.(proximas);\n },\n [hiddenSeries, ocultas, onHiddenSeriesChange],\n );\n\n return {\n isHidden: useCallback((label: string) => ocultas.includes(label), [ocultas]),\n toggle,\n };\n}\n"],"names":["useSeriesToggle","defaultHiddenSeries","hiddenSeries","onHiddenSeriesChange","internas","setInternas","useState","
|
|
1
|
+
{"version":3,"file":"useSeriesToggle.js","sources":["../../../../src/components/charts/core/useSeriesToggle.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport interface UseSeriesToggleOptions {\n defaultHiddenSeries?: readonly string[];\n hiddenSeries?: readonly string[];\n /** Todos os rotulos; com eles, desligar a ultima serie mantem a escala de antes. */\n labels?: readonly string[];\n onHiddenSeriesChange?: (hidden: readonly string[]) => void;\n}\n\nexport interface SeriesToggle {\n isHidden: (label: string) => boolean;\n /**\n * Se a serie fica fora da escala de valores. E o `isHidden` enquanto alguma esta ligada; com todas desligadas\n * pela legenda, vale o que estava ligado antes da ultima sair, e a escala nao se mexe enquanto ela some.\n */\n isOutOfScale: (label: string) => boolean;\n toggle: (label: string) => void;\n}\n\n/**\n * Quais series estao ocultas. Controlado quando o produto informa\n * `hiddenSeries`, nao controlado em caso contrario, conforme `COMPONENTS.md`\n * secao 6. Trabalha com rotulos porque e o rotulo que a legenda exibe e o que\n * o produto reconhece; indices mudariam de significado ao reordenar as series.\n */\nexport function useSeriesToggle({\n defaultHiddenSeries = [],\n hiddenSeries,\n labels,\n onHiddenSeriesChange,\n}: UseSeriesToggleOptions): SeriesToggle {\n const [internas, setInternas] = useState<readonly string[]>(defaultHiddenSeries);\n const [ocultasAntesDaUltima, setOcultasAntesDaUltima] = useState<readonly string[] | null>(null);\n const ocultas = hiddenSeries ?? internas;\n const todasOcultas = labels !== undefined && labels.length > 0 && labels.every((label) => ocultas.includes(label));\n const ocultasDaEscala = todasOcultas && ocultasAntesDaUltima ? ocultasAntesDaUltima : ocultas;\n\n const toggle = useCallback(\n (label: string) => {\n const proximas = ocultas.includes(label)\n ? ocultas.filter((oculta) => oculta !== label)\n : [...ocultas, label];\n\n if (hiddenSeries === undefined) {\n setInternas(proximas);\n }\n\n setOcultasAntesDaUltima(labels?.every((rotulo) => proximas.includes(rotulo)) ? ocultas : null);\n\n onHiddenSeriesChange?.(proximas);\n },\n [hiddenSeries, labels, ocultas, onHiddenSeriesChange],\n );\n\n return {\n isHidden: useCallback((label: string) => ocultas.includes(label), [ocultas]),\n isOutOfScale: useCallback((label: string) => ocultasDaEscala.includes(label), [ocultasDaEscala]),\n toggle,\n };\n}\n\n/**\n * Series que entram na escala de valores, ou todas quando nenhuma entra. Sem isso a escala desabava ao\n * desligar a ultima, e ela saia esticada para fora do grafico em vez de encolher no lugar.\n */\nexport function seriesInScale<T extends { label: string }>(series: readonly T[], isHidden: (label: string) => boolean) {\n const visiveis = series.filter((serie) => !isHidden(serie.label));\n\n return visiveis.length > 0 ? visiveis : series;\n}\n"],"names":["useSeriesToggle","defaultHiddenSeries","hiddenSeries","labels","onHiddenSeriesChange","internas","setInternas","useState","ocultasAntesDaUltima","setOcultasAntesDaUltima","ocultas","ocultasDaEscala","label","toggle","useCallback","proximas","oculta","rotulo","seriesInScale","series","isHidden","visiveis","serie"],"mappings":";AA0BO,SAASA,EAAgB;AAAA,EAC9B,qBAAAC,IAAsB,CAAA;AAAA,EACtB,cAAAC;AAAA,EACA,QAAAC;AAAA,EACA,sBAAAC;AACF,GAAyC;AACvC,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAA4BN,CAAmB,GACzE,CAACO,GAAsBC,CAAuB,IAAIF,EAAmC,IAAI,GACzFG,IAAUR,KAAgBG,GAE1BM,IADeR,MAAW,UAAaA,EAAO,SAAS,KAAKA,EAAO,MAAM,CAACS,MAAUF,EAAQ,SAASE,CAAK,CAAC,KACzEJ,IAAuBA,IAAuBE,GAEhFG,IAASC;AAAA,IACb,CAACF,MAAkB;AACjB,YAAMG,IAAWL,EAAQ,SAASE,CAAK,IACnCF,EAAQ,OAAO,CAACM,MAAWA,MAAWJ,CAAK,IAC3C,CAAC,GAAGF,GAASE,CAAK;AAEtB,MAAIV,MAAiB,UACnBI,EAAYS,CAAQ,GAGtBN,EAAwBN,KAAA,QAAAA,EAAQ,MAAM,CAACc,MAAWF,EAAS,SAASE,CAAM,KAAKP,IAAU,IAAI,GAE7FN,KAAA,QAAAA,EAAuBW;AAAA,IACzB;AAAA,IACA,CAACb,GAAcC,GAAQO,GAASN,CAAoB;AAAA,EAAA;AAGtD,SAAO;AAAA,IACL,UAAUU,EAAY,CAACF,MAAkBF,EAAQ,SAASE,CAAK,GAAG,CAACF,CAAO,CAAC;AAAA,IAC3E,cAAcI,EAAY,CAACF,MAAkBD,EAAgB,SAASC,CAAK,GAAG,CAACD,CAAe,CAAC;AAAA,IAC/F,QAAAE;AAAA,EAAA;AAEJ;AAMO,SAASK,EAA2CC,GAAsBC,GAAsC;AACrH,QAAMC,IAAWF,EAAO,OAAO,CAACG,MAAU,CAACF,EAASE,EAAM,KAAK,CAAC;AAEhE,SAAOD,EAAS,SAAS,IAAIA,IAAWF;AAC1C;"}
|