From bdc96853996bf261257cffa0d6f6b2a2ad108a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kry=C5=A1p=C3=ADn?= Date: Fri, 9 Jun 2023 11:04:49 +0200 Subject: [PATCH] BREAKING CHANGE(web-react): Rename ScrollView `indicators` prop to `overflowDecorators` #DS-825 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Migration Guide Rename `indicators` prop to `overflowDecorators` on all ScrollView component usages. - `` → `` - `` → `` - `` → `` Please refer back to these instructions or reach out to our team if you encounter any issues during migration. --- .../ModalComposedWithScrollView.stories.tsx | 2 +- .../src/components/ScrollView/README.md | 12 +++++----- .../src/components/ScrollView/ScrollView.tsx | 8 +++---- .../__tests__/useScrollViewStyleProps.test.ts | 14 +++++++----- .../src/components/ScrollView/constants.ts | 2 +- .../components/ScrollView/stories/argTypes.ts | 14 ++++++------ .../ScrollView/useScrollViewStyleProps.ts | 22 +++++++++---------- packages/web-react/src/types/scrollView.ts | 4 ++-- 8 files changed, 40 insertions(+), 38 deletions(-) diff --git a/packages/web-react/docs/stories/examples/ModalComposedWithScrollView.stories.tsx b/packages/web-react/docs/stories/examples/ModalComposedWithScrollView.stories.tsx index f92cf47a10..aa07f77005 100644 --- a/packages/web-react/docs/stories/examples/ModalComposedWithScrollView.stories.tsx +++ b/packages/web-react/docs/stories/examples/ModalComposedWithScrollView.stories.tsx @@ -30,7 +30,7 @@ export const ModalComposedWithScrollView = () => { Modal with ScrollView - +

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam at excepturi laudantium magnam diff --git a/packages/web-react/src/components/ScrollView/README.md b/packages/web-react/src/components/ScrollView/README.md index 401dd795a6..a60b567fea 100644 --- a/packages/web-react/src/components/ScrollView/README.md +++ b/packages/web-react/src/components/ScrollView/README.md @@ -2,7 +2,7 @@ ## Usage -To make scrolling and scroll indicators function correctly, the parent +To make scrolling and scroll overflow decorators function correctly, the parent container's height must be limited. In our examples, we set this height limit using inline styles for demonstration purposes only. @@ -40,21 +40,21 @@ limit using inline styles for demonstration purposes only. ``` -## Scrolling Indicators +## Overflow Decorators -The ScrollView component provides indicators on its edges, showing that there is more content to scroll to. +The ScrollView component provides overflow decorators on its edges, showing that there is more content to scroll to. Shadows are used by default. You can use borders instead: ```javascript - + ``` Or both: ```javascript - + ``` ## Hiding the Scrollbar @@ -69,7 +69,7 @@ Or both: | --------------------- | ---------------------------- | ---------- | -------- | ---------------------------------- | | `children` | `ReactNode` | - | yes | ScrollView children's nodes | | `direction` | `horizontal`, `vertical` | `vertical` | no | Direction of the wrapper | -| `edgeIndicators` | `borders`, `shadows`, `both` | `shadows` | no | ScrollView edge indicators | | `isScrollbarDisabled` | `boolean` | `false` | no | If true, the Scrollbar is disabled | +| `overflowDecorators` | `borders`, `shadows`, `both` | `shadows` | no | ScrollView overflow decorators | | `UNSAFE_className` | `string` | - | no | Wrapper custom class name | | `UNSAFE_style` | `CSSProperties` | - | no | Wrapper custom style | diff --git a/packages/web-react/src/components/ScrollView/ScrollView.tsx b/packages/web-react/src/components/ScrollView/ScrollView.tsx index d22954843d..7f5917dcf9 100644 --- a/packages/web-react/src/components/ScrollView/ScrollView.tsx +++ b/packages/web-react/src/components/ScrollView/ScrollView.tsx @@ -4,14 +4,14 @@ import { SpiritScrollViewProps } from '../../types'; import { useStyleProps } from '../../hooks'; import { useScrollViewStyleProps } from './useScrollViewStyleProps'; import { useScrollPosition } from './useScrollPosition'; -import { SCROLL_VIEW_DEFAULT_EDGE_INDICATOR, SCROLL_VIEW_DEFAULT_DIRECTION } from './constants'; +import { SCROLL_VIEW_DEFAULT_DIRECTION, SCROLL_VIEW_DEFAULT_OVERFLOW_DECORATOR } from './constants'; const ScrollView = (props: SpiritScrollViewProps) => { const { children, direction = SCROLL_VIEW_DEFAULT_DIRECTION, - edgeIndicators = SCROLL_VIEW_DEFAULT_EDGE_INDICATOR, isScrollbarDisabled, + overflowDecorators = SCROLL_VIEW_DEFAULT_OVERFLOW_DECORATOR, ...restProps } = props; @@ -25,10 +25,10 @@ const ScrollView = (props: SpiritScrollViewProps) => { }); const { classProps } = useScrollViewStyleProps({ direction, - edgeIndicators, isScrollbarDisabled, isScrolledAtStart, isScrolledAtEnd, + overflowDecorators, }); const { styleProps, props: transferProps } = useStyleProps(restProps); @@ -39,7 +39,7 @@ const ScrollView = (props: SpiritScrollViewProps) => { {children} -