From f4346d75df3f1ca5cf71161bd80e0f5ce578decc Mon Sep 17 00:00:00 2001 From: Matt Vickers Date: Tue, 3 Dec 2024 12:41:22 -0600 Subject: [PATCH] Debarrel packages/polaris-viz --- .eslintrc | 10 ++- .storybook/preview.js | 4 +- .../src/hooks/stories/Hooks.stories.mdx | 10 +-- .../ColorScale/ColorScale.stories.mdx | 9 +- .../OpacityScale/OpacityScale.stories.mdx | 9 +- .../stories/changeColorOpacity.stories.mdx | 9 +- .../stories/changeGradientOpacity.stories.mdx | 9 +- .../src/utilities/stories/clamp.stories.mdx | 9 +- .../createCSSConicGradient.stories.mdx | 9 +- .../stories/createGradient.stories.mdx | 9 +- .../utilities/stories/createTheme.stories.mdx | 10 +-- .../stories/curveStepRounded.stories.mdx | 9 +- .../stories/estimateStringWidth.stories.mdx | 9 +- .../stories/getAverageColor.stories.mdx | 9 +- .../stories/getFilteredSeries.stories.mdx | 9 +- .../stories/getSeriesColors.stories.mdx | 9 +- .../stories/getValueFromXScale.stories.mdx | 9 +- .../stories/isGradientType.stories.mdx | 10 +-- .../stories/isValueWithinDomain.stories.mdx | 9 +- .../stories/paddingStringToObject.stories.mdx | 8 +- .../stories/removeFalsyValues.stories.mdx | 10 +-- .../utilities/stories/uniqueId.stories.mdx | 8 +- .../stories/useSVGBlurEvents.stories.mdx | 10 +-- packages/polaris-viz/src/chromatic/index.ts | 2 - .../stories/DataShape.chromatic.stories.tsx | 10 +-- .../stories/DataVolume.chromatic.stories.tsx | 10 +-- .../stories/EmptyData.chromatic.stories.tsx | 26 +++--- .../EmptyDataSeries.chromatic.stories.tsx | 26 +++--- .../InfinityData.chromatic.stories.tsx | 26 +++--- .../stories/SmallCharts.chromatic.stories.tsx | 26 +++--- .../stories/Themes.chromatic.stories.tsx | 16 ++-- .../utilities/renderCombinationSections.tsx | 2 +- .../components/Annotations/Annotations.tsx | 10 +-- .../Annotations/YAxisAnnotations.tsx | 10 +-- .../components/AnnotationContent/index.ts | 1 - .../AnnotationLabel/AnnotationLabel.test.tsx | 2 +- .../AnnotationLabel/AnnotationLabel.tsx | 2 +- .../components/AnnotationLabel/index.ts | 1 - .../components/AnnotationLine/index.ts | 1 - .../components/AnnotationYAxisLabel/index.ts | 1 - .../ShowMoreAnnotationsButton.test.tsx | 5 +- .../ShowMoreAnnotationsButton.tsx | 5 +- .../components/index.ts | 2 - .../ShowMoreAnnotationsButton/index.ts | 1 - .../Annotations/components/index.ts | 5 -- .../src/components/Annotations/index.ts | 17 ---- .../Annotations/tests/Annotations.test.tsx | 10 +-- .../tests/YAxisAnnotations.test.tsx | 8 +- .../polaris-viz/src/components/Arc/Arc.tsx | 4 +- .../polaris-viz/src/components/Arc/index.ts | 1 - .../src/components/Arc/tests/Arc.test.tsx | 2 +- .../src/components/BarChart/BarChart.tsx | 14 +-- .../src/components/BarChart/index.ts | 2 - .../HorizontalBarChart.chromatic.stories.tsx | 2 +- .../HorizontalBarChart.stories.tsx | 2 +- .../VerticalBarChart.chromatic.stories.tsx | 2 +- .../Annotations/VerticalBarChart.stories.tsx | 2 +- .../stories/BarChart.chromatic.stories.tsx | 2 +- .../BarChart/stories/Default.stories.tsx | 2 +- .../FormattedValues.chromatic.stories.tsx | 2 +- .../BarChart/stories/HideXAxis.stories.tsx | 2 +- .../BarChart/stories/Horizontal.stories.tsx | 2 +- .../stories/HorizontalStacked.stories.tsx | 4 +- ...ontalStackedWithoutXAxisLabels.stories.tsx | 2 +- .../BarChart/stories/IntegersOnly.stories.tsx | 2 +- .../InteractiveCustomLegend.stories.tsx | 4 +- .../BarChart/stories/NegativeOnly.stories.tsx | 2 +- .../stories/NoOverflowStyle.stories.tsx | 6 +- .../OverwrittenSeriesColors.stories.tsx | 2 +- .../BarChart/stories/SingleBar.stories.tsx | 2 +- .../BarChart/stories/Stacked.stories.tsx | 2 +- .../stories/WithRoundedCorners.stories.tsx | 6 +- .../stories/YAxisPercentages.stories.tsx | 2 +- .../src/components/BarChart/stories/data.tsx | 2 +- .../src/components/BarChart/stories/meta.tsx | 4 +- .../playground/MisMatchedData.stories.tsx | 4 +- .../stories/playground/Playground.stories.tsx | 4 +- ...StackedHorizontalLotsOfLegends.stories.tsx | 4 +- .../playground/ZeroDataChange.stories.tsx | 4 +- .../BarChart/tests/BarChart.test.tsx | 6 +- .../ChartContainer/ChartContainer.tsx | 7 +- .../hooks/useContainerBounds.ts | 9 +- .../src/components/ChartContainer/index.ts | 1 - .../src/components/ChartElements/index.ts | 7 -- .../ChartErrorBoundary/ChartErrorBoundary.tsx | 4 +- .../components/ChartErrorBoundary/index.ts | 1 - .../tests/ChartErrorBoundary.test.tsx | 2 +- .../ChartSkeleton/ChartSkeleton.tsx | 20 ++--- .../DonutSkeleton/DonutSkeleton.tsx | 5 +- .../components/DonutSkeleton/index.ts | 1 - .../components/ErrorText/ErrorText.tsx | 4 +- .../components/ErrorText/index.ts | 1 - .../FunnelSkeleton/FunnelSkeleton.tsx | 4 +- .../components/FunnelSkeleton/index.ts | 1 - .../components/GridSkeleton/GridSkeleton.tsx | 2 +- .../components/GridSkeleton/index.ts | 1 - .../ChartSkeleton/components/Shimmer/index.ts | 1 - .../SimpleBarSkeleton/SimpleBarSkeleton.tsx | 2 +- .../components/SimpleBarSkeleton/index.ts | 1 - .../SimpleNormalizedSkeleton.tsx | 4 +- .../SimpleNormalizedSkeleton/index.ts | 1 - .../SparkSkeleton/SparkSkeleton.tsx | 2 +- .../components/SparkSkeleton/index.ts | 1 - .../ChartSkeleton/components/index.ts | 8 -- .../src/components/ChartSkeleton/index.ts | 9 -- .../tests/ChartSkeleton.test.tsx | 2 +- .../src/components/ComboChart/Chart.tsx | 39 +++++---- .../src/components/ComboChart/ComboChart.tsx | 7 +- .../components/AxisLabel/AxisLabel.test.tsx | 5 +- .../components/AxisLabel/AxisLabel.tsx | 2 +- .../ComboChart/components/AxisLabel/index.ts | 1 - .../ComboBarChart/ComboBarChart.tsx | 5 +- .../components/ComboBarChart/index.ts | 1 - .../ComboLineChart/ComboLineChart.tsx | 6 +- .../components/ComboLineChart/index.ts | 1 - .../components/ComboChart/components/index.ts | 3 - .../hooks/useComboChartTooltipContent.ts | 2 +- .../ComboChart/hooks/useGetDualAxis.ts | 8 +- .../src/components/ComboChart/index.ts | 2 - .../stories/Annotations.stories.tsx | 2 +- .../ComboChart/stories/Default.stories.tsx | 2 +- .../FormattedValues.chromatic.stories.tsx | 2 +- .../InteractiveCustomLegend.stories.tsx | 6 +- .../ComboChart/tests/Chart.test.tsx | 12 +-- .../ComparisonMetric/ComparisonMetric.tsx | 2 +- .../src/components/ComparisonMetric/index.ts | 2 - .../tests/ComparisonMetric.test.tsx | 2 +- .../ConicGradientWithStops.tsx | 2 +- .../ConicGradientWithStops/index.ts | 1 - .../tests/ConicGradientWithStops.test.tsx | 2 +- .../src/components/Crosshair/index.ts | 1 - .../Crosshair/tests/Crosshair.test.tsx | 6 +- .../stories/AnalyticsExperiences.stories.mdx | 2 +- .../stories/AvailableNativeCharts.stories.mdx | 3 +- .../stories/AvailableWebCharts.stories.mdx | 3 +- .../Docs/stories/Behavior.stories.mdx | 2 +- .../Docs/stories/BuildingBlocks.stories.mdx | 2 +- .../Docs/stories/Context.stories.mdx | 2 +- .../stories/CustomizingThemes.stories.mdx | 7 +- .../components/Docs/stories/Data.stories.mdx | 23 ++--- .../Docs/stories/DefaultThemes.stories.mdx | 4 +- .../Docs/stories/Definitions.stories.mdx | 2 +- .../Docs/stories/FormattingValues.stories.mdx | 14 ++- .../GettingStartedWithNative.stories.mdx | 4 +- .../stories/GettingStartedWithWeb.stories.mdx | 4 +- .../Docs/stories/Labels.stories.mdx | 6 +- .../Docs/stories/Legends.stories.mdx | 12 ++- .../Docs/stories/Principles.stories.mdx | 2 +- .../Docs/stories/Readme.stories.mdx | 6 +- .../Docs/stories/ThemeDefinition.stories.mdx | 17 +--- .../components/Docs/stories/arc.stories.mdx | 4 +- .../components/Docs/stories/bar.stories.mdx | 12 +-- .../Docs/stories/chartConainer.stories.mdx | 2 +- .../Docs/stories/components/Banner/index.ts | 1 - .../stories/components/CodeBlock/index.ts | 1 - .../ComponentContainer/ComponentContainer.tsx | 5 +- .../components/ComponentContainer/index.ts | 1 - .../stories/components/ExamplesGrid/index.ts | 1 - .../components/LogoHeader/LogoHeader.tsx | 3 +- .../components/LogoHeader/images/index.ts | 1 - .../stories/components/LogoHeader/index.ts | 1 - .../MobileComponents/MobileComponents.tsx | 8 +- .../components/MobileComponents/index.ts | 1 - .../PageWithSizingInfo/PageWithSizingInfo.tsx | 2 +- .../components/PageWithSizingInfo/index.ts | 1 - .../components/PropertyTable/index.tsx | 1 - .../stories/components/SampleComponents.tsx | 26 +++--- .../SimpleContainer/SimpleContainer.tsx | 4 +- .../components/SimpleContainer/index.ts | 1 - .../Docs/stories/components/Title/index.ts | 1 - .../UtilitiesHeader/UtilitiesHeader.tsx | 2 +- .../components/UtilitiesHeader/index.ts | 1 - .../WebComponents/WebComponents.tsx | 27 +++--- .../stories/components/WebComponents/index.ts | 1 - .../Docs/stories/components/index.ts | 23 ----- .../stories/createThemeUtility.stories.mdx | 2 +- .../Docs/stories/crosshair.stories.mdx | 16 ++-- .../components/Docs/stories/grid.stories.mdx | 16 ++-- .../src/components/Docs/stories/index.ts | 1 - .../Docs/stories/legend.stories.mdx | 19 ++-- .../components/Docs/stories/line.stories.mdx | 21 ++--- .../Docs/stories/seriesColors.stories.mdx | 15 ++-- .../Docs/stories/tooltip.stories.mdx | 12 +-- .../components/Docs/stories/xaxis.stories.mdx | 18 ++-- .../components/Docs/stories/yaxis.stories.mdx | 20 ++--- .../Docs/{utilities/index.ts => utilities.ts} | 0 .../src/components/DonutChart/Chart.tsx | 22 ++--- .../src/components/DonutChart/DonutChart.tsx | 4 +- .../components/InnerValue/InnerValue.tsx | 6 +- .../DonutChart/components/InnerValue/index.ts | 1 - .../InnerValue/tests/InnerValue.test.tsx | 2 +- .../components/LegendValues/LegendValues.tsx | 1 - .../LegendValueItem/LegendValueItem.tsx | 4 +- .../components/LegendValues/index.ts | 1 - .../components/DonutChart/components/index.ts | 2 - .../src/components/DonutChart/index.ts | 4 - .../DonutChart/stories/CustomArc.stories.tsx | 2 +- .../CustomInnerValueContent.stories.tsx | 2 +- .../stories/DonutChart.chromatic.stories.tsx | 9 +- .../InteractiveCustomLegend.stories.tsx | 4 +- .../stories/LegendFullWidth.stories.tsx | 4 +- .../LoadingStateWithCustomArc.stories.tsx | 2 +- .../stories/TruncatedLegends.stories.tsx | 4 +- .../stories/WithLegendValues.stories.tsx | 2 +- .../stories/WithoutRoundedCorners.stories.tsx | 2 +- .../playground/AnimationSpeed.stories.tsx | 4 +- .../DonutChart/tests/DonutChart.test.tsx | 11 ++- .../src/components/DonutChart/types.ts | 2 +- .../src/components/FunnelChart/Chart.tsx | 11 +-- .../components/FunnelChart/FunnelChart.tsx | 6 +- .../components/FunnelChartXAxisArrows.tsx | 4 +- .../components/FunnelChartXAxisLabels.tsx | 5 +- .../FunnelChart/components/index.ts | 4 - .../src/components/FunnelChart/index.ts | 2 - .../FunnelChart/stories/Default.stories.tsx | 2 +- .../stories/DynamicData.stories.tsx | 2 +- .../components/FunnelChart/stories/meta.ts | 2 +- .../components/Grid/components/GroupCell.tsx | 2 +- .../Grid/components/XAxisLabels.tsx | 2 +- .../Grid/components/YAxisLabels.tsx | 2 +- .../polaris-viz/src/components/Grid/index.ts | 2 - .../src/components/Grid/stories/meta.tsx | 2 +- .../src/components/Grid/tests/Grid.test.tsx | 4 +- .../components/HorizontalBarChart/Chart.tsx | 53 ++++++----- .../HorizontalBarChartXAnnotations.tsx | 10 +-- ...eHorizontalBarChartXAnnotationPositions.ts | 8 +- .../HorizontalBarChartXAnnotations/index.ts | 1 - .../HorizontalBarChartYAnnotations.tsx | 8 +- ...HorizontalBarChartYAnnotationsPositions.ts | 4 +- .../HorizontalBarChartYAnnotations/index.ts | 1 - .../components/VerticalGridLines/index.ts | 1 - .../HorizontalBarChart/components/index.ts | 3 - .../components/HorizontalBarChart/index.ts | 2 - .../HorizontalBarChart/tests/Chart.test.tsx | 26 +++--- .../HorizontalBarChartXAxisLabels.tsx | 4 +- .../HorizontalBarChartXAxisLabels/index.ts | 1 - .../HorizontalGridLines.test.tsx | 6 +- .../components/HorizontalGridLines/index.ts | 1 - .../Labels/Labels.chromatic.stories.tsx | 2 +- .../src/components/Labels/hooks/index.ts | 1 - .../src/components/Labels/hooks/useLabels.tsx | 2 +- .../src/components/Labels/index.ts | 3 - .../Labels/utilities/truncateLabels.ts | 2 +- .../src/components/Legend/Legend.tsx | 6 +- .../components/LegendItem/LegendItem.tsx | 4 +- .../Legend/components/LegendItem/index.ts | 2 - .../src/components/Legend/components/index.ts | 2 - .../src/components/Legend/index.ts | 5 -- .../stories/Legend.chromatic.stories.tsx | 9 +- .../Legend/stories/Legend.stories.tsx | 2 +- .../components/Legend/tests/Legend.test.tsx | 4 +- .../LegendContainer/LegendContainer.tsx | 7 +- .../components/HiddenLegendTooltip.tsx | 6 +- .../tests/HiddenLegendTooltip.test.tsx | 2 +- .../hooks/useOverflowLegend.ts | 2 +- .../src/components/LegendContainer/index.ts | 2 - .../tests/LegendsContainer.test.tsx | 2 +- .../src/components/LineChart/Chart.tsx | 45 +++++----- .../src/components/LineChart/LineChart.tsx | 12 +-- .../LineChart/components/Points/Points.tsx | 4 +- .../LineChart/components/Points/index.ts | 1 - .../PointsAndCrosshair/PointsAndCrosshair.tsx | 6 +- .../components/PointsAndCrosshair/index.ts | 1 - .../components/LineChart/components/index.ts | 2 - .../src/components/LineChart/hooks/index.ts | 1 - .../src/components/LineChart/index.ts | 3 - .../LineChart/stories/Annotations.stories.tsx | 2 +- .../LineChart/stories/Default.stories.tsx | 2 +- .../LineChart/stories/DynamicData.stories.tsx | 2 +- .../stories/FixedYScaleWidth.stories.tsx | 2 +- .../FormattedValues.chromatic.stories.tsx | 2 +- .../LineChart/stories/HideXAxis.stories.tsx | 2 +- .../stories/IntegersOnly.stories.tsx | 2 +- .../InteractiveCustomLegend.stories.tsx | 4 +- .../stories/NoOverflowStyle.stories.tsx | 2 +- .../OverwrittenSeriesColors.stories.tsx | 2 +- .../stories/ResizeableChart.stories.tsx | 4 +- .../stories/WithNullValues.stories.tsx | 2 +- .../stories/YAxisPercentages.stories.tsx | 2 +- .../Annotations.chromatic.stories.tsx | 2 +- .../FixedYScaleWidth.chromatic.stories.tsx | 2 +- .../src/components/LineChart/stories/meta.tsx | 2 +- .../playground/CrosshairOffset.stories.tsx | 2 +- .../playground/MisMatchedData.stories.tsx | 4 +- .../stories/playground/Playground.stories.tsx | 2 +- .../components/LineChart/tests/Chart.test.tsx | 28 +++--- .../LineChart/tests/LineChart.test.tsx | 2 +- .../components/LineChart/utilities/index.ts | 1 - .../LineChartPredictive.tsx | 5 +- .../components/CustomLegend/CustomLegend.tsx | 4 +- .../components/CustomLegend/index.ts | 1 - .../PredictiveLinePoints.tsx | 4 +- .../components/PredictiveLinePoints/index.ts | 1 - .../components/SeriesIcon/index.ts | 1 - .../LineChartPredictive/components/index.ts | 3 - .../components/LineChartPredictive/index.ts | 2 - .../LineChartPredictive/stories/meta.tsx | 2 +- .../components/LineChartPredictive/types.ts | 2 +- .../renderLinearPredictiveTooltipContent.tsx | 12 ++- .../LineChartRelational.tsx | 8 +- .../components/Area/index.ts | 1 - .../components/CustomLegend/CustomLegend.tsx | 2 +- .../components/CustomLegend/index.ts | 1 - .../components/MissingDataArea/index.ts | 1 - .../components/RelatedAreas/RelatedAreas.tsx | 5 +- .../components/RelatedAreas/index.ts | 1 - .../RelatedAreas/tests/RelatedAreas.test.tsx | 2 +- .../LineChartRelational/components/index.ts | 4 - .../components/LineChartRelational/index.ts | 3 - .../FormattedValues.chromatic.stories.tsx | 2 +- .../LineChartRelational/stories/data.tsx | 2 +- .../LineChartRelational/stories/meta.tsx | 2 +- .../src/components/LinePreview/index.ts | 2 - .../stories/LinePreview.stories.tsx | 2 +- .../src/components/Point/Point.tsx | 2 +- .../polaris-viz/src/components/Point/index.ts | 1 - .../components/PolarisVizProvider/index.ts | 1 - .../PolarisVizProvider.chromatic.stories.tsx | 20 ++--- .../src/components/SimpleBarChart/Chart.tsx | 37 ++++---- .../SimpleBarChart/SimpleBarChart.tsx | 6 +- .../src/components/SimpleBarChart/index.ts | 3 - .../stories/Comparison.stories.tsx | 2 +- .../stories/Default.stories.tsx | 2 +- .../FormattedValues.chromatic.stories.tsx | 2 +- .../InteractiveCustomLegend.stories.tsx | 4 +- .../stories/LongLabels.stories.tsx | 2 +- .../stories/MultipleSeries.stories.tsx | 2 +- .../MultipleTrendIndicators.stories.tsx | 2 +- .../OverwrittenSeriesColors.stories.tsx | 2 +- .../SimpleBarChart.chromatic.stories.tsx | 2 +- .../stories/SimpleStacked.stories.tsx | 2 +- .../stories/WithTrendIndicators.stories.tsx | 2 +- .../AllZeroValues.chromatic.stories.tsx | 2 +- .../SimpleBarChart/stories/meta.tsx | 2 +- .../playground/MisMatchedData.stories.tsx | 4 +- .../SimpleBarChart/tests/Chart.test.tsx | 14 ++- .../tests/SimpleBarChart.test.tsx | 2 +- .../src/components/SimpleBarChart/types.ts | 2 +- .../components/SimpleBarChart/utilities.ts | 6 +- .../SimpleNormalizedChart/Chart.tsx | 15 ++-- .../SimpleNormalizedChart.tsx | 6 +- .../components/BarLabel/BarLabel.tsx | 6 +- .../components/BarLabel/index.ts | 2 - .../components/BarSegment/BarSegment.tsx | 2 +- .../components/BarSegment/index.ts | 1 - .../SimpleNormalizedChart/components/index.ts | 2 - .../components/SimpleNormalizedChart/index.ts | 4 - .../stories/Default.stories.tsx | 2 +- .../stories/ErrorState.stories.tsx | 2 +- .../stories/FormattedValues.stories.tsx | 2 +- .../stories/HiddenLegend.stories.tsx | 2 +- .../InteractiveCustomLegend.stories.tsx | 4 +- .../stories/LoadingState.stories.tsx | 2 +- .../LoadingStateWithMediumSize.stories.tsx | 2 +- .../LoadingStateWithoutLegend.stories.tsx | 2 +- ...leNormalizedBarChart.chromatic.stories.tsx | 9 +- .../SimpleNormalizedChart/stories/data.tsx | 2 +- .../SimpleNormalizedChart/stories/meta.tsx | 2 +- .../tests/Chart.test.tsx | 7 +- .../tests/SimpleNormalizedChart.test.tsx | 2 +- .../src/components/SkipLink/index.ts | 1 - .../SparkBarChart/SparkBarChart.tsx | 4 +- .../src/components/SparkBarChart/index.ts | 2 - .../SparkBarChart/stories/Default.stories.tsx | 2 +- .../stories/NoTargetLine.stories.tsx | 2 +- .../stories/OffsetAndNulls.stories.tsx | 2 +- .../OverwrittenSeriesColors.stories.tsx | 2 +- .../SparkBarChart.chromatic.stories.tsx | 9 +- .../components/SparkBarChart/stories/data.tsx | 2 +- .../components/SparkBarChart/stories/meta.tsx | 2 +- .../src/components/SparkLineChart/Chart.tsx | 2 +- .../SparkLineChart/SparkLineChart.tsx | 4 +- .../src/components/SparkLineChart/index.ts | 2 - .../stories/Default.stories.tsx | 2 +- .../stories/ErrorState.stories.tsx | 2 +- .../stories/OffsetAndNulls.stories.tsx | 2 +- .../OverwrittenSeriesColors.stories.tsx | 2 +- .../SparkLineChart.chromatic.stories.tsx | 11 ++- .../stories/WithoutSpline.stories.tsx | 2 +- .../stories/ZeroSeries.stories.tsx | 2 +- .../SparkLineChart/stories/meta.tsx | 2 +- .../NonNumeric.chromatic.stories.tsx | 2 +- .../stories/playground/Playground.stories.tsx | 2 +- .../components/SquareColorPreview/index.ts | 2 - .../stories/SquareColorPreview.stories.tsx | 2 +- .../src/components/StackedAreaChart/Chart.tsx | 58 ++++++------- .../StackedAreaChart/StackedAreaChart.tsx | 10 +-- .../StackedAreaChart/components/Area/index.ts | 2 - .../Area/tests/AnimatedArea.test.tsx | 6 +- .../components/Points/Points.tsx | 4 +- .../components/Points/index.ts | 1 - .../components/StackedAreas/StackedAreas.tsx | 6 +- .../components/StackedAreas/index.ts | 1 - .../StackedAreas/tests/StackedAreas.test.tsx | 3 +- .../StackedAreaChart/components/index.ts | 3 - .../StackedAreaChart/hooks/index.ts | 1 - .../src/components/StackedAreaChart/index.ts | 2 - .../stories/Annotations.stories.tsx | 2 +- .../stories/Default.stories.tsx | 2 +- .../stories/DynamicData.stories.tsx | 2 +- .../stories/ExternalTooltip.stories.tsx | 13 +-- .../FormattedValues.chromatic.stories.tsx | 2 +- .../stories/HideXAxis.stories.tsx | 2 +- .../InteractiveCustomLegend.stories.tsx | 4 +- .../stories/NoOverflowStyle.stories.tsx | 2 +- .../OverwrittenSeriesColors.stories.tsx | 2 +- .../stories/SeriesColors.stories.tsx | 2 +- .../stories/YAxisPercentages.stories.tsx | 2 +- .../StackedAreaChart/stories/meta.tsx | 2 +- .../playground/LongerComparison.stories.tsx | 4 +- .../playground/MisMatchedData.stories.tsx | 4 +- .../StackedAreaChart/tests/Chart.test.tsx | 32 +++---- .../tests/StackedAreaChart.test.tsx | 2 +- .../src/components/SwallowErrors/index.ts | 1 - .../src/components/TextLine/TextLine.tsx | 3 +- .../src/components/TextLine/index.ts | 1 - .../TooltipContent/TooltipContent.tsx | 12 ++- .../TooltipContentContainer.tsx | 2 +- .../TooltipContentContainer/index.ts | 1 - .../components/TooltipRow/TooltipRow.tsx | 2 +- .../components/TooltipRow/index.ts | 1 - .../components/TooltipSeries/index.ts | 1 - .../components/TooltipSeriesName/index.ts | 1 - .../components/TooltipTitle/index.ts | 1 - .../TooltipContent/components/index.ts | 5 -- .../src/components/TooltipContent/index.ts | 9 -- .../stories/Default.stories.tsx | 2 +- .../stories/NoSeriesName.stories.tsx | 2 +- .../stories/NoSeriesNoTitle.stories.tsx | 2 +- .../stories/NoTitle.stories.tsx | 2 +- .../stories/PreviewIcons.stories.tsx | 2 +- .../stories/RenderTooltipContent.stories.mdx | 4 +- .../TooltipContent.chromatic.stories.tsx | 9 +- .../TooltipWrapper/TooltipWrapper.tsx | 2 +- .../src/components/TooltipWrapper/index.ts | 4 - .../getVerticalBarChartTooltipPosition.ts | 2 +- .../tests/getAlteredLineChartPosition.test.ts | 1 + .../TrendIndicator/TrendIndicator.tsx | 4 +- .../TrendIndicator/components/Arrows/index.ts | 2 - .../TrendIndicator/components/Svg/index.ts | 1 - .../TrendIndicator/components/index.ts | 2 - .../src/components/TrendIndicator/index.ts | 5 -- .../stories/Default.stories.tsx | 2 +- .../TrendContainerWidth.chromatic.stories.tsx | 12 ++- .../TrendIndicator.chromatic.stories.tsx | 11 ++- .../TrendIndicator/stories/meta.tsx | 6 +- .../utilities/estimateTrendIndicatorWidth.ts | 2 +- .../src/components/VerticalBarChart/Chart.tsx | 49 +++++------ .../VerticalBarChart/VerticalBarChart.tsx | 2 +- .../components/BarGroup/BarGroup.tsx | 8 +- .../components/BarGroup/index.ts | 1 - .../BarGroup/tests/BarGroup.test.tsx | 2 +- .../StackedBarGroups/StackedBarGroups.tsx | 6 +- .../components/Stack/Stack.tsx | 10 +-- .../components/Stack/index.ts | 1 - .../StackedBarGroups/components/index.ts | 1 - .../components/StackedBarGroups/index.ts | 1 - .../components/VerticalBar/VerticalBar.tsx | 2 +- .../components/VerticalBar/index.ts | 1 - .../VerticalBarGroup/VerticalBarGroup.tsx | 6 +- .../components/VerticalBarGroup/index.ts | 1 - .../VerticalBarChart/components/index.ts | 3 - .../VerticalBarChart/hooks/index.ts | 2 - .../hooks/useStackedGapsForVerticalChart.tsx | 2 +- .../src/components/VerticalBarChart/index.ts | 5 -- .../VerticalBarChart/tests/Chart.test.tsx | 27 +++--- .../utilities/getYPosition.ts | 2 +- .../VerticalBarChart/utilities/index.ts | 4 - .../components/VisuallyHiddenRows/index.ts | 1 - .../src/components/XAxis/XAxis.tsx | 5 +- .../polaris-viz/src/components/XAxis/index.ts | 1 - .../src/components/YAxis/YAxis.tsx | 7 +- .../polaris-viz/src/components/YAxis/index.ts | 1 - packages/polaris-viz/src/components/index.ts | 56 ------------ .../src/components/shared/Bar/Bar.tsx | 2 +- .../src/components/shared/Bar/index.ts | 1 - .../components/shared/GradientDefs/index.ts | 1 - .../shared/GroupLabel/GroupLabel.tsx | 5 +- .../src/components/shared/GroupLabel/index.ts | 1 - .../shared/HorizontalBars/HorizontalBars.tsx | 20 ++--- .../components/shared/HorizontalBars/index.ts | 3 - .../tests/HorizontalBars.test.tsx | 8 +- .../HorizontalGroup/HorizontalGroup.tsx | 8 +- .../shared/HorizontalGroup/index.ts | 1 - .../tests/HorizontalGroup.test.tsx | 4 +- .../HorizontalStackedBars.tsx | 22 ++--- .../components/StackedBar/index.ts | 1 - .../HorizontalStackedBars/components/index.ts | 1 - .../HorizontalStackedBars/hooks/index.ts | 1 - .../hooks/useStackedGaps.ts | 2 +- .../shared/HorizontalStackedBars/index.ts | 3 - .../tests/HorizontalStackedBars.test.tsx | 4 +- .../utilities/getXPosition.ts | 2 +- .../HorizontalStackedBars/utilities/index.ts | 1 - .../src/components/shared/Label/index.ts | 1 - .../components/shared/LabelWrapper/index.ts | 1 - .../shared/SeriesIcon/SeriesIcon.test.tsx | 7 +- .../shared/SeriesIcon/SeriesIcon.tsx | 4 +- .../src/components/shared/SeriesIcon/index.ts | 1 - .../components/shared/ZeroValueLine/index.ts | 1 - .../src/components/shared/index.ts | 6 -- .../src/hooks/ColorVisionA11y/index.ts | 3 - .../stories/ColorVisionA11y.stories.mdx | 7 +- .../ColorVisionA11y/stories/Playground.tsx | 3 +- .../ColorVisionA11y/useColorVisionEvents.ts | 2 +- .../useWatchColorVisionEvents.tsx | 2 +- .../src/hooks/ExternalEvents/index.ts | 2 - .../ExternalEvents/useExternalHideEvents.ts | 2 +- .../utilities/setHiddenItems.ts | 2 +- packages/polaris-viz/src/hooks/index.ts | 35 -------- .../hooks/tests/useWatchActiveSeries.test.tsx | 2 +- .../src/hooks/useHorizontalStackedValues.ts | 2 +- .../src/hooks/useLinearChartAnimations.tsx | 3 +- .../src/hooks/useLinearLabelsAndDimensions.ts | 2 +- .../src/hooks/useWatchActiveSeries.ts | 2 +- packages/polaris-viz/src/index.ts | 87 +++++++++---------- .../src/playground/ErrorBoundary.stories.tsx | 3 +- .../src/playground/ExternalEvents.stories.tsx | 8 +- .../polaris-viz/src/test-utilities/index.ts | 3 - .../src/test-utilities/mountWithProvider.tsx | 2 +- packages/polaris-viz/src/types.ts | 3 +- .../getStackedValuesFromDataSeries.tsx | 2 +- .../utilities/getTooltipContentRenderer.tsx | 5 +- .../src/utilities/getTrendIndicatorData.ts | 5 +- packages/polaris-viz/src/utilities/index.ts | 23 ----- .../utilities/renderLinearTooltipContent.tsx | 14 ++- .../src/utilities/setSingleSeriesActive.ts | 2 +- ...LinearTooltipContent.chromatic.stories.tsx | 6 +- .../utilities/tests/getAxisOptions.test.ts | 5 +- .../tests/getTooltipContentRenderer.test.tsx | 2 +- tests/setup/tests.ts | 25 +++--- 531 files changed, 1175 insertions(+), 1687 deletions(-) delete mode 100644 packages/polaris-viz/src/chromatic/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/components/AnnotationContent/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/components/AnnotationLine/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/components/AnnotationYAxisLabel/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/components/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/components/index.ts delete mode 100644 packages/polaris-viz/src/components/Annotations/index.ts delete mode 100644 packages/polaris-viz/src/components/Arc/index.ts delete mode 100644 packages/polaris-viz/src/components/BarChart/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartContainer/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartElements/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartErrorBoundary/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/Shimmer/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/components/index.ts delete mode 100644 packages/polaris-viz/src/components/ChartSkeleton/index.ts delete mode 100644 packages/polaris-viz/src/components/ComboChart/components/AxisLabel/index.ts delete mode 100644 packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/index.ts delete mode 100644 packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/index.ts delete mode 100644 packages/polaris-viz/src/components/ComboChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/ComboChart/index.ts delete mode 100644 packages/polaris-viz/src/components/ComparisonMetric/index.ts delete mode 100644 packages/polaris-viz/src/components/ConicGradientWithStops/index.ts delete mode 100644 packages/polaris-viz/src/components/Crosshair/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/Banner/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/CodeBlock/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/ComponentContainer/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/ExamplesGrid/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/LogoHeader/images/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/LogoHeader/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/MobileComponents/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/PageWithSizingInfo/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/PropertyTable/index.tsx delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/Title/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/WebComponents/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/components/index.ts delete mode 100644 packages/polaris-viz/src/components/Docs/stories/index.ts rename packages/polaris-viz/src/components/Docs/{utilities/index.ts => utilities.ts} (100%) delete mode 100644 packages/polaris-viz/src/components/DonutChart/components/InnerValue/index.ts delete mode 100644 packages/polaris-viz/src/components/DonutChart/components/LegendValues/index.ts delete mode 100644 packages/polaris-viz/src/components/DonutChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/DonutChart/index.ts delete mode 100644 packages/polaris-viz/src/components/FunnelChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/FunnelChart/index.ts delete mode 100644 packages/polaris-viz/src/components/Grid/index.ts delete mode 100644 packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/index.ts delete mode 100644 packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/index.ts delete mode 100644 packages/polaris-viz/src/components/HorizontalBarChart/components/VerticalGridLines/index.ts delete mode 100644 packages/polaris-viz/src/components/HorizontalBarChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/HorizontalBarChart/index.ts delete mode 100644 packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/index.ts delete mode 100644 packages/polaris-viz/src/components/HorizontalGridLines/index.ts delete mode 100644 packages/polaris-viz/src/components/Labels/hooks/index.ts delete mode 100644 packages/polaris-viz/src/components/Labels/index.ts delete mode 100644 packages/polaris-viz/src/components/Legend/components/LegendItem/index.ts delete mode 100644 packages/polaris-viz/src/components/Legend/components/index.ts delete mode 100644 packages/polaris-viz/src/components/Legend/index.ts delete mode 100644 packages/polaris-viz/src/components/LegendContainer/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChart/components/Points/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChart/components/PointsAndCrosshair/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChart/hooks/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChart/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChart/utilities/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartPredictive/components/SeriesIcon/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartPredictive/components/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartPredictive/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartRelational/components/Area/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartRelational/components/MissingDataArea/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartRelational/components/index.ts delete mode 100644 packages/polaris-viz/src/components/LineChartRelational/index.ts delete mode 100644 packages/polaris-viz/src/components/LinePreview/index.ts delete mode 100644 packages/polaris-viz/src/components/Point/index.ts delete mode 100644 packages/polaris-viz/src/components/PolarisVizProvider/index.ts delete mode 100644 packages/polaris-viz/src/components/SimpleBarChart/index.ts delete mode 100644 packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/index.ts delete mode 100644 packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/index.ts delete mode 100644 packages/polaris-viz/src/components/SimpleNormalizedChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/SimpleNormalizedChart/index.ts delete mode 100644 packages/polaris-viz/src/components/SkipLink/index.ts delete mode 100644 packages/polaris-viz/src/components/SparkBarChart/index.ts delete mode 100644 packages/polaris-viz/src/components/SparkLineChart/index.ts delete mode 100644 packages/polaris-viz/src/components/SquareColorPreview/index.ts delete mode 100644 packages/polaris-viz/src/components/StackedAreaChart/components/Area/index.ts delete mode 100644 packages/polaris-viz/src/components/StackedAreaChart/components/Points/index.ts delete mode 100644 packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/index.ts delete mode 100644 packages/polaris-viz/src/components/StackedAreaChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/StackedAreaChart/hooks/index.ts delete mode 100644 packages/polaris-viz/src/components/StackedAreaChart/index.ts delete mode 100644 packages/polaris-viz/src/components/SwallowErrors/index.ts delete mode 100644 packages/polaris-viz/src/components/TextLine/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipContent/components/TooltipSeries/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipContent/components/TooltipSeriesName/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipContent/components/TooltipTitle/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipContent/components/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipContent/index.ts delete mode 100644 packages/polaris-viz/src/components/TooltipWrapper/index.ts delete mode 100644 packages/polaris-viz/src/components/TrendIndicator/components/Arrows/index.ts delete mode 100644 packages/polaris-viz/src/components/TrendIndicator/components/Svg/index.ts delete mode 100644 packages/polaris-viz/src/components/TrendIndicator/components/index.ts delete mode 100644 packages/polaris-viz/src/components/TrendIndicator/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/components/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/hooks/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/index.ts delete mode 100644 packages/polaris-viz/src/components/VerticalBarChart/utilities/index.ts delete mode 100644 packages/polaris-viz/src/components/VisuallyHiddenRows/index.ts delete mode 100644 packages/polaris-viz/src/components/XAxis/index.ts delete mode 100644 packages/polaris-viz/src/components/YAxis/index.ts delete mode 100644 packages/polaris-viz/src/components/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/Bar/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/GradientDefs/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/GroupLabel/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/HorizontalBars/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/HorizontalGroup/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/StackedBar/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/HorizontalStackedBars/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/Label/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/LabelWrapper/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/SeriesIcon/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/ZeroValueLine/index.ts delete mode 100644 packages/polaris-viz/src/components/shared/index.ts delete mode 100644 packages/polaris-viz/src/hooks/ColorVisionA11y/index.ts delete mode 100644 packages/polaris-viz/src/hooks/ExternalEvents/index.ts delete mode 100644 packages/polaris-viz/src/hooks/index.ts delete mode 100644 packages/polaris-viz/src/test-utilities/index.ts delete mode 100644 packages/polaris-viz/src/utilities/index.ts diff --git a/.eslintrc b/.eslintrc index 44a5a01c7..32fc12937 100644 --- a/.eslintrc +++ b/.eslintrc @@ -81,7 +81,8 @@ "UNSTABLE_telemetry" ] } - ] + ], + "@shopify/strict-component-boundaries": "off" }, "overrides": [ { @@ -150,6 +151,13 @@ "react/no-unused-prop-types": "off", "@shopify/strict-component-boundaries": "off" } + }, + { + "files": ["codemods/**/*.js"], + "rules": { + "no-console": "off", + "import/no-extraneous-dependencies": "off" + } } ] } diff --git a/.storybook/preview.js b/.storybook/preview.js index ec6ef7134..3c3201315 100644 --- a/.storybook/preview.js +++ b/.storybook/preview.js @@ -1,7 +1,7 @@ import {themes} from '@storybook/theming'; import {PolarisVizProvider} from '@shopify/polaris-viz'; -import {DARK_THEME, LIGHT_THEME} from '../packages/polaris-viz/src/constants'; -import {useTheme} from '../packages/polaris-viz/src/hooks'; +import {DARK_THEME} from '../packages/polaris-viz/src/constants'; +import {useTheme} from '@shopify/polaris-viz-core'; // https://github.com/storybookjs/storybook/issues/548 const storiesOrder = { diff --git a/packages/polaris-viz-core/src/hooks/stories/Hooks.stories.mdx b/packages/polaris-viz-core/src/hooks/stories/Hooks.stories.mdx index bec2fdb4c..aac60c8ac 100644 --- a/packages/polaris-viz-core/src/hooks/stories/Hooks.stories.mdx +++ b/packages/polaris-viz-core/src/hooks/stories/Hooks.stories.mdx @@ -1,10 +1,8 @@ -import {Meta, Story, Canvas} from '@storybook/addon-docs'; +import {Meta} from '@storybook/addon-docs'; -import { - Divider, - Title, - Banner, -} from '../../../../polaris-viz/src/components/Docs/stories/components'; +import {Title} from '../../../../polaris-viz/src/components/Docs/stories/components/Title/Title'; +import {Banner} from '../../../../polaris-viz/src/components/Docs/stories/components/Banner/Banner'; +import {UtilitiesHeader} from '../../../../polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/UtilitiesHeader'; +; diff --git a/packages/polaris-viz-core/src/utilities/stories/isValueWithinDomain.stories.mdx b/packages/polaris-viz-core/src/utilities/stories/isValueWithinDomain.stories.mdx index 2676cd7f5..53d42d2b3 100644 --- a/packages/polaris-viz-core/src/utilities/stories/isValueWithinDomain.stories.mdx +++ b/packages/polaris-viz-core/src/utilities/stories/isValueWithinDomain.stories.mdx @@ -1,10 +1,7 @@ -import {Meta, Story, Canvas} from '@storybook/addon-docs'; +import {Meta} from '@storybook/addon-docs'; -import { - Divider, - Title, - UtilitiesHeader, -} from '../../../../polaris-viz/src/components/Docs/stories/components'; +import {UtilitiesHeader} from '../../../../polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/UtilitiesHeader'; +import {Title} from '../../../../polaris-viz/src/components/Docs/stories/components/Title/Title'; { return (
- + {Object.keys(CHARTS).map((key) => { const Chart = CHARTS[key]; return ( -
+
-
+
); })}
); -}); \ No newline at end of file +}); diff --git a/packages/polaris-viz/src/chromatic/stories/Themes.chromatic.stories.tsx b/packages/polaris-viz/src/chromatic/stories/Themes.chromatic.stories.tsx index d25cc422f..85c9ff069 100644 --- a/packages/polaris-viz/src/chromatic/stories/Themes.chromatic.stories.tsx +++ b/packages/polaris-viz/src/chromatic/stories/Themes.chromatic.stories.tsx @@ -1,12 +1,12 @@ import {storiesOf} from '@storybook/react'; -import { - BarChart, - LineChart, - PolarisVizProvider, - SparkBarChart, - SparkLineChart, - StackedAreaChart, -} from '../../components'; + +import {BarChart} from '../../components/BarChart/BarChart'; +import {LineChart} from '../../components/LineChart/LineChart'; +import {PolarisVizProvider} from '../../components/PolarisVizProvider/PolarisVizProvider'; +import {SparkBarChart} from '../../components/SparkBarChart/SparkBarChart'; +import {SparkLineChart} from '../../components/SparkLineChart/SparkLineChart'; +import {StackedAreaChart} from '../../components/StackedAreaChart/StackedAreaChart'; + import {DARK_THEME, LIGHT_THEME} from '@shopify/polaris-viz-core'; const STORIES = [ diff --git a/packages/polaris-viz/src/chromatic/utilities/renderCombinationSections.tsx b/packages/polaris-viz/src/chromatic/utilities/renderCombinationSections.tsx index 0f5e4a992..f9a071d4e 100644 --- a/packages/polaris-viz/src/chromatic/utilities/renderCombinationSections.tsx +++ b/packages/polaris-viz/src/chromatic/utilities/renderCombinationSections.tsx @@ -1,7 +1,7 @@ import type {FC} from 'react'; import {StorySection} from '../components/StorySection'; -import {PolarisVizProvider} from '../../components'; +import {PolarisVizProvider} from '../../components/PolarisVizProvider/PolarisVizProvider'; type CombinationSection = [string, FC]; diff --git a/packages/polaris-viz/src/components/Annotations/Annotations.tsx b/packages/polaris-viz/src/components/Annotations/Annotations.tsx index 5a9ec9877..ada90ae58 100644 --- a/packages/polaris-viz/src/components/Annotations/Annotations.tsx +++ b/packages/polaris-viz/src/components/Annotations/Annotations.tsx @@ -7,12 +7,10 @@ import {useSVGBlurEvent} from '../../hooks/useSVGBlurEvent'; import {shouldHideAnnotation} from '../../utilities/shouldHideAnnotation'; import {isShowMoreAnnotationsButtonVisible} from '../../utilities/isShowMoreAnnotationsButtonVisible'; -import { - AnnotationLabel, - AnnotationLine, - AnnotationContent, - ShowMoreAnnotationsButton, -} from './components'; +import {AnnotationLabel} from './components/AnnotationLabel/AnnotationLabel'; +import {AnnotationLine} from './components/AnnotationLine/AnnotationLine'; +import {AnnotationContent} from './components/AnnotationContent/AnnotationContent'; +import {ShowMoreAnnotationsButton} from './components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton'; import {useAnnotationPositions} from './hooks/useAnnotationPositions'; import {PILL_HEIGHT, SHOW_MORE_BUTTON_OFFSET} from './constants'; import styles from './Annotations.scss'; diff --git a/packages/polaris-viz/src/components/Annotations/YAxisAnnotations.tsx b/packages/polaris-viz/src/components/Annotations/YAxisAnnotations.tsx index a81125f74..735cd0c56 100644 --- a/packages/polaris-viz/src/components/Annotations/YAxisAnnotations.tsx +++ b/packages/polaris-viz/src/components/Annotations/YAxisAnnotations.tsx @@ -9,12 +9,10 @@ import type {Annotation, AnnotationLookupTable, YAxisTick} from '../../types'; import {useSVGBlurEvent} from '../../hooks/useSVGBlurEvent'; import {useYAxisAnnotationPositions} from './hooks/useYAxisAnnotationPositions'; -import { - AnnotationContent, - AnnotationLabel, - AnnotationLine, - AnnotationYAxisLabel, -} from './components'; +import {AnnotationContent} from './components/AnnotationContent/AnnotationContent'; +import {AnnotationLabel} from './components/AnnotationLabel/AnnotationLabel'; +import {AnnotationLine} from './components/AnnotationLine/AnnotationLine'; +import {AnnotationYAxisLabel} from './components/AnnotationYAxisLabel/AnnotationYAxisLabel'; import type {OptionalDualAxisYAxis} from './types'; import styles from './Annotations.scss'; diff --git a/packages/polaris-viz/src/components/Annotations/components/AnnotationContent/index.ts b/packages/polaris-viz/src/components/Annotations/components/AnnotationContent/index.ts deleted file mode 100644 index df8c45dc7..000000000 --- a/packages/polaris-viz/src/components/Annotations/components/AnnotationContent/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {AnnotationContent} from './AnnotationContent'; diff --git a/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.test.tsx b/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.test.tsx index ba9f50dbf..6241a92a6 100644 --- a/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.test.tsx +++ b/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.test.tsx @@ -1,6 +1,6 @@ import {mount} from '@shopify/react-testing'; -import {SingleTextLine} from '../../../Labels'; +import {SingleTextLine} from '../../../Labels/SingleTextLine'; import type {AnnotationLabelProps} from './AnnotationLabel'; import {AnnotationLabel} from './AnnotationLabel'; diff --git a/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.tsx b/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.tsx index 18ede2cb3..3fae7fa23 100644 --- a/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.tsx +++ b/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/AnnotationLabel.tsx @@ -3,7 +3,7 @@ import {Fragment} from 'react'; import {FONT_SIZE, LINE_HEIGHT, useTheme} from '@shopify/polaris-viz-core'; import {useBrowserCheck} from '../../../../hooks/useBrowserCheck'; -import {SingleTextLine} from '../../../Labels'; +import {SingleTextLine} from '../../../Labels/SingleTextLine'; import {PILL_HEIGHT, PILL_PADDING} from '../../constants'; import type {AnnotationPosition} from '../../types'; diff --git a/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/index.ts b/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/index.ts deleted file mode 100644 index 68b38687b..000000000 --- a/packages/polaris-viz/src/components/Annotations/components/AnnotationLabel/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {AnnotationLabel} from './AnnotationLabel'; diff --git a/packages/polaris-viz/src/components/Annotations/components/AnnotationLine/index.ts b/packages/polaris-viz/src/components/Annotations/components/AnnotationLine/index.ts deleted file mode 100644 index 2f0e7d4a1..000000000 --- a/packages/polaris-viz/src/components/Annotations/components/AnnotationLine/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {AnnotationLine} from './AnnotationLine'; diff --git a/packages/polaris-viz/src/components/Annotations/components/AnnotationYAxisLabel/index.ts b/packages/polaris-viz/src/components/Annotations/components/AnnotationYAxisLabel/index.ts deleted file mode 100644 index 2228bb0b8..000000000 --- a/packages/polaris-viz/src/components/Annotations/components/AnnotationYAxisLabel/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {AnnotationYAxisLabel} from './AnnotationYAxisLabel'; diff --git a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.test.tsx b/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.test.tsx index 0d522bfa3..77f6bc821 100644 --- a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.test.tsx +++ b/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.test.tsx @@ -1,11 +1,12 @@ import {mount} from '@shopify/react-testing'; import {LIGHT_THEME} from '@shopify/polaris-viz-core'; -import {SingleTextLine} from '../../../Labels'; +import {SingleTextLine} from '../../../Labels/SingleTextLine'; import type {Props} from './ShowMoreAnnotationsButton'; import {ShowMoreAnnotationsButton} from './ShowMoreAnnotationsButton'; -import {Icon, Shadow} from './components'; +import {Icon} from './components/Icon'; +import {Shadow} from './components/Shadow'; jest.mock('@shopify/polaris-viz-core/src/utilities', () => ({ ...jest.requireActual('@shopify/polaris-viz-core/src/utilities'), diff --git a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.tsx b/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.tsx index df84efbf2..e0af514fa 100644 --- a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.tsx +++ b/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton.tsx @@ -7,10 +7,11 @@ import { } from '@shopify/polaris-viz-core'; import {PILL_HEIGHT, PILL_PADDING, PILL_X_MIN} from '../../constants'; -import {SingleTextLine} from '../../../Labels'; +import {SingleTextLine} from '../../../Labels/SingleTextLine'; import styles from './ShowMoreAnnotationsButton.scss'; -import {Icon, Shadow} from './components'; +import {Icon} from './components/Icon'; +import {Shadow} from './components/Shadow'; const STROKE = 2; diff --git a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/components/index.ts b/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/components/index.ts deleted file mode 100644 index d136a6166..000000000 --- a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {Icon} from './Icon'; -export {Shadow} from './Shadow'; diff --git a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/index.ts b/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/index.ts deleted file mode 100644 index ef0f04132..000000000 --- a/packages/polaris-viz/src/components/Annotations/components/ShowMoreAnnotationsButton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ShowMoreAnnotationsButton} from './ShowMoreAnnotationsButton'; diff --git a/packages/polaris-viz/src/components/Annotations/components/index.ts b/packages/polaris-viz/src/components/Annotations/components/index.ts deleted file mode 100644 index 0ff3cd3ec..000000000 --- a/packages/polaris-viz/src/components/Annotations/components/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export {AnnotationLine} from './AnnotationLine'; -export {AnnotationLabel} from './AnnotationLabel'; -export {AnnotationContent} from './AnnotationContent'; -export {ShowMoreAnnotationsButton} from './ShowMoreAnnotationsButton'; -export {AnnotationYAxisLabel} from './AnnotationYAxisLabel'; diff --git a/packages/polaris-viz/src/components/Annotations/index.ts b/packages/polaris-viz/src/components/Annotations/index.ts deleted file mode 100644 index 600dd9325..000000000 --- a/packages/polaris-viz/src/components/Annotations/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -export {Annotations} from './Annotations'; -export { - PILL_HEIGHT, - PILL_PADDING, - SHOW_MORE_BUTTON_OFFSET, - PILL_ROW_GAP, - PILL_X_MIN, -} from './constants'; -export {YAxisAnnotations} from './YAxisAnnotations'; -export {AnnotationContent} from './components/AnnotationContent'; -export {AnnotationLabel} from './components/AnnotationLabel'; -export {AnnotationLine} from './components/AnnotationLine'; -export type {AnnotationPosition} from './types'; -export {ShowMoreAnnotationsButton} from './components/ShowMoreAnnotationsButton'; -export {useShowMoreAnnotationsButton} from './hooks/useShowMoreAnnotationsButton'; -export {checkForHorizontalSpace} from './utilities/checkForHorizontalSpace'; -export {checkAvailableAnnotations} from './utilities/checkAvailableAnnotations'; diff --git a/packages/polaris-viz/src/components/Annotations/tests/Annotations.test.tsx b/packages/polaris-viz/src/components/Annotations/tests/Annotations.test.tsx index 40f94fa3f..4d486365c 100644 --- a/packages/polaris-viz/src/components/Annotations/tests/Annotations.test.tsx +++ b/packages/polaris-viz/src/components/Annotations/tests/Annotations.test.tsx @@ -5,12 +5,10 @@ import type {Annotation} from '../../../types'; import {normalizeData} from '../../../utilities/normalizeData'; import type {AnnotationsProps} from '../Annotations'; import {Annotations} from '../Annotations'; -import { - AnnotationContent, - AnnotationLabel, - AnnotationLine, - ShowMoreAnnotationsButton, -} from '../components'; +import {AnnotationContent} from '../components/AnnotationContent/AnnotationContent'; +import {AnnotationLabel} from '../components/AnnotationLabel/AnnotationLabel'; +import {AnnotationLine} from '../components/AnnotationLine/AnnotationLine'; +import {ShowMoreAnnotationsButton} from '../components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton'; jest.mock('@shopify/polaris-viz-core/src/utilities', () => ({ ...jest.requireActual('@shopify/polaris-viz-core/src/utilities'), diff --git a/packages/polaris-viz/src/components/Annotations/tests/YAxisAnnotations.test.tsx b/packages/polaris-viz/src/components/Annotations/tests/YAxisAnnotations.test.tsx index cc0ad027f..dba67bf05 100644 --- a/packages/polaris-viz/src/components/Annotations/tests/YAxisAnnotations.test.tsx +++ b/packages/polaris-viz/src/components/Annotations/tests/YAxisAnnotations.test.tsx @@ -5,11 +5,9 @@ import type {Annotation} from '../../../types'; import {normalizeData} from '../../../utilities/normalizeData'; import type {YAxisAnnotationsProps} from '../YAxisAnnotations'; import {YAxisAnnotations} from '../YAxisAnnotations'; -import { - AnnotationContent, - AnnotationLabel, - AnnotationLine, -} from '../components'; +import {AnnotationContent} from '../components/AnnotationContent/AnnotationContent'; +import {AnnotationLabel} from '../components/AnnotationLabel/AnnotationLabel'; +import {AnnotationLine} from '../components/AnnotationLine/AnnotationLine'; jest.mock('@shopify/polaris-viz-core/src/utilities', () => ({ ...jest.requireActual('@shopify/polaris-viz-core/src/utilities'), diff --git a/packages/polaris-viz/src/components/Arc/Arc.tsx b/packages/polaris-viz/src/components/Arc/Arc.tsx index 1de745d92..4611e2ce0 100644 --- a/packages/polaris-viz/src/components/Arc/Arc.tsx +++ b/packages/polaris-viz/src/components/Arc/Arc.tsx @@ -13,8 +13,8 @@ import { import type {Color} from '@shopify/polaris-viz-core'; import {useSpring, animated, to} from '@react-spring/web'; -import {ConicGradientWithStops} from '..'; -import {classNames} from '../../utilities'; +import {ConicGradientWithStops} from '../ConicGradientWithStops/ConicGradientWithStops'; +import {classNames} from '../../utilities/classnames'; import {ARC_PAD_ANGLE} from '../../constants'; import styles from './Arc.scss'; diff --git a/packages/polaris-viz/src/components/Arc/index.ts b/packages/polaris-viz/src/components/Arc/index.ts deleted file mode 100644 index 0e0cb89d0..000000000 --- a/packages/polaris-viz/src/components/Arc/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Arc} from './Arc'; diff --git a/packages/polaris-viz/src/components/Arc/tests/Arc.test.tsx b/packages/polaris-viz/src/components/Arc/tests/Arc.test.tsx index 8b33021bc..b6a8a7bdf 100644 --- a/packages/polaris-viz/src/components/Arc/tests/Arc.test.tsx +++ b/packages/polaris-viz/src/components/Arc/tests/Arc.test.tsx @@ -2,7 +2,7 @@ import {mount} from '@shopify/react-testing'; import {Arc} from '../Arc'; import type {ArcProps} from '../Arc'; -import {ConicGradientWithStops} from '../../ConicGradientWithStops'; +import {ConicGradientWithStops} from '../../ConicGradientWithStops/ConicGradientWithStops'; describe('', () => { const mockProps: ArcProps = { diff --git a/packages/polaris-viz/src/components/BarChart/BarChart.tsx b/packages/polaris-viz/src/components/BarChart/BarChart.tsx index ddf3d0291..1c8e756c8 100644 --- a/packages/polaris-viz/src/components/BarChart/BarChart.tsx +++ b/packages/polaris-viz/src/components/BarChart/BarChart.tsx @@ -17,21 +17,21 @@ import type { import {bucketDataSeries} from '../../utilities/bucketDataSeries'; import {getTooltipContentRenderer} from '../../utilities/getTooltipContentRenderer'; -import {ChartContainer} from '../../components/ChartContainer'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; import type { Annotation, RenderLegendContent, TooltipOptions, } from '../../types'; -import {SkipLink} from '../SkipLink'; +import {SkipLink} from '../SkipLink/SkipLink'; import { getXAxisOptionsWithDefaults, getYAxisOptionsWithDefaults, - normalizeData, -} from '../../utilities'; -import {HorizontalBarChart} from '../HorizontalBarChart'; -import {VerticalBarChart} from '../VerticalBarChart'; -import {ChartSkeleton} from '../../components/ChartSkeleton'; +} from '../../utilities/getAxisOptions'; +import {normalizeData} from '../../utilities/normalizeData'; +import {HorizontalBarChart} from '../HorizontalBarChart/HorizontalBarChart'; +import {VerticalBarChart} from '../VerticalBarChart/VerticalBarChart'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; import {fillMissingDataPoints} from '../../utilities/fillMissingDataPoints'; export type BarChartProps = { diff --git a/packages/polaris-viz/src/components/BarChart/index.ts b/packages/polaris-viz/src/components/BarChart/index.ts deleted file mode 100644 index 8242d9a68..000000000 --- a/packages/polaris-viz/src/components/BarChart/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {BarChart} from './BarChart'; -export type {BarChartProps} from './BarChart'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.chromatic.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.chromatic.stories.tsx index d6f4bcf24..3c0462c37 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.chromatic.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {BarChartProps} from '../../../../components'; +import type {BarChartProps} from '../../BarChart'; import {Template} from '../data'; import {META} from '../meta'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.stories.tsx index 3095189b9..32c448511 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/Annotations/HorizontalBarChart.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {BarChartProps} from '../../../../components'; +import type {BarChartProps} from '../../BarChart'; import {DEFAULT_DATA, Template} from '../data'; import {META} from '../meta'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.chromatic.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.chromatic.stories.tsx index ab091f88e..98b13be75 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.chromatic.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {BarChartProps} from '../../../../components'; +import type {BarChartProps} from '../../BarChart'; import {Template} from '../data'; import {META} from '../meta'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.stories.tsx index f26641939..afc6f1275 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/Annotations/VerticalBarChart.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {BarChartProps} from '../../../../components'; +import type {BarChartProps} from '../../BarChart'; import {DEFAULT_DATA, Template} from '../data'; import {META} from '../meta'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/BarChart.chromatic.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/BarChart.chromatic.stories.tsx index f6dd08d35..c535a1924 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/BarChart.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/BarChart.chromatic.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import {META} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/Default.stories.tsx index 057893628..99ed19aad 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/FormattedValues.chromatic.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/FormattedValues.chromatic.stories.tsx index 02a15fb28..3a034caa5 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/FormattedValues.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/FormattedValues.chromatic.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import {META} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/HideXAxis.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/HideXAxis.stories.tsx index e34b5f742..38963fded 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/HideXAxis.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/HideXAxis.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/Horizontal.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/Horizontal.stories.tsx index 642f922b6..bcd9b2c31 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/Horizontal.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/Horizontal.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx index 981dffa7e..a5ede6262 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/HorizontalStacked.stories.tsx @@ -2,10 +2,10 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; -import {PolarisVizProvider} from '../../PolarisVizProvider'; +import {PolarisVizProvider} from '../../PolarisVizProvider/PolarisVizProvider'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; export const HorizontalStacked: Story = ( diff --git a/packages/polaris-viz/src/components/BarChart/stories/HorizontalStackedWithoutXAxisLabels.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/HorizontalStackedWithoutXAxisLabels.stories.tsx index 99b51bb25..9303c24ce 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/HorizontalStackedWithoutXAxisLabels.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/HorizontalStackedWithoutXAxisLabels.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/IntegersOnly.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/IntegersOnly.stories.tsx index 61ec9102a..7e3db7465 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/IntegersOnly.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/IntegersOnly.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/InteractiveCustomLegend.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/InteractiveCustomLegend.stories.tsx index 47d4e8def..20b41b427 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/InteractiveCustomLegend.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/InteractiveCustomLegend.stories.tsx @@ -3,8 +3,8 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; import {DARK_THEME} from '../../../constants'; -import type {BarChartProps} from '../../BarChart'; -import {SquareColorPreview} from '../../SquareColorPreview'; +import type {BarChartProps} from '../BarChart'; +import {SquareColorPreview} from '../../SquareColorPreview/SquareColorPreview'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/NegativeOnly.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/NegativeOnly.stories.tsx index 4aa2a3a39..fc4ac0ab6 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/NegativeOnly.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/NegativeOnly.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/NoOverflowStyle.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/NoOverflowStyle.stories.tsx index 5d4ee7594..afaa078f4 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/NoOverflowStyle.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/NoOverflowStyle.stories.tsx @@ -2,8 +2,10 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import {BarChart, BarChartProps} from '../../../components'; -import {PolarisVizProvider} from '../../PolarisVizProvider'; +import {BarChart} from '../BarChart'; +import type {BarChartProps} from '../BarChart'; + +import {PolarisVizProvider} from '../../PolarisVizProvider/PolarisVizProvider'; import {DEFAULT_DATA} from './data'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/OverwrittenSeriesColors.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/OverwrittenSeriesColors.stories.tsx index cdbe203de..427e731bc 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/OverwrittenSeriesColors.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/OverwrittenSeriesColors.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/SingleBar.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/SingleBar.stories.tsx index fcfe50f15..ce3e71842 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/SingleBar.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/SingleBar.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/Stacked.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/Stacked.stories.tsx index 95b81ac98..a1e018bec 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/Stacked.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/Stacked.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/WithRoundedCorners.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/WithRoundedCorners.stories.tsx index fe55730f9..ec57e985d 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/WithRoundedCorners.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/WithRoundedCorners.stories.tsx @@ -2,8 +2,10 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import {BarChart, BarChartProps} from '../../../components'; -import {PolarisVizProvider} from '../../PolarisVizProvider'; +import {BarChart} from '../BarChart'; +import type {BarChartProps} from '../BarChart'; + +import {PolarisVizProvider} from '../../PolarisVizProvider/PolarisVizProvider'; import {DEFAULT_DATA} from './data'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/YAxisPercentages.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/YAxisPercentages.stories.tsx index 31d53be91..bada59dcc 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/YAxisPercentages.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/YAxisPercentages.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {BarChartProps} from '../../../components'; +import type {BarChartProps} from '../BarChart'; import {formatPercentageYAxisLabel} from '../../../storybook/utilities'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/data.tsx b/packages/polaris-viz/src/components/BarChart/stories/data.tsx index ce4f1fa99..c195e09ec 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/data.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/data.tsx @@ -1,7 +1,7 @@ import type {DataSeries} from '@shopify/polaris-viz-core'; import type {Story} from '@storybook/react'; -import {SquareColorPreview} from '../../SquareColorPreview'; +import {SquareColorPreview} from '../../SquareColorPreview/SquareColorPreview'; import type {RenderTooltipContentData} from '../../../types'; import type {BarChartProps} from '../BarChart'; import {BarChart} from '../BarChart'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/meta.tsx b/packages/polaris-viz/src/components/BarChart/stories/meta.tsx index 4648c8b70..cea46efd7 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/meta.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/meta.tsx @@ -1,6 +1,6 @@ import type {Meta} from '@storybook/react'; -import {BarChart} from '../../../components'; +import {BarChart} from '../BarChart'; import { ANNOTATIONS_ARGS, CHART_STATE_CONTROL_ARGS, @@ -20,7 +20,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {TOOLTIP_CONTENT} from './data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/playground/MisMatchedData.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/playground/MisMatchedData.stories.tsx index 0d4f61fb7..1a0004f51 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/playground/MisMatchedData.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/playground/MisMatchedData.stories.tsx @@ -1,6 +1,8 @@ import type {Story} from '@storybook/react'; -import {BarChart, BarChartProps} from '../../../../components'; +import {BarChart} from '../../BarChart'; +import type {BarChartProps} from '../../BarChart'; + import {META} from '../meta'; import {DEFAULT_DATA as LINEAR_DATA} from '../../../LineChart/stories/data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/playground/Playground.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/playground/Playground.stories.tsx index e4104eff1..59c1efdad 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/playground/Playground.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/playground/Playground.stories.tsx @@ -1,6 +1,8 @@ import type {Story} from '@storybook/react'; -import {BarChart, BarChartProps} from '../../../../components'; +import {BarChart} from '../../BarChart'; +import type {BarChartProps} from '../../BarChart'; + import type {Annotation} from '../../../../types'; import {META} from '../meta'; import {Template} from '../data'; diff --git a/packages/polaris-viz/src/components/BarChart/stories/playground/StackedHorizontalLotsOfLegends.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/playground/StackedHorizontalLotsOfLegends.stories.tsx index 55fce7b87..980c8b84d 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/playground/StackedHorizontalLotsOfLegends.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/playground/StackedHorizontalLotsOfLegends.stories.tsx @@ -2,10 +2,10 @@ import type {Story} from '@storybook/react'; import {META} from '../meta'; -import type {BarChartProps} from '../../../../components'; +import type {BarChartProps} from '../../BarChart'; import {Template} from '../data'; -import {PolarisVizProvider} from '../../../PolarisVizProvider'; +import {PolarisVizProvider} from '../../../PolarisVizProvider/PolarisVizProvider'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; export default { diff --git a/packages/polaris-viz/src/components/BarChart/stories/playground/ZeroDataChange.stories.tsx b/packages/polaris-viz/src/components/BarChart/stories/playground/ZeroDataChange.stories.tsx index 274721c6f..90dc38ca4 100644 --- a/packages/polaris-viz/src/components/BarChart/stories/playground/ZeroDataChange.stories.tsx +++ b/packages/polaris-viz/src/components/BarChart/stories/playground/ZeroDataChange.stories.tsx @@ -1,6 +1,8 @@ import type {Story} from '@storybook/react'; -import {BarChart, BarChartProps} from '../../../../components'; +import {BarChart} from '../../BarChart'; +import type {BarChartProps} from '../../BarChart'; + import {META} from '../meta'; import {useState} from 'react'; diff --git a/packages/polaris-viz/src/components/BarChart/tests/BarChart.test.tsx b/packages/polaris-viz/src/components/BarChart/tests/BarChart.test.tsx index 740c34eef..cd1ae464e 100644 --- a/packages/polaris-viz/src/components/BarChart/tests/BarChart.test.tsx +++ b/packages/polaris-viz/src/components/BarChart/tests/BarChart.test.tsx @@ -1,10 +1,10 @@ import {mount} from '@shopify/react-testing'; -import {SkipLink} from '../../../components/SkipLink'; +import {SkipLink} from '../../SkipLink/SkipLink'; import type {BarChartProps} from '../BarChart'; import {BarChart} from '../BarChart'; -import {VerticalBarChart} from '../../VerticalBarChart'; -import {HorizontalBarChart} from '../../HorizontalBarChart'; +import {VerticalBarChart} from '../../VerticalBarChart/VerticalBarChart'; +import {HorizontalBarChart} from '../../HorizontalBarChart/HorizontalBarChart'; describe('', () => { const mockProps: BarChartProps = { diff --git a/packages/polaris-viz/src/components/ChartContainer/ChartContainer.tsx b/packages/polaris-viz/src/components/ChartContainer/ChartContainer.tsx index 847587099..1e5f278da 100644 --- a/packages/polaris-viz/src/components/ChartContainer/ChartContainer.tsx +++ b/packages/polaris-viz/src/components/ChartContainer/ChartContainer.tsx @@ -13,16 +13,17 @@ import { isLargeDataSet, usePolarisVizContext, isTouchDevice, + useTheme, } from '@shopify/polaris-viz-core'; import type {ChartContextValues} from '@shopify/polaris-viz-core/src/contexts'; import {EMPTY_BOUNDS} from '../../constants'; -import {ChartErrorBoundary} from '../ChartErrorBoundary'; +import {ChartErrorBoundary} from '../ChartErrorBoundary/ChartErrorBoundary'; import {getChartId} from '../../utilities/getChartId'; import characterWidths from '../../data/character-widths.json'; import characterWidthOffsets from '../../data/character-width-offsets.json'; -import {useTheme, usePrefersReducedMotion} from '../../hooks'; -import type {SkeletonType} from '../ChartSkeleton'; +import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'; +import type {SkeletonType} from '../ChartSkeleton/ChartSkeleton'; import styles from './ChartContainer.scss'; import {useContainerBounds} from './hooks/useContainerBounds'; diff --git a/packages/polaris-viz/src/components/ChartContainer/hooks/useContainerBounds.ts b/packages/polaris-viz/src/components/ChartContainer/hooks/useContainerBounds.ts index ad147b4d4..b20a5f78b 100644 --- a/packages/polaris-viz/src/components/ChartContainer/hooks/useContainerBounds.ts +++ b/packages/polaris-viz/src/components/ChartContainer/hooks/useContainerBounds.ts @@ -2,13 +2,10 @@ import type {BoundingRect} from '@shopify/polaris-viz-core'; import type {Dispatch, SetStateAction} from 'react'; import {useCallback, useLayoutEffect, useState} from 'react'; import {useDebouncedCallback} from 'use-debounce'; +import {usePrevious, useTheme} from '@shopify/polaris-viz-core'; -import { - usePrevious, - usePrintResizing, - useResizeObserver, - useTheme, -} from '../../../hooks'; +import {usePrintResizing} from '../../../hooks/usePrintResizing'; +import {useResizeObserver} from '../../../hooks/useResizeObserver'; export function useContainerBounds({ onIsPrintingChange, diff --git a/packages/polaris-viz/src/components/ChartContainer/index.ts b/packages/polaris-viz/src/components/ChartContainer/index.ts deleted file mode 100644 index f9757c3a2..000000000 --- a/packages/polaris-viz/src/components/ChartContainer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ChartContainer} from './ChartContainer'; diff --git a/packages/polaris-viz/src/components/ChartElements/index.ts b/packages/polaris-viz/src/components/ChartElements/index.ts deleted file mode 100644 index 643bd7503..000000000 --- a/packages/polaris-viz/src/components/ChartElements/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import {ChartDiv} from './ChartDiv'; -import {ChartSVG} from './ChartSVG'; - -export const ChartElements = { - Div: ChartDiv, - Svg: ChartSVG, -}; diff --git a/packages/polaris-viz/src/components/ChartErrorBoundary/ChartErrorBoundary.tsx b/packages/polaris-viz/src/components/ChartErrorBoundary/ChartErrorBoundary.tsx index 031903abb..ed800af22 100644 --- a/packages/polaris-viz/src/components/ChartErrorBoundary/ChartErrorBoundary.tsx +++ b/packages/polaris-viz/src/components/ChartErrorBoundary/ChartErrorBoundary.tsx @@ -8,8 +8,8 @@ import {ChartState} from '@shopify/polaris-viz-core'; import type {ErrorInfo, ReactNode} from 'react'; import {Component} from 'react'; -import {ChartSkeleton} from '../ChartSkeleton'; -import type {SkeletonType} from '../ChartSkeleton'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; +import type {SkeletonType} from '../ChartSkeleton/ChartSkeleton'; import {checkForMismatchedData} from './utilities/checkForMismatchedData'; diff --git a/packages/polaris-viz/src/components/ChartErrorBoundary/index.ts b/packages/polaris-viz/src/components/ChartErrorBoundary/index.ts deleted file mode 100644 index 6610f07f0..000000000 --- a/packages/polaris-viz/src/components/ChartErrorBoundary/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ChartErrorBoundary} from './ChartErrorBoundary'; diff --git a/packages/polaris-viz/src/components/ChartErrorBoundary/tests/ChartErrorBoundary.test.tsx b/packages/polaris-viz/src/components/ChartErrorBoundary/tests/ChartErrorBoundary.test.tsx index 7a5dc9a66..d3fe57a50 100644 --- a/packages/polaris-viz/src/components/ChartErrorBoundary/tests/ChartErrorBoundary.test.tsx +++ b/packages/polaris-viz/src/components/ChartErrorBoundary/tests/ChartErrorBoundary.test.tsx @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import type {DataGroup, DataSeries} from '@shopify/polaris-viz-core'; -import {ChartSkeleton} from '../../ChartSkeleton'; +import {ChartSkeleton} from '../../ChartSkeleton/ChartSkeleton'; import {ChartErrorBoundary} from '../ChartErrorBoundary'; import {mountWithProvider} from '../../../test-utilities/mountWithProvider'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/ChartSkeleton.tsx b/packages/polaris-viz/src/components/ChartSkeleton/ChartSkeleton.tsx index d93ccedce..1f972222f 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/ChartSkeleton.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/ChartSkeleton.tsx @@ -1,16 +1,14 @@ import {ChartState, useChartContext, useTheme} from '@shopify/polaris-viz-core'; -import type {Size} from '../SimpleNormalizedChart'; - -import { - GridSkeleton, - DonutSkeleton, - FunnelSkeleton, - Shimmer, - SimpleBarSkeleton, - SimpleNormalizedSkeleton, - SparkSkeleton, -} from './components'; +import type {Size} from '../SimpleNormalizedChart/types'; + +import {GridSkeleton} from './components/GridSkeleton/GridSkeleton'; +import {DonutSkeleton} from './components/DonutSkeleton/DonutSkeleton'; +import {FunnelSkeleton} from './components/FunnelSkeleton/FunnelSkeleton'; +import {Shimmer} from './components/Shimmer/Shimmer'; +import {SimpleBarSkeleton} from './components/SimpleBarSkeleton/SimpleBarSkeleton'; +import {SimpleNormalizedSkeleton} from './components/SimpleNormalizedSkeleton/SimpleNormalizedSkeleton'; +import {SparkSkeleton} from './components/SparkSkeleton/SparkSkeleton'; import styles from './ChartSkeleton.scss'; export type SkeletonType = diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/DonutSkeleton.tsx b/packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/DonutSkeleton.tsx index bfb01908b..3556411de 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/DonutSkeleton.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/DonutSkeleton.tsx @@ -1,10 +1,9 @@ /* eslint-disable node/callback-return */ import {useEffect} from 'react'; -import {ChartState, useChartContext} from '@shopify/polaris-viz-core'; +import {ChartState, useChartContext, useTheme} from '@shopify/polaris-viz-core'; import {useSprings, animated, config, easings} from '@react-spring/web'; -import {Arc} from '../../../Arc/'; -import {useTheme} from '../../../../hooks'; +import {Arc} from '../../../Arc/Arc'; import styles from './DonutSkeleton.scss'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/index.ts deleted file mode 100644 index 4242781ad..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/DonutSkeleton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {DonutSkeleton} from './DonutSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/ErrorText.tsx b/packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/ErrorText.tsx index 3f0bbd817..5ed1dd062 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/ErrorText.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/ErrorText.tsx @@ -1,7 +1,7 @@ import {FONT_SIZE, useTheme} from '@shopify/polaris-viz-core'; -import {useLabels} from '../../../Labels/hooks'; -import {TextLine} from '../../../TextLine'; +import {useLabels} from '../../../Labels/hooks/useLabels'; +import {TextLine} from '../../../TextLine/TextLine'; const TEXT_DROP_SHADOW_SIZE = 3; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/index.ts deleted file mode 100644 index 30defde9b..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/ErrorText/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ErrorText} from './ErrorText'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/FunnelSkeleton.tsx b/packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/FunnelSkeleton.tsx index 1daf60b66..fd66f9d30 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/FunnelSkeleton.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/FunnelSkeleton.tsx @@ -7,8 +7,8 @@ import { useChartContext, } from '@shopify/polaris-viz-core'; -import {Bar} from '../../../shared'; -import {ErrorText} from '../ErrorText'; +import {Bar} from '../../../shared/Bar/Bar'; +import {ErrorText} from '../ErrorText/ErrorText'; interface Props { state: ChartState; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/index.ts deleted file mode 100644 index 0553ad3e1..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/FunnelSkeleton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './FunnelSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/GridSkeleton.tsx b/packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/GridSkeleton.tsx index 6204bd8e5..0b7ea1ce7 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/GridSkeleton.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/GridSkeleton.tsx @@ -8,7 +8,7 @@ import { } from '@shopify/polaris-viz-core'; import {useSprings, animated} from '@react-spring/web'; -import {ErrorText} from '../ErrorText'; +import {ErrorText} from '../ErrorText/ErrorText'; const BRICK_HEIGHT = 12; const BRICK_WIDTH = 32; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/index.ts deleted file mode 100644 index bfceb45dd..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/GridSkeleton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {GridSkeleton} from './GridSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/Shimmer/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/Shimmer/index.ts deleted file mode 100644 index cc6800516..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/Shimmer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Shimmer} from './Shimmer'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/SimpleBarSkeleton.tsx b/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/SimpleBarSkeleton.tsx index 656ef1774..b19b737b4 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/SimpleBarSkeleton.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/SimpleBarSkeleton.tsx @@ -6,7 +6,7 @@ import { useChartContext, } from '@shopify/polaris-viz-core'; -import {ErrorText} from '../ErrorText'; +import {ErrorText} from '../ErrorText/ErrorText'; import styles from './SimpleBarSkeleton.scss'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/index.ts deleted file mode 100644 index 3d6ed918a..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleBarSkeleton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SimpleBarSkeleton} from './SimpleBarSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/SimpleNormalizedSkeleton.tsx b/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/SimpleNormalizedSkeleton.tsx index 70a4f4a9b..92d4b6e74 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/SimpleNormalizedSkeleton.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/SimpleNormalizedSkeleton.tsx @@ -6,8 +6,8 @@ import { useChartContext, } from '@shopify/polaris-viz-core'; -import type {Size} from '../../../SimpleNormalizedChart'; -import {ErrorText} from '../ErrorText'; +import type {Size} from '../../../SimpleNormalizedChart/types'; +import {ErrorText} from '../ErrorText/ErrorText'; import styles from './SimpleNormalizedSkeleton.scss'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/index.ts deleted file mode 100644 index 318ad7225..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/SimpleNormalizedSkeleton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SimpleNormalizedSkeleton} from './SimpleNormalizedSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/SparkSkeleton.tsx b/packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/SparkSkeleton.tsx index aefa92caa..5e2ffca1c 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/SparkSkeleton.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/SparkSkeleton.tsx @@ -5,7 +5,7 @@ import { useChartContext, } from '@shopify/polaris-viz-core'; -import {ErrorText} from '../ErrorText'; +import {ErrorText} from '../ErrorText/ErrorText'; interface Props { state: ChartState; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/index.ts deleted file mode 100644 index e469d1649..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/SparkSkeleton/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SparkSkeleton} from './SparkSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/components/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/components/index.ts deleted file mode 100644 index 80a69dde3..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/components/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export {Shimmer} from './Shimmer'; -export {GridSkeleton} from './GridSkeleton'; -export {DonutSkeleton} from './DonutSkeleton'; -export {FunnelSkeleton} from './FunnelSkeleton'; -export {ErrorText} from './ErrorText'; -export {SimpleBarSkeleton} from './SimpleBarSkeleton'; -export {SimpleNormalizedSkeleton} from './SimpleNormalizedSkeleton'; -export {SparkSkeleton} from './SparkSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/index.ts b/packages/polaris-viz/src/components/ChartSkeleton/index.ts deleted file mode 100644 index 041302208..000000000 --- a/packages/polaris-viz/src/components/ChartSkeleton/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export {ChartSkeleton} from './ChartSkeleton'; -export type { - DonutSkeletonProps, - FunnelSkeletonProps, - SimpleBarSkeletonProps, - SparkSkeletonProps, - SimpleNormalizedSkeletonProps, -} from './ChartSkeleton'; -export type {SkeletonType} from './ChartSkeleton'; diff --git a/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx b/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx index 0b09d3871..98aa34f45 100644 --- a/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx +++ b/packages/polaris-viz/src/components/ChartSkeleton/tests/ChartSkeleton.test.tsx @@ -5,7 +5,7 @@ import { mountWithProvider, mockDefaultTheme, } from '../../../test-utilities/mountWithProvider'; -import {Shimmer} from '../components'; +import {Shimmer} from '../components/Shimmer/Shimmer'; import {DEFAULT_CHART_CONTEXT as MOCK_DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; jest.mock('@shopify/polaris-viz-core/src/hooks/useChartContext', () => ({ diff --git a/packages/polaris-viz/src/components/ComboChart/Chart.tsx b/packages/polaris-viz/src/components/ComboChart/Chart.tsx index eeb46c2df..a212ecaf3 100644 --- a/packages/polaris-viz/src/components/ComboChart/Chart.tsx +++ b/packages/polaris-viz/src/components/ComboChart/Chart.tsx @@ -16,32 +16,35 @@ import type { LabelFormatter, } from '@shopify/polaris-viz-core'; -import {useVerticalBarChart} from '../VerticalBarChart'; -import {ChartElements} from '../ChartElements'; -import { - Annotations, - checkAvailableAnnotations, - YAxisAnnotations, -} from '../Annotations'; -import {TooltipWrapper} from '../TooltipWrapper'; +import {ChartSVG} from '../ChartElements/ChartSVG'; +import {ChartDiv} from '../ChartElements/ChartDiv'; +import {Annotations} from '../Annotations/Annotations'; +import {checkAvailableAnnotations} from '../Annotations/utilities/checkAvailableAnnotations'; +import {YAxisAnnotations} from '../Annotations/YAxisAnnotations'; +import {TooltipWrapper} from '../TooltipWrapper/TooltipWrapper'; import type { AnnotationLookupTable, RenderLegendContent, RenderTooltipContentData, } from '../../types'; -import {XAxis} from '../XAxis'; +import {XAxis} from '../XAxis/XAxis'; import {useThemeSeriesColorsForDataGroup} from '../../hooks/useThemeSeriesColorsForDataGroup'; -import {useColorVisionEvents, useReducedLabelIndexes} from '../../hooks'; -import {HorizontalGridLines} from '../HorizontalGridLines'; -import {YAxis} from '../YAxis'; -import {LegendContainer, useLegend} from '../LegendContainer'; +import {useColorVisionEvents} from '../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {useReducedLabelIndexes} from '../../hooks/useReducedLabelIndexes'; +import {HorizontalGridLines} from '../HorizontalGridLines/HorizontalGridLines'; +import {YAxis} from '../YAxis/YAxis'; +import {LegendContainer} from '../LegendContainer/LegendContainer'; +import {useLegend} from '../LegendContainer/hooks/useLegend'; import {ANNOTATIONS_LABELS_OFFSET} from '../../constants'; +import {useVerticalBarChart} from '../VerticalBarChart/hooks/useVerticalBarChart'; import {useDualAxisTicks} from './hooks/useDualAxisTicks'; import {useDualAxisTicksWidth} from './hooks/useDualAxisTickWidths'; import {useDualAxisScale} from './hooks/useDualAxisScale'; import {useXScale} from './hooks/useXScale'; -import {ComboBarChart, ComboLineChart, AxisLabel} from './components'; +import {ComboBarChart} from './components/ComboBarChart/ComboBarChart'; +import {ComboLineChart} from './components/ComboLineChart/ComboLineChart'; +import {AxisLabel} from './components/AxisLabel/AxisLabel'; import {useSplitDataForCharts} from './hooks/useSplitDataForCharts'; import {useComboChartTooltipContent} from './hooks/useComboChartTooltipContent'; import {useComboChartPositions} from './hooks/useComboChartPositions'; @@ -181,8 +184,8 @@ export function Chart({ }); return ( - - + + {selectedTheme.grid.showHorizontalLines ? ( )} - + )} - + ); } diff --git a/packages/polaris-viz/src/components/ComboChart/ComboChart.tsx b/packages/polaris-viz/src/components/ComboChart/ComboChart.tsx index b332a8425..a8b6a1fda 100644 --- a/packages/polaris-viz/src/components/ComboChart/ComboChart.tsx +++ b/packages/polaris-viz/src/components/ComboChart/ComboChart.tsx @@ -12,9 +12,10 @@ import type { import type {ReactNode} from 'react'; import {flattenDataGroupToDataSeries} from '../../utilities/flattenDataGroupToDataSeries'; -import {TooltipContent} from '../TooltipContent'; -import {getXAxisOptionsWithDefaults, normalizeData} from '../../utilities'; -import {ChartContainer} from '../ChartContainer'; +import {TooltipContent} from '../TooltipContent/TooltipContent'; +import {getXAxisOptionsWithDefaults} from '../../utilities/getAxisOptions'; +import {normalizeData} from '../../utilities/normalizeData'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; import type { ComboAnnotation, RenderLegendContent, diff --git a/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.test.tsx b/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.test.tsx index 225f1d4c4..c039cf1a4 100644 --- a/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.test.tsx +++ b/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.test.tsx @@ -1,11 +1,10 @@ import {mount} from '@shopify/react-testing'; import {LIGHT_THEME} from '@shopify/polaris-viz-core'; -import {SingleTextLine} from '../../../Labels'; +import {SingleTextLine} from '../../../Labels/SingleTextLine'; import type {AxisLabelProps} from './AxisLabel'; - -import {AxisLabel} from './'; +import {AxisLabel} from './AxisLabel'; jest.mock('../../../../hooks/useEstimateStringWidth', () => ({ useEstimateStringWidth: () => 100, diff --git a/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.tsx b/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.tsx index f94cca322..f2b7dd90b 100644 --- a/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.tsx +++ b/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/AxisLabel.tsx @@ -2,7 +2,7 @@ import {LINE_HEIGHT, useTheme} from '@shopify/polaris-viz-core'; import {getFontSize} from '../../../../utilities/getFontSize'; import {useEstimateStringWidth} from '../../../../hooks/useEstimateStringWidth'; -import {SingleTextLine} from '../../../Labels'; +import {SingleTextLine} from '../../../Labels/SingleTextLine'; export interface AxisLabelProps { axis: 'primary' | 'secondary'; diff --git a/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/index.ts b/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/index.ts deleted file mode 100644 index 3dfa24d75..000000000 --- a/packages/polaris-viz/src/components/ComboChart/components/AxisLabel/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {AxisLabel} from './AxisLabel'; diff --git a/packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/ComboBarChart.tsx b/packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/ComboBarChart.tsx index 97f5281d7..18251d486 100644 --- a/packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/ComboBarChart.tsx +++ b/packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/ComboBarChart.tsx @@ -3,8 +3,9 @@ import {useMemo} from 'react'; import {uniqueId} from '@shopify/polaris-viz-core'; import type {Color, DataGroup} from '@shopify/polaris-viz-core'; -import {getYAxisOptionsWithDefaults} from '../../../../utilities'; -import {useVerticalBarChart, VerticalBarGroup} from '../../../VerticalBarChart'; +import {getYAxisOptionsWithDefaults} from '../../../../utilities/getAxisOptions'; +import {useVerticalBarChart} from '../../../VerticalBarChart/hooks/useVerticalBarChart'; +import {VerticalBarGroup} from '../../../VerticalBarChart/components/VerticalBarGroup/VerticalBarGroup'; interface ComboBarChartProps { colors: Color[]; diff --git a/packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/index.ts b/packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/index.ts deleted file mode 100644 index 5b32a5207..000000000 --- a/packages/polaris-viz/src/components/ComboChart/components/ComboBarChart/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ComboBarChart} from './ComboBarChart'; diff --git a/packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/ComboLineChart.tsx b/packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/ComboLineChart.tsx index abc6cd920..4d923c9ba 100644 --- a/packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/ComboLineChart.tsx +++ b/packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/ComboLineChart.tsx @@ -2,9 +2,9 @@ import {Fragment, useState} from 'react'; import type {Color, DataGroup} from '@shopify/polaris-viz-core'; import {COLOR_VISION_SINGLE_ITEM, LineSeries} from '@shopify/polaris-viz-core'; -import {useWatchColorVisionEvents} from '../../../../hooks'; -import {PointsAndCrosshair} from '../../../LineChart'; -import {useFormatData} from '../../../LineChart/hooks'; +import {useWatchColorVisionEvents} from '../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {PointsAndCrosshair} from '../../../LineChart/components/PointsAndCrosshair/PointsAndCrosshair'; +import {useFormatData} from '../../../LineChart/hooks/useFormatData'; import {getLineChartDataWithDefaults} from '../../../../utilities/getLineChartDataWithDefaults'; interface ComboLineChartProps { diff --git a/packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/index.ts b/packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/index.ts deleted file mode 100644 index ca1670323..000000000 --- a/packages/polaris-viz/src/components/ComboChart/components/ComboLineChart/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ComboLineChart} from './ComboLineChart'; diff --git a/packages/polaris-viz/src/components/ComboChart/components/index.ts b/packages/polaris-viz/src/components/ComboChart/components/index.ts deleted file mode 100644 index b6728f9c6..000000000 --- a/packages/polaris-viz/src/components/ComboChart/components/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {ComboBarChart} from './ComboBarChart'; -export {ComboLineChart} from './ComboLineChart'; -export {AxisLabel} from './AxisLabel'; diff --git a/packages/polaris-viz/src/components/ComboChart/hooks/useComboChartTooltipContent.ts b/packages/polaris-viz/src/components/ComboChart/hooks/useComboChartTooltipContent.ts index 4465352d9..c0ee7c78e 100644 --- a/packages/polaris-viz/src/components/ComboChart/hooks/useComboChartTooltipContent.ts +++ b/packages/polaris-viz/src/components/ComboChart/hooks/useComboChartTooltipContent.ts @@ -9,7 +9,7 @@ import type { import {useChartContext} from '@shopify/polaris-viz-core'; import {flattenDataGroupToDataSeries} from '../../../utilities/flattenDataGroupToDataSeries'; -import {getYAxisOptionsWithDefaults} from '../../../utilities'; +import {getYAxisOptionsWithDefaults} from '../../../utilities/getAxisOptions'; import type { RenderTooltipContentData, RenderTooltipDataPoint, diff --git a/packages/polaris-viz/src/components/ComboChart/hooks/useGetDualAxis.ts b/packages/polaris-viz/src/components/ComboChart/hooks/useGetDualAxis.ts index 359875002..39d1ca6c8 100644 --- a/packages/polaris-viz/src/components/ComboChart/hooks/useGetDualAxis.ts +++ b/packages/polaris-viz/src/components/ComboChart/hooks/useGetDualAxis.ts @@ -1,11 +1,9 @@ import {useMemo} from 'react'; import type {DataGroup} from '@shopify/polaris-viz-core'; -import {yAxisMinMax} from '../../LineChart/utilities'; -import { - getStackedMinMax, - getYAxisOptionsWithDefaults, -} from '../../../utilities'; +import {yAxisMinMax} from '../../LineChart/utilities/yAxisMinMax'; +import {getStackedMinMax} from '../../../utilities/getStackedMinMax'; +import {getYAxisOptionsWithDefaults} from '../../../utilities/getAxisOptions'; import type {Axis} from '../types'; import {AxisValueRange} from '../types'; diff --git a/packages/polaris-viz/src/components/ComboChart/index.ts b/packages/polaris-viz/src/components/ComboChart/index.ts deleted file mode 100644 index 3be5444f6..000000000 --- a/packages/polaris-viz/src/components/ComboChart/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {ComboChart} from './ComboChart'; -export type {ComboChartProps} from './ComboChart'; diff --git a/packages/polaris-viz/src/components/ComboChart/stories/Annotations.stories.tsx b/packages/polaris-viz/src/components/ComboChart/stories/Annotations.stories.tsx index c0ff5c2e2..3ffa33256 100644 --- a/packages/polaris-viz/src/components/ComboChart/stories/Annotations.stories.tsx +++ b/packages/polaris-viz/src/components/ComboChart/stories/Annotations.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {ComboChartProps} from '../../../components'; +import type {ComboChartProps} from '../ComboChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/ComboChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/ComboChart/stories/Default.stories.tsx index 2e461492c..a2804bc08 100644 --- a/packages/polaris-viz/src/components/ComboChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/ComboChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {ComboChartProps} from '../../../components'; +import type {ComboChartProps} from '../ComboChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/ComboChart/stories/FormattedValues.chromatic.stories.tsx b/packages/polaris-viz/src/components/ComboChart/stories/FormattedValues.chromatic.stories.tsx index 80046d25c..00b53f4b5 100644 --- a/packages/polaris-viz/src/components/ComboChart/stories/FormattedValues.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/ComboChart/stories/FormattedValues.chromatic.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import {META} from './meta'; -import type {ComboChartProps} from '../../../components'; +import type {ComboChartProps} from '../ComboChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/ComboChart/stories/InteractiveCustomLegend.stories.tsx b/packages/polaris-viz/src/components/ComboChart/stories/InteractiveCustomLegend.stories.tsx index fd59518e8..6e87d06d2 100644 --- a/packages/polaris-viz/src/components/ComboChart/stories/InteractiveCustomLegend.stories.tsx +++ b/packages/polaris-viz/src/components/ComboChart/stories/InteractiveCustomLegend.stories.tsx @@ -1,8 +1,10 @@ import type {Story} from '@storybook/react'; import {DARK_THEME} from '../../../constants'; -import type {ComboChartProps} from '../../ComboChart'; -import {LinePreview, SquareColorPreview} from '../..'; +import type {ComboChartProps} from '../ComboChart'; + +import {LinePreview} from '../../LinePreview/LinePreview'; +import {SquareColorPreview} from '../../SquareColorPreview/SquareColorPreview'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/ComboChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/ComboChart/tests/Chart.test.tsx index d4aa47e8a..17f3bc070 100644 --- a/packages/polaris-viz/src/components/ComboChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/ComboChart/tests/Chart.test.tsx @@ -3,11 +3,13 @@ import type {DataGroup} from '@shopify/polaris-viz-core'; import type {ChartProps} from '../Chart'; import {Chart} from '../Chart'; -import {getXAxisOptionsWithDefaults, normalizeData} from '../../../utilities'; -import {LegendContainer} from '../../LegendContainer'; -import {Annotations, YAxisAnnotations} from '../../Annotations'; -import {AxisLabel} from '../components'; -import {YAxis} from '../../YAxis'; +import {getXAxisOptionsWithDefaults} from '../../../utilities/getAxisOptions'; +import {normalizeData} from '../../../utilities/normalizeData'; +import {LegendContainer} from '../../LegendContainer/LegendContainer'; +import {Annotations} from '../../Annotations/Annotations'; +import {YAxisAnnotations} from '../../Annotations/YAxisAnnotations'; +import {AxisLabel} from '../components/AxisLabel/AxisLabel'; +import {YAxis} from '../../YAxis/YAxis'; jest.mock('../../../hooks/useEstimateStringWidth', () => ({ useEstimateStringWidth: () => 100, diff --git a/packages/polaris-viz/src/components/ComparisonMetric/ComparisonMetric.tsx b/packages/polaris-viz/src/components/ComparisonMetric/ComparisonMetric.tsx index ce9c73ae0..528c14ead 100644 --- a/packages/polaris-viz/src/components/ComparisonMetric/ComparisonMetric.tsx +++ b/packages/polaris-viz/src/components/ComparisonMetric/ComparisonMetric.tsx @@ -1,6 +1,6 @@ import type {Trend} from 'types'; -import {TrendIndicator} from '../TrendIndicator'; +import {TrendIndicator} from '../TrendIndicator/TrendIndicator'; export interface ComparisonMetricProps { metric?: string; diff --git a/packages/polaris-viz/src/components/ComparisonMetric/index.ts b/packages/polaris-viz/src/components/ComparisonMetric/index.ts deleted file mode 100644 index 2601e4130..000000000 --- a/packages/polaris-viz/src/components/ComparisonMetric/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {ComparisonMetric} from './ComparisonMetric'; -export type {ComparisonMetricProps} from './ComparisonMetric'; diff --git a/packages/polaris-viz/src/components/ComparisonMetric/tests/ComparisonMetric.test.tsx b/packages/polaris-viz/src/components/ComparisonMetric/tests/ComparisonMetric.test.tsx index 53808b72a..e71366c4f 100644 --- a/packages/polaris-viz/src/components/ComparisonMetric/tests/ComparisonMetric.test.tsx +++ b/packages/polaris-viz/src/components/ComparisonMetric/tests/ComparisonMetric.test.tsx @@ -1,7 +1,7 @@ import {mount} from '@shopify/react-testing'; import {ComparisonMetric} from '../ComparisonMetric'; -import {TrendIndicator} from '../../TrendIndicator'; +import {TrendIndicator} from '../../TrendIndicator/TrendIndicator'; describe('', () => { describe('', () => { diff --git a/packages/polaris-viz/src/components/ConicGradientWithStops/ConicGradientWithStops.tsx b/packages/polaris-viz/src/components/ConicGradientWithStops/ConicGradientWithStops.tsx index 2fc690129..559fdc52e 100644 --- a/packages/polaris-viz/src/components/ConicGradientWithStops/ConicGradientWithStops.tsx +++ b/packages/polaris-viz/src/components/ConicGradientWithStops/ConicGradientWithStops.tsx @@ -1,6 +1,6 @@ import type {GradientStop} from '@shopify/polaris-viz-core'; -import {createCSSConicGradient} from '../../utilities'; +import {createCSSConicGradient} from '../../utilities/createCssConicGradient'; export interface ConicGradientWithStopsProps { gradient: GradientStop[]; diff --git a/packages/polaris-viz/src/components/ConicGradientWithStops/index.ts b/packages/polaris-viz/src/components/ConicGradientWithStops/index.ts deleted file mode 100644 index 98f526e4c..000000000 --- a/packages/polaris-viz/src/components/ConicGradientWithStops/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ConicGradientWithStops} from './ConicGradientWithStops'; diff --git a/packages/polaris-viz/src/components/ConicGradientWithStops/tests/ConicGradientWithStops.test.tsx b/packages/polaris-viz/src/components/ConicGradientWithStops/tests/ConicGradientWithStops.test.tsx index f08c3a91c..16b93d280 100644 --- a/packages/polaris-viz/src/components/ConicGradientWithStops/tests/ConicGradientWithStops.test.tsx +++ b/packages/polaris-viz/src/components/ConicGradientWithStops/tests/ConicGradientWithStops.test.tsx @@ -1,6 +1,6 @@ import {mount} from '@shopify/react-testing'; -import {ConicGradientWithStops} from '..'; +import {ConicGradientWithStops} from '../ConicGradientWithStops'; import type {ConicGradientWithStopsProps} from '../ConicGradientWithStops'; const mockProps1 = { diff --git a/packages/polaris-viz/src/components/Crosshair/index.ts b/packages/polaris-viz/src/components/Crosshair/index.ts deleted file mode 100644 index 9688bbeb7..000000000 --- a/packages/polaris-viz/src/components/Crosshair/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Crosshair} from './Crosshair'; diff --git a/packages/polaris-viz/src/components/Crosshair/tests/Crosshair.test.tsx b/packages/polaris-viz/src/components/Crosshair/tests/Crosshair.test.tsx index 354a18983..f582ca90d 100644 --- a/packages/polaris-viz/src/components/Crosshair/tests/Crosshair.test.tsx +++ b/packages/polaris-viz/src/components/Crosshair/tests/Crosshair.test.tsx @@ -1,8 +1,10 @@ import {mount} from '@shopify/react-testing'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; -import {mountWithProvider} from '../../../test-utilities'; -import {mockDefaultTheme} from '../../../test-utilities/mountWithProvider'; +import { + mountWithProvider, + mockDefaultTheme, +} from '../../../test-utilities/mountWithProvider'; import {Crosshair} from '../Crosshair'; describe('', () => { diff --git a/packages/polaris-viz/src/components/Docs/stories/AnalyticsExperiences.stories.mdx b/packages/polaris-viz/src/components/Docs/stories/AnalyticsExperiences.stories.mdx index 2442e3652..6850e4576 100644 --- a/packages/polaris-viz/src/components/Docs/stories/AnalyticsExperiences.stories.mdx +++ b/packages/polaris-viz/src/components/Docs/stories/AnalyticsExperiences.stories.mdx @@ -2,7 +2,7 @@ import {Meta, Description} from '@storybook/addon-docs'; import Development from '!raw-loader!../../../../../../ANALYTICS_EXPERIENCES.md'; -import {Title} from './components'; +import {Title} from './components/Title/Title'; +; diff --git a/packages/polaris-viz/src/components/Docs/stories/DefaultThemes.stories.mdx b/packages/polaris-viz/src/components/Docs/stories/DefaultThemes.stories.mdx index bd1efdefa..d930c968e 100644 --- a/packages/polaris-viz/src/components/Docs/stories/DefaultThemes.stories.mdx +++ b/packages/polaris-viz/src/components/Docs/stories/DefaultThemes.stories.mdx @@ -2,7 +2,9 @@ import {Meta} from '@storybook/addon-docs'; import LinkTo from '@storybook/addon-links/react'; import {PolarisVizProvider} from '@shopify/polaris-viz'; -import {ComponentContainer, Title, SampleBarChart} from './components'; +import {ComponentContainer} from './components/ComponentContainer/ComponentContainer'; +import {Title} from './components/Title/Title'; +import {SampleBarChart} from './components/SampleComponents'; diff --git a/packages/polaris-viz/src/components/Docs/stories/ThemeDefinition.stories.mdx b/packages/polaris-viz/src/components/Docs/stories/ThemeDefinition.stories.mdx index 10269f34a..585ecda98 100644 --- a/packages/polaris-viz/src/components/Docs/stories/ThemeDefinition.stories.mdx +++ b/packages/polaris-viz/src/components/Docs/stories/ThemeDefinition.stories.mdx @@ -1,19 +1,10 @@ import {Meta, Story, Canvas} from '@storybook/addon-docs'; import {PolarisVizProvider} from '../../../'; -import { - Divider, - ComponentContainer, - Title, - ExamplesGrid, - SampleSparkbar, - SampleSparkLineChart, - SampleBarChart, - PropertyTable, - SampleLineChart, - SampleStackedAreaChart, - SampleSimpleNormalizedChart, -} from './components'; +import {ComponentContainer} from './components/ComponentContainer/ComponentContainer'; +import {Title} from './components/Title/Title'; +import {ExamplesGrid} from './components/ExamplesGrid/ExamplesGrid'; +import {PropertyTable} from './components/PropertyTable/PropertyTable'; { return ( diff --git a/packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/SimpleContainer.tsx b/packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/SimpleContainer.tsx index 4b34d2fd2..3ce0db005 100644 --- a/packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/SimpleContainer.tsx +++ b/packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/SimpleContainer.tsx @@ -1,8 +1,6 @@ -import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; +import {DEFAULT_THEME_NAME, useTheme} from '@shopify/polaris-viz-core'; import type {ReactNode} from 'react'; -import {useTheme} from '../../../../../hooks'; - export const SimpleContainer = ({ children, height, diff --git a/packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/index.ts b/packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/index.ts deleted file mode 100644 index f30fe115d..000000000 --- a/packages/polaris-viz/src/components/Docs/stories/components/SimpleContainer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SimpleContainer} from './SimpleContainer'; diff --git a/packages/polaris-viz/src/components/Docs/stories/components/Title/index.ts b/packages/polaris-viz/src/components/Docs/stories/components/Title/index.ts deleted file mode 100644 index da711b5c0..000000000 --- a/packages/polaris-viz/src/components/Docs/stories/components/Title/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Title} from './Title'; diff --git a/packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/UtilitiesHeader.tsx b/packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/UtilitiesHeader.tsx index 48fcd49ed..8cbba82b8 100644 --- a/packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/UtilitiesHeader.tsx +++ b/packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/UtilitiesHeader.tsx @@ -1,6 +1,6 @@ import {Fragment} from 'react'; -import {Title} from '../Title'; +import {Title} from '../Title/Title'; export function UtilitiesHeader() { return ( diff --git a/packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/index.ts b/packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/index.ts deleted file mode 100644 index 72ded26e0..000000000 --- a/packages/polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {UtilitiesHeader} from './UtilitiesHeader'; diff --git a/packages/polaris-viz/src/components/Docs/stories/components/WebComponents/WebComponents.tsx b/packages/polaris-viz/src/components/Docs/stories/components/WebComponents/WebComponents.tsx index 482e08761..165a3c81a 100644 --- a/packages/polaris-viz/src/components/Docs/stories/components/WebComponents/WebComponents.tsx +++ b/packages/polaris-viz/src/components/Docs/stories/components/WebComponents/WebComponents.tsx @@ -1,19 +1,18 @@ import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; -import {PolarisVizProvider} from '../../../../PolarisVizProvider'; -import { - BarChart, - LineChart, - StackedAreaChart, - SimpleNormalizedChart, - SparkLineChart, - SparkBarChart, - SimpleBarChart, - DonutChart, - FunnelChart, - ComboChart, -} from '../../../../'; -import {ComponentContainer, Title} from '../'; +import {PolarisVizProvider} from '../../../../PolarisVizProvider/PolarisVizProvider'; +import {BarChart} from '../../../../BarChart/BarChart'; +import {LineChart} from '../../../../LineChart/LineChart'; +import {StackedAreaChart} from '../../../../StackedAreaChart/StackedAreaChart'; +import {SimpleNormalizedChart} from '../../../../SimpleNormalizedChart/SimpleNormalizedChart'; +import {SparkLineChart} from '../../../../SparkLineChart/SparkLineChart'; +import {SparkBarChart} from '../../../../SparkBarChart/SparkBarChart'; +import {SimpleBarChart} from '../../../../SimpleBarChart/SimpleBarChart'; +import {DonutChart} from '../../../../DonutChart/DonutChart'; +import {FunnelChart} from '../../../../FunnelChart/FunnelChart'; +import {ComboChart} from '../../../../ComboChart/ComboChart'; +import {ComponentContainer} from '../ComponentContainer/ComponentContainer'; +import {Title} from '../Title/Title'; const KIND = 'polaris-viz/Charts/'; diff --git a/packages/polaris-viz/src/components/Docs/stories/components/WebComponents/index.ts b/packages/polaris-viz/src/components/Docs/stories/components/WebComponents/index.ts deleted file mode 100644 index a16682b1e..000000000 --- a/packages/polaris-viz/src/components/Docs/stories/components/WebComponents/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {WebComponents} from './WebComponents'; diff --git a/packages/polaris-viz/src/components/Docs/stories/components/index.ts b/packages/polaris-viz/src/components/Docs/stories/components/index.ts deleted file mode 100644 index e2ce5e126..000000000 --- a/packages/polaris-viz/src/components/Docs/stories/components/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -export {ComponentContainer} from './ComponentContainer'; -export {LogoHeader} from './LogoHeader'; -export {Title} from './Title'; -export {Divider} from './Divider'; -export {ExamplesGrid} from './ExamplesGrid'; -export {PropertyTable} from './PropertyTable'; -export { - SampleSparkLineChart, - SampleLineChart, - SampleBarChart, - SampleStackedAreaChart, - SampleSimpleNormalizedChart, - SampleLegendContainer, - SampleLegendChart, - SampleLabelsBarChart, - SampleDonutChart, -} from './SampleComponents'; -export {SimpleContainer} from './SimpleContainer'; -export {Banner} from './Banner'; -export {WebComponents} from './WebComponents'; -export {MobileComponents} from './MobileComponents'; -export {UtilitiesHeader} from './UtilitiesHeader'; -export {PageWithSizingInfo} from './PageWithSizingInfo'; diff --git a/packages/polaris-viz/src/components/Docs/stories/createThemeUtility.stories.mdx b/packages/polaris-viz/src/components/Docs/stories/createThemeUtility.stories.mdx index 031ee1498..cfafef99d 100644 --- a/packages/polaris-viz/src/components/Docs/stories/createThemeUtility.stories.mdx +++ b/packages/polaris-viz/src/components/Docs/stories/createThemeUtility.stories.mdx @@ -1,7 +1,7 @@ import {Meta} from '@storybook/addon-docs'; import {PolarisVizProvider} from '@shopify/polaris-viz'; -import {Title} from './components'; +import {Title} from './components/Title/Title'; import {BORDER_RADIUS} from '../../../../../polaris-viz-core/src/constants.ts'; +/>; <code>line</code> diff --git a/packages/polaris-viz/src/components/Docs/stories/seriesColors.stories.mdx b/packages/polaris-viz/src/components/Docs/stories/seriesColors.stories.mdx index 3e2e5c328..cba0446a6 100644 --- a/packages/polaris-viz/src/components/Docs/stories/seriesColors.stories.mdx +++ b/packages/polaris-viz/src/components/Docs/stories/seriesColors.stories.mdx @@ -2,19 +2,15 @@ import {Meta, Story, Canvas} from '@storybook/addon-docs'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; import {PolarisVizProvider} from '../../../'; +import {ComponentContainer} from './components/ComponentContainer/ComponentContainer'; +import {Title} from './components/Title/Title'; +import {ExamplesGrid} from './components/ExamplesGrid/ExamplesGrid'; +import {PropertyTable} from './components/PropertyTable/PropertyTable'; import { - Divider, - ComponentContainer, - Title, - ExamplesGrid, - SampleSparkbar, SampleSparkLineChart, SampleBarChart, - PropertyTable, - SampleLineChart, SampleStackedAreaChart, - SampleSimpleNormalizedChart, -} from './components'; +} from './components/SampleComponents'; <Meta title="Shared/Themes/Theme Definition/Global Properties/seriesColors" @@ -23,6 +19,7 @@ import { docsOnly: true, }} /> +; <Title>✍️ Theme Definition diff --git a/packages/polaris-viz/src/components/Docs/stories/tooltip.stories.mdx b/packages/polaris-viz/src/components/Docs/stories/tooltip.stories.mdx index 60cbd28cb..87be274cb 100644 --- a/packages/polaris-viz/src/components/Docs/stories/tooltip.stories.mdx +++ b/packages/polaris-viz/src/components/Docs/stories/tooltip.stories.mdx @@ -2,19 +2,19 @@ import {Meta, Story, Canvas} from '@storybook/addon-docs'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; import {PolarisVizProvider} from '../../../'; +import {Divider} from './components/Divider'; +import {ComponentContainer} from './components/ComponentContainer/ComponentContainer'; +import {Title} from './components/Title/Title'; +import {ExamplesGrid} from './components/ExamplesGrid/ExamplesGrid'; +import {PropertyTable} from './components/PropertyTable/PropertyTable'; import { - Divider, - ComponentContainer, - Title, - ExamplesGrid, SampleSparkbar, SampleSparkLineChart, SampleBarChart, - PropertyTable, SampleLineChart, SampleStackedAreaChart, SampleSimpleNormalizedChart, -} from './components'; +} from './components/SampleComponents'; ({ - ...jest.requireActual('../components'), +jest.mock('../../ComparisonMetric/ComparisonMetric', () => ({ ComparisonMetric: () => null, })); diff --git a/packages/polaris-viz/src/components/DonutChart/types.ts b/packages/polaris-viz/src/components/DonutChart/types.ts index f87dea5c8..d59218024 100644 --- a/packages/polaris-viz/src/components/DonutChart/types.ts +++ b/packages/polaris-viz/src/components/DonutChart/types.ts @@ -1,6 +1,6 @@ import type {DataSeries} from '@shopify/polaris-viz-core/src/types'; -import type {TrendIndicatorProps} from '../TrendIndicator'; +import type {TrendIndicatorProps} from '../TrendIndicator/TrendIndicator'; export type MetaDataTrendIndicator = Omit; diff --git a/packages/polaris-viz/src/components/FunnelChart/Chart.tsx b/packages/polaris-viz/src/components/FunnelChart/Chart.tsx index 913f90351..5a125ae96 100644 --- a/packages/polaris-viz/src/components/FunnelChart/Chart.tsx +++ b/packages/polaris-viz/src/components/FunnelChart/Chart.tsx @@ -17,15 +17,16 @@ import { isInfinity, } from '@shopify/polaris-viz-core'; -import {ChartElements} from '../ChartElements'; -import {useReducedLabelIndexes} from '../../hooks'; +import {ChartSVG} from '../ChartElements/ChartSVG'; +import {useReducedLabelIndexes} from '../../hooks/useReducedLabelIndexes'; import { BAR_CONTAINER_TEXT_HEIGHT, MASK_HIGHLIGHT_COLOR, MIN_BAR_HEIGHT, } from '../../constants'; -import {FunnelChartXAxisLabels, FunnelSegment} from './components/'; +import {FunnelChartXAxisLabels} from './components/FunnelChartXAxisLabels'; +import {FunnelSegment} from './components/FunnelSegment'; import type {LabelHelpers} from './FunnelChart'; const X_LABEL_OFFSET = 16; @@ -134,7 +135,7 @@ export function Chart({ }; return ( - + - + ); } diff --git a/packages/polaris-viz/src/components/FunnelChart/FunnelChart.tsx b/packages/polaris-viz/src/components/FunnelChart/FunnelChart.tsx index 1e7cc37b3..d488b9372 100644 --- a/packages/polaris-viz/src/components/FunnelChart/FunnelChart.tsx +++ b/packages/polaris-viz/src/components/FunnelChart/FunnelChart.tsx @@ -12,12 +12,12 @@ import { usePolarisVizContext, } from '@shopify/polaris-viz-core'; -import {ChartContainer} from '../../components/ChartContainer'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; import { getYAxisOptionsWithDefaults, getXAxisOptionsWithDefaults, -} from '../../utilities'; -import {ChartSkeleton} from '../'; +} from '../../utilities/getAxisOptions'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; import {Chart} from './Chart'; diff --git a/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisArrows.tsx b/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisArrows.tsx index 443521e9a..13308bb75 100644 --- a/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisArrows.tsx +++ b/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisArrows.tsx @@ -1,7 +1,7 @@ import type {Dispatch, SetStateAction} from 'react'; -import {useLabels} from '../../Labels'; -import {TextLine} from '../../TextLine'; +import {useLabels} from '../../Labels/hooks/useLabels'; +import {TextLine} from '../../TextLine/TextLine'; const ARROW_WIDTH = 11; const ARROW_HEIGHT = 9; diff --git a/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisLabels.tsx b/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisLabels.tsx index 5f2aeb0ff..855afa26d 100644 --- a/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisLabels.tsx +++ b/packages/polaris-viz/src/components/FunnelChart/components/FunnelChartXAxisLabels.tsx @@ -2,8 +2,9 @@ import type {Dispatch, SetStateAction} from 'react'; import {Fragment} from 'react'; import type {ScaleBand} from 'd3-scale'; -import {useLabels, shouldSkipLabel} from '../../Labels'; -import {TextLine} from '../../TextLine'; +import {useLabels} from '../../Labels/hooks/useLabels'; +import {shouldSkipLabel} from '../../Labels/utilities/shouldSkipLabel'; +import {TextLine} from '../../TextLine/TextLine'; import {FunnelChartXAxisArrows} from './FunnelChartXAxisArrows'; diff --git a/packages/polaris-viz/src/components/FunnelChart/components/index.ts b/packages/polaris-viz/src/components/FunnelChart/components/index.ts deleted file mode 100644 index c24a2d8f0..000000000 --- a/packages/polaris-viz/src/components/FunnelChart/components/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export {FunnelChartXAxisArrows} from './FunnelChartXAxisArrows'; -export {FunnelChartXAxisLabels} from './FunnelChartXAxisLabels'; -export {Label} from './Label'; -export {FunnelSegment} from './FunnelSegment'; diff --git a/packages/polaris-viz/src/components/FunnelChart/index.ts b/packages/polaris-viz/src/components/FunnelChart/index.ts deleted file mode 100644 index c06475fec..000000000 --- a/packages/polaris-viz/src/components/FunnelChart/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {FunnelChart} from './FunnelChart'; -export type {FunnelChartProps} from './FunnelChart'; diff --git a/packages/polaris-viz/src/components/FunnelChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/FunnelChart/stories/Default.stories.tsx index 865c90796..76f81dff5 100644 --- a/packages/polaris-viz/src/components/FunnelChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/FunnelChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {FunnelChartProps} from '../../../components'; +import type {FunnelChartProps} from '../FunnelChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/FunnelChart/stories/DynamicData.stories.tsx b/packages/polaris-viz/src/components/FunnelChart/stories/DynamicData.stories.tsx index 53a0177e9..d959be82b 100644 --- a/packages/polaris-viz/src/components/FunnelChart/stories/DynamicData.stories.tsx +++ b/packages/polaris-viz/src/components/FunnelChart/stories/DynamicData.stories.tsx @@ -2,7 +2,7 @@ import { useState } from 'react'; export {META as default} from './meta'; -import {FunnelChart} from '../../../components'; +import {FunnelChart} from '../FunnelChart'; export const DynamicData = () => { const [data, setData] = useState({ diff --git a/packages/polaris-viz/src/components/FunnelChart/stories/meta.ts b/packages/polaris-viz/src/components/FunnelChart/stories/meta.ts index fa0dbfa63..1c8cc3c30 100644 --- a/packages/polaris-viz/src/components/FunnelChart/stories/meta.ts +++ b/packages/polaris-viz/src/components/FunnelChart/stories/meta.ts @@ -7,7 +7,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {FunnelChart} from '../FunnelChart'; export const META: Meta = { diff --git a/packages/polaris-viz/src/components/Grid/components/GroupCell.tsx b/packages/polaris-viz/src/components/Grid/components/GroupCell.tsx index df6354ff6..b91423519 100644 --- a/packages/polaris-viz/src/components/Grid/components/GroupCell.tsx +++ b/packages/polaris-viz/src/components/Grid/components/GroupCell.tsx @@ -6,7 +6,7 @@ import { HIDE_NAME_AND_SECONDARY_VALUE_HEIGHT_THRESHOLD, HIDE_NAME_AND_SECONDARY_VALUE_WIDTH_THRESHOLD, } from '../utilities/constants'; -import {classNames} from '../../../utilities'; +import {classNames} from '../../../utilities/classnames'; import styles from './GroupCell.scss'; import {Background} from './Background'; diff --git a/packages/polaris-viz/src/components/Grid/components/XAxisLabels.tsx b/packages/polaris-viz/src/components/Grid/components/XAxisLabels.tsx index 930a0e2b9..ca9830d7a 100644 --- a/packages/polaris-viz/src/components/Grid/components/XAxisLabels.tsx +++ b/packages/polaris-viz/src/components/Grid/components/XAxisLabels.tsx @@ -1,7 +1,7 @@ import React from 'react'; import type {ScaleLinear} from 'd3-scale'; -import {XAxis} from '../../XAxis'; +import {XAxis} from '../../XAxis/XAxis'; import { X_AXIS_HEIGHT, X_AXIS_LABEL_OFFSET, diff --git a/packages/polaris-viz/src/components/Grid/components/YAxisLabels.tsx b/packages/polaris-viz/src/components/Grid/components/YAxisLabels.tsx index 966d7fb75..d3abebcd3 100644 --- a/packages/polaris-viz/src/components/Grid/components/YAxisLabels.tsx +++ b/packages/polaris-viz/src/components/Grid/components/YAxisLabels.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import {YAxis} from '../../YAxis'; +import {YAxis} from '../../YAxis/YAxis'; import {Y_AXIS_LABEL_WIDTH, Y_LABEL_OFFSET} from '../utilities/constants'; import styles from './YAxisLabels.scss'; diff --git a/packages/polaris-viz/src/components/Grid/index.ts b/packages/polaris-viz/src/components/Grid/index.ts deleted file mode 100644 index 246d1a535..000000000 --- a/packages/polaris-viz/src/components/Grid/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {Grid} from './Grid'; -export type {GridProps} from './Grid'; diff --git a/packages/polaris-viz/src/components/Grid/stories/meta.tsx b/packages/polaris-viz/src/components/Grid/stories/meta.tsx index 9fd4833f3..4a1bd540f 100644 --- a/packages/polaris-viz/src/components/Grid/stories/meta.tsx +++ b/packages/polaris-viz/src/components/Grid/stories/meta.tsx @@ -8,7 +8,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; export const META: Meta = { title: 'polaris-viz/Charts/Grid', diff --git a/packages/polaris-viz/src/components/Grid/tests/Grid.test.tsx b/packages/polaris-viz/src/components/Grid/tests/Grid.test.tsx index df3f30e39..708089833 100644 --- a/packages/polaris-viz/src/components/Grid/tests/Grid.test.tsx +++ b/packages/polaris-viz/src/components/Grid/tests/Grid.test.tsx @@ -2,8 +2,8 @@ import {mount} from '@shopify/react-testing'; import {act} from 'react-dom/test-utils'; import {Grid} from '../Grid'; -import {XAxis} from '../../XAxis'; -import {YAxis} from '../../YAxis'; +import {XAxis} from '../../XAxis/XAxis'; +import {YAxis} from '../../YAxis/YAxis'; import {GroupCell} from '../components/GroupCell'; describe('', () => { diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/Chart.tsx b/packages/polaris-viz/src/components/HorizontalBarChart/Chart.tsx index 5fffaa569..636119695 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChart/Chart.tsx +++ b/packages/polaris-viz/src/components/HorizontalBarChart/Chart.tsx @@ -9,6 +9,7 @@ import { LINE_HEIGHT, InternalChartType, useChartContext, + useTheme, } from '@shopify/polaris-viz-core'; import type { DataSeries, @@ -20,38 +21,36 @@ import type { } from '@shopify/polaris-viz-core'; import {animated} from '@react-spring/web'; -import {ChartElements} from '../ChartElements'; -import {checkAvailableAnnotations} from '../../components/Annotations'; +import {ChartSVG} from '../ChartElements/ChartSVG'; +import {ChartDiv} from '../ChartElements/ChartDiv'; +import {checkAvailableAnnotations} from '../Annotations/utilities/checkAvailableAnnotations'; import {useFormattedLabels} from '../../hooks/useFormattedLabels'; import type { AnnotationLookupTable, RenderLegendContent, RenderTooltipContentData, } from '../../types'; -import {HorizontalBarChartXAxisLabels} from '../HorizontalBarChartXAxisLabels'; -import {useLegend, LegendContainer} from '../LegendContainer'; +import {HorizontalBarChartXAxisLabels} from '../HorizontalBarChartXAxisLabels/HorizontalBarChartXAxisLabels'; +import {useLegend} from '../LegendContainer/hooks/useLegend'; +import {LegendContainer} from '../LegendContainer/LegendContainer'; import type {HorizontalTransitionStyle} from '../../hooks/useHorizontalTransitions'; -import {GradientDefs, HorizontalGroup} from '../shared'; -import { - useBarChartTooltipContent, - useColorVisionEvents, - useDataForHorizontalChart, - useHorizontalBarSizes, - useHorizontalSeriesColors, - useHorizontalStackedValues, - useHorizontalTransitions, - useHorizontalXScale, - useTheme, -} from '../../hooks'; +import {GradientDefs} from '../shared/GradientDefs/GradientDefs'; +import {HorizontalGroup} from '../shared/HorizontalGroup/HorizontalGroup'; +import {useBarChartTooltipContent} from '../../hooks/useBarChartTooltipContent'; +import {useColorVisionEvents} from '../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {useDataForHorizontalChart} from '../../hooks/useDataForHorizontalChart'; +import {useHorizontalBarSizes} from '../../hooks/useHorizontalBarSizes'; +import {useHorizontalSeriesColors} from '../../hooks/useHorizontalSeriesColors'; +import {useHorizontalStackedValues} from '../../hooks/useHorizontalStackedValues'; +import {useHorizontalTransitions} from '../../hooks/useHorizontalTransitions'; +import {useHorizontalXScale} from '../../hooks/useHorizontalXScale'; import {ChartMargin, ANNOTATIONS_LABELS_OFFSET} from '../../constants'; -import {formatDataIntoGroups} from '../../utilities'; -import {TooltipWrapper} from '../TooltipWrapper'; +import {formatDataIntoGroups} from '../../utilities/formatDataIntoGroups'; +import {TooltipWrapper} from '../TooltipWrapper/TooltipWrapper'; -import { - VerticalGridLines, - HorizontalBarChartYAnnotations, - HorizontalBarChartXAnnotations, -} from './components'; +import {VerticalGridLines} from './components/VerticalGridLines/VerticalGridLines'; +import {HorizontalBarChartYAnnotations} from './components/HorizontalBarChartYAnnotations/HorizontalBarChartYAnnotations'; +import {HorizontalBarChartXAnnotations} from './components/HorizontalBarChartXAnnotations/HorizontalBarChartXAnnotations'; export interface ChartProps { annotationsLookupTable: AnnotationLookupTable; @@ -199,8 +198,8 @@ export function Chart({ }); return ( - - + + {xAxisOptions.hide === true ? null : ( )} - + {highestValueForSeries.length !== 0 && ( )} - + ); } diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/HorizontalBarChartXAnnotations.tsx b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/HorizontalBarChartXAnnotations.tsx index 2b14e4574..126d22db4 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/HorizontalBarChartXAnnotations.tsx +++ b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/HorizontalBarChartXAnnotations.tsx @@ -4,14 +4,14 @@ import {isValueWithinDomain} from '@shopify/polaris-viz-core'; import type {Annotation, AnnotationLookupTable} from '../../../../types'; import {useSVGBlurEvent} from '../../../../hooks/useSVGBlurEvent'; +import {AnnotationLabel} from '../../../Annotations/components/AnnotationLabel/AnnotationLabel'; +import {AnnotationLine} from '../../../Annotations/components/AnnotationLine/AnnotationLine'; +import {AnnotationContent} from '../../../Annotations/components/AnnotationContent/AnnotationContent'; +import {ShowMoreAnnotationsButton} from '../../../Annotations/components/ShowMoreAnnotationsButton/ShowMoreAnnotationsButton'; import { - AnnotationLabel, - AnnotationLine, - AnnotationContent, - ShowMoreAnnotationsButton, PILL_HEIGHT, SHOW_MORE_BUTTON_OFFSET, -} from '../../../Annotations'; +} from '../../../Annotations/constants'; import {isShowMoreAnnotationsButtonVisible} from '../../../../utilities/isShowMoreAnnotationsButtonVisible'; import {shouldHideAnnotation} from '../../../../utilities/shouldHideAnnotation'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/hooks/useHorizontalBarChartXAnnotationPositions.ts b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/hooks/useHorizontalBarChartXAnnotationPositions.ts index cb7c076c8..206648beb 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/hooks/useHorizontalBarChartXAnnotationPositions.ts +++ b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/hooks/useHorizontalBarChartXAnnotationPositions.ts @@ -6,15 +6,15 @@ import { } from '@shopify/polaris-viz-core'; import type {ScaleLinear} from 'd3-scale'; -import type {AnnotationPosition} from '../../../../Annotations'; +import type {AnnotationPosition} from '../../../../Annotations/types'; +import {checkForHorizontalSpace} from '../../../../Annotations/utilities/checkForHorizontalSpace'; +import {useShowMoreAnnotationsButton} from '../../../../Annotations/hooks/useShowMoreAnnotationsButton'; import { - checkForHorizontalSpace, - useShowMoreAnnotationsButton, PILL_HEIGHT, PILL_PADDING, PILL_ROW_GAP, PILL_X_MIN, -} from '../../../../Annotations'; +} from '../../../../Annotations/constants'; import {COLLAPSED_ANNOTATIONS_COUNT} from '../../../../../constants'; import type {Annotation} from '../../../../../types'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/index.ts b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/index.ts deleted file mode 100644 index b2fc1373d..000000000 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartXAnnotations/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {HorizontalBarChartXAnnotations} from './HorizontalBarChartXAnnotations'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/HorizontalBarChartYAnnotations.tsx b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/HorizontalBarChartYAnnotations.tsx index 18c4dbc98..e7f241817 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/HorizontalBarChartYAnnotations.tsx +++ b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/HorizontalBarChartYAnnotations.tsx @@ -1,10 +1,8 @@ import {Fragment, useMemo, useState} from 'react'; -import { - AnnotationContent, - AnnotationLabel, - AnnotationLine, -} from '../../../Annotations'; +import {AnnotationContent} from '../../../Annotations/components/AnnotationContent/AnnotationContent'; +import {AnnotationLabel} from '../../../Annotations/components/AnnotationLabel/AnnotationLabel'; +import {AnnotationLine} from '../../../Annotations/components/AnnotationLine/AnnotationLine'; import type {Annotation, AnnotationLookupTable} from '../../../../types'; import {useSVGBlurEvent} from '../../../../hooks/useSVGBlurEvent'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/hooks/useHorizontalBarChartYAnnotationsPositions.ts b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/hooks/useHorizontalBarChartYAnnotationsPositions.ts index 3d581a7d0..927c5170a 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/hooks/useHorizontalBarChartYAnnotationsPositions.ts +++ b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/hooks/useHorizontalBarChartYAnnotationsPositions.ts @@ -6,8 +6,8 @@ import { useChartContext, } from '@shopify/polaris-viz-core'; -import type {AnnotationPosition} from '../../../../Annotations'; -import {PILL_HEIGHT, PILL_PADDING} from '../../../../Annotations'; +import type {AnnotationPosition} from '../../../../Annotations/types'; +import {PILL_HEIGHT, PILL_PADDING} from '../../../../Annotations/constants'; import type {Annotation} from '../../../../../types'; export interface Props { diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/index.ts b/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/index.ts deleted file mode 100644 index bdb1a44bb..000000000 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/HorizontalBarChartYAnnotations/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {HorizontalBarChartYAnnotations} from './HorizontalBarChartYAnnotations'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/VerticalGridLines/index.ts b/packages/polaris-viz/src/components/HorizontalBarChart/components/VerticalGridLines/index.ts deleted file mode 100644 index f19cfc722..000000000 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/VerticalGridLines/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {VerticalGridLines} from './VerticalGridLines'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/components/index.ts b/packages/polaris-viz/src/components/HorizontalBarChart/components/index.ts deleted file mode 100644 index cbad309f9..000000000 --- a/packages/polaris-viz/src/components/HorizontalBarChart/components/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {VerticalGridLines} from './VerticalGridLines'; -export {HorizontalBarChartYAnnotations} from './HorizontalBarChartYAnnotations'; -export {HorizontalBarChartXAnnotations} from './HorizontalBarChartXAnnotations'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/index.ts b/packages/polaris-viz/src/components/HorizontalBarChart/index.ts deleted file mode 100644 index 36d5ac168..000000000 --- a/packages/polaris-viz/src/components/HorizontalBarChart/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {HorizontalBarChart} from './HorizontalBarChart'; -export type {HorizontalBarChartProps} from './HorizontalBarChart'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx index 93c6316b6..d3e7dfc57 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/HorizontalBarChart/tests/Chart.test.tsx @@ -2,23 +2,19 @@ import {mount} from '@shopify/react-testing'; import type {DataSeries} from '@shopify/polaris-viz-core'; import {LIGHT_THEME} from '@shopify/polaris-viz-core'; -import {HorizontalBarChartXAxisLabels} from '../../../components/HorizontalBarChartXAxisLabels'; -import {LegendContainer} from '../../LegendContainer'; -import { - GradientDefs, - GroupLabel, - HorizontalBars, - HorizontalStackedBars, -} from '../../shared'; +import {HorizontalBarChartXAxisLabels} from '../../HorizontalBarChartXAxisLabels/HorizontalBarChartXAxisLabels'; +import {LegendContainer} from '../../LegendContainer/LegendContainer'; +import {GradientDefs} from '../../shared/GradientDefs/GradientDefs'; +import {GroupLabel} from '../../shared/GroupLabel/GroupLabel'; +import {HorizontalBars} from '../../shared/HorizontalBars/HorizontalBars'; +import {HorizontalStackedBars} from '../../shared/HorizontalStackedBars/HorizontalStackedBars'; import type {ChartProps} from '../Chart'; import {Chart} from '../Chart'; -import { - HorizontalBarChartXAnnotations, - HorizontalBarChartYAnnotations, - VerticalGridLines, -} from '../components'; -import {normalizeData} from '../../../utilities'; -import {TooltipWrapper} from '../../TooltipWrapper'; +import {HorizontalBarChartXAnnotations} from '../components/HorizontalBarChartXAnnotations/HorizontalBarChartXAnnotations'; +import {HorizontalBarChartYAnnotations} from '../components/HorizontalBarChartYAnnotations/HorizontalBarChartYAnnotations'; +import {VerticalGridLines} from '../components/VerticalGridLines/VerticalGridLines'; +import {normalizeData} from '../../../utilities/normalizeData'; +import {TooltipWrapper} from '../../TooltipWrapper/TooltipWrapper'; // jest will not allow access to out of scope constants if they are not named `MOCK_` import {DEFAULT_CHART_CONTEXT as MOCK_DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; diff --git a/packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/HorizontalBarChartXAxisLabels.tsx b/packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/HorizontalBarChartXAxisLabels.tsx index c55e25f58..37a667518 100644 --- a/packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/HorizontalBarChartXAxisLabels.tsx +++ b/packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/HorizontalBarChartXAxisLabels.tsx @@ -2,8 +2,8 @@ import type {Dispatch, SetStateAction} from 'react'; import {Fragment} from 'react'; import type {ScaleLinear} from 'd3-scale'; -import {useLabels} from '../Labels'; -import {TextLine} from '../TextLine'; +import {useLabels} from '../Labels/hooks/useLabels'; +import {TextLine} from '../TextLine/TextLine'; interface HorizontalBarChartXAxisLabelsProps { allowLineWrap: boolean; diff --git a/packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/index.ts b/packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/index.ts deleted file mode 100644 index df6ee1b7d..000000000 --- a/packages/polaris-viz/src/components/HorizontalBarChartXAxisLabels/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {HorizontalBarChartXAxisLabels} from './HorizontalBarChartXAxisLabels'; diff --git a/packages/polaris-viz/src/components/HorizontalGridLines/HorizontalGridLines.test.tsx b/packages/polaris-viz/src/components/HorizontalGridLines/HorizontalGridLines.test.tsx index 5fc2d10ed..203706af3 100644 --- a/packages/polaris-viz/src/components/HorizontalGridLines/HorizontalGridLines.test.tsx +++ b/packages/polaris-viz/src/components/HorizontalGridLines/HorizontalGridLines.test.tsx @@ -1,7 +1,9 @@ import {mount} from '@shopify/react-testing'; -import {mountWithProvider} from '../../test-utilities'; -import {mockDefaultTheme} from '../../test-utilities/mountWithProvider'; +import { + mountWithProvider, + mockDefaultTheme, +} from '../../test-utilities/mountWithProvider'; import type {Props} from './HorizontalGridLines'; import {HorizontalGridLines} from './HorizontalGridLines'; diff --git a/packages/polaris-viz/src/components/HorizontalGridLines/index.ts b/packages/polaris-viz/src/components/HorizontalGridLines/index.ts deleted file mode 100644 index a5d3896bb..000000000 --- a/packages/polaris-viz/src/components/HorizontalGridLines/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {HorizontalGridLines} from './HorizontalGridLines'; diff --git a/packages/polaris-viz/src/components/Labels/Labels.chromatic.stories.tsx b/packages/polaris-viz/src/components/Labels/Labels.chromatic.stories.tsx index ca1a81e1b..8ed3714e1 100644 --- a/packages/polaris-viz/src/components/Labels/Labels.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/Labels/Labels.chromatic.stories.tsx @@ -1,6 +1,6 @@ import {storiesOf} from '@storybook/react'; -import {XAxis} from '../XAxis'; +import {XAxis} from '../XAxis/XAxis'; import {ChartContext} from '@shopify/polaris-viz-core'; import {DEFAULT_CHART_CONTEXT} from '../../storybook/constants'; diff --git a/packages/polaris-viz/src/components/Labels/hooks/index.ts b/packages/polaris-viz/src/components/Labels/hooks/index.ts deleted file mode 100644 index 4f566be99..000000000 --- a/packages/polaris-viz/src/components/Labels/hooks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {useLabels} from './useLabels'; diff --git a/packages/polaris-viz/src/components/Labels/hooks/useLabels.tsx b/packages/polaris-viz/src/components/Labels/hooks/useLabels.tsx index 8b8f76ec4..86ec7e89c 100644 --- a/packages/polaris-viz/src/components/Labels/hooks/useLabels.tsx +++ b/packages/polaris-viz/src/components/Labels/hooks/useLabels.tsx @@ -3,7 +3,7 @@ import {useEffect, useMemo} from 'react'; import {useChartContext} from '@shopify/polaris-viz-core'; import {getFontSize} from '../../../utilities/getFontSize'; -import {estimateStringWidthWithOffset} from '../../../utilities'; +import {estimateStringWidthWithOffset} from '../../../utilities/estimateStringWidthWithOffset'; import { LINE_HEIGHT, DIAGONAL_LABEL_MIN_WIDTH, diff --git a/packages/polaris-viz/src/components/Labels/index.ts b/packages/polaris-viz/src/components/Labels/index.ts deleted file mode 100644 index 7d7d2a21a..000000000 --- a/packages/polaris-viz/src/components/Labels/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {useLabels} from './hooks'; -export {shouldSkipLabel} from './utilities/shouldSkipLabel'; -export {SingleTextLine} from './SingleTextLine'; diff --git a/packages/polaris-viz/src/components/Labels/utilities/truncateLabels.ts b/packages/polaris-viz/src/components/Labels/utilities/truncateLabels.ts index 4e8306eb6..edc0351c2 100644 --- a/packages/polaris-viz/src/components/Labels/utilities/truncateLabels.ts +++ b/packages/polaris-viz/src/components/Labels/utilities/truncateLabels.ts @@ -1,6 +1,6 @@ import type {CharacterWidths} from '@shopify/polaris-viz-core'; -import {estimateStringWidthWithOffset} from '../../../utilities'; +import {estimateStringWidthWithOffset} from '../../../utilities/estimateStringWidthWithOffset'; import type {PreparedLabels} from '../../../types'; import {endLineTruncate} from './endLineTruncate'; diff --git a/packages/polaris-viz/src/components/Legend/Legend.tsx b/packages/polaris-viz/src/components/Legend/Legend.tsx index 036abce78..e12004596 100644 --- a/packages/polaris-viz/src/components/Legend/Legend.tsx +++ b/packages/polaris-viz/src/components/Legend/Legend.tsx @@ -3,11 +3,11 @@ import type {RefObject} from 'react'; import type {LabelFormatter} from '@shopify/polaris-viz-core'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; -import {useExternalHideEvents} from '../../hooks'; +import {useExternalHideEvents} from '../../hooks/ExternalEvents/useExternalHideEvents'; import type {LegendData} from '../../types'; -import {LegendItem} from './components'; -import type {LegendItemDimension} from './components'; +import {LegendItem} from './components/LegendItem/LegendItem'; +import type {LegendItemDimension} from './components/LegendItem/LegendItem'; export interface LegendProps { data: LegendData[]; diff --git a/packages/polaris-viz/src/components/Legend/components/LegendItem/LegendItem.tsx b/packages/polaris-viz/src/components/Legend/components/LegendItem/LegendItem.tsx index 636434625..d0bca627c 100644 --- a/packages/polaris-viz/src/components/Legend/components/LegendItem/LegendItem.tsx +++ b/packages/polaris-viz/src/components/Legend/components/LegendItem/LegendItem.tsx @@ -2,6 +2,7 @@ import type {LabelFormatter} from '@shopify/polaris-viz-core'; import { getColorVisionEventAttrs, getColorVisionStylesForActiveIndex, + useTheme, } from '@shopify/polaris-viz-core'; import type {ReactNode} from 'react'; import {useEffect, useRef, useState} from 'react'; @@ -13,9 +14,8 @@ import { LEGEND_ITEM_GAP, } from '../../constants'; import {PREVIEW_ICON_SIZE} from '../../../../constants'; -import {SeriesIcon} from '../../../shared/SeriesIcon'; +import {SeriesIcon} from '../../../shared/SeriesIcon/SeriesIcon'; import type {LegendData} from '../../../../types'; -import {useTheme} from '../../../../hooks'; import style from './LegendItem.scss'; diff --git a/packages/polaris-viz/src/components/Legend/components/LegendItem/index.ts b/packages/polaris-viz/src/components/Legend/components/LegendItem/index.ts deleted file mode 100644 index 57ab71165..000000000 --- a/packages/polaris-viz/src/components/Legend/components/LegendItem/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {LegendItem} from './LegendItem'; -export type {LegendItemDimension} from './LegendItem'; diff --git a/packages/polaris-viz/src/components/Legend/components/index.ts b/packages/polaris-viz/src/components/Legend/components/index.ts deleted file mode 100644 index 57ab71165..000000000 --- a/packages/polaris-viz/src/components/Legend/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {LegendItem} from './LegendItem'; -export type {LegendItemDimension} from './LegendItem'; diff --git a/packages/polaris-viz/src/components/Legend/index.ts b/packages/polaris-viz/src/components/Legend/index.ts deleted file mode 100644 index 2d19ddf9c..000000000 --- a/packages/polaris-viz/src/components/Legend/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export {Legend} from './Legend'; -export {LegendItem} from './components'; -export type {LegendProps} from './Legend'; -export {estimateLegendItemWidth} from './utilities/estimateLegendItemWidth'; -export type {LegendItemDimension} from './components'; diff --git a/packages/polaris-viz/src/components/Legend/stories/Legend.chromatic.stories.tsx b/packages/polaris-viz/src/components/Legend/stories/Legend.chromatic.stories.tsx index 5faeab971..ffa453ef6 100644 --- a/packages/polaris-viz/src/components/Legend/stories/Legend.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/Legend/stories/Legend.chromatic.stories.tsx @@ -1,11 +1,10 @@ import {storiesOf} from '@storybook/react'; import type {PropCombinations} from '../../../chromatic/types'; -import { - addWithPropsCombinations, - renderCombinationSections, -} from '../../../chromatic'; -import {LegendItem} from '../components'; +import {addWithPropsCombinations} from '../../../chromatic/components/AddWithPropsCombinations'; +import {renderCombinationSections} from '../../../chromatic/utilities/renderCombinationSections'; + +import {LegendItem} from '../components/LegendItem/LegendItem'; import type {LegendItemProps} from '../components/LegendItem/LegendItem'; const stories = storiesOf('Chromatic/Components', module).addParameters({ diff --git a/packages/polaris-viz/src/components/Legend/stories/Legend.stories.tsx b/packages/polaris-viz/src/components/Legend/stories/Legend.stories.tsx index 94168fb23..54cc81522 100644 --- a/packages/polaris-viz/src/components/Legend/stories/Legend.stories.tsx +++ b/packages/polaris-viz/src/components/Legend/stories/Legend.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LegendProps} from '../../../components'; +import type {LegendProps} from '../Legend'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/Legend/tests/Legend.test.tsx b/packages/polaris-viz/src/components/Legend/tests/Legend.test.tsx index a13c6d202..d26c6a905 100644 --- a/packages/polaris-viz/src/components/Legend/tests/Legend.test.tsx +++ b/packages/polaris-viz/src/components/Legend/tests/Legend.test.tsx @@ -3,8 +3,8 @@ import {mount} from '@shopify/react-testing'; import type {LegendProps} from '../Legend'; import {Legend} from '../Legend'; -import {LegendItem} from '../../Legend/components'; -import type {LegendItemDimension} from '../../Legend/components'; +import {LegendItem} from '../components/LegendItem/LegendItem'; +import type {LegendItemDimension} from '../components/LegendItem/LegendItem'; const mockProps: LegendProps = { data: [ diff --git a/packages/polaris-viz/src/components/LegendContainer/LegendContainer.tsx b/packages/polaris-viz/src/components/LegendContainer/LegendContainer.tsx index b91e4e085..cb56a188f 100644 --- a/packages/polaris-viz/src/components/LegendContainer/LegendContainer.tsx +++ b/packages/polaris-viz/src/components/LegendContainer/LegendContainer.tsx @@ -12,15 +12,16 @@ import { import type {Direction, Dimensions} from '@shopify/polaris-viz-core'; import {DEFAULT_LEGEND_HEIGHT, DEFAULT_LEGEND_WIDTH} from '../../constants'; -import {useResizeObserver, useWatchColorVisionEvents} from '../../hooks'; -import {Legend} from '../Legend'; +import {useResizeObserver} from '../../hooks/useResizeObserver'; +import {useWatchColorVisionEvents} from '../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {Legend} from '../Legend/Legend'; import type { LegendData, LegendPosition, RenderHiddenLegendLabel, RenderLegendContent, } from '../../types'; -import {classNames} from '../../utilities'; +import {classNames} from '../../utilities/classnames'; import style from './LegendContainer.scss'; import {HiddenLegendTooltip} from './components/HiddenLegendTooltip'; diff --git a/packages/polaris-viz/src/components/LegendContainer/components/HiddenLegendTooltip.tsx b/packages/polaris-viz/src/components/LegendContainer/components/HiddenLegendTooltip.tsx index ae934eaa0..2fa96e833 100644 --- a/packages/polaris-viz/src/components/LegendContainer/components/HiddenLegendTooltip.tsx +++ b/packages/polaris-viz/src/components/LegendContainer/components/HiddenLegendTooltip.tsx @@ -14,14 +14,14 @@ import { useTheme, } from '@shopify/polaris-viz-core'; +import {TOOLTIP_MARGIN} from '../../TooltipWrapper/constants'; import {getFontSize} from '../../../utilities/getFontSize'; import type {LegendData} from '../../../types'; import {TOOLTIP_BG_OPACITY} from '../../../constants'; import {useBrowserCheck} from '../../../hooks/useBrowserCheck'; import {useRootContainer} from '../../../hooks/useRootContainer'; -import {useColorVisionEvents} from '../../../hooks/ColorVisionA11y'; -import {TOOLTIP_MARGIN} from '../../TooltipWrapper'; -import {Legend} from '../../Legend'; +import {useColorVisionEvents} from '../../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {Legend} from '../../Legend/Legend'; import style from './HiddenLegendTooltip.scss'; diff --git a/packages/polaris-viz/src/components/LegendContainer/components/tests/HiddenLegendTooltip.test.tsx b/packages/polaris-viz/src/components/LegendContainer/components/tests/HiddenLegendTooltip.test.tsx index 221e64362..4845a1167 100644 --- a/packages/polaris-viz/src/components/LegendContainer/components/tests/HiddenLegendTooltip.test.tsx +++ b/packages/polaris-viz/src/components/LegendContainer/components/tests/HiddenLegendTooltip.test.tsx @@ -4,7 +4,7 @@ import { HiddenLegendTooltip, LEGEND_TOOLIP_Z_INDEX, } from '../HiddenLegendTooltip'; -import {Legend} from '../../../Legend'; +import {Legend} from '../../../Legend/Legend'; const mockProps = { activeIndex: 0, diff --git a/packages/polaris-viz/src/components/LegendContainer/hooks/useOverflowLegend.ts b/packages/polaris-viz/src/components/LegendContainer/hooks/useOverflowLegend.ts index 2b8de0e55..c84a828e1 100644 --- a/packages/polaris-viz/src/components/LegendContainer/hooks/useOverflowLegend.ts +++ b/packages/polaris-viz/src/components/LegendContainer/hooks/useOverflowLegend.ts @@ -2,7 +2,7 @@ import type {RefObject} from 'react'; import {useMemo} from 'react'; import type {LegendData} from '../../../types'; -import type {LegendItemDimension} from '../../Legend'; +import type {LegendItemDimension} from '../../Legend/components/LegendItem/LegendItem'; export interface HorizontalOverflowLegendProps { direction: 'horizontal'; diff --git a/packages/polaris-viz/src/components/LegendContainer/index.ts b/packages/polaris-viz/src/components/LegendContainer/index.ts deleted file mode 100644 index e4df83e26..000000000 --- a/packages/polaris-viz/src/components/LegendContainer/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {LegendContainer} from './LegendContainer'; -export {useLegend} from './hooks/useLegend'; diff --git a/packages/polaris-viz/src/components/LegendContainer/tests/LegendsContainer.test.tsx b/packages/polaris-viz/src/components/LegendContainer/tests/LegendsContainer.test.tsx index a34c9b8ee..21933f856 100644 --- a/packages/polaris-viz/src/components/LegendContainer/tests/LegendsContainer.test.tsx +++ b/packages/polaris-viz/src/components/LegendContainer/tests/LegendsContainer.test.tsx @@ -3,7 +3,7 @@ import {useChartContext} from '@shopify/polaris-viz-core'; import type {LegendContainerProps} from '../LegendContainer'; import {LegendContainer} from '../LegendContainer'; -import {Legend} from '../../Legend'; +import {Legend} from '../../Legend/Legend'; import {HiddenLegendTooltip} from '../components/HiddenLegendTooltip'; const WIDTH_WITH_OVERFLOW = 10; diff --git a/packages/polaris-viz/src/components/LineChart/Chart.tsx b/packages/polaris-viz/src/components/LineChart/Chart.tsx index eb92914eb..cd1370af2 100644 --- a/packages/polaris-viz/src/components/LineChart/Chart.tsx +++ b/packages/polaris-viz/src/components/LineChart/Chart.tsx @@ -12,6 +12,7 @@ import { LINE_HEIGHT, SMALL_CHART_HEIGHT, InternalChartType, + useTheme, } from '@shopify/polaris-viz-core'; import type { XAxisOptions, @@ -21,13 +22,11 @@ import type { LabelFormatter, } from '@shopify/polaris-viz-core'; -import {useExternalHideEvents} from '../../hooks/ExternalEvents'; +import {useExternalHideEvents} from '../../hooks/ExternalEvents/useExternalHideEvents'; import {useIndexForLabels} from '../../hooks/useIndexForLabels'; -import { - Annotations, - checkAvailableAnnotations, - YAxisAnnotations, -} from '../Annotations'; +import {Annotations} from '../Annotations/Annotations'; +import {checkAvailableAnnotations} from '../Annotations/utilities/checkAvailableAnnotations'; +import {YAxisAnnotations} from '../Annotations/YAxisAnnotations'; import type { AnnotationLookupTable, LineChartSlotProps, @@ -36,30 +35,28 @@ import type { RenderTooltipContentData, } from '../../types'; import {useFormattedLabels} from '../../hooks/useFormattedLabels'; -import {XAxis} from '../XAxis'; -import {useLegend, LegendContainer} from '../LegendContainer'; -import {TooltipWrapper} from '../../components/TooltipWrapper'; -import { - useTheme, - useColorVisionEvents, - useWatchColorVisionEvents, - useLinearLabelsAndDimensions, -} from '../../hooks'; +import {XAxis} from '../XAxis/XAxis'; +import {useLegend} from '../LegendContainer/hooks/useLegend'; +import {LegendContainer} from '../LegendContainer/LegendContainer'; +import {TooltipWrapper} from '../TooltipWrapper/TooltipWrapper'; +import {useColorVisionEvents} from '../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {useWatchColorVisionEvents} from '../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {useLinearLabelsAndDimensions} from '../../hooks/useLinearLabelsAndDimensions'; import { ChartMargin, ANNOTATIONS_LABELS_OFFSET, Y_AXIS_LABEL_OFFSET, CROSSHAIR_ID, } from '../../constants'; -import {VisuallyHiddenRows} from '../VisuallyHiddenRows'; -import {YAxis} from '../YAxis'; -import {HorizontalGridLines} from '../HorizontalGridLines'; -import {ChartElements} from '../ChartElements'; +import {VisuallyHiddenRows} from '../VisuallyHiddenRows/VisuallyHiddenRows'; +import {YAxis} from '../YAxis/YAxis'; +import {HorizontalGridLines} from '../HorizontalGridLines/HorizontalGridLines'; +import {ChartSVG} from '../ChartElements/ChartSVG'; import {useLineChartTooltipContent} from './hooks/useLineChartTooltipContent'; -import {PointsAndCrosshair} from './components'; -import {useFormatData} from './hooks'; -import {yAxisMinMax} from './utilities'; +import {PointsAndCrosshair} from './components/PointsAndCrosshair/PointsAndCrosshair'; +import {useFormatData} from './hooks/useFormatData'; +import {yAxisMinMax} from './utilities/yAxisMinMax'; export interface ChartProps { renderTooltipContent: (data: RenderTooltipContentData) => ReactNode; @@ -244,7 +241,7 @@ export function Chart({ return ( - )} - + {longestSeriesLength !== -1 && ( { const [data, setData] = useState({ diff --git a/packages/polaris-viz/src/components/LineChart/stories/FixedYScaleWidth.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/FixedYScaleWidth.stories.tsx index 36363ce00..6a77fb40d 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/FixedYScaleWidth.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/FixedYScaleWidth.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LineChartProps} from '../../../components'; +import type {LineChartProps} from '../LineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/FormattedValues.chromatic.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/FormattedValues.chromatic.stories.tsx index 130740143..f7e2edeb5 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/FormattedValues.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/FormattedValues.chromatic.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import {META} from './meta'; -import type {LineChartProps} from '../../../components'; +import type {LineChartProps} from '../LineChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/HideXAxis.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/HideXAxis.stories.tsx index 6c327c67a..0f4065c14 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/HideXAxis.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/HideXAxis.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LineChartProps} from '../../../components'; +import type {LineChartProps} from '../LineChart'; import {formatLinearXAxisLabel} from '../../../storybook/utilities'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/IntegersOnly.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/IntegersOnly.stories.tsx index e387a6a8b..be6c1cec4 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/IntegersOnly.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/IntegersOnly.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LineChartProps} from '../../../components'; +import type {LineChartProps} from '../LineChart'; import {formatLinearYAxisLabel} from '../../../storybook/utilities'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/InteractiveCustomLegend.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/InteractiveCustomLegend.stories.tsx index 61e2f8aa9..743095888 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/InteractiveCustomLegend.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/InteractiveCustomLegend.stories.tsx @@ -2,9 +2,9 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import {LinePreview} from '../../..'; +import {LinePreview} from '../../LinePreview/LinePreview'; import {DARK_THEME} from '../../../constants'; -import type {LineChartProps} from '../..'; +import type {LineChartProps} from '../LineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/NoOverflowStyle.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/NoOverflowStyle.stories.tsx index 8a24dd8ee..94295a720 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/NoOverflowStyle.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/NoOverflowStyle.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LineChartProps} from '../../../components'; +import type {LineChartProps} from '../LineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/OverwrittenSeriesColors.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/OverwrittenSeriesColors.stories.tsx index 62b0521da..f79d9acc1 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/OverwrittenSeriesColors.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/OverwrittenSeriesColors.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LineChartProps} from '../../../components'; +import type {LineChartProps} from '../LineChart'; import {formatLinearXAxisLabel} from '../../../storybook/utilities'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/ResizeableChart.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/ResizeableChart.stories.tsx index 36cc4baca..74a8a8d87 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/ResizeableChart.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/ResizeableChart.stories.tsx @@ -1,6 +1,8 @@ export {META as default} from './meta'; -import {LineChart, LineChartProps} from '../../../components'; +import {LineChart} from '../LineChart'; +import type {LineChartProps} from '../LineChart'; + import type {Story} from '@storybook/react'; import {DEFAULT_DATA, DEFAULT_PROPS} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/WithNullValues.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/WithNullValues.stories.tsx index 40de0ee1f..569844df2 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/WithNullValues.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/WithNullValues.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LineChartProps} from '../../../components'; +import type {LineChartProps} from '../LineChart'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/YAxisPercentages.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/YAxisPercentages.stories.tsx index 67555d5eb..2816d0a6c 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/YAxisPercentages.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/YAxisPercentages.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LineChartProps} from '../..'; +import type {LineChartProps} from '../LineChart'; import {formatPercentageYAxisLabel} from '../../../storybook/utilities'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/chromatic/Annotations.chromatic.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/chromatic/Annotations.chromatic.stories.tsx index 8ebf60332..6e643ace2 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/chromatic/Annotations.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/chromatic/Annotations.chromatic.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {LineChartProps} from '../../../../components'; +import type {LineChartProps} from '../../LineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from '../data'; import {META} from '../meta'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/chromatic/FixedYScaleWidth.chromatic.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/chromatic/FixedYScaleWidth.chromatic.stories.tsx index 00edba6ba..e7f783f71 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/chromatic/FixedYScaleWidth.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/chromatic/FixedYScaleWidth.chromatic.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {LineChartProps} from '../../../../components'; +import type {LineChartProps} from '../../LineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from '../data'; import {META} from '../meta'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/meta.tsx b/packages/polaris-viz/src/components/LineChart/stories/meta.tsx index 14d75e999..b5b8f40cf 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/meta.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/meta.tsx @@ -15,7 +15,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {LineChart} from '../LineChart'; import {TOOLTIP_CONTENT} from './data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/playground/CrosshairOffset.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/playground/CrosshairOffset.stories.tsx index dcfaad0e4..76d746536 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/playground/CrosshairOffset.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/playground/CrosshairOffset.stories.tsx @@ -1,6 +1,6 @@ import type {Story} from '@storybook/react'; -import type {LineChartProps} from '../../../../components'; +import type {LineChartProps} from '../../LineChart'; import {META} from '../meta'; import {DEFAULT_PROPS, Template} from '../data'; diff --git a/packages/polaris-viz/src/components/LineChart/stories/playground/MisMatchedData.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/playground/MisMatchedData.stories.tsx index 3e2c69a79..a08bd8802 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/playground/MisMatchedData.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/playground/MisMatchedData.stories.tsx @@ -1,6 +1,8 @@ import type {Story} from '@storybook/react'; -import {LineChart, LineChartProps} from '../../../../components'; +import {LineChart} from '../../LineChart'; +import type {LineChartProps} from '../../LineChart'; + import {META} from '../meta'; export default { diff --git a/packages/polaris-viz/src/components/LineChart/stories/playground/Playground.stories.tsx b/packages/polaris-viz/src/components/LineChart/stories/playground/Playground.stories.tsx index 63b29119b..8837b40a0 100644 --- a/packages/polaris-viz/src/components/LineChart/stories/playground/Playground.stories.tsx +++ b/packages/polaris-viz/src/components/LineChart/stories/playground/Playground.stories.tsx @@ -7,7 +7,7 @@ import { formatLinearYAxisLabel, } from '../../../../storybook/utilities'; import {META} from '../meta'; -import {renderLinearTooltipContent} from '../../../../utilities'; +import {renderLinearTooltipContent} from '../../../../utilities/renderLinearTooltipContent'; export default { ...META, diff --git a/packages/polaris-viz/src/components/LineChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/LineChart/tests/Chart.test.tsx index d7e85a294..bf6f4f3d4 100644 --- a/packages/polaris-viz/src/components/LineChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/LineChart/tests/Chart.test.tsx @@ -10,22 +10,24 @@ import { useChartContext, } from '@shopify/polaris-viz-core'; -import {LegendContainer} from '../../LegendContainer'; -import {Crosshair} from '../../../components/Crosshair'; -import {VisuallyHiddenRows} from '../../../components/VisuallyHiddenRows'; -import {Point} from '../../../components/Point'; -import {mountWithProvider, triggerSVGMouseMove} from '../../../test-utilities'; -import {HorizontalGridLines} from '../../../components/HorizontalGridLines'; -import {mockDefaultTheme} from '../../../test-utilities/mountWithProvider'; +import {LegendContainer} from '../../LegendContainer/LegendContainer'; +import {Crosshair} from '../../Crosshair/Crosshair'; +import {VisuallyHiddenRows} from '../../VisuallyHiddenRows/VisuallyHiddenRows'; +import {Point} from '../../Point/Point'; import { - TooltipAnimatedContainer, - TooltipWrapper, -} from '../../../components/TooltipWrapper'; + mountWithProvider, + mockDefaultTheme, +} from '../../../test-utilities/mountWithProvider'; +import {triggerSVGMouseMove} from '../../../test-utilities/triggerSvgMouseMove'; +import {HorizontalGridLines} from '../../HorizontalGridLines/HorizontalGridLines'; +import {TooltipAnimatedContainer} from '../../TooltipWrapper/components/TooltipAnimatedContainer'; +import {TooltipWrapper} from '../../TooltipWrapper/TooltipWrapper'; import type {ChartProps} from '../Chart'; import {Chart} from '../Chart'; -import {YAxis} from '../../YAxis'; -import {Annotations, YAxisAnnotations} from '../../Annotations'; -import {normalizeData} from '../../../utilities'; +import {YAxis} from '../../YAxis/YAxis'; +import {Annotations} from '../../Annotations/Annotations'; +import {YAxisAnnotations} from '../../Annotations/YAxisAnnotations'; +import {normalizeData} from '../../../utilities/normalizeData'; import {DEFAULT_CHART_CONTEXT as MOCK_DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; const MOCK_DATA: Required = { diff --git a/packages/polaris-viz/src/components/LineChart/tests/LineChart.test.tsx b/packages/polaris-viz/src/components/LineChart/tests/LineChart.test.tsx index 68edf8d2b..9f65cfad5 100644 --- a/packages/polaris-viz/src/components/LineChart/tests/LineChart.test.tsx +++ b/packages/polaris-viz/src/components/LineChart/tests/LineChart.test.tsx @@ -2,7 +2,7 @@ import {mount} from '@shopify/react-testing'; import type {DataSeries} from '@shopify/polaris-viz-core'; import {LineChart} from '../LineChart'; -import {SkipLink} from '../../SkipLink'; +import {SkipLink} from '../../SkipLink/SkipLink'; import {Chart} from '../Chart'; const primarySeries: DataSeries = { diff --git a/packages/polaris-viz/src/components/LineChart/utilities/index.ts b/packages/polaris-viz/src/components/LineChart/utilities/index.ts deleted file mode 100644 index fdb1afaf9..000000000 --- a/packages/polaris-viz/src/components/LineChart/utilities/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {yAxisMinMax} from './yAxisMinMax'; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/LineChartPredictive.tsx b/packages/polaris-viz/src/components/LineChartPredictive/LineChartPredictive.tsx index c9a83a776..a794e30cd 100644 --- a/packages/polaris-viz/src/components/LineChartPredictive/LineChartPredictive.tsx +++ b/packages/polaris-viz/src/components/LineChartPredictive/LineChartPredictive.tsx @@ -8,10 +8,11 @@ import { import {useMemo} from 'react'; import type {RenderTooltipContentData} from 'types'; -import {LineChart} from '../LineChart'; +import {LineChart} from '../LineChart/LineChart'; import type {LineChartPredictiveProps} from './types'; -import {CustomLegend, PredictiveLinePoints} from './components'; +import {CustomLegend} from './components/CustomLegend/CustomLegend'; +import {PredictiveLinePoints} from './components/PredictiveLinePoints/PredictiveLinePoints'; import {renderLinearPredictiveTooltipContent} from './utilities/renderLinearPredictiveTooltipContent'; export function LineChartPredictive(props: LineChartPredictiveProps) { diff --git a/packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/CustomLegend.tsx b/packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/CustomLegend.tsx index e3ae3d705..fc1616d65 100644 --- a/packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/CustomLegend.tsx +++ b/packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/CustomLegend.tsx @@ -2,8 +2,8 @@ import type {LabelFormatter} from '@shopify/polaris-viz-core'; import type {LineChartPredictiveDataSeries} from '../../../../components/LineChartPredictive/types'; import type {ColorVisionInteractionMethods} from '../../../../types'; -import {LegendItem} from '../../../../components/Legend'; -import {SeriesIcon} from '../SeriesIcon'; +import {LegendItem} from '../../../Legend/components/LegendItem/LegendItem'; +import {SeriesIcon} from '../SeriesIcon/SeriesIcon'; import styles from './CustomLegend.scss'; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/index.ts b/packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/index.ts deleted file mode 100644 index da14739fe..000000000 --- a/packages/polaris-viz/src/components/LineChartPredictive/components/CustomLegend/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {CustomLegend} from './CustomLegend'; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/PredictiveLinePoints.tsx b/packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/PredictiveLinePoints.tsx index 2ae6c58b5..8134457f4 100644 --- a/packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/PredictiveLinePoints.tsx +++ b/packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/PredictiveLinePoints.tsx @@ -9,8 +9,8 @@ import { import {Fragment, useMemo, useState} from 'react'; import type {LineChartSlotProps} from 'types'; -import {Point} from '../../../Point'; -import {useWatchColorVisionEvents} from '../../../../hooks'; +import {Point} from '../../../Point/Point'; +import {useWatchColorVisionEvents} from '../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; import type {LineChartPredictiveProps} from '../../types'; interface PredictiveLinePointsProps extends LineChartSlotProps { diff --git a/packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/index.ts b/packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/index.ts deleted file mode 100644 index 18a5f234c..000000000 --- a/packages/polaris-viz/src/components/LineChartPredictive/components/PredictiveLinePoints/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {PredictiveLinePoints} from './PredictiveLinePoints'; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/components/SeriesIcon/index.ts b/packages/polaris-viz/src/components/LineChartPredictive/components/SeriesIcon/index.ts deleted file mode 100644 index 67ffefcd7..000000000 --- a/packages/polaris-viz/src/components/LineChartPredictive/components/SeriesIcon/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SeriesIcon} from './SeriesIcon'; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/components/index.ts b/packages/polaris-viz/src/components/LineChartPredictive/components/index.ts deleted file mode 100644 index fe18bba2b..000000000 --- a/packages/polaris-viz/src/components/LineChartPredictive/components/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {PredictiveLinePoints} from './PredictiveLinePoints'; -export {CustomLegend} from './CustomLegend'; -export {SeriesIcon} from './SeriesIcon'; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/index.ts b/packages/polaris-viz/src/components/LineChartPredictive/index.ts deleted file mode 100644 index 7a2707f5f..000000000 --- a/packages/polaris-viz/src/components/LineChartPredictive/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {LineChartPredictive} from './LineChartPredictive'; -export type {LineChartPredictiveProps} from './types'; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/stories/meta.tsx b/packages/polaris-viz/src/components/LineChartPredictive/stories/meta.tsx index 517d7cb87..f794ff8fb 100644 --- a/packages/polaris-viz/src/components/LineChartPredictive/stories/meta.tsx +++ b/packages/polaris-viz/src/components/LineChartPredictive/stories/meta.tsx @@ -14,7 +14,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {LineChartPredictive} from '../LineChartPredictive'; export const META: Meta = { diff --git a/packages/polaris-viz/src/components/LineChartPredictive/types.ts b/packages/polaris-viz/src/components/LineChartPredictive/types.ts index 80f9e1aab..bc9e6a35b 100644 --- a/packages/polaris-viz/src/components/LineChartPredictive/types.ts +++ b/packages/polaris-viz/src/components/LineChartPredictive/types.ts @@ -1,6 +1,6 @@ import type {DataSeries} from '@shopify/polaris-viz-core'; -import type {LineChartProps} from '../../components/LineChart'; +import type {LineChartProps} from '../LineChart/LineChart'; export interface MetaData { isPredictive?: boolean; diff --git a/packages/polaris-viz/src/components/LineChartPredictive/utilities/renderLinearPredictiveTooltipContent.tsx b/packages/polaris-viz/src/components/LineChartPredictive/utilities/renderLinearPredictiveTooltipContent.tsx index 4432b9b75..f7e849ab5 100644 --- a/packages/polaris-viz/src/components/LineChartPredictive/utilities/renderLinearPredictiveTooltipContent.tsx +++ b/packages/polaris-viz/src/components/LineChartPredictive/utilities/renderLinearPredictiveTooltipContent.tsx @@ -2,14 +2,12 @@ import type {ReactNode} from 'react'; import {Fragment} from 'react'; import {PREVIEW_ICON_SIZE} from '../../../constants'; -import { - TooltipContentContainer, - TooltipTitle, - TooltipRow, - LinePreview, -} from '../../'; +import {TooltipContentContainer} from '../../TooltipContent/components/TooltipContentContainer/TooltipContentContainer'; +import {TooltipTitle} from '../../TooltipContent/components/TooltipTitle/TooltipTitle'; +import {TooltipRow} from '../../TooltipContent/components/TooltipRow/TooltipRow'; +import {LinePreview} from '../../LinePreview/LinePreview'; import type {RenderTooltipContentData} from '../../../types'; -import {SeriesIcon} from '../components'; +import {SeriesIcon} from '../components/SeriesIcon/SeriesIcon'; import styles from './Styles.scss'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/LineChartRelational.tsx b/packages/polaris-viz/src/components/LineChartRelational/LineChartRelational.tsx index f84b3353f..69e682231 100644 --- a/packages/polaris-viz/src/components/LineChartRelational/LineChartRelational.tsx +++ b/packages/polaris-viz/src/components/LineChartRelational/LineChartRelational.tsx @@ -5,10 +5,12 @@ import { } from '@shopify/polaris-viz-core'; import {Fragment} from 'react'; -import type {LineChartProps} from '../LineChart'; -import {LineChart} from '../LineChart'; +import type {LineChartProps} from '../LineChart/LineChart'; +import {LineChart} from '../LineChart/LineChart'; -import {RelatedAreas, MissingDataArea, CustomLegend} from './components'; +import {RelatedAreas} from './components/RelatedAreas/RelatedAreas'; +import {MissingDataArea} from './components/MissingDataArea/MissingDataArea'; +import {CustomLegend} from './components/CustomLegend/CustomLegend'; export type LineChartRelationalProps = Omit< LineChartProps, diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/Area/index.ts b/packages/polaris-viz/src/components/LineChartRelational/components/Area/index.ts deleted file mode 100644 index efcedeb16..000000000 --- a/packages/polaris-viz/src/components/LineChartRelational/components/Area/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Area} from './Area'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/CustomLegend.tsx b/packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/CustomLegend.tsx index 0ea9a5679..490812791 100644 --- a/packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/CustomLegend.tsx +++ b/packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/CustomLegend.tsx @@ -1,7 +1,7 @@ import type {DataSeries, LabelFormatter} from '@shopify/polaris-viz-core'; import type {ColorVisionInteractionMethods} from '../../../../types'; -import {LegendItem} from '../../../../components/Legend'; +import {LegendItem} from '../../../Legend/components/LegendItem/LegendItem'; import styles from './CustomLegend.scss'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/index.ts b/packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/index.ts deleted file mode 100644 index da14739fe..000000000 --- a/packages/polaris-viz/src/components/LineChartRelational/components/CustomLegend/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {CustomLegend} from './CustomLegend'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/MissingDataArea/index.ts b/packages/polaris-viz/src/components/LineChartRelational/components/MissingDataArea/index.ts deleted file mode 100644 index 7d6c5f1a5..000000000 --- a/packages/polaris-viz/src/components/LineChartRelational/components/MissingDataArea/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {MissingDataArea} from './MissingDataArea'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/RelatedAreas.tsx b/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/RelatedAreas.tsx index c4c35ee15..5d4e5d48e 100644 --- a/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/RelatedAreas.tsx +++ b/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/RelatedAreas.tsx @@ -4,9 +4,10 @@ import {useChartContext, curveStepRounded} from '@shopify/polaris-viz-core'; import {area as areaShape} from 'd3-shape'; import type {LineChartSlotProps} from 'types'; -import {useExternalHideEvents, useWatchActiveSeries} from '../../../../hooks'; +import {useExternalHideEvents} from '../../../../hooks/ExternalEvents/useExternalHideEvents'; +import {useWatchActiveSeries} from '../../../../hooks/useWatchActiveSeries'; import type {LineChartRelationalDataSeries} from '../../types'; -import {Area} from '../Area'; +import {Area} from '../Area/Area'; export interface RelatedAreaProps extends LineChartSlotProps { data: LineChartRelationalDataSeries[]; diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/index.ts b/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/index.ts deleted file mode 100644 index 537529f52..000000000 --- a/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {RelatedAreas} from './RelatedAreas'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/tests/RelatedAreas.test.tsx b/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/tests/RelatedAreas.test.tsx index b7b31193d..53f45c92e 100644 --- a/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/tests/RelatedAreas.test.tsx +++ b/packages/polaris-viz/src/components/LineChartRelational/components/RelatedAreas/tests/RelatedAreas.test.tsx @@ -3,7 +3,7 @@ import {scaleLinear} from 'd3-scale'; import type {RelatedAreaProps} from '../RelatedAreas'; import {RelatedAreas} from '../RelatedAreas'; -import {Area} from '../../Area'; +import {Area} from '../../Area/Area'; const MOCK_PROPS: RelatedAreaProps = { data: [ diff --git a/packages/polaris-viz/src/components/LineChartRelational/components/index.ts b/packages/polaris-viz/src/components/LineChartRelational/components/index.ts deleted file mode 100644 index a13f72640..000000000 --- a/packages/polaris-viz/src/components/LineChartRelational/components/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export {Area} from './Area'; -export {MissingDataArea} from './MissingDataArea'; -export {RelatedAreas} from './RelatedAreas'; -export {CustomLegend} from './CustomLegend'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/index.ts b/packages/polaris-viz/src/components/LineChartRelational/index.ts deleted file mode 100644 index 47f36f2db..000000000 --- a/packages/polaris-viz/src/components/LineChartRelational/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {LineChartRelational} from './LineChartRelational'; -export {MissingDataArea} from './components/MissingDataArea'; -export type {LineChartRelationalProps} from './LineChartRelational'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/stories/FormattedValues.chromatic.stories.tsx b/packages/polaris-viz/src/components/LineChartRelational/stories/FormattedValues.chromatic.stories.tsx index 25b4f487d..78d121f57 100644 --- a/packages/polaris-viz/src/components/LineChartRelational/stories/FormattedValues.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/LineChartRelational/stories/FormattedValues.chromatic.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import {META} from './meta'; -import type {LineChartRelationalProps} from '../../LineChartRelational'; +import type {LineChartRelationalProps} from '../LineChartRelational'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/LineChartRelational/stories/data.tsx b/packages/polaris-viz/src/components/LineChartRelational/stories/data.tsx index 825202040..7f740530f 100644 --- a/packages/polaris-viz/src/components/LineChartRelational/stories/data.tsx +++ b/packages/polaris-viz/src/components/LineChartRelational/stories/data.tsx @@ -9,7 +9,7 @@ import { formatLinearXAxisLabel, formatLinearYAxisLabel, } from '../../../storybook/utilities'; -import {renderLinearTooltipContent} from '../../../utilities'; +import {renderLinearTooltipContent} from '../../../utilities/renderLinearTooltipContent'; export const TOOLTIP_CONTENT = { empty: undefined, diff --git a/packages/polaris-viz/src/components/LineChartRelational/stories/meta.tsx b/packages/polaris-viz/src/components/LineChartRelational/stories/meta.tsx index b1cd23655..5db3ac9c0 100644 --- a/packages/polaris-viz/src/components/LineChartRelational/stories/meta.tsx +++ b/packages/polaris-viz/src/components/LineChartRelational/stories/meta.tsx @@ -15,7 +15,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {LineChartRelational} from '../LineChartRelational'; import {TOOLTIP_CONTENT} from './data'; diff --git a/packages/polaris-viz/src/components/LinePreview/index.ts b/packages/polaris-viz/src/components/LinePreview/index.ts deleted file mode 100644 index 132bfe9f9..000000000 --- a/packages/polaris-viz/src/components/LinePreview/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {LinePreview} from './LinePreview'; -export type {LinePreviewProps} from './LinePreview'; diff --git a/packages/polaris-viz/src/components/LinePreview/stories/LinePreview.stories.tsx b/packages/polaris-viz/src/components/LinePreview/stories/LinePreview.stories.tsx index f8f72d284..deac3f76f 100644 --- a/packages/polaris-viz/src/components/LinePreview/stories/LinePreview.stories.tsx +++ b/packages/polaris-viz/src/components/LinePreview/stories/LinePreview.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {LinePreviewProps} from '../../../components'; +import type {LinePreviewProps} from '../LinePreview'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/Point/Point.tsx b/packages/polaris-viz/src/components/Point/Point.tsx index d572be2cb..66db6abc1 100644 --- a/packages/polaris-viz/src/components/Point/Point.tsx +++ b/packages/polaris-viz/src/components/Point/Point.tsx @@ -4,7 +4,7 @@ import {useTheme} from '@shopify/polaris-viz-core'; import type {Interpolation} from '@react-spring/web'; import {useSpring, animated} from '@react-spring/web'; -import {classNames} from '../../utilities'; +import {classNames} from '../../utilities/classnames'; import {BASE_ANIMATION_DURATION} from '../../constants'; import styles from './Point.scss'; diff --git a/packages/polaris-viz/src/components/Point/index.ts b/packages/polaris-viz/src/components/Point/index.ts deleted file mode 100644 index 77f653359..000000000 --- a/packages/polaris-viz/src/components/Point/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Point} from './Point'; diff --git a/packages/polaris-viz/src/components/PolarisVizProvider/index.ts b/packages/polaris-viz/src/components/PolarisVizProvider/index.ts deleted file mode 100644 index 9b992f169..000000000 --- a/packages/polaris-viz/src/components/PolarisVizProvider/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {PolarisVizProvider} from './PolarisVizProvider'; diff --git a/packages/polaris-viz/src/components/PolarisVizProvider/stories/PolarisVizProvider.chromatic.stories.tsx b/packages/polaris-viz/src/components/PolarisVizProvider/stories/PolarisVizProvider.chromatic.stories.tsx index a34b0477d..20a30bd0d 100644 --- a/packages/polaris-viz/src/components/PolarisVizProvider/stories/PolarisVizProvider.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/PolarisVizProvider/stories/PolarisVizProvider.chromatic.stories.tsx @@ -1,14 +1,14 @@ import type {Story} from '@storybook/react'; -import {BarChart} from '../../BarChart'; -import {DonutChart} from '../../DonutChart'; -import {FunnelChart} from '../../FunnelChart'; -import {LineChart} from '../../LineChart'; -import {LineChartRelational} from '../../LineChartRelational'; -import {SimpleBarChart} from '../../SimpleBarChart'; -import {SimpleNormalizedChart} from '../../SimpleNormalizedChart'; -import {SparkBarChart} from '../../SparkBarChart'; -import {SparkLineChart} from '../../SparkLineChart'; -import {StackedAreaChart} from '../../StackedAreaChart'; +import {BarChart} from '../../BarChart/BarChart'; +import {DonutChart} from '../../DonutChart/DonutChart'; +import {FunnelChart} from '../../FunnelChart/FunnelChart'; +import {LineChart} from '../../LineChart/LineChart'; +import {LineChartRelational} from '../../LineChartRelational/LineChartRelational'; +import {SimpleBarChart} from '../../SimpleBarChart/SimpleBarChart'; +import {SimpleNormalizedChart} from '../../SimpleNormalizedChart/SimpleNormalizedChart'; +import {SparkBarChart} from '../../SparkBarChart/SparkBarChart'; +import {SparkLineChart} from '../../SparkLineChart/SparkLineChart'; +import {StackedAreaChart} from '../../StackedAreaChart/StackedAreaChart'; import {PolarisVizProvider} from '../PolarisVizProvider'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/Chart.tsx b/packages/polaris-viz/src/components/SimpleBarChart/Chart.tsx index 164f3179f..cab57ce89 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/Chart.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/Chart.tsx @@ -14,20 +14,21 @@ import type { import {animated} from '@react-spring/web'; import {getFontSize} from '../../utilities/getFontSize'; -import {ChartElements} from '../ChartElements'; -import {LegendContainer, useLegend} from '../../components/LegendContainer'; -import {GradientDefs, HorizontalGroup} from '../shared'; -import type {HorizontalTransitionStyle} from '../../hooks'; -import { - useHorizontalBarSizes, - useDataForHorizontalChart, - useHorizontalXScale, - useHorizontalTransitions, - useHorizontalSeriesColors, - useHorizontalStackedValues, - useColorVisionEvents, -} from '../../hooks'; -import {getContainerAlignmentForLegend} from '../../utilities'; +import {ChartSVG} from '../ChartElements/ChartSVG'; +import {ChartDiv} from '../ChartElements/ChartDiv'; +import {LegendContainer} from '../LegendContainer/LegendContainer'; +import {useLegend} from '../LegendContainer/hooks/useLegend'; +import {GradientDefs} from '../shared/GradientDefs/GradientDefs'; +import {HorizontalGroup} from '../shared/HorizontalGroup/HorizontalGroup'; +import type {HorizontalTransitionStyle} from '../../hooks/useHorizontalTransitions'; +import {useHorizontalBarSizes} from '../../hooks/useHorizontalBarSizes'; +import {useDataForHorizontalChart} from '../../hooks/useDataForHorizontalChart'; +import {useHorizontalXScale} from '../../hooks/useHorizontalXScale'; +import {useHorizontalTransitions} from '../../hooks/useHorizontalTransitions'; +import {useHorizontalSeriesColors} from '../../hooks/useHorizontalSeriesColors'; +import {useHorizontalStackedValues} from '../../hooks/useHorizontalStackedValues'; +import {useColorVisionEvents} from '../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {getContainerAlignmentForLegend} from '../../utilities/getContainerAlignmentForLegend'; import type {LegendPosition, RenderLegendContent} from '../../types'; import type {SimpleBarChartDataSeries} from './types'; @@ -128,8 +129,8 @@ export function Chart({ const containerStyle = getContainerAlignmentForLegend(legendPosition, true); return ( - - + + ); })} - + {showLegend && ( )} - + ); } diff --git a/packages/polaris-viz/src/components/SimpleBarChart/SimpleBarChart.tsx b/packages/polaris-viz/src/components/SimpleBarChart/SimpleBarChart.tsx index 2ac7ece02..6798d3281 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/SimpleBarChart.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/SimpleBarChart.tsx @@ -14,9 +14,9 @@ import { import { getXAxisOptionsWithDefaults, getYAxisOptionsWithDefaults, -} from '../../utilities'; -import {ChartContainer} from '../../components/ChartContainer'; -import {ChartSkeleton} from '../../components'; +} from '../../utilities/getAxisOptions'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; import type {LegendPosition, RenderLegendContent} from '../../types'; import {Chart} from './Chart'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/index.ts b/packages/polaris-viz/src/components/SimpleBarChart/index.ts deleted file mode 100644 index bfc5a024a..000000000 --- a/packages/polaris-viz/src/components/SimpleBarChart/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {SimpleBarChart} from './SimpleBarChart'; -export type {SimpleBarChartProps} from './SimpleBarChart'; -export type {MetaDataTrendIndicator} from './types'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/Comparison.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/Comparison.stories.tsx index b80be78ee..cbe8caf38 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/Comparison.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/Comparison.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/Default.stories.tsx index 35a365582..b78a10fb1 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {SINGLE_SERIES, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/FormattedValues.chromatic.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/FormattedValues.chromatic.stories.tsx index 8b87280a4..5f18735ff 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/FormattedValues.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/FormattedValues.chromatic.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import {META} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {SINGLE_SERIES, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/InteractiveCustomLegend.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/InteractiveCustomLegend.stories.tsx index c6383d687..a1d3487d9 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/InteractiveCustomLegend.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/InteractiveCustomLegend.stories.tsx @@ -3,8 +3,8 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; import {DARK_THEME} from '../../../constants'; -import type {SimpleBarChartProps} from '..'; -import {SquareColorPreview} from '../../SquareColorPreview'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; +import {SquareColorPreview} from '../../SquareColorPreview/SquareColorPreview'; import {SERIES, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/LongLabels.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/LongLabels.stories.tsx index 42287658f..9ae3798bc 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/LongLabels.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/LongLabels.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {LONG_LABEL_SERIES, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleSeries.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleSeries.stories.tsx index f8df73f95..5701d9778 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleSeries.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleSeries.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {SERIES, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleTrendIndicators.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleTrendIndicators.stories.tsx index 93ecc3ab5..9dbe7589e 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleTrendIndicators.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/MultipleTrendIndicators.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/OverwrittenSeriesColors.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/OverwrittenSeriesColors.stories.tsx index 2451a9b38..2953a68c8 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/OverwrittenSeriesColors.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/OverwrittenSeriesColors.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleBarChart.chromatic.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleBarChart.chromatic.stories.tsx index 3a6cce728..81b2706f8 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleBarChart.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleBarChart.chromatic.stories.tsx @@ -11,7 +11,7 @@ export default { }, }; -import {SimpleBarChart} from '../../../components'; +import {SimpleBarChart} from '../SimpleBarChart'; import {SINGLE_SERIES} from './data'; const METADATA: MetaData = { diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleStacked.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleStacked.stories.tsx index fb40d3da1..2a35fc38f 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleStacked.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/SimpleStacked.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {SERIES, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/WithTrendIndicators.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/WithTrendIndicators.stories.tsx index 99c9ce0b9..c05ac84fc 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/WithTrendIndicators.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/WithTrendIndicators.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleBarChartProps} from '../../../components'; +import type {SimpleBarChartProps} from '../SimpleBarChart'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/chromatic/AllZeroValues.chromatic.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/chromatic/AllZeroValues.chromatic.stories.tsx index 5e2d34f48..ce388d90c 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/chromatic/AllZeroValues.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/chromatic/AllZeroValues.chromatic.stories.tsx @@ -11,7 +11,7 @@ export default { }, }; -import type {SimpleBarChartProps} from '../../../../components'; +import type {SimpleBarChartProps} from '../../SimpleBarChart'; import {Template} from '../data'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/meta.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/meta.tsx index fae035621..8e018229c 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/meta.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/meta.tsx @@ -12,7 +12,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {SimpleBarChart} from '../SimpleBarChart'; export const META: Meta = { diff --git a/packages/polaris-viz/src/components/SimpleBarChart/stories/playground/MisMatchedData.stories.tsx b/packages/polaris-viz/src/components/SimpleBarChart/stories/playground/MisMatchedData.stories.tsx index 9ea5757ac..57c6cc7a9 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/stories/playground/MisMatchedData.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/stories/playground/MisMatchedData.stories.tsx @@ -1,6 +1,8 @@ import type {Story} from '@storybook/react'; -import {SimpleBarChart, SimpleBarChartProps} from '../../../../components'; +import {SimpleBarChart} from '../../SimpleBarChart'; +import type {SimpleBarChartProps} from '../../SimpleBarChart'; + import {META} from '../meta'; export default { diff --git a/packages/polaris-viz/src/components/SimpleBarChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/SimpleBarChart/tests/Chart.test.tsx index 203a3e3e1..b93c8c797 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/tests/Chart.test.tsx @@ -4,14 +4,12 @@ import {LIGHT_THEME} from '@shopify/polaris-viz-core'; import type {ChartProps} from '../Chart'; import {Chart} from '../Chart'; -import {LegendContainer} from '../../LegendContainer'; -import { - GroupLabel, - GradientDefs, - HorizontalStackedBars, - HorizontalBars, - Label, -} from '../../shared'; +import {LegendContainer} from '../../LegendContainer/LegendContainer'; +import {GroupLabel} from '../../shared/GroupLabel/GroupLabel'; +import {GradientDefs} from '../../shared/GradientDefs/GradientDefs'; +import {HorizontalStackedBars} from '../../shared/HorizontalStackedBars/HorizontalStackedBars'; +import {HorizontalBars} from '../../shared/HorizontalBars/HorizontalBars'; +import {Label} from '../../shared/Label/Label'; jest.mock('@shopify/polaris-viz-core/src/utilities', () => { return { diff --git a/packages/polaris-viz/src/components/SimpleBarChart/tests/SimpleBarChart.test.tsx b/packages/polaris-viz/src/components/SimpleBarChart/tests/SimpleBarChart.test.tsx index e2d328d6f..ccb7d38f6 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/tests/SimpleBarChart.test.tsx +++ b/packages/polaris-viz/src/components/SimpleBarChart/tests/SimpleBarChart.test.tsx @@ -1,7 +1,7 @@ import {mount} from '@shopify/react-testing'; import type {DataSeries} from '@shopify/polaris-viz-core'; -import {ChartContainer} from '../../ChartContainer'; +import {ChartContainer} from '../../ChartContainer/ChartContainer'; import type {SimpleBarChartProps} from '../SimpleBarChart'; import {SimpleBarChart} from '../SimpleBarChart'; import {Chart} from '../Chart'; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/types.ts b/packages/polaris-viz/src/components/SimpleBarChart/types.ts index e06d7f98d..1534da330 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/types.ts +++ b/packages/polaris-viz/src/components/SimpleBarChart/types.ts @@ -1,6 +1,6 @@ import type {DataSeries} from '@shopify/polaris-viz-core'; -import type {TrendIndicatorProps} from '../TrendIndicator'; +import type {TrendIndicatorProps} from '../TrendIndicator/TrendIndicator'; export type MetaDataTrendIndicator = Omit; diff --git a/packages/polaris-viz/src/components/SimpleBarChart/utilities.ts b/packages/polaris-viz/src/components/SimpleBarChart/utilities.ts index b3f96135a..58fca807c 100644 --- a/packages/polaris-viz/src/components/SimpleBarChart/utilities.ts +++ b/packages/polaris-viz/src/components/SimpleBarChart/utilities.ts @@ -1,9 +1,7 @@ import {HORIZONTAL_BAR_LABEL_OFFSET} from '@shopify/polaris-viz-core'; -import { - estimateTrendIndicatorWidth, - TREND_INDICATOR_FONT_WEIGHT, -} from '../TrendIndicator'; +import {estimateTrendIndicatorWidth} from '../TrendIndicator/utilities/estimateTrendIndicatorWidth'; +import {FONT_WEIGHT as TREND_INDICATOR_FONT_WEIGHT} from '../TrendIndicator/constants'; import type {SimpleBarChartDataSeries} from './types'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/Chart.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/Chart.tsx index 899f2a07a..0ea917456 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/Chart.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/Chart.tsx @@ -6,6 +6,7 @@ import { getColorVisionEventAttrs, getColorVisionStylesForActiveIndex, isInfinity, + useTheme, } from '@shopify/polaris-viz-core'; import type { Direction, @@ -13,18 +14,16 @@ import type { DataSeries, } from '@shopify/polaris-viz-core'; -import type {ComparisonMetricProps} from '../ComparisonMetric'; +import type {ComparisonMetricProps} from '../ComparisonMetric/ComparisonMetric'; import {useThemeSeriesColors} from '../../hooks/useThemeSeriesColors'; -import { - useColorVisionEvents, - useTheme, - useWatchColorVisionEvents, -} from '../../hooks'; -import {classNames} from '../../utilities'; +import {useColorVisionEvents} from '../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {useWatchColorVisionEvents} from '../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {classNames} from '../../utilities/classnames'; import type {LegendPosition, RenderLegendContent} from '../../types'; import {WARN_FOR_DEVELOPMENT} from '../../constants'; -import {BarSegment, BarLabel} from './components'; +import {BarSegment} from './components/BarSegment/BarSegment'; +import {BarLabel} from './components/BarLabel/BarLabel'; import type {Size} from './types'; import styles from './SimpleNormalizedChart.scss'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/SimpleNormalizedChart.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/SimpleNormalizedChart.tsx index 0be5c8993..0ad18e140 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/SimpleNormalizedChart.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/SimpleNormalizedChart.tsx @@ -9,9 +9,9 @@ import type { LabelFormatter, } from '@shopify/polaris-viz-core'; -import type {ComparisonMetricProps} from '../ComparisonMetric'; -import {ChartContainer} from '../ChartContainer'; -import {ChartSkeleton} from '../ChartSkeleton'; +import type {ComparisonMetricProps} from '../ComparisonMetric/ComparisonMetric'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; import type {LegendPosition, RenderLegendContent} from '../../types'; import {Chart} from './Chart'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/BarLabel.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/BarLabel.tsx index 0f89d912a..356c112da 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/BarLabel.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/BarLabel.tsx @@ -8,9 +8,9 @@ import type {Color, Direction} from '@shopify/polaris-viz-core'; import {getFontSize} from '../../../../utilities/getFontSize'; import {getCSSBackgroundFromColor} from '../../../../utilities/getCSSBackgroundFromColor'; -import {classNames} from '../../../../utilities'; -import type {ComparisonMetricProps} from '../../../ComparisonMetric'; -import {ComparisonMetric} from '../../../ComparisonMetric'; +import {classNames} from '../../../../utilities/classnames'; +import type {ComparisonMetricProps} from '../../../ComparisonMetric/ComparisonMetric'; +import {ComparisonMetric} from '../../../ComparisonMetric/ComparisonMetric'; import type {LegendPosition} from '../../../../types'; import styles from './BarLabel.scss'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/index.ts b/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/index.ts deleted file mode 100644 index a502177e1..000000000 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarLabel/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {BarLabel} from './BarLabel'; -export type {Props as BarLabelProps} from './BarLabel'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/BarSegment.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/BarSegment.tsx index a5f9aa54f..d19a5608c 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/BarSegment.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/BarSegment.tsx @@ -8,7 +8,7 @@ import { import type {Color, Direction} from '@shopify/polaris-viz-core'; import {getCSSBackgroundFromColor} from '../../../../utilities/getCSSBackgroundFromColor'; -import {classNames} from '../../../../utilities'; +import {classNames} from '../../../../utilities/classnames'; import {useBarSpringConfig} from '../../../../hooks/useBarSpringConfig'; import type {Size} from '../../types'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/index.ts b/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/index.ts deleted file mode 100644 index aed99db2c..000000000 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/BarSegment/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {BarSegment} from './BarSegment'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/index.ts b/packages/polaris-viz/src/components/SimpleNormalizedChart/components/index.ts deleted file mode 100644 index 193862245..000000000 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {BarLabel} from './BarLabel'; -export {BarSegment} from './BarSegment'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/index.ts b/packages/polaris-viz/src/components/SimpleNormalizedChart/index.ts deleted file mode 100644 index 1b3c269d0..000000000 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export {SimpleNormalizedChart} from './SimpleNormalizedChart'; -export {BarSegment} from './components/BarSegment'; -export type {SimpleNormalizedChartProps} from './SimpleNormalizedChart'; -export type {Size} from './types'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/Default.stories.tsx index 16489e3c9..3e07e5b25 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleNormalizedChartProps} from '../../../components'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/ErrorState.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/ErrorState.stories.tsx index d09c8ba29..f621fb064 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/ErrorState.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/ErrorState.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleNormalizedChartProps} from '../..'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/FormattedValues.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/FormattedValues.stories.tsx index 4371182d5..400fdd4d7 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/FormattedValues.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/FormattedValues.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleNormalizedChartProps} from '../../../components'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/HiddenLegend.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/HiddenLegend.stories.tsx index 8b79f952e..f81931fc0 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/HiddenLegend.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/HiddenLegend.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleNormalizedChartProps} from '../..'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/InteractiveCustomLegend.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/InteractiveCustomLegend.stories.tsx index 073dbe9f3..f6d859705 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/InteractiveCustomLegend.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/InteractiveCustomLegend.stories.tsx @@ -3,8 +3,8 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; import {DARK_THEME} from '../../../constants'; -import type {SimpleNormalizedChartProps} from '../../SimpleNormalizedChart'; -import {SquareColorPreview} from '../../SquareColorPreview'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; +import {SquareColorPreview} from '../../SquareColorPreview/SquareColorPreview'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingState.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingState.stories.tsx index 649925fea..c11243a5a 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingState.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingState.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleNormalizedChartProps} from '../..'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithMediumSize.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithMediumSize.stories.tsx index a5b5c3d69..1ace217b7 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithMediumSize.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithMediumSize.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleNormalizedChartProps} from '../..'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithoutLegend.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithoutLegend.stories.tsx index f0e1e1c78..45b69bf50 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithoutLegend.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/LoadingStateWithoutLegend.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SimpleNormalizedChartProps} from '../..'; +import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {DEFAULT_PROPS, DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/SimpleNormalizedBarChart.chromatic.stories.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/SimpleNormalizedBarChart.chromatic.stories.tsx index 251b01383..d2b15c024 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/SimpleNormalizedBarChart.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/SimpleNormalizedBarChart.chromatic.stories.tsx @@ -2,11 +2,10 @@ import {storiesOf} from '@storybook/react'; import {DEFAULT_DATA} from './data'; -import { - addWithPropsCombinations, - renderCombinationSections, -} from '../../../chromatic'; -import {SimpleNormalizedChart} from '../'; +import {addWithPropsCombinations} from '../../../chromatic/components/AddWithPropsCombinations'; +import {renderCombinationSections} from '../../../chromatic/utilities/renderCombinationSections'; + +import {SimpleNormalizedChart} from '../SimpleNormalizedChart'; import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; const stories = storiesOf('Chromatic/Components', module).addParameters({ diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/data.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/data.tsx index 32e173968..461486094 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/data.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/data.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import type {DataSeries} from '@shopify/polaris-viz-core'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; -import {PolarisVizProvider} from '../../PolarisVizProvider'; +import {PolarisVizProvider} from '../../PolarisVizProvider/PolarisVizProvider'; import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {SimpleNormalizedChart} from '../SimpleNormalizedChart'; diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/meta.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/meta.tsx index b09908764..c80359fb1 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/meta.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/stories/meta.tsx @@ -1,6 +1,6 @@ import type {Meta} from '@storybook/react'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import { CHART_STATE_CONTROL_ARGS, CONTROLS_ARGS, diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/Chart.test.tsx index d30e29573..890af5be6 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/Chart.test.tsx @@ -1,9 +1,10 @@ import {mount} from '@shopify/react-testing'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; -import {SimpleNormalizedChart} from '../../../components/SimpleNormalizedChart'; -import {mountWithProvider} from '../../../test-utilities'; -import {BarSegment, BarLabel} from '../components'; +import {SimpleNormalizedChart} from '../SimpleNormalizedChart'; +import {mountWithProvider} from '../../../test-utilities/mountWithProvider'; +import {BarSegment} from '../components/BarSegment/BarSegment'; +import {BarLabel} from '../components/BarLabel/BarLabel'; import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; describe('', () => { diff --git a/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/SimpleNormalizedChart.test.tsx b/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/SimpleNormalizedChart.test.tsx index 926b3a011..204cd0cdd 100644 --- a/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/SimpleNormalizedChart.test.tsx +++ b/packages/polaris-viz/src/components/SimpleNormalizedChart/tests/SimpleNormalizedChart.test.tsx @@ -1,6 +1,6 @@ import {mount} from '@shopify/react-testing'; -import {ChartContainer} from '../../ChartContainer'; +import {ChartContainer} from '../../ChartContainer/ChartContainer'; import type {SimpleNormalizedChartProps} from '../SimpleNormalizedChart'; import {SimpleNormalizedChart} from '../SimpleNormalizedChart'; import {Chart} from '../Chart'; diff --git a/packages/polaris-viz/src/components/SkipLink/index.ts b/packages/polaris-viz/src/components/SkipLink/index.ts deleted file mode 100644 index 6e5031bb0..000000000 --- a/packages/polaris-viz/src/components/SkipLink/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SkipLink} from './SkipLink'; diff --git a/packages/polaris-viz/src/components/SparkBarChart/SparkBarChart.tsx b/packages/polaris-viz/src/components/SparkBarChart/SparkBarChart.tsx index 6a312f0bd..e0bb358bc 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/SparkBarChart.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/SparkBarChart.tsx @@ -5,8 +5,8 @@ import { } from '@shopify/polaris-viz-core'; import type {ChartProps, TargetLine} from '@shopify/polaris-viz-core'; -import {ChartContainer} from '../ChartContainer'; -import {ChartSkeleton} from '../'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; import {Chart} from './Chart'; diff --git a/packages/polaris-viz/src/components/SparkBarChart/index.ts b/packages/polaris-viz/src/components/SparkBarChart/index.ts deleted file mode 100644 index 308e549e6..000000000 --- a/packages/polaris-viz/src/components/SparkBarChart/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {SparkBarChart} from './SparkBarChart'; -export type {SparkBarChartProps} from './SparkBarChart'; diff --git a/packages/polaris-viz/src/components/SparkBarChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/SparkBarChart/stories/Default.stories.tsx index 8e6efa912..e27de8338 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkBarChartProps} from '../../../components'; +import type {SparkBarChartProps} from '../SparkBarChart'; import { DEFAULT_DATA, diff --git a/packages/polaris-viz/src/components/SparkBarChart/stories/NoTargetLine.stories.tsx b/packages/polaris-viz/src/components/SparkBarChart/stories/NoTargetLine.stories.tsx index bb839badb..beec3d635 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/stories/NoTargetLine.stories.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/stories/NoTargetLine.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkBarChartProps} from '../../../components'; +import type {SparkBarChartProps} from '../SparkBarChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkBarChart/stories/OffsetAndNulls.stories.tsx b/packages/polaris-viz/src/components/SparkBarChart/stories/OffsetAndNulls.stories.tsx index 1fabe5c86..43cb85b4e 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/stories/OffsetAndNulls.stories.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/stories/OffsetAndNulls.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkBarChartProps} from '../../../components'; +import type {SparkBarChartProps} from '../SparkBarChart'; import {DEFAULT_PROPS, DEFAULT_COMPARISON_VALUE, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkBarChart/stories/OverwrittenSeriesColors.stories.tsx b/packages/polaris-viz/src/components/SparkBarChart/stories/OverwrittenSeriesColors.stories.tsx index 63aa18b5e..c2cdfeb69 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/stories/OverwrittenSeriesColors.stories.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/stories/OverwrittenSeriesColors.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkBarChartProps} from '../../../components'; +import type {SparkBarChartProps} from '../SparkBarChart'; import {DEFAULT_PROPS, DEFAULT_COMPARISON_VALUE, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkBarChart/stories/SparkBarChart.chromatic.stories.tsx b/packages/polaris-viz/src/components/SparkBarChart/stories/SparkBarChart.chromatic.stories.tsx index 492e6a5e0..012768c48 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/stories/SparkBarChart.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/stories/SparkBarChart.chromatic.stories.tsx @@ -1,11 +1,10 @@ import {storiesOf} from '@storybook/react'; import type {PropCombinations} from '../../../chromatic/types'; -import { - addWithPropsCombinations, - renderCombinationSections, -} from '../../../chromatic'; -import {SparkBarChart} from '../'; +import {addWithPropsCombinations} from '../../../chromatic/components/AddWithPropsCombinations'; +import {renderCombinationSections} from '../../../chromatic/utilities/renderCombinationSections'; + +import {SparkBarChart} from '../SparkBarChart'; import type {SparkBarChartProps} from '../SparkBarChart'; const stories = storiesOf('Chromatic/Components', module).addParameters({ diff --git a/packages/polaris-viz/src/components/SparkBarChart/stories/data.tsx b/packages/polaris-viz/src/components/SparkBarChart/stories/data.tsx index ed7551b0d..4de5f9b64 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/stories/data.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/stories/data.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import type {DataSeries} from '@shopify/polaris-viz-core'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; -import {PolarisVizProvider} from '../../PolarisVizProvider'; +import {PolarisVizProvider} from '../../PolarisVizProvider/PolarisVizProvider'; import type {SparkBarChartProps} from '../SparkBarChart'; import {SparkBarChart} from '../SparkBarChart'; diff --git a/packages/polaris-viz/src/components/SparkBarChart/stories/meta.tsx b/packages/polaris-viz/src/components/SparkBarChart/stories/meta.tsx index 8baefb9a0..931e89fcc 100644 --- a/packages/polaris-viz/src/components/SparkBarChart/stories/meta.tsx +++ b/packages/polaris-viz/src/components/SparkBarChart/stories/meta.tsx @@ -7,7 +7,7 @@ import { IS_ANIMATED_ARGS, THEME_CONTROL_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {SparkBarChart} from '../SparkBarChart'; export const META: Meta = { diff --git a/packages/polaris-viz/src/components/SparkLineChart/Chart.tsx b/packages/polaris-viz/src/components/SparkLineChart/Chart.tsx index 2ba966ff2..57509c674 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/Chart.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/Chart.tsx @@ -6,10 +6,10 @@ import { useChartContext, useFilteredSparkLineData, useSparkLine, + useTheme, } from '@shopify/polaris-viz-core'; import {useThemeSeriesColors} from '../../hooks/useThemeSeriesColors'; -import {useTheme} from '../../hooks'; import {XMLNS} from '../../constants'; import styles from './SparkLineChart.scss'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/SparkLineChart.tsx b/packages/polaris-viz/src/components/SparkLineChart/SparkLineChart.tsx index 71113922f..b9ed39a6b 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/SparkLineChart.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/SparkLineChart.tsx @@ -5,8 +5,8 @@ import { usePolarisVizContext, } from '@shopify/polaris-viz-core'; -import {ChartContainer} from '../ChartContainer'; -import {ChartSkeleton} from '../ChartSkeleton'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; import {fillMissingDataPoints} from '../../utilities/fillMissingDataPoints'; import {Chart} from './Chart'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/index.ts b/packages/polaris-viz/src/components/SparkLineChart/index.ts deleted file mode 100644 index 10c070e98..000000000 --- a/packages/polaris-viz/src/components/SparkLineChart/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {SparkLineChart} from './SparkLineChart'; -export type {SparkLineChartProps} from './SparkLineChart'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/Default.stories.tsx index 7f9e4091f..44c1873c0 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkLineChartProps} from '../../../components'; +import type {SparkLineChartProps} from '../SparkLineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/ErrorState.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/ErrorState.stories.tsx index 1e0215125..673cdad8a 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/ErrorState.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/ErrorState.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkLineChartProps} from '../../../components'; +import type {SparkLineChartProps} from '../SparkLineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/OffsetAndNulls.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/OffsetAndNulls.stories.tsx index 27cf9bfd1..d3014483d 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/OffsetAndNulls.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/OffsetAndNulls.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkLineChartProps} from '../../../components'; +import type {SparkLineChartProps} from '../SparkLineChart'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/OverwrittenSeriesColors.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/OverwrittenSeriesColors.stories.tsx index 6eb4022b4..7e9424041 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/OverwrittenSeriesColors.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/OverwrittenSeriesColors.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkLineChartProps} from '../../../components'; +import type {SparkLineChartProps} from '../SparkLineChart'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/SparkLineChart.chromatic.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/SparkLineChart.chromatic.stories.tsx index 85ba85ac9..ea9a8ee65 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/SparkLineChart.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/SparkLineChart.chromatic.stories.tsx @@ -1,12 +1,11 @@ import {storiesOf} from '@storybook/react'; import type {PropCombinations} from '../../../chromatic/types'; -import { - addWithPropsCombinations, - renderCombinationSections, -} from '../../../chromatic'; -import {SparkLineChart} from '../'; -import type {SparkLineChartProps} from '../'; +import {addWithPropsCombinations} from '../../../chromatic/components/AddWithPropsCombinations'; +import {renderCombinationSections} from '../../../chromatic/utilities/renderCombinationSections'; + +import {SparkLineChart} from '../SparkLineChart'; +import type {SparkLineChartProps} from '../SparkLineChart'; const stories = storiesOf('Chromatic/Components', module).addParameters({ docs: {page: null}, diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/WithoutSpline.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/WithoutSpline.stories.tsx index aeb116207..54bbbc799 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/WithoutSpline.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/WithoutSpline.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkLineChartProps} from '../../../components'; +import type {SparkLineChartProps} from '../SparkLineChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/ZeroSeries.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/ZeroSeries.stories.tsx index 363182fdc..4f43f2842 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/ZeroSeries.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/ZeroSeries.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {SparkLineChartProps} from '../../../components'; +import type {SparkLineChartProps} from '../SparkLineChart'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/meta.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/meta.tsx index 4277c69fd..90fd61bcd 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/meta.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/meta.tsx @@ -1,6 +1,6 @@ import type {Meta} from '@storybook/react'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import { CHART_STATE_CONTROL_ARGS, CONTROLS_ARGS, diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/playground/NonNumeric.chromatic.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/playground/NonNumeric.chromatic.stories.tsx index 40715ea02..32e2d1892 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/playground/NonNumeric.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/playground/NonNumeric.chromatic.stories.tsx @@ -7,7 +7,7 @@ export default { title: `${META.title}/Playground`, }; -import type {SparkLineChartProps} from '../../../../components'; +import type {SparkLineChartProps} from '../../SparkLineChart'; import {DEFAULT_PROPS, Template} from '../data'; diff --git a/packages/polaris-viz/src/components/SparkLineChart/stories/playground/Playground.stories.tsx b/packages/polaris-viz/src/components/SparkLineChart/stories/playground/Playground.stories.tsx index d777b8a34..9928f3048 100644 --- a/packages/polaris-viz/src/components/SparkLineChart/stories/playground/Playground.stories.tsx +++ b/packages/polaris-viz/src/components/SparkLineChart/stories/playground/Playground.stories.tsx @@ -7,7 +7,7 @@ export default { title: `${META.title}/Playground`, }; -import type {SparkLineChartProps} from '../../../../components'; +import type {SparkLineChartProps} from '../../SparkLineChart'; import {DEFAULT_PROPS, Template} from '../data'; diff --git a/packages/polaris-viz/src/components/SquareColorPreview/index.ts b/packages/polaris-viz/src/components/SquareColorPreview/index.ts deleted file mode 100644 index 61f317e48..000000000 --- a/packages/polaris-viz/src/components/SquareColorPreview/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {SquareColorPreview} from './SquareColorPreview'; -export type {SquareColorPreviewProps} from './SquareColorPreview'; diff --git a/packages/polaris-viz/src/components/SquareColorPreview/stories/SquareColorPreview.stories.tsx b/packages/polaris-viz/src/components/SquareColorPreview/stories/SquareColorPreview.stories.tsx index 85d09c460..59bc4fa17 100644 --- a/packages/polaris-viz/src/components/SquareColorPreview/stories/SquareColorPreview.stories.tsx +++ b/packages/polaris-viz/src/components/SquareColorPreview/stories/SquareColorPreview.stories.tsx @@ -3,7 +3,7 @@ import {COLOR_VARIABLES} from '@shopify/polaris-viz-core'; export {META as default} from './meta'; -import type {SquareColorPreviewProps} from '../../../components'; +import type {SquareColorPreviewProps} from '../SquareColorPreview'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/Chart.tsx b/packages/polaris-viz/src/components/StackedAreaChart/Chart.tsx index 90a43f8cb..f1d85f3bd 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/Chart.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/Chart.tsx @@ -19,38 +19,37 @@ import { SMALL_CHART_HEIGHT, InternalChartType, useChartContext, + useTheme, + useThemeSeriesColors, } from '@shopify/polaris-viz-core'; -import {ChartElements} from '../ChartElements'; -import { - Annotations, - checkAvailableAnnotations, - YAxisAnnotations, -} from '../Annotations'; +import {ChartSVG} from '../ChartElements/ChartSVG'; +import {ChartDiv} from '../ChartElements/ChartDiv'; +import {Annotations} from '../Annotations/Annotations'; +import {checkAvailableAnnotations} from '../Annotations/utilities/checkAvailableAnnotations'; +import {YAxisAnnotations} from '../Annotations/YAxisAnnotations'; import type { AnnotationLookupTable, GetXPosition, RenderLegendContent, RenderTooltipContentData, } from '../../types'; -import {XAxis} from '../XAxis'; -import {LegendContainer, useLegend} from '../LegendContainer'; -import {TooltipWrapper} from '../TooltipWrapper'; -import { - useLinearChartAnimations, - useTheme, - useThemeSeriesColors, - useColorVisionEvents, - useLinearLabelsAndDimensions, -} from '../../hooks'; +import {XAxis} from '../XAxis/XAxis'; +import {LegendContainer} from '../LegendContainer/LegendContainer'; +import {useLegend} from '../LegendContainer/hooks/useLegend'; +import {TooltipWrapper} from '../TooltipWrapper/TooltipWrapper'; +import {useLinearChartAnimations} from '../../hooks/useLinearChartAnimations'; +import {useColorVisionEvents} from '../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {useLinearLabelsAndDimensions} from '../../hooks/useLinearLabelsAndDimensions'; import {ChartMargin, ANNOTATIONS_LABELS_OFFSET} from '../../constants'; -import {YAxis} from '../YAxis'; -import {Crosshair} from '../Crosshair'; -import {VisuallyHiddenRows} from '../VisuallyHiddenRows'; -import {HorizontalGridLines} from '../HorizontalGridLines'; - -import {useStackedData} from './hooks'; -import {StackedAreas, Points} from './components'; +import {YAxis} from '../YAxis/YAxis'; +import {Crosshair} from '../Crosshair/Crosshair'; +import {VisuallyHiddenRows} from '../VisuallyHiddenRows/VisuallyHiddenRows'; +import {HorizontalGridLines} from '../HorizontalGridLines/HorizontalGridLines'; + +import {useStackedData} from './hooks/useStackedData'; +import {StackedAreas} from './components/StackedAreas/StackedAreas'; +import {Points} from './components/Points/Points'; import {useStackedChartTooltipContent} from './hooks/useStackedChartTooltipContent'; import {yAxisMinMax} from './utilities/yAxisMinMax'; import styles from './Chart.scss'; @@ -255,13 +254,8 @@ export function Chart({ const halfXAxisLabelWidth = xAxisDetails.labelWidth / 2; return ( - - + + {hideXAxis ? null : ( )} - + {longestSeriesLength !== -1 && ( )} - + ); } diff --git a/packages/polaris-viz/src/components/StackedAreaChart/StackedAreaChart.tsx b/packages/polaris-viz/src/components/StackedAreaChart/StackedAreaChart.tsx index 6a6bb658c..fa50f0806 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/StackedAreaChart.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/StackedAreaChart.tsx @@ -17,11 +17,11 @@ import {fillMissingDataPoints} from '../../utilities/fillMissingDataPoints'; import { getXAxisOptionsWithDefaults, getYAxisOptionsWithDefaults, - normalizeData, -} from '../../utilities'; -import {ChartContainer} from '../ChartContainer'; -import {ChartSkeleton} from '../ChartSkeleton'; -import {SkipLink} from '../SkipLink'; +} from '../../utilities/getAxisOptions'; +import {normalizeData} from '../../utilities/normalizeData'; +import {ChartContainer} from '../ChartContainer/ChartContainer'; +import {ChartSkeleton} from '../ChartSkeleton/ChartSkeleton'; +import {SkipLink} from '../SkipLink/SkipLink'; import type { Annotation, RenderLegendContent, diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/Area/index.ts b/packages/polaris-viz/src/components/StackedAreaChart/components/Area/index.ts deleted file mode 100644 index a28a89606..000000000 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/Area/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {Area} from './Area'; -export {AnimatedArea} from './AnimatedArea'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/Area/tests/AnimatedArea.test.tsx b/packages/polaris-viz/src/components/StackedAreaChart/components/Area/tests/AnimatedArea.test.tsx index b53f5632d..de15d1a42 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/Area/tests/AnimatedArea.test.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/components/Area/tests/AnimatedArea.test.tsx @@ -3,8 +3,10 @@ import {area, line} from 'd3-shape'; import {scaleLinear} from 'd3-scale'; import React from 'react'; -import {mountWithProvider} from '../../../../../test-utilities'; -import {mockDefaultTheme} from '../../../../../test-utilities/mountWithProvider'; +import { + mountWithProvider, + mockDefaultTheme, +} from '../../../../../test-utilities/mountWithProvider'; import {DARK_THEME} from '../../../../../constants'; import type {StackedSeries, Theme} from '../../../../../types'; import type {AreaProps} from '../types'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/Points/Points.tsx b/packages/polaris-viz/src/components/StackedAreaChart/components/Points/Points.tsx index 5aa56cb38..1a1206d89 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/Points/Points.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/components/Points/Points.tsx @@ -13,9 +13,9 @@ import { } from '@shopify/polaris-viz-core'; import type {ScaleLinear} from 'd3-scale'; -import {Point} from '../../../'; +import {Point} from '../../../Point/Point'; import type {AnimatedCoordinate, GetXPosition} from '../../../../types'; -import {useWatchColorVisionEvents} from '../../../../hooks'; +import {useWatchColorVisionEvents} from '../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; interface PointsProps { activePointIndex: number | null; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/Points/index.ts b/packages/polaris-viz/src/components/StackedAreaChart/components/Points/index.ts deleted file mode 100644 index 991ab6dea..000000000 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/Points/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Points} from './Points'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/StackedAreas.tsx b/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/StackedAreas.tsx index 0d39b14de..71a20fe62 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/StackedAreas.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/StackedAreas.tsx @@ -7,6 +7,7 @@ import { uniqueId, COLOR_VISION_SINGLE_ITEM, usePrevious, + useTheme, } from '@shopify/polaris-viz-core'; import { @@ -16,8 +17,9 @@ import { LINE_ANIMATION_DURATION_STEP, } from '../../../../constants'; import type {StackedSeries} from '../../../../types'; -import {useTheme, useWatchColorVisionEvents} from '../../../../hooks'; -import {AnimatedArea, Area} from '../Area'; +import {useWatchColorVisionEvents} from '../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {AnimatedArea} from '../Area/AnimatedArea'; +import {Area} from '../Area/Area'; interface Props { colors: Color[]; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/index.ts b/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/index.ts deleted file mode 100644 index 8f0bddd78..000000000 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {StackedAreas} from './StackedAreas'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/tests/StackedAreas.test.tsx b/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/tests/StackedAreas.test.tsx index 340b76701..bbd4d0cef 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/tests/StackedAreas.test.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/components/StackedAreas/tests/StackedAreas.test.tsx @@ -4,7 +4,8 @@ import React from 'react'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; import {StackedAreas} from '../StackedAreas'; -import {AnimatedArea, Area} from '../../Area'; +import {AnimatedArea} from '../../Area/AnimatedArea'; +import {Area} from '../../Area/Area'; import type {StackedSeries} from '../../../../../types'; jest.mock('d3-scale', () => ({ diff --git a/packages/polaris-viz/src/components/StackedAreaChart/components/index.ts b/packages/polaris-viz/src/components/StackedAreaChart/components/index.ts deleted file mode 100644 index 8f4af7d8f..000000000 --- a/packages/polaris-viz/src/components/StackedAreaChart/components/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {StackedAreas} from './StackedAreas'; -export {Area} from './Area'; -export {Points} from './Points'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/hooks/index.ts b/packages/polaris-viz/src/components/StackedAreaChart/hooks/index.ts deleted file mode 100644 index edad95a49..000000000 --- a/packages/polaris-viz/src/components/StackedAreaChart/hooks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {useStackedData} from './useStackedData'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/index.ts b/packages/polaris-viz/src/components/StackedAreaChart/index.ts deleted file mode 100644 index 919870081..000000000 --- a/packages/polaris-viz/src/components/StackedAreaChart/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {StackedAreaChart} from './StackedAreaChart'; -export type {StackedAreaChartProps} from './StackedAreaChart'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/Annotations.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/Annotations.stories.tsx index b5176f45f..3582173d0 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/Annotations.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/Annotations.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/Default.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/Default.stories.tsx index cee474889..dfb67d30f 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/DynamicData.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/DynamicData.stories.tsx index 38a15c2bb..e4b282b31 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/DynamicData.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/DynamicData.stories.tsx @@ -2,7 +2,7 @@ import {useState} from 'react'; export {META as default} from './meta'; -import {StackedAreaChart} from '../../../components'; +import {StackedAreaChart} from '../StackedAreaChart'; export const DynamicData = () => { const [data, setData] = useState({ diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/ExternalTooltip.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/ExternalTooltip.stories.tsx index 66f3acc97..e42a9d12e 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/ExternalTooltip.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/ExternalTooltip.stories.tsx @@ -2,7 +2,8 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import {StackedAreaChart, type StackedAreaChartProps} from '../../../components'; +import {StackedAreaChart} from '../StackedAreaChart'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {DEFAULT_DATA, DEFAULT_PROPS} from './data'; @@ -21,16 +22,16 @@ function Card(args: StackedAreaChartProps) { ); } -const Template: Story = (args: StackedAreaChartProps) => { +const Template: Story = ( + args: StackedAreaChartProps, +) => { return ( -
+
); -} - - +}; export const ExternalTooltip: Story = Template.bind({}); diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/FormattedValues.chromatic.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/FormattedValues.chromatic.stories.tsx index 420b160cc..7e48d1a4c 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/FormattedValues.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/FormattedValues.chromatic.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; import {META} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/HideXAxis.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/HideXAxis.stories.tsx index 4b58efa37..3f481089c 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/HideXAxis.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/HideXAxis.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {formatLinearXAxisLabel} from '../../../storybook/utilities'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/InteractiveCustomLegend.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/InteractiveCustomLegend.stories.tsx index 5f0bab4a2..632684820 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/InteractiveCustomLegend.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/InteractiveCustomLegend.stories.tsx @@ -3,8 +3,8 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; import {DARK_THEME} from '../../../constants'; -import {LinePreview} from '../../LinePreview'; -import type {StackedAreaChartProps} from '../../StackedAreaChart'; +import {LinePreview} from '../../LinePreview/LinePreview'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/NoOverflowStyle.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/NoOverflowStyle.stories.tsx index 4478c4509..188f5d056 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/NoOverflowStyle.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/NoOverflowStyle.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {DEFAULT_DATA, DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/OverwrittenSeriesColors.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/OverwrittenSeriesColors.stories.tsx index 71fbcfa13..f5d3730a2 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/OverwrittenSeriesColors.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/OverwrittenSeriesColors.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/SeriesColors.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/SeriesColors.stories.tsx index 839f66776..cc9258ce4 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/SeriesColors.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/SeriesColors.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {generateMultipleSeries} from '../../Docs/utilities'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/YAxisPercentages.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/YAxisPercentages.stories.tsx index 47e209938..ff45151c7 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/YAxisPercentages.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/YAxisPercentages.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {StackedAreaChartProps} from '../../../components'; +import type {StackedAreaChartProps} from '../StackedAreaChart'; import {formatPercentageYAxisLabel} from '../../../storybook/utilities'; import {DEFAULT_PROPS, Template} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/meta.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/meta.tsx index 6ca41e85d..071beba59 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/meta.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/meta.tsx @@ -14,7 +14,7 @@ import { X_AXIS_OPTIONS_ARGS, Y_AXIS_OPTIONS_ARGS, } from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; import {StackedAreaChart} from '../StackedAreaChart'; import {TOOLTIP_CONTENT} from './data'; diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/LongerComparison.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/LongerComparison.stories.tsx index 40f4c95d7..8aaae87d4 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/LongerComparison.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/LongerComparison.stories.tsx @@ -1,6 +1,8 @@ import type {Story} from '@storybook/react'; -import {StackedAreaChart, StackedAreaChartProps} from '../../../../components'; +import {StackedAreaChart} from '../../StackedAreaChart'; +import type {StackedAreaChartProps} from '../../StackedAreaChart'; + import {META} from '../meta'; export default { diff --git a/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/MisMatchedData.stories.tsx b/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/MisMatchedData.stories.tsx index 290318eee..7c217e423 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/MisMatchedData.stories.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/stories/playground/MisMatchedData.stories.tsx @@ -1,6 +1,8 @@ import type {Story} from '@storybook/react'; -import {StackedAreaChart, StackedAreaChartProps} from '../../../../components'; +import {StackedAreaChart} from '../../StackedAreaChart'; +import type {StackedAreaChartProps} from '../../StackedAreaChart'; + import {META} from '../meta'; export default { diff --git a/packages/polaris-viz/src/components/StackedAreaChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/StackedAreaChart/tests/Chart.test.tsx index ed7a9dfcf..fcfb20bf8 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/tests/Chart.test.tsx @@ -1,24 +1,26 @@ import {mount} from '@shopify/react-testing'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; -import {LegendContainer} from '../../LegendContainer'; -import {mockDefaultTheme} from '../../../test-utilities/mountWithProvider'; -import {YAxis} from '../../../components/YAxis'; -import {HorizontalGridLines} from '../../../components/HorizontalGridLines'; -import {VisuallyHiddenRows} from '../../../components/VisuallyHiddenRows'; -import {Point} from '../../../components/Point'; -import {Crosshair} from '../../../components/Crosshair'; +import {LegendContainer} from '../../LegendContainer/LegendContainer'; import { - TooltipWrapper, - TooltipAnimatedContainer, -} from '../../../components/TooltipWrapper'; -import {mountWithProvider, triggerSVGMouseMove} from '../../../test-utilities'; -import {StackedAreas} from '../components'; + mockDefaultTheme, + mountWithProvider, +} from '../../../test-utilities/mountWithProvider'; +import {YAxis} from '../../YAxis/YAxis'; +import {HorizontalGridLines} from '../../HorizontalGridLines/HorizontalGridLines'; +import {VisuallyHiddenRows} from '../../VisuallyHiddenRows/VisuallyHiddenRows'; +import {Point} from '../../Point/Point'; +import {Crosshair} from '../../Crosshair/Crosshair'; +import {TooltipWrapper} from '../../TooltipWrapper/TooltipWrapper'; +import {TooltipAnimatedContainer} from '../../TooltipWrapper/components/TooltipAnimatedContainer'; +import {triggerSVGMouseMove} from '../../../test-utilities/triggerSvgMouseMove'; +import {StackedAreas} from '../components/StackedAreas/StackedAreas'; import type {Props} from '../Chart'; import {Chart} from '../Chart'; -import {Annotations, YAxisAnnotations} from '../../Annotations'; -import {normalizeData} from '../../../utilities'; -import {TextLine} from '../../TextLine'; +import {Annotations} from '../../Annotations/Annotations'; +import {YAxisAnnotations} from '../../Annotations/YAxisAnnotations'; +import {normalizeData} from '../../../utilities/normalizeData'; +import {TextLine} from '../../TextLine/TextLine'; import {DEFAULT_CHART_CONTEXT as MOCK_DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; jest.mock('@shopify/polaris-viz-core/src/utilities/estimateStringWidth', () => { diff --git a/packages/polaris-viz/src/components/StackedAreaChart/tests/StackedAreaChart.test.tsx b/packages/polaris-viz/src/components/StackedAreaChart/tests/StackedAreaChart.test.tsx index c2134a6a4..ced0f75f7 100644 --- a/packages/polaris-viz/src/components/StackedAreaChart/tests/StackedAreaChart.test.tsx +++ b/packages/polaris-viz/src/components/StackedAreaChart/tests/StackedAreaChart.test.tsx @@ -4,7 +4,7 @@ import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; import {StackedAreaChart} from '../StackedAreaChart'; import {Chart} from '../Chart'; -import {SkipLink} from '../../SkipLink'; +import {SkipLink} from '../../SkipLink/SkipLink'; const mockData: DataSeries[] = [ { diff --git a/packages/polaris-viz/src/components/SwallowErrors/index.ts b/packages/polaris-viz/src/components/SwallowErrors/index.ts deleted file mode 100644 index 2c3343ddc..000000000 --- a/packages/polaris-viz/src/components/SwallowErrors/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SwallowErrors} from './SwallowErrors'; diff --git a/packages/polaris-viz/src/components/TextLine/TextLine.tsx b/packages/polaris-viz/src/components/TextLine/TextLine.tsx index 9b3a5cd1c..1cb883b60 100644 --- a/packages/polaris-viz/src/components/TextLine/TextLine.tsx +++ b/packages/polaris-viz/src/components/TextLine/TextLine.tsx @@ -1,7 +1,6 @@ import {Fragment} from 'react'; -import {FONT_FAMILY} from '@shopify/polaris-viz-core'; +import {FONT_FAMILY, useTheme} from '@shopify/polaris-viz-core'; -import {useTheme} from '../../hooks'; import type {FormattedLine} from '../../types'; interface TextLineProps { diff --git a/packages/polaris-viz/src/components/TextLine/index.ts b/packages/polaris-viz/src/components/TextLine/index.ts deleted file mode 100644 index 2216b4765..000000000 --- a/packages/polaris-viz/src/components/TextLine/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {TextLine} from './TextLine'; diff --git a/packages/polaris-viz/src/components/TooltipContent/TooltipContent.tsx b/packages/polaris-viz/src/components/TooltipContent/TooltipContent.tsx index 0144ec5d2..e7ebaceb0 100644 --- a/packages/polaris-viz/src/components/TooltipContent/TooltipContent.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/TooltipContent.tsx @@ -5,13 +5,11 @@ import type {TooltipData} from '../../types'; import {useGetLongestLabelFromData} from './hooks/useGetLongestLabelFromData'; import {SPACE_BETWEEN_LABEL_AND_VALUE} from './constants'; -import { - TooltipContentContainer, - TooltipRow, - TooltipSeries, - TooltipSeriesName, - TooltipTitle, -} from './components/'; +import {TooltipContentContainer} from './components/TooltipContentContainer/TooltipContentContainer'; +import {TooltipRow} from './components/TooltipRow/TooltipRow'; +import {TooltipSeries} from './components/TooltipSeries/TooltipSeries'; +import {TooltipSeriesName} from './components/TooltipSeriesName/TooltipSeriesName'; +import {TooltipTitle} from './components/TooltipTitle/TooltipTitle'; export interface TooltipContentProps { data: TooltipData[]; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/TooltipContentContainer.tsx b/packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/TooltipContentContainer.tsx index 03db0d8dd..5a6acfc5e 100644 --- a/packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/TooltipContentContainer.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/TooltipContentContainer.tsx @@ -7,7 +7,7 @@ import { import type {ReactNode} from 'react'; import {useState} from 'react'; -import {useWatchColorVisionEvents} from '../../../../hooks'; +import {useWatchColorVisionEvents} from '../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; import {TOOLTIP_BG_OPACITY} from '../../../../constants'; import {useBrowserCheck} from '../../../../hooks/useBrowserCheck'; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/index.ts b/packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/index.ts deleted file mode 100644 index 91509b9e3..000000000 --- a/packages/polaris-viz/src/components/TooltipContent/components/TooltipContentContainer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {TooltipContentContainer} from './TooltipContentContainer'; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/TooltipRow.tsx b/packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/TooltipRow.tsx index d335cbfb4..c778256e1 100644 --- a/packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/TooltipRow.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/TooltipRow.tsx @@ -5,7 +5,7 @@ import { import type {Shape, Color} from '@shopify/polaris-viz-core'; import {PREVIEW_ICON_SIZE} from '../../../../constants'; -import {SeriesIcon} from '../../../shared/SeriesIcon'; +import {SeriesIcon} from '../../../shared/SeriesIcon/SeriesIcon'; import {TITLE_MARGIN} from '../../constants'; import styles from './TooltipRow.scss'; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/index.ts b/packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/index.ts deleted file mode 100644 index 6d32bda1f..000000000 --- a/packages/polaris-viz/src/components/TooltipContent/components/TooltipRow/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {TooltipRow} from './TooltipRow'; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/TooltipSeries/index.ts b/packages/polaris-viz/src/components/TooltipContent/components/TooltipSeries/index.ts deleted file mode 100644 index 1ef5c81c0..000000000 --- a/packages/polaris-viz/src/components/TooltipContent/components/TooltipSeries/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {TooltipSeries} from './TooltipSeries'; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/TooltipSeriesName/index.ts b/packages/polaris-viz/src/components/TooltipContent/components/TooltipSeriesName/index.ts deleted file mode 100644 index 93e6c8043..000000000 --- a/packages/polaris-viz/src/components/TooltipContent/components/TooltipSeriesName/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {TooltipSeriesName} from './TooltipSeriesName'; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/TooltipTitle/index.ts b/packages/polaris-viz/src/components/TooltipContent/components/TooltipTitle/index.ts deleted file mode 100644 index 18c8b3828..000000000 --- a/packages/polaris-viz/src/components/TooltipContent/components/TooltipTitle/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {TooltipTitle} from './TooltipTitle'; diff --git a/packages/polaris-viz/src/components/TooltipContent/components/index.ts b/packages/polaris-viz/src/components/TooltipContent/components/index.ts deleted file mode 100644 index fbbebfba9..000000000 --- a/packages/polaris-viz/src/components/TooltipContent/components/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export {TooltipRow} from './TooltipRow'; -export {TooltipContentContainer} from './TooltipContentContainer'; -export {TooltipTitle} from './TooltipTitle'; -export {TooltipSeriesName} from './TooltipSeriesName'; -export {TooltipSeries} from './TooltipSeries'; diff --git a/packages/polaris-viz/src/components/TooltipContent/index.ts b/packages/polaris-viz/src/components/TooltipContent/index.ts deleted file mode 100644 index c1f52e8d4..000000000 --- a/packages/polaris-viz/src/components/TooltipContent/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -export {TooltipContent} from './TooltipContent'; -export type {TooltipContentProps} from './TooltipContent'; -export { - TooltipContentContainer, - TooltipTitle, - TooltipSeriesName, - TooltipRow, - TooltipSeries, -} from './components'; diff --git a/packages/polaris-viz/src/components/TooltipContent/stories/Default.stories.tsx b/packages/polaris-viz/src/components/TooltipContent/stories/Default.stories.tsx index 2255ae27c..33d748aa5 100644 --- a/packages/polaris-viz/src/components/TooltipContent/stories/Default.stories.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/stories/Default.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {TooltipContentProps} from '../../../components'; +import type {TooltipContentProps} from '../TooltipContent'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesName.stories.tsx b/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesName.stories.tsx index 58ac58025..5f1c37a4b 100644 --- a/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesName.stories.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesName.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {TooltipContentProps} from '../../../components'; +import type {TooltipContentProps} from '../TooltipContent'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesNoTitle.stories.tsx b/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesNoTitle.stories.tsx index c5495bff2..13bb8f0ac 100644 --- a/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesNoTitle.stories.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/stories/NoSeriesNoTitle.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {TooltipContentProps} from '../../../components'; +import type {TooltipContentProps} from '../TooltipContent'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/TooltipContent/stories/NoTitle.stories.tsx b/packages/polaris-viz/src/components/TooltipContent/stories/NoTitle.stories.tsx index 75706f69b..54a09cd0f 100644 --- a/packages/polaris-viz/src/components/TooltipContent/stories/NoTitle.stories.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/stories/NoTitle.stories.tsx @@ -2,7 +2,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {TooltipContentProps} from '../../../components'; +import type {TooltipContentProps} from '../TooltipContent'; import {DEFAULT_DATA, Template} from './data'; diff --git a/packages/polaris-viz/src/components/TooltipContent/stories/PreviewIcons.stories.tsx b/packages/polaris-viz/src/components/TooltipContent/stories/PreviewIcons.stories.tsx index 53eebb744..3dc9a88fc 100644 --- a/packages/polaris-viz/src/components/TooltipContent/stories/PreviewIcons.stories.tsx +++ b/packages/polaris-viz/src/components/TooltipContent/stories/PreviewIcons.stories.tsx @@ -3,7 +3,7 @@ import type {Story} from '@storybook/react'; export {META as default} from './meta'; -import type {TooltipContentProps} from '../../../components'; +import type {TooltipContentProps} from '../TooltipContent'; import {Template} from './data'; diff --git a/packages/polaris-viz/src/components/TooltipContent/stories/RenderTooltipContent.stories.mdx b/packages/polaris-viz/src/components/TooltipContent/stories/RenderTooltipContent.stories.mdx index ffd2594ce..6b8afec18 100644 --- a/packages/polaris-viz/src/components/TooltipContent/stories/RenderTooltipContent.stories.mdx +++ b/packages/polaris-viz/src/components/TooltipContent/stories/RenderTooltipContent.stories.mdx @@ -1,6 +1,8 @@ import {Meta, Story, Canvas} from '@storybook/addon-docs'; import {PolarisVizProvider} from '@shopify/polaris-viz'; -import {Divider, Title, PropertyTable} from '../../Docs/stories/components'; +import {Divider} from '../../Docs/stories/components/Divider'; +import {Title} from '../../Docs/stories/components/Title/Title'; +import {PropertyTable} from '../../Docs/stories/components/PropertyTable/PropertyTable'; = ( args: TrendIndicatorProps, ) => { - return
; + return ( +
+
+ +
+
+ ); }; - export const Default: Story = Template.bind({}); Default.args = { diff --git a/packages/polaris-viz/src/components/TrendIndicator/stories/TrendIndicator.chromatic.stories.tsx b/packages/polaris-viz/src/components/TrendIndicator/stories/TrendIndicator.chromatic.stories.tsx index a953abe08..bf89782a6 100644 --- a/packages/polaris-viz/src/components/TrendIndicator/stories/TrendIndicator.chromatic.stories.tsx +++ b/packages/polaris-viz/src/components/TrendIndicator/stories/TrendIndicator.chromatic.stories.tsx @@ -1,11 +1,10 @@ import {storiesOf} from '@storybook/react'; -import { - addWithPropsCombinations, - renderCombinationSections, -} from '../../../chromatic'; -import {TrendIndicator} from '../'; -import type {TrendIndicatorProps} from '../'; +import {addWithPropsCombinations} from '../../../chromatic/components/AddWithPropsCombinations'; +import {renderCombinationSections} from '../../../chromatic/utilities/renderCombinationSections'; + +import {TrendIndicator} from '../TrendIndicator'; +import type {TrendIndicatorProps} from '../TrendIndicator'; const stories = storiesOf('Chromatic/Components', module).addParameters({ docs: {page: null}, diff --git a/packages/polaris-viz/src/components/TrendIndicator/stories/meta.tsx b/packages/polaris-viz/src/components/TrendIndicator/stories/meta.tsx index 7e5b6c572..fb92c3cfd 100644 --- a/packages/polaris-viz/src/components/TrendIndicator/stories/meta.tsx +++ b/packages/polaris-viz/src/components/TrendIndicator/stories/meta.tsx @@ -1,9 +1,9 @@ import type {Meta} from '@storybook/react'; -import type {TrendIndicatorProps} from '../'; -import {TrendIndicator} from '../'; +import type {TrendIndicatorProps} from '../TrendIndicator'; +import {TrendIndicator} from '../TrendIndicator'; import {CONTROLS_ARGS, THEME_CONTROL_ARGS} from '../../../storybook/constants'; -import {PageWithSizingInfo} from '../../Docs/stories'; +import {PageWithSizingInfo} from '../../Docs/stories/components/PageWithSizingInfo/PageWithSizingInfo'; export const META: Meta = { title: 'polaris-viz/Subcomponents/TrendIndicator', diff --git a/packages/polaris-viz/src/components/TrendIndicator/utilities/estimateTrendIndicatorWidth.ts b/packages/polaris-viz/src/components/TrendIndicator/utilities/estimateTrendIndicatorWidth.ts index ecc24e303..f8e11161c 100644 --- a/packages/polaris-viz/src/components/TrendIndicator/utilities/estimateTrendIndicatorWidth.ts +++ b/packages/polaris-viz/src/components/TrendIndicator/utilities/estimateTrendIndicatorWidth.ts @@ -1,4 +1,4 @@ -import {estimateStringWidthWithOffset} from '../../../utilities'; +import {estimateStringWidthWithOffset} from '../../../utilities/estimateStringWidthWithOffset'; import {ICON_SIZE, NO_VALUE_WIDTH, TEXT_ICON_SPACING} from '../constants'; export function estimateTrendIndicatorWidth( diff --git a/packages/polaris-viz/src/components/VerticalBarChart/Chart.tsx b/packages/polaris-viz/src/components/VerticalBarChart/Chart.tsx index 3e4015591..468fa43c9 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/Chart.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/Chart.tsx @@ -12,6 +12,7 @@ import { SMALL_CHART_HEIGHT, isInfinity, InternalChartType, + useTheme, } from '@shopify/polaris-viz-core'; import type { DataSeries, @@ -24,34 +25,32 @@ import type { import {stackOffsetDiverging, stackOrderNone} from 'd3-shape'; import {useIndexForLabels} from '../../hooks/useIndexForLabels'; -import {ChartElements} from '../ChartElements'; -import { - YAxisAnnotations, - Annotations, - checkAvailableAnnotations, -} from '../Annotations'; +import {ChartSVG} from '../ChartElements/ChartSVG'; +import {ChartDiv} from '../ChartElements/ChartDiv'; +import {YAxisAnnotations} from '../Annotations/YAxisAnnotations'; +import {Annotations} from '../Annotations/Annotations'; +import {checkAvailableAnnotations} from '../Annotations/utilities/checkAvailableAnnotations'; import type { AnnotationLookupTable, RenderLegendContent, RenderTooltipContentData, } from '../../types'; import {useFormattedLabels} from '../../hooks/useFormattedLabels'; -import {XAxis} from '../XAxis'; -import {LegendContainer, useLegend} from '../LegendContainer'; -import {GradientDefs} from '../shared'; +import {XAxis} from '../XAxis/XAxis'; +import {LegendContainer} from '../LegendContainer/LegendContainer'; +import {useLegend} from '../LegendContainer/hooks/useLegend'; +import {GradientDefs} from '../shared/GradientDefs/GradientDefs'; import {ANNOTATIONS_LABELS_OFFSET, ChartMargin} from '../../constants'; -import {TooltipWrapper} from '../TooltipWrapper'; -import {getStackedValues, getStackedMinMax} from '../../utilities'; -import {YAxis} from '../YAxis'; -import {HorizontalGridLines} from '../HorizontalGridLines'; -import { - useBarChartTooltipContent, - useColorVisionEvents, - useTheme, - useReducedLabelIndexes, -} from '../../hooks'; - -import {VerticalBarGroup} from './components'; +import {TooltipWrapper} from '../TooltipWrapper/TooltipWrapper'; +import {getStackedValues} from '../../utilities/getStackedValues'; +import {getStackedMinMax} from '../../utilities/getStackedMinMax'; +import {YAxis} from '../YAxis/YAxis'; +import {HorizontalGridLines} from '../HorizontalGridLines/HorizontalGridLines'; +import {useBarChartTooltipContent} from '../../hooks/useBarChartTooltipContent'; +import {useColorVisionEvents} from '../../hooks/ColorVisionA11y/useColorVisionEvents'; +import {useReducedLabelIndexes} from '../../hooks/useReducedLabelIndexes'; + +import {VerticalBarGroup} from './components/VerticalBarGroup/VerticalBarGroup'; import {useVerticalBarChart} from './hooks/useVerticalBarChart'; export interface Props { @@ -232,8 +231,8 @@ export function Chart({ const xAxisLabelHalf = xScale.bandwidth() / 2; return ( - - + )} - + {sortedData.length > 0 && ( )} - + ); } diff --git a/packages/polaris-viz/src/components/VerticalBarChart/VerticalBarChart.tsx b/packages/polaris-viz/src/components/VerticalBarChart/VerticalBarChart.tsx index fb3c9634b..9aeaa3b15 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/VerticalBarChart.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/VerticalBarChart.tsx @@ -6,13 +6,13 @@ import type { LabelFormatter, } from '@shopify/polaris-viz-core'; import type {ReactNode} from 'react'; +import {useTheme, useThemeSeriesColors} from '@shopify/polaris-viz-core'; import type { AnnotationLookupTable, RenderLegendContent, RenderTooltipContentData, } from '../../types'; -import {useTheme, useThemeSeriesColors} from '../../hooks'; import {Chart} from './Chart'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/BarGroup.tsx b/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/BarGroup.tsx index 7a54ddaa6..54070d61e 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/BarGroup.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/BarGroup.tsx @@ -15,16 +15,16 @@ import { import type {Color} from '@shopify/polaris-viz-core'; import {getChartId} from '../../../../utilities/getChartId'; -import {getHoverZoneOffset} from '../../../../utilities'; +import {getHoverZoneOffset} from '../../../../utilities/getHoverZoneOffset'; import { MASK_HIGHLIGHT_COLOR, SHAPE_ANIMATION_HEIGHT_BUFFER, } from '../../../../constants'; import type {AccessibilitySeries} from '../../../VerticalBarChart/types'; -import {formatAriaLabel} from '../../utilities'; +import {formatAriaLabel} from '../../utilities/formatAriaLabel'; import {applyColorVisionToDomElement} from '../../../../utilities/applyColorVisionToDomElement'; -import {useWatchColorVisionEvents} from '../../../../hooks'; -import {VerticalBar} from '../VerticalBar'; +import {useWatchColorVisionEvents} from '../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {VerticalBar} from '../VerticalBar/VerticalBar'; import styles from './BarGroup.scss'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/index.ts deleted file mode 100644 index e2f1d890d..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {BarGroup} from './BarGroup'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/tests/BarGroup.test.tsx b/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/tests/BarGroup.test.tsx index ab85e9ebd..939d7bbac 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/tests/BarGroup.test.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/components/BarGroup/tests/BarGroup.test.tsx @@ -4,7 +4,7 @@ import {LinearGradientWithStops, BAR_SPACING} from '@shopify/polaris-viz-core'; import type {BarGroupProps} from '../BarGroup'; import {BarGroup} from '../BarGroup'; -import {VerticalBar} from '../../VerticalBar'; +import {VerticalBar} from '../../VerticalBar/VerticalBar'; jest.mock('d3-scale', () => ({ scaleLinear: jest.requireActual('d3-scale').scaleLinear, diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/StackedBarGroups.tsx b/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/StackedBarGroups.tsx index b3262d9af..f855a5477 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/StackedBarGroups.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/StackedBarGroups.tsx @@ -10,12 +10,12 @@ import { } from '@shopify/polaris-viz-core'; import {getLoadAnimationDelay} from '../../../../utilities/getLoadAnimationDelay'; -import {formatAriaLabel} from '../../../VerticalBarChart/utilities'; +import {formatAriaLabel} from '../../utilities/formatAriaLabel'; import type {AccessibilitySeries} from '../../../VerticalBarChart/types'; import type {StackedSeries} from '../../../../types'; -import {useStackedGapsForVerticalChart} from '../../hooks'; +import {useStackedGapsForVerticalChart} from '../../hooks/useStackedGapsForVerticalChart'; -import {Stack} from './components'; +import {Stack} from './components/Stack/Stack'; import styles from './StackedBarGroups.scss'; interface StackedBarGroupsProps { diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/Stack.tsx b/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/Stack.tsx index 3e4f2fbf2..8dedeff66 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/Stack.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/Stack.tsx @@ -14,12 +14,10 @@ import type { FormattedStackedSeries, StackedBarGapDirections, } from '../../../../../../types'; -import { - getBorderRadiusForStackedValues, - getYPosition, -} from '../../../../utilities'; -import {getGradientDefId} from '../../../../../../components/shared'; -import {useWatchColorVisionEvents} from '../../../../../../hooks'; +import {getBorderRadiusForStackedValues} from '../../../../utilities/getBorderRadiusForStackedValues'; +import {getYPosition} from '../../../../utilities/getYPosition'; +import {getGradientDefId} from '../../../../../shared/GradientDefs/GradientDefs'; +import {useWatchColorVisionEvents} from '../../../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; import {STACKED_BAR_GAP} from '../../../../../../constants'; import styles from './Stack.scss'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/index.ts deleted file mode 100644 index 572b51dcf..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/Stack/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Stack} from './Stack'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/index.ts deleted file mode 100644 index 572b51dcf..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Stack} from './Stack'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/index.ts deleted file mode 100644 index 96bdf490d..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/StackedBarGroups/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {StackedBarGroups} from './StackedBarGroups'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/VerticalBar.tsx b/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/VerticalBar.tsx index 848f94bb6..29812632e 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/VerticalBar.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/VerticalBar.tsx @@ -7,7 +7,7 @@ import { } from '@shopify/polaris-viz-core'; import {useBarSpringConfig} from '../../../../hooks/useBarSpringConfig'; -import {ZeroValueLine} from '../../../shared/ZeroValueLine'; +import {ZeroValueLine} from '../../../shared/ZeroValueLine/ZeroValueLine'; import styles from './VerticalBar.scss'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/index.ts deleted file mode 100644 index 6108dedd5..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {VerticalBar} from './VerticalBar'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/VerticalBarGroup.tsx b/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/VerticalBarGroup.tsx index b7dd7ed6b..98ddce97c 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/VerticalBarGroup.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/VerticalBarGroup.tsx @@ -16,9 +16,9 @@ import {getLoadAnimationDelay} from '../../../../utilities/getLoadAnimationDelay import {getChartId} from '../../../../utilities/getChartId'; import {applyColorVisionToDomElement} from '../../../../utilities/applyColorVisionToDomElement'; import type {SortedBarChartData} from '../../../../types'; -import {useWatchColorVisionEvents} from '../../../../hooks'; -import {BarGroup} from '../BarGroup'; -import {StackedBarGroups} from '../StackedBarGroups'; +import {useWatchColorVisionEvents} from '../../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {BarGroup} from '../BarGroup/BarGroup'; +import {StackedBarGroups} from '../StackedBarGroups/StackedBarGroups'; interface VerticalBarGroupProps { colors: Color[]; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/index.ts deleted file mode 100644 index 68de3bb3b..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/VerticalBarGroup/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {VerticalBarGroup} from './VerticalBarGroup'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/components/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/components/index.ts deleted file mode 100644 index 9b781a3a3..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/components/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {BarGroup} from './BarGroup'; -export {StackedBarGroups} from './StackedBarGroups'; -export {VerticalBarGroup} from './VerticalBarGroup'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/hooks/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/hooks/index.ts deleted file mode 100644 index f99e30b9c..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/hooks/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {useXScale} from './useXScale'; -export {useStackedGapsForVerticalChart} from './useStackedGapsForVerticalChart'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/hooks/useStackedGapsForVerticalChart.tsx b/packages/polaris-viz/src/components/VerticalBarChart/hooks/useStackedGapsForVerticalChart.tsx index 1376e17d5..95821cbcf 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/hooks/useStackedGapsForVerticalChart.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/hooks/useStackedGapsForVerticalChart.tsx @@ -4,7 +4,7 @@ import type { StackedSeries, } from '../../../types'; import {STACKED_BAR_GAP} from '../../../constants'; -import {pushGapToArray} from '../../../utilities'; +import {pushGapToArray} from '../../../utilities/pushGapToArray'; // Note: Because horizontal and vertical bar charts render the bars // differently, we need two different methods until we can refactor diff --git a/packages/polaris-viz/src/components/VerticalBarChart/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/index.ts deleted file mode 100644 index 2774e18cb..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export {VerticalBarChart} from './VerticalBarChart'; -export type {VerticalBarChartProps} from './VerticalBarChart'; -export {useVerticalBarChart} from './hooks/useVerticalBarChart'; -export {VerticalBarGroup} from './components/VerticalBarGroup'; -export {sortBarChartData} from './utilities'; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/tests/Chart.test.tsx b/packages/polaris-viz/src/components/VerticalBarChart/tests/Chart.test.tsx index a79a3194d..5748da6b8 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/tests/Chart.test.tsx +++ b/packages/polaris-viz/src/components/VerticalBarChart/tests/Chart.test.tsx @@ -1,20 +1,23 @@ import {mount} from '@shopify/react-testing'; -import {YAxis, XAxis} from '../../../components'; -import {mountWithProvider, triggerSVGMouseMove} from '../../../test-utilities'; -import {HorizontalGridLines} from '../../../components/HorizontalGridLines'; -import {mockDefaultTheme} from '../../../test-utilities/mountWithProvider'; +import {YAxis} from '../../YAxis/YAxis'; +import {XAxis} from '../../XAxis/XAxis'; import { - TooltipAnimatedContainer, - TooltipWrapper, -} from '../../../components/TooltipWrapper'; + mountWithProvider, + mockDefaultTheme, +} from '../../../test-utilities/mountWithProvider'; +import {triggerSVGMouseMove} from '../../../test-utilities/triggerSvgMouseMove'; +import {HorizontalGridLines} from '../../HorizontalGridLines/HorizontalGridLines'; +import {TooltipAnimatedContainer} from '../../TooltipWrapper/components/TooltipAnimatedContainer'; +import {TooltipWrapper} from '../../TooltipWrapper/TooltipWrapper'; import type {Props} from '../Chart'; import {Chart} from '../Chart'; -import {StackedBarGroups} from '../components'; -import {LegendContainer} from '../../LegendContainer'; -import {Annotations, YAxisAnnotations} from '../../Annotations'; -import {normalizeData} from '../../../utilities'; -import {TextLine} from '../../TextLine'; +import {StackedBarGroups} from '../components/StackedBarGroups/StackedBarGroups'; +import {LegendContainer} from '../../LegendContainer/LegendContainer'; +import {Annotations} from '../../Annotations/Annotations'; +import {YAxisAnnotations} from '../../Annotations/YAxisAnnotations'; +import {normalizeData} from '../../../utilities/normalizeData'; +import {TextLine} from '../../TextLine/TextLine'; import {DEFAULT_CHART_CONTEXT as MOCK_DEFAULT_CHART_CONTEXT} from '../../../storybook/constants'; jest.mock('@shopify/polaris-viz-core/src/utilities', () => { diff --git a/packages/polaris-viz/src/components/VerticalBarChart/utilities/getYPosition.ts b/packages/polaris-viz/src/components/VerticalBarChart/utilities/getYPosition.ts index 6cc25c5cc..cf0779225 100644 --- a/packages/polaris-viz/src/components/VerticalBarChart/utilities/getYPosition.ts +++ b/packages/polaris-viz/src/components/VerticalBarChart/utilities/getYPosition.ts @@ -1,7 +1,7 @@ import type {ScaleLinear} from 'd3-scale'; import type {StackedBarGapDirections} from '../../../types'; -import {getGapForIndex} from '../../../utilities'; +import {getGapForIndex} from '../../../utilities/getGapForIndex'; interface Props { start: number; diff --git a/packages/polaris-viz/src/components/VerticalBarChart/utilities/index.ts b/packages/polaris-viz/src/components/VerticalBarChart/utilities/index.ts deleted file mode 100644 index a66293f2c..000000000 --- a/packages/polaris-viz/src/components/VerticalBarChart/utilities/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export {formatAriaLabel} from './formatAriaLabel'; -export {getBorderRadiusForStackedValues} from './getBorderRadiusForStackedValues'; -export {getYPosition} from './getYPosition'; -export {sortBarChartData} from './sortBarChartData'; diff --git a/packages/polaris-viz/src/components/VisuallyHiddenRows/index.ts b/packages/polaris-viz/src/components/VisuallyHiddenRows/index.ts deleted file mode 100644 index 051be0fbc..000000000 --- a/packages/polaris-viz/src/components/VisuallyHiddenRows/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {VisuallyHiddenRows} from './VisuallyHiddenRows'; diff --git a/packages/polaris-viz/src/components/XAxis/XAxis.tsx b/packages/polaris-viz/src/components/XAxis/XAxis.tsx index 0cab7a478..6090ed9b4 100644 --- a/packages/polaris-viz/src/components/XAxis/XAxis.tsx +++ b/packages/polaris-viz/src/components/XAxis/XAxis.tsx @@ -2,8 +2,9 @@ import type {Dispatch, SetStateAction} from 'react'; import type {ScaleBand, ScaleLinear} from 'd3-scale'; import {scaleLinear} from 'd3-scale'; -import {useLabels, shouldSkipLabel} from '../Labels'; -import {TextLine} from '../TextLine'; +import {useLabels} from '../Labels/hooks/useLabels'; +import {shouldSkipLabel} from '../Labels/utilities/shouldSkipLabel'; +import {TextLine} from '../TextLine/TextLine'; interface XAxisProps { allowLineWrap: boolean; diff --git a/packages/polaris-viz/src/components/XAxis/index.ts b/packages/polaris-viz/src/components/XAxis/index.ts deleted file mode 100644 index 4519208e2..000000000 --- a/packages/polaris-viz/src/components/XAxis/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {XAxis} from './XAxis'; diff --git a/packages/polaris-viz/src/components/YAxis/YAxis.tsx b/packages/polaris-viz/src/components/YAxis/YAxis.tsx index 3a71d256a..5ef6439f0 100644 --- a/packages/polaris-viz/src/components/YAxis/YAxis.tsx +++ b/packages/polaris-viz/src/components/YAxis/YAxis.tsx @@ -1,8 +1,7 @@ -import {clamp} from '@shopify/polaris-viz-core'; +import {clamp, useTheme} from '@shopify/polaris-viz-core'; -import {estimateStringWidthWithOffset} from '../../utilities'; -import {SingleTextLine} from '../Labels'; -import {useTheme} from '../../hooks'; +import {estimateStringWidthWithOffset} from '../../utilities/estimateStringWidthWithOffset'; +import {SingleTextLine} from '../Labels/SingleTextLine'; import {LINE_HEIGHT} from '../../constants'; import type {YAxisTick} from '../../types'; import {getFontSize} from '../../utilities/getFontSize'; diff --git a/packages/polaris-viz/src/components/YAxis/index.ts b/packages/polaris-viz/src/components/YAxis/index.ts deleted file mode 100644 index 66e1a0087..000000000 --- a/packages/polaris-viz/src/components/YAxis/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {YAxis} from './YAxis'; diff --git a/packages/polaris-viz/src/components/index.ts b/packages/polaris-viz/src/components/index.ts deleted file mode 100644 index ed49e27f0..000000000 --- a/packages/polaris-viz/src/components/index.ts +++ /dev/null @@ -1,56 +0,0 @@ -export {Point} from './Point'; -export {Crosshair} from './Crosshair'; -export {HorizontalGridLines} from './HorizontalGridLines'; -export {SparkLineChart} from './SparkLineChart'; -export type {SparkLineChartProps} from './SparkLineChart'; -export {SparkBarChart} from './SparkBarChart'; -export type {SparkBarChartProps} from './SparkBarChart'; -export {LineChart} from './LineChart'; -export type {LineChartProps} from './LineChart'; -export {SimpleNormalizedChart} from './SimpleNormalizedChart'; -export type {SimpleNormalizedChartProps} from './SimpleNormalizedChart'; -export {YAxis} from './YAxis'; -export {SquareColorPreview} from './SquareColorPreview'; -export type {SquareColorPreviewProps} from './SquareColorPreview'; -export {StackedAreaChart} from './StackedAreaChart'; -export type {StackedAreaChartProps} from './StackedAreaChart'; -export {BarChart} from './BarChart'; -export {DonutChart} from './DonutChart'; -export type {DonutChartProps} from './DonutChart'; -export type {BarChartProps} from './BarChart'; -export {FunnelChart} from './FunnelChart'; -export type {FunnelChartProps} from './FunnelChart'; -export {SkipLink} from './SkipLink'; -export {VisuallyHiddenRows} from './VisuallyHiddenRows'; -export {LinePreview} from './LinePreview'; -export type {LinePreviewProps} from './LinePreview'; -export {TooltipWrapper} from './TooltipWrapper'; -export type {TooltipPosition} from './TooltipWrapper'; -export {SimpleBarChart} from './SimpleBarChart'; -export type {SimpleBarChartProps} from './SimpleBarChart'; -export {Legend} from './Legend'; -export type {LegendProps} from './Legend'; -export {PolarisVizProvider} from './PolarisVizProvider'; -export { - TooltipContent, - TooltipContentContainer, - TooltipSeriesName, - TooltipTitle, - TooltipRow, - TooltipSeries, -} from './TooltipContent'; -export type {TooltipContentProps} from './TooltipContent'; -export {ConicGradientWithStops} from './ConicGradientWithStops'; -export {ChartSkeleton} from './ChartSkeleton'; -export {ComboChart} from './ComboChart'; -export type {ComboChartProps} from './ComboChart'; -export {XAxis} from './XAxis'; -export {TrendIndicator, estimateTrendIndicatorWidth} from './TrendIndicator'; -export type {TrendIndicatorProps} from './TrendIndicator'; -export {LineChartRelational, MissingDataArea} from './LineChartRelational'; -export type {LineChartRelationalProps} from './LineChartRelational'; -export {LineChartPredictive} from './LineChartPredictive'; -export type {LineChartPredictiveProps} from './LineChartPredictive'; -export type {ComparisonMetricProps} from './ComparisonMetric'; -export {Grid} from './Grid'; -export type {GridProps} from './Grid'; diff --git a/packages/polaris-viz/src/components/shared/Bar/Bar.tsx b/packages/polaris-viz/src/components/shared/Bar/Bar.tsx index 4cdc41785..f0631704c 100644 --- a/packages/polaris-viz/src/components/shared/Bar/Bar.tsx +++ b/packages/polaris-viz/src/components/shared/Bar/Bar.tsx @@ -9,7 +9,7 @@ import { } from '@shopify/polaris-viz-core'; import {useBarSpringConfig} from '../../../hooks/useBarSpringConfig'; -import {ZeroValueLine} from '../ZeroValueLine'; +import {ZeroValueLine} from '../ZeroValueLine/ZeroValueLine'; import styles from './Bar.scss'; diff --git a/packages/polaris-viz/src/components/shared/Bar/index.ts b/packages/polaris-viz/src/components/shared/Bar/index.ts deleted file mode 100644 index 9419fa908..000000000 --- a/packages/polaris-viz/src/components/shared/Bar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Bar} from './Bar'; diff --git a/packages/polaris-viz/src/components/shared/GradientDefs/index.ts b/packages/polaris-viz/src/components/shared/GradientDefs/index.ts deleted file mode 100644 index 97642eb9d..000000000 --- a/packages/polaris-viz/src/components/shared/GradientDefs/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {GradientDefs, getGradientDefId} from './GradientDefs'; diff --git a/packages/polaris-viz/src/components/shared/GroupLabel/GroupLabel.tsx b/packages/polaris-viz/src/components/shared/GroupLabel/GroupLabel.tsx index 9b77ecad0..19330a7fb 100644 --- a/packages/polaris-viz/src/components/shared/GroupLabel/GroupLabel.tsx +++ b/packages/polaris-viz/src/components/shared/GroupLabel/GroupLabel.tsx @@ -1,6 +1,7 @@ -import {estimateStringWidthWithOffset} from '../../../utilities'; +import {useTheme} from '@shopify/polaris-viz-core'; + +import {estimateStringWidthWithOffset} from '../../../utilities/estimateStringWidthWithOffset'; import {getFontSize} from '../../../utilities/getFontSize'; -import {useTheme} from '../../../hooks'; import {HORIZONTAL_GROUP_LABEL_HEIGHT} from '../../../constants'; import styles from './GroupLabel.scss'; diff --git a/packages/polaris-viz/src/components/shared/GroupLabel/index.ts b/packages/polaris-viz/src/components/shared/GroupLabel/index.ts deleted file mode 100644 index 9a7994e73..000000000 --- a/packages/polaris-viz/src/components/shared/GroupLabel/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {GroupLabel} from './GroupLabel'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalBars/HorizontalBars.tsx b/packages/polaris-viz/src/components/shared/HorizontalBars/HorizontalBars.tsx index 2d7896c48..45cd318af 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalBars/HorizontalBars.tsx +++ b/packages/polaris-viz/src/components/shared/HorizontalBars/HorizontalBars.tsx @@ -6,25 +6,25 @@ import { COLOR_VISION_SINGLE_ITEM, useChartContext, clamp, + useTheme, } from '@shopify/polaris-viz-core'; import {getFontSize} from '../../../utilities/getFontSize'; import {getTrendIndicatorData} from '../../../utilities/getTrendIndicatorData'; -import {TREND_INDICATOR_HEIGHT, TrendIndicator} from '../../TrendIndicator'; -import { - estimateStringWidthWithOffset, - getHoverZoneOffset, -} from '../../../utilities'; +import {HEIGHT as TREND_INDICATOR_HEIGHT} from '../../TrendIndicator/constants'; +import {TrendIndicator} from '../../TrendIndicator/TrendIndicator'; +import {estimateStringWidthWithOffset} from '../../../utilities/estimateStringWidthWithOffset'; +import {getHoverZoneOffset} from '../../../utilities/getHoverZoneOffset'; import { HORIZONTAL_BAR_LABEL_OFFSET, HORIZONTAL_GROUP_LABEL_HEIGHT, HORIZONTAL_SPACE_BETWEEN_SINGLE, } from '../../../constants'; -import {useTheme, useWatchColorVisionEvents} from '../../../hooks'; -import {getGradientDefId} from '../GradientDefs'; -import {Label} from '../Label'; -import {LabelWrapper} from '../LabelWrapper'; -import {Bar} from '../Bar'; +import {useWatchColorVisionEvents} from '../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {getGradientDefId} from '../GradientDefs/GradientDefs'; +import {Label} from '../Label/Label'; +import {LabelWrapper} from '../LabelWrapper/LabelWrapper'; +import {Bar} from '../Bar/Bar'; import styles from './HorizontalBars.scss'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalBars/index.ts b/packages/polaris-viz/src/components/shared/HorizontalBars/index.ts deleted file mode 100644 index baf267bef..000000000 --- a/packages/polaris-viz/src/components/shared/HorizontalBars/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {HorizontalBars} from './HorizontalBars'; -export {Label} from '../Label'; -export {LabelWrapper} from '../LabelWrapper'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalBars/tests/HorizontalBars.test.tsx b/packages/polaris-viz/src/components/shared/HorizontalBars/tests/HorizontalBars.test.tsx index 4ce9f27c4..806b1117f 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalBars/tests/HorizontalBars.test.tsx +++ b/packages/polaris-viz/src/components/shared/HorizontalBars/tests/HorizontalBars.test.tsx @@ -4,10 +4,10 @@ import type {DataSeries} from '@shopify/polaris-viz-core'; import type {HorizontalBarsProps} from '../HorizontalBars'; import {HorizontalBars} from '../HorizontalBars'; -import {Bar} from '../../Bar'; -import {Label} from '../../Label'; -import {LabelWrapper} from '../../LabelWrapper'; -import {TrendIndicator} from '../../..'; +import {Bar} from '../../Bar/Bar'; +import {Label} from '../../Label/Label'; +import {LabelWrapper} from '../../LabelWrapper/LabelWrapper'; +import {TrendIndicator} from '../../../TrendIndicator/TrendIndicator'; jest.mock('d3-scale', () => ({ scaleLinear: jest.requireActual('d3-scale').scaleLinear, diff --git a/packages/polaris-viz/src/components/shared/HorizontalGroup/HorizontalGroup.tsx b/packages/polaris-viz/src/components/shared/HorizontalGroup/HorizontalGroup.tsx index 31bcdf216..6b0cf839b 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalGroup/HorizontalGroup.tsx +++ b/packages/polaris-viz/src/components/shared/HorizontalGroup/HorizontalGroup.tsx @@ -17,11 +17,11 @@ import { HORIZONTAL_GROUP_LABEL_HEIGHT, HORIZONTAL_SPACE_BETWEEN_SINGLE, } from '../../../constants'; -import {useWatchColorVisionEvents} from '../../../hooks'; +import {useWatchColorVisionEvents} from '../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; import type {FormattedStackedSeries} from '../../../types'; -import {GroupLabel} from '../GroupLabel'; -import {HorizontalStackedBars} from '../HorizontalStackedBars'; -import {HorizontalBars} from '../HorizontalBars'; +import {GroupLabel} from '../GroupLabel/GroupLabel'; +import {HorizontalStackedBars} from '../HorizontalStackedBars/HorizontalStackedBars'; +import {HorizontalBars} from '../HorizontalBars/HorizontalBars'; import style from './HorizontalGroup.scss'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalGroup/index.ts b/packages/polaris-viz/src/components/shared/HorizontalGroup/index.ts deleted file mode 100644 index d527a2b66..000000000 --- a/packages/polaris-viz/src/components/shared/HorizontalGroup/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {HorizontalGroup} from './HorizontalGroup'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalGroup/tests/HorizontalGroup.test.tsx b/packages/polaris-viz/src/components/shared/HorizontalGroup/tests/HorizontalGroup.test.tsx index 9152a1920..ff53a0af7 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalGroup/tests/HorizontalGroup.test.tsx +++ b/packages/polaris-viz/src/components/shared/HorizontalGroup/tests/HorizontalGroup.test.tsx @@ -4,8 +4,8 @@ import type {FormattedStackedSeries} from '@shopify/polaris-viz-core'; import type {HorizontalGroupProps} from '../HorizontalGroup'; import {HorizontalGroup} from '../HorizontalGroup'; -import {HorizontalStackedBars} from '../..'; -import {HorizontalBars} from '../../HorizontalBars'; +import {HorizontalStackedBars} from '../../HorizontalStackedBars/HorizontalStackedBars'; +import {HorizontalBars} from '../../HorizontalBars/HorizontalBars'; jest.mock('d3-scale', () => ({ scaleLinear: jest.requireActual('d3-scale').scaleLinear, diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/HorizontalStackedBars.tsx b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/HorizontalStackedBars.tsx index a2e883bfa..0fbf3d29e 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/HorizontalStackedBars.tsx +++ b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/HorizontalStackedBars.tsx @@ -5,25 +5,27 @@ import { COLOR_VISION_SINGLE_ITEM, BORDER_RADIUS, useChartContext, + useTheme, } from '@shopify/polaris-viz-core'; import {getFontSize} from '../../../utilities/getFontSize'; -import {useWatchColorVisionEvents, useTheme} from '../../../hooks'; -import {estimateStringWidthWithOffset, getBarId} from '../../../utilities'; +import {useWatchColorVisionEvents} from '../../../hooks/ColorVisionA11y/useWatchColorVisionEvents'; +import {estimateStringWidthWithOffset} from '../../../utilities/estimateStringWidthWithOffset'; +import {getBarId} from '../../../utilities/getBarId'; import { HORIZONTAL_GROUP_LABEL_HEIGHT, HORIZONTAL_BAR_LABEL_OFFSET, NEGATIVE_ZERO_LINE_OFFSET, } from '../../../constants'; import type {FormattedStackedSeries} from '../../../types'; -import {getGradientDefId} from '..'; -import {ZeroValueLine} from '../ZeroValueLine'; -import {Label} from '../Label'; -import {LabelWrapper} from '../LabelWrapper'; - -import {StackedBar} from './components'; -import {useStackedGaps} from './hooks'; -import {getXPosition} from './utilities'; +import {getGradientDefId} from '../GradientDefs/GradientDefs'; +import {ZeroValueLine} from '../ZeroValueLine/ZeroValueLine'; +import {Label} from '../Label/Label'; +import {LabelWrapper} from '../LabelWrapper/LabelWrapper'; + +import {StackedBar} from './components/StackedBar/StackedBar'; +import {useStackedGaps} from './hooks/useStackedGaps'; +import {getXPosition} from './utilities/getXPosition'; export interface HorizontalStackedBarsProps { activeGroupIndex: number; diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/StackedBar/index.ts b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/StackedBar/index.ts deleted file mode 100644 index fd895d68e..000000000 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/StackedBar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {StackedBar} from './StackedBar'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/index.ts b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/index.ts deleted file mode 100644 index fd895d68e..000000000 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {StackedBar} from './StackedBar'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/index.ts b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/index.ts deleted file mode 100644 index 6cac79d31..000000000 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {useStackedGaps} from './useStackedGaps'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/useStackedGaps.ts b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/useStackedGaps.ts index adad6d209..12beaec1a 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/useStackedGaps.ts +++ b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/hooks/useStackedGaps.ts @@ -1,7 +1,7 @@ import {useMemo} from 'react'; import {STACKED_BAR_GAP} from '../../../../constants'; -import {pushGapToArray} from '../../../../utilities'; +import {pushGapToArray} from '../../../../utilities/pushGapToArray'; import type { FormattedStackedSeries, StackedBarGapDirections, diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/index.ts b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/index.ts deleted file mode 100644 index f4d973bb3..000000000 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {HorizontalStackedBars} from './HorizontalStackedBars'; -export {LabelWrapper} from '../LabelWrapper'; -export {Label} from '../Label'; diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/tests/HorizontalStackedBars.test.tsx b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/tests/HorizontalStackedBars.test.tsx index 06f234545..aa41ba651 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/tests/HorizontalStackedBars.test.tsx +++ b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/tests/HorizontalStackedBars.test.tsx @@ -8,8 +8,8 @@ import { } from '../../../../test-utilities/mountWithProvider'; import type {HorizontalStackedBarsProps} from '../HorizontalStackedBars'; import {HorizontalStackedBars} from '../HorizontalStackedBars'; -import {StackedBar} from '../components'; -import {Label} from '../../Label'; +import {StackedBar} from '../components/StackedBar/StackedBar'; +import {Label} from '../../Label/Label'; import type {FormattedStackedSeries} from '../../../../types'; jest.mock('d3-scale', () => ({ diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/getXPosition.ts b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/getXPosition.ts index 0d533f468..38c4c9b0c 100644 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/getXPosition.ts +++ b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/getXPosition.ts @@ -1,7 +1,7 @@ import type {ScaleLinear} from 'd3-scale'; import type {StackedBarGapDirections} from '../../../../types'; -import {getGapForIndex} from '../../../../utilities'; +import {getGapForIndex} from '../../../../utilities/getGapForIndex'; interface Props { start: number; diff --git a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/index.ts b/packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/index.ts deleted file mode 100644 index eb6b7e60a..000000000 --- a/packages/polaris-viz/src/components/shared/HorizontalStackedBars/utilities/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {getXPosition} from './getXPosition'; diff --git a/packages/polaris-viz/src/components/shared/Label/index.ts b/packages/polaris-viz/src/components/shared/Label/index.ts deleted file mode 100644 index ea1392885..000000000 --- a/packages/polaris-viz/src/components/shared/Label/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {Label} from './Label'; diff --git a/packages/polaris-viz/src/components/shared/LabelWrapper/index.ts b/packages/polaris-viz/src/components/shared/LabelWrapper/index.ts deleted file mode 100644 index e9d65ae63..000000000 --- a/packages/polaris-viz/src/components/shared/LabelWrapper/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {LabelWrapper} from './LabelWrapper'; diff --git a/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx b/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx index f71b0788e..304f04868 100644 --- a/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx +++ b/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.test.tsx @@ -1,8 +1,9 @@ import {mount} from '@shopify/react-testing'; -import {SeriesIcon} from '../SeriesIcon'; -import {SquareColorPreview} from '../../SquareColorPreview'; -import {LinePreview} from '../../LinePreview'; +import {SquareColorPreview} from '../../SquareColorPreview/SquareColorPreview'; +import {LinePreview} from '../../LinePreview/LinePreview'; + +import {SeriesIcon} from './SeriesIcon'; describe('', () => { it('renders a ', () => { diff --git a/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.tsx b/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.tsx index d418f674b..e9fc9918c 100644 --- a/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.tsx +++ b/packages/polaris-viz/src/components/shared/SeriesIcon/SeriesIcon.tsx @@ -1,8 +1,8 @@ import type {Shape, Color} from '@shopify/polaris-viz-core'; import {useTheme} from '@shopify/polaris-viz-core'; -import {LinePreview} from '../../LinePreview'; -import {SquareColorPreview} from '../../SquareColorPreview'; +import {LinePreview} from '../../LinePreview/LinePreview'; +import {SquareColorPreview} from '../../SquareColorPreview/SquareColorPreview'; interface Props { color: Color; diff --git a/packages/polaris-viz/src/components/shared/SeriesIcon/index.ts b/packages/polaris-viz/src/components/shared/SeriesIcon/index.ts deleted file mode 100644 index 67ffefcd7..000000000 --- a/packages/polaris-viz/src/components/shared/SeriesIcon/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {SeriesIcon} from './SeriesIcon'; diff --git a/packages/polaris-viz/src/components/shared/ZeroValueLine/index.ts b/packages/polaris-viz/src/components/shared/ZeroValueLine/index.ts deleted file mode 100644 index db1e136bf..000000000 --- a/packages/polaris-viz/src/components/shared/ZeroValueLine/index.ts +++ /dev/null @@ -1 +0,0 @@ -export {ZeroValueLine} from './ZeroValueLine'; diff --git a/packages/polaris-viz/src/components/shared/index.ts b/packages/polaris-viz/src/components/shared/index.ts deleted file mode 100644 index a9168e01d..000000000 --- a/packages/polaris-viz/src/components/shared/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export {GradientDefs, getGradientDefId} from './GradientDefs'; -export {GroupLabel} from './GroupLabel'; -export {HorizontalBars, Label} from './HorizontalBars'; -export {HorizontalStackedBars} from './HorizontalStackedBars'; -export {HorizontalGroup} from './HorizontalGroup'; -export {Bar} from './Bar'; diff --git a/packages/polaris-viz/src/hooks/ColorVisionA11y/index.ts b/packages/polaris-viz/src/hooks/ColorVisionA11y/index.ts deleted file mode 100644 index 480d0c143..000000000 --- a/packages/polaris-viz/src/hooks/ColorVisionA11y/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export {useColorVisionEvents} from './useColorVisionEvents'; -export {useWatchColorVisionEvents} from './useWatchColorVisionEvents'; -export {getEventName} from './utilities'; diff --git a/packages/polaris-viz/src/hooks/ColorVisionA11y/stories/ColorVisionA11y.stories.mdx b/packages/polaris-viz/src/hooks/ColorVisionA11y/stories/ColorVisionA11y.stories.mdx index e3bfe45fb..79045cb3c 100644 --- a/packages/polaris-viz/src/hooks/ColorVisionA11y/stories/ColorVisionA11y.stories.mdx +++ b/packages/polaris-viz/src/hooks/ColorVisionA11y/stories/ColorVisionA11y.stories.mdx @@ -1,10 +1,7 @@ import {Meta, Story, Canvas} from '@storybook/addon-docs'; -import { - Divider, - Title, - UtilitiesHeader, -} from '../../../../../polaris-viz/src/components/Docs/stories/components'; +import {Title} from '../../../../../polaris-viz/src/components/Docs/stories/components/Title/Title'; +import {UtilitiesHeader} from '../../../../../polaris-viz/src/components/Docs/stories/components/UtilitiesHeader/UtilitiesHeader'; , diff --git a/packages/polaris-viz/src/types.ts b/packages/polaris-viz/src/types.ts index 036203b28..a43ee51c4 100644 --- a/packages/polaris-viz/src/types.ts +++ b/packages/polaris-viz/src/types.ts @@ -8,7 +8,8 @@ import type { } from '@shopify/polaris-viz-core'; import type {Series, SeriesPoint} from 'd3-shape'; import type {ScaleLinear} from 'd3-scale'; -import type {TrendIndicatorProps} from 'components/TrendIndicator'; + +import type {TrendIndicatorProps} from './components/TrendIndicator/TrendIndicator'; export interface YAxisTick { value: number; diff --git a/packages/polaris-viz/src/utilities/getStackedValuesFromDataSeries.tsx b/packages/polaris-viz/src/utilities/getStackedValuesFromDataSeries.tsx index 75c4b3074..2f7f0d7c9 100644 --- a/packages/polaris-viz/src/utilities/getStackedValuesFromDataSeries.tsx +++ b/packages/polaris-viz/src/utilities/getStackedValuesFromDataSeries.tsx @@ -1,7 +1,7 @@ import type {DataSeries} from '@shopify/polaris-viz-core'; import {stackOrderNone, stackOffsetDiverging} from 'd3-shape'; -import {getStackedValues} from './'; +import {getStackedValues} from './getStackedValues'; export function getStackedValuesFromDataSeries(data: DataSeries[]) { const longestSeries = data.reduce((prev, cur) => { diff --git a/packages/polaris-viz/src/utilities/getTooltipContentRenderer.tsx b/packages/polaris-viz/src/utilities/getTooltipContentRenderer.tsx index f6f12bcfb..f6cf27905 100644 --- a/packages/polaris-viz/src/utilities/getTooltipContentRenderer.tsx +++ b/packages/polaris-viz/src/utilities/getTooltipContentRenderer.tsx @@ -1,8 +1,9 @@ import type {DataSeries} from '@shopify/polaris-viz-core'; import type {TooltipOptions, RenderTooltipContentData} from '../types'; -import {formatDataForTooltip} from '../utilities'; -import {TooltipContent} from '../components'; +import {TooltipContent} from '../components/TooltipContent/TooltipContent'; + +import {formatDataForTooltip} from './formatDataForTooltip'; export function getTooltipContentRenderer({ tooltipOptions = {}, diff --git a/packages/polaris-viz/src/utilities/getTrendIndicatorData.ts b/packages/polaris-viz/src/utilities/getTrendIndicatorData.ts index 1fe180d21..4b93585cf 100644 --- a/packages/polaris-viz/src/utilities/getTrendIndicatorData.ts +++ b/packages/polaris-viz/src/utilities/getTrendIndicatorData.ts @@ -1,9 +1,8 @@ import type {MetaDataTrendIndicator} from 'types'; -// eslint-disable-next-line @shopify/strict-component-boundaries -import {TREND_INDICATOR_FONT_WEIGHT} from '../components/TrendIndicator'; +import {FONT_WEIGHT as TREND_INDICATOR_FONT_WEIGHT} from '../components/TrendIndicator/constants'; import {FONT_SIZE} from '../constants'; -import {estimateTrendIndicatorWidth} from '../components'; +import {estimateTrendIndicatorWidth} from '../components/TrendIndicator/utilities/estimateTrendIndicatorWidth'; export function getTrendIndicatorData( trendMetadata: MetaDataTrendIndicator | undefined, diff --git a/packages/polaris-viz/src/utilities/index.ts b/packages/polaris-viz/src/utilities/index.ts deleted file mode 100644 index 4b9d54594..000000000 --- a/packages/polaris-viz/src/utilities/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -export {getPathLength} from './getPathLength'; -export {getPointAtLength} from './getPointAtLength'; -export {normalizeData} from './normalizeData'; -export {createCSSGradient} from './createCssGradient'; -export {createCSSConicGradient} from './createCssConicGradient'; -export {classNames} from './classnames'; -export {getBarId} from './getBarId'; -export {formatDataIntoGroups} from './formatDataIntoGroups'; -export {formatDataForTooltip} from './formatDataForTooltip'; -export {fillMissingDataPoints} from './fillMissingDataPoints'; -export {getStackedMinMax} from './getStackedMinMax'; -export {getStackedValues} from './getStackedValues'; -export {pushGapToArray} from './pushGapToArray'; -export {getGapForIndex} from './getGapForIndex'; -export { - getYAxisOptionsWithDefaults, - getXAxisOptionsWithDefaults, -} from './getAxisOptions'; -export {getHoverZoneOffset} from './getHoverZoneOffset'; -export {getContainerAlignmentForLegend} from './getContainerAlignmentForLegend'; -export {estimateStringWidthWithOffset} from './estimateStringWidthWithOffset'; -export {setSingleSeriesActive} from './setSingleSeriesActive'; -export {renderLinearTooltipContent} from './renderLinearTooltipContent'; diff --git a/packages/polaris-viz/src/utilities/renderLinearTooltipContent.tsx b/packages/polaris-viz/src/utilities/renderLinearTooltipContent.tsx index ab34cb37a..59cc191bd 100644 --- a/packages/polaris-viz/src/utilities/renderLinearTooltipContent.tsx +++ b/packages/polaris-viz/src/utilities/renderLinearTooltipContent.tsx @@ -2,14 +2,12 @@ import type {DataSeries} from '@shopify/polaris-viz-core'; import type {ReactNode} from 'react'; import {Fragment} from 'react'; -import { - TooltipSeries, - TooltipContentContainer, - TooltipSeriesName, - TooltipTitle, - TooltipRow, - LinePreview, -} from '../components'; +import {TooltipSeries} from '../components/TooltipContent/components/TooltipSeries/TooltipSeries'; +import {TooltipContentContainer} from '../components/TooltipContent/components/TooltipContentContainer/TooltipContentContainer'; +import {TooltipSeriesName} from '../components/TooltipContent/components/TooltipSeriesName/TooltipSeriesName'; +import {TooltipTitle} from '../components/TooltipContent/components/TooltipTitle/TooltipTitle'; +import {TooltipRow} from '../components/TooltipContent/components/TooltipRow/TooltipRow'; +import {LinePreview} from '../components/LinePreview/LinePreview'; import type {RenderTooltipContentData, TooltipFormatters} from '../types'; interface Group { diff --git a/packages/polaris-viz/src/utilities/setSingleSeriesActive.ts b/packages/polaris-viz/src/utilities/setSingleSeriesActive.ts index 1047208ab..6f075f7ba 100644 --- a/packages/polaris-viz/src/utilities/setSingleSeriesActive.ts +++ b/packages/polaris-viz/src/utilities/setSingleSeriesActive.ts @@ -1,6 +1,6 @@ import {COLOR_VISION_SINGLE_ITEM} from '@shopify/polaris-viz-core'; -import {getEventName} from '../hooks/ColorVisionA11y'; +import {getEventName} from '../hooks/ColorVisionA11y/utilities'; export function setSingleSeriesActive(id: string, index: number) { const custom = new CustomEvent(getEventName(id, COLOR_VISION_SINGLE_ITEM), { diff --git a/packages/polaris-viz/src/utilities/stories/renderLinearTooltipContent.chromatic.stories.tsx b/packages/polaris-viz/src/utilities/stories/renderLinearTooltipContent.chromatic.stories.tsx index 99f38bd58..fcd20fe9b 100644 --- a/packages/polaris-viz/src/utilities/stories/renderLinearTooltipContent.chromatic.stories.tsx +++ b/packages/polaris-viz/src/utilities/stories/renderLinearTooltipContent.chromatic.stories.tsx @@ -1,9 +1,7 @@ import {storiesOf} from '@storybook/react'; -import { - addWithPropsCombinations, - renderCombinationSections, -} from '../../chromatic'; +import {addWithPropsCombinations} from '../../chromatic/components/AddWithPropsCombinations'; +import {renderCombinationSections} from '../../chromatic/utilities/renderCombinationSections'; import { renderLinearTooltipContent, diff --git a/packages/polaris-viz/src/utilities/tests/getAxisOptions.test.ts b/packages/polaris-viz/src/utilities/tests/getAxisOptions.test.ts index 2e1909415..fefae1d1a 100644 --- a/packages/polaris-viz/src/utilities/tests/getAxisOptions.test.ts +++ b/packages/polaris-viz/src/utilities/tests/getAxisOptions.test.ts @@ -1,4 +1,7 @@ -import {getYAxisOptionsWithDefaults, getXAxisOptionsWithDefaults} from '../'; +import { + getYAxisOptionsWithDefaults, + getXAxisOptionsWithDefaults, +} from '../getAxisOptions'; describe('get-axis-options', () => { describe('getYAxisOptionsWithDefaults()', () => { diff --git a/packages/polaris-viz/src/utilities/tests/getTooltipContentRenderer.test.tsx b/packages/polaris-viz/src/utilities/tests/getTooltipContentRenderer.test.tsx index 68f06e96c..718a2ef19 100644 --- a/packages/polaris-viz/src/utilities/tests/getTooltipContentRenderer.test.tsx +++ b/packages/polaris-viz/src/utilities/tests/getTooltipContentRenderer.test.tsx @@ -2,7 +2,7 @@ import {Fragment} from 'react'; import {DEFAULT_THEME_NAME} from '@shopify/polaris-viz-core'; import {mountWithProvider} from '../../test-utilities/mountWithProvider'; -import {TooltipContent} from '../../components'; +import {TooltipContent} from '../../components/TooltipContent/TooltipContent'; import type {RenderTooltipContentData} from '../../types'; import {getTooltipContentRenderer} from '../getTooltipContentRenderer'; diff --git a/tests/setup/tests.ts b/tests/setup/tests.ts index 34d82de9f..26f3fef0b 100644 --- a/tests/setup/tests.ts +++ b/tests/setup/tests.ts @@ -7,17 +7,20 @@ import {Globals} from '@react-spring/web'; const mockCloneElement = (element: React.ReactElement, props) => cloneElement(element, props); -jest.mock('../../packages/polaris-viz/src/components/ChartContainer', () => { - return { - ChartContainer: ({children}) => - mockCloneElement(children, { - dimensions: { - width: 600, - height: 400, - }, - }), - }; -}); +jest.mock( + '../../packages/polaris-viz/src/components/ChartContainer/ChartContainer', + () => { + return { + ChartContainer: ({children}) => + mockCloneElement(children, { + dimensions: { + width: 600, + height: 400, + }, + }), + }; + }, +); jest.mock('../../packages/polaris-viz-core/src/hooks/useChartContext', () => { // eslint-disable-next-line @typescript-eslint/no-var-requires