From c2c99e6445e942eb8f35a6f0dd533695c9074a7b Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 10 Jan 2020 17:02:31 -0500 Subject: [PATCH 001/244] [DDW-829] Installs react-custom-scrollbars as dependency --- package.json | 1 + yarn.lock | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/package.json b/package.json index f52e1d8b..ce15a3b1 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "create-react-ref": "0.1.0", "filter-react-dom-props": "0.0.2", "postinstall-build": "5.0.1", + "react-custom-scrollbars": "4.2.1", "react-modal": "3.1.12" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 6ac247d5..633dc382 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2036,6 +2036,11 @@ acorn@^6.2.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.0.tgz#b659d2ffbafa24baf5db1cdbb2c94a983ecd2784" integrity sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw== +add-px-to-style@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/add-px-to-style/-/add-px-to-style-1.0.0.tgz#d0c135441fa8014a8137904531096f67f28f263a" + integrity sha1-0ME1RB+oAUqBN5BFMQlvZ/KPJjo= + address@1.1.2, address@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/address/-/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6" @@ -4352,6 +4357,15 @@ dom-converter@~0.1: dependencies: utila "~0.3" +dom-css@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/dom-css/-/dom-css-2.1.0.tgz#fdbc2d5a015d0a3e1872e11472bbd0e7b9e6a202" + integrity sha1-/bwtWgFdCj4YcuEUcrvQ57nmogI= + dependencies: + add-px-to-style "1.0.0" + prefix-style "2.0.1" + to-camel-case "1.0.0" + dom-serializer@0, dom-serializer@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" @@ -9400,6 +9414,11 @@ postinstall-build@5.0.1: resolved "https://registry.yarnpkg.com/postinstall-build/-/postinstall-build-5.0.1.tgz#b917a9079b26178d9a24af5a5cd8cb4a991d11b9" integrity sha1-uRepB5smF42aJK9aXNjLSpkdEbk= +prefix-style@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/prefix-style/-/prefix-style-2.0.1.tgz#66bba9a870cfda308a5dc20e85e9120932c95a06" + integrity sha1-ZrupqHDP2jCKXcIOhekSCTLJWgY= + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -9701,6 +9720,13 @@ querystringify@^2.1.1: resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== +raf@^3.1.0: + version "3.4.1" + resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" + integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA== + dependencies: + performance-now "^2.1.0" + raf@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.0.tgz#a28876881b4bc2ca9117d4138163ddb80f781575" @@ -9810,6 +9836,15 @@ react-clientside-effect@^1.2.0: dependencies: "@babel/runtime" "^7.0.0" +react-custom-scrollbars@4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/react-custom-scrollbars/-/react-custom-scrollbars-4.2.1.tgz#830fd9502927e97e8a78c2086813899b2a8b66db" + integrity sha1-gw/ZUCkn6X6KeMIIaBOJmyqLZts= + dependencies: + dom-css "^2.0.0" + prop-types "^15.5.10" + raf "^3.1.0" + react-dev-utils@^9.0.0: version "9.1.0" resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-9.1.0.tgz#3ad2bb8848a32319d760d0a84c56c14bdaae5e81" @@ -11603,11 +11638,23 @@ to-arraybuffer@^1.0.0: resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= +to-camel-case@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/to-camel-case/-/to-camel-case-1.0.0.tgz#1a56054b2f9d696298ce66a60897322b6f423e46" + integrity sha1-GlYFSy+daWKYzmamCJcyK29CPkY= + dependencies: + to-space-case "^1.0.0" + to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= +to-no-case@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/to-no-case/-/to-no-case-1.0.2.tgz#c722907164ef6b178132c8e69930212d1b4aa16a" + integrity sha1-xyKQcWTvaxeBMsjmmTAhLRtKoWo= + to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" @@ -11633,6 +11680,13 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" +to-space-case@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/to-space-case/-/to-space-case-1.0.0.tgz#b052daafb1b2b29dc770cea0163e5ec0ebc9fc17" + integrity sha1-sFLar7Gysp3HcM6gFj5ewOvJ/Bc= + dependencies: + to-no-case "^1.0.0" + toggle-selection@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" From 8121270f8c547f5771b057ea7b936cbc152606a9 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 10 Jan 2020 17:10:14 -0500 Subject: [PATCH 002/244] [DDW-829] Creates ScrollBar component --- source/components/ScrollBar.js | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 source/components/ScrollBar.js diff --git a/source/components/ScrollBar.js b/source/components/ScrollBar.js new file mode 100644 index 00000000..2ae3071d --- /dev/null +++ b/source/components/ScrollBar.js @@ -0,0 +1,70 @@ +// @flow +import React, { Component } from 'react'; +import type { ComponentType } from 'react'; + +// internal utility functions +import { createEmptyContext, withTheme } from './HOC/withTheme'; +import { composeTheme, addThemeId, didThemePropsChange } from '../utils/themes'; + +// import constants +import { IDENTIFIERS } from '.'; +import type { ThemeContextProp } from './HOC/withTheme'; + +type Props = { + className?: string, + context: ThemeContextProp, + skin?: ComponentType, + theme: ?Object, // will take precedence over theme in context if passed + themeId: string, + themeOverrides: Object // custom css/scss from user that adheres to component's theme API +}; + +type State = { + composedTheme: Object +}; + +class ScrollBarBase extends Component { + // define static properties + static displayName = 'ScrollBar'; + static defaultProps = { + context: createEmptyContext(), + theme: null, + themeId: IDENTIFIERS.SCROLLBAR, + themeOverrides: {} + }; + + constructor(props: Props) { + super(props); + + const { context, themeId, theme, themeOverrides } = props; + + this.state = { + composedTheme: composeTheme( + addThemeId(theme || context.theme, themeId), + addThemeId(themeOverrides, themeId), + context.ROOT_THEME_API + ) + }; + } + + componentWillReceiveProps(nextProps: Props) { + didThemePropsChange(this.props, nextProps, this.setState.bind(this)); + } + + render() { + // destructuring props ensures only the "...rest" get passed down + const { + skin, + theme, + themeOverrides, + context, + ...rest + } = this.props; + + const ScrollBarSkin = skin || context.skins[IDENTIFIERS.SCROLLBAR]; + + return ; + } +} + +export const ScrollBar = withTheme(ScrollBarBase); From 3f4659366cdb1e8117f3dfa33f542cc8a55aa62e Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 10 Jan 2020 17:10:40 -0500 Subject: [PATCH 003/244] [DDW-829] Creates SCROLLBAR identifier --- source/components/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/source/components/index.js b/source/components/index.js index 769b3f2a..90adbc89 100644 --- a/source/components/index.js +++ b/source/components/index.js @@ -18,6 +18,7 @@ export const IDENTIFIERS = { OPTIONS: 'options', PROGRESS_BAR: 'progressbar', RADIO: 'radio', + SCROLLBAR: 'scrollbar', SELECT: 'select', STEPPER: 'stepper', SWITCH: 'switch', From 79fa6eb02cd9bb3bf303fc194392ccee7c6576c1 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 10 Jan 2020 17:26:33 -0500 Subject: [PATCH 004/244] [DDW-829] Creates ScrollBarSkin using react-custom-scrollbars package --- source/skins/simple/ScrollBarSkin.js | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 source/skins/simple/ScrollBarSkin.js diff --git a/source/skins/simple/ScrollBarSkin.js b/source/skins/simple/ScrollBarSkin.js new file mode 100644 index 00000000..b6adb053 --- /dev/null +++ b/source/skins/simple/ScrollBarSkin.js @@ -0,0 +1,29 @@ +// @flow +import React from 'react'; + +// external libraries +import classnames from 'classnames'; +import { Scrollbars } from 'react-custom-scrollbars'; + +type Props = { + className: string, + render: Function, + theme: Object, + themeId: string +}; + +export const ScrollBarSkin = (props: Props) => { + const { className, render, themeId } = props; + const theme = props.theme[themeId]; + + const renderThumb = (thumbProps: any) =>
; + + return ( + + {render()} + + ); +}; From 1b80e531cca54806304548b3e4d28b024c3f85ff Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 10 Jan 2020 17:27:12 -0500 Subject: [PATCH 005/244] [DDW-829] Exports ScrollBarSkin from index using identifier --- source/skins/simple/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/skins/simple/index.js b/source/skins/simple/index.js index 23db4903..ed4686b9 100644 --- a/source/skins/simple/index.js +++ b/source/skins/simple/index.js @@ -15,6 +15,7 @@ import { ModalSkin } from './ModalSkin'; import { OptionsSkin } from './OptionsSkin'; import { ProgressBarSkin } from './ProgressBarSkin'; import { RadioSkin } from './RadioSkin'; +import { ScrollBarSkin } from './ScrollBarSkin'; import { SelectSkin } from './SelectSkin'; import { StepperSkin } from './StepperSkin'; import { SwitchSkin } from './SwitchSkin'; @@ -38,6 +39,7 @@ export const SimpleSkins = { [IDENTIFIERS.OPTIONS]: OptionsSkin, [IDENTIFIERS.PROGRESS_BAR]: ProgressBarSkin, [IDENTIFIERS.RADIO]: RadioSkin, + [IDENTIFIERS.SCROLLBAR]: ScrollBarSkin, [IDENTIFIERS.SELECT]: SelectSkin, [IDENTIFIERS.STEPPER]: StepperSkin, [IDENTIFIERS.SWITCH]: SwitchSkin, From f6385715ceedd40da422218f807eb871e10d8508 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 13 Jan 2020 15:19:18 -0500 Subject: [PATCH 006/244] [DDW-829] Changes render prop to children --- source/skins/simple/ScrollBarSkin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/skins/simple/ScrollBarSkin.js b/source/skins/simple/ScrollBarSkin.js index b6adb053..e3df82db 100644 --- a/source/skins/simple/ScrollBarSkin.js +++ b/source/skins/simple/ScrollBarSkin.js @@ -6,14 +6,14 @@ import classnames from 'classnames'; import { Scrollbars } from 'react-custom-scrollbars'; type Props = { + children: Node, className: string, - render: Function, theme: Object, themeId: string }; export const ScrollBarSkin = (props: Props) => { - const { className, render, themeId } = props; + const { children, className, themeId } = props; const theme = props.theme[themeId]; const renderThumb = (thumbProps: any) =>
; @@ -23,7 +23,7 @@ export const ScrollBarSkin = (props: Props) => { className={classnames([className, theme.root])} renderThumbVertical={renderThumb} > - {render()} + {children} ); }; From 05f5c8eab32bae912e50e059d84d4591a32be18f Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 13 Jan 2020 15:23:52 -0500 Subject: [PATCH 007/244] [DDW-829] Adds SCROLLBAR_THEME_API --- source/themes/API/scrollbar.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 source/themes/API/scrollbar.js diff --git a/source/themes/API/scrollbar.js b/source/themes/API/scrollbar.js new file mode 100644 index 00000000..661073bf --- /dev/null +++ b/source/themes/API/scrollbar.js @@ -0,0 +1,5 @@ +// @flow +export const SCROLLBAR_THEME_API = { + root: '', + thumb: '', +}; From e900523967da1420d279e7c8710ee944699ec74e Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 13 Jan 2020 15:24:08 -0500 Subject: [PATCH 008/244] [DDW-829] Adds theme api export --- source/themes/API/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/themes/API/index.js b/source/themes/API/index.js index f5a676ad..79784ce1 100644 --- a/source/themes/API/index.js +++ b/source/themes/API/index.js @@ -18,6 +18,7 @@ import { MODAL_THEME_API } from './modal'; import { OPTIONS_THEME_API } from './options'; import { PROGRESS_BAR_THEME_API } from './progressbar'; import { RADIO_THEME_API } from './radio'; +import { SCROLLBAR_THEME_API } from './scrollbar'; import { SELECT_THEME_API } from './select'; import { STEPPER_THEME_API } from './stepper'; import { SWITCH_THEME_API } from './switch'; @@ -44,6 +45,7 @@ export const ROOT_THEME_API = { [IDENTIFIERS.OPTIONS]: OPTIONS_THEME_API, [IDENTIFIERS.PROGRESS_BAR]: PROGRESS_BAR_THEME_API, [IDENTIFIERS.RADIO]: RADIO_THEME_API, + [IDENTIFIERS.SCROLLBAR]: SCROLLBAR_THEME_API, [IDENTIFIERS.SELECT]: SELECT_THEME_API, [IDENTIFIERS.STEPPER]: STEPPER_THEME_API, [IDENTIFIERS.SWITCH]: SWITCH_THEME_API, From 72bb1569d6645c5eed0cdbdde70b15b84c31e856 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 13 Jan 2020 15:28:58 -0500 Subject: [PATCH 009/244] [DDW-829] Creates SimpleScrollBar theme file --- source/themes/simple/SimpleScrollBar.scss | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 source/themes/simple/SimpleScrollBar.scss diff --git a/source/themes/simple/SimpleScrollBar.scss b/source/themes/simple/SimpleScrollBar.scss new file mode 100644 index 00000000..66696ef7 --- /dev/null +++ b/source/themes/simple/SimpleScrollBar.scss @@ -0,0 +1,5 @@ +@import "theme"; + +.root {} + +.thumb {} \ No newline at end of file From df21afc97b6844240b3c8dd437d36a13034151a4 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 13 Jan 2020 15:29:15 -0500 Subject: [PATCH 010/244] [DDW-829] Exports SimpleScrollBar theme file --- source/themes/simple/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/themes/simple/index.js b/source/themes/simple/index.js index 88719aca..11090ce7 100644 --- a/source/themes/simple/index.js +++ b/source/themes/simple/index.js @@ -21,6 +21,7 @@ import SimpleModal from './SimpleModal.scss'; import SimpleOptions from './SimpleOptions.scss'; import SimpleProgressBar from './SimpleProgressBar.scss'; import SimpleRadio from './SimpleRadio.scss'; +import SimpleScrollBar from './SimpleScrollBar.scss'; import SimpleSelect from './SimpleSelect.scss'; import SimpleStepper from './SimpleStepper.scss'; import SimpleSwitch from './SimpleSwitch.scss'; @@ -51,6 +52,7 @@ export const SimpleTheme = { [IDENTIFIERS.OPTIONS]: SimpleOptions, [IDENTIFIERS.PROGRESS_BAR]: SimpleProgressBar, [IDENTIFIERS.RADIO]: SimpleRadio, + [IDENTIFIERS.SCROLLBAR]: SimpleScrollBar, [IDENTIFIERS.SELECT]: SimpleSelect, [IDENTIFIERS.STEPPER]: SimpleStepper, [IDENTIFIERS.SWITCH]: SimpleSwitch, From 70f69bda3e312f7dec8572d28a453936a0f923cc Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 13 Jan 2020 16:43:41 -0500 Subject: [PATCH 011/244] [DDW-829] Adds configurable CSS vars to theme file --- source/themes/simple/SimpleScrollBar.scss | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/themes/simple/SimpleScrollBar.scss b/source/themes/simple/SimpleScrollBar.scss index 66696ef7..41a28f3d 100644 --- a/source/themes/simple/SimpleScrollBar.scss +++ b/source/themes/simple/SimpleScrollBar.scss @@ -1,5 +1,23 @@ @import "theme"; +// OVERRIDABLE CONFIGURATION VARIABLES + +$scrollbar-thumb-bg-color: var(--rp-scrollbar-thumb-bg-color, rgba(255, 255, 255, 0.1)) !default; +$scrollbar-thumb-bg-color-active: var(--rp-scrollbar-thumb-bg-color-active, rgba(255, 255, 255, 0.3)) !default; +$scrollbar-thumb-bg-color-hover: var(--rp-scrollbar-thumb-bg-color-hover, rgba(255, 255, 255, 0.3)) !default; +$scrollbar-thumb-border-radius: var(--rp-scrollbar-thumb-border-radius, 3px) !default; + .root {} -.thumb {} \ No newline at end of file +.thumb { + background-color: $scrollbar-thumb-bg-color; + border-radius: $scrollbar-thumb-border-radius; + + &:active { + background-color: $scrollbar-thumb-bg-color-active; + } + + &:hover { + background-color: $scrollbar-thumb-bg-color-hover; + } +} \ No newline at end of file From 4c4bae7c41ee98528a53bd1c8e9d97cebaf10717 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Tue, 14 Jan 2020 22:55:45 -0500 Subject: [PATCH 012/244] [DDW-829] Swaps className prop for style prop --- source/skins/simple/ScrollBarSkin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/skins/simple/ScrollBarSkin.js b/source/skins/simple/ScrollBarSkin.js index e3df82db..5e404768 100644 --- a/source/skins/simple/ScrollBarSkin.js +++ b/source/skins/simple/ScrollBarSkin.js @@ -2,25 +2,25 @@ import React from 'react'; // external libraries -import classnames from 'classnames'; import { Scrollbars } from 'react-custom-scrollbars'; type Props = { children: Node, className: string, + style: Object, theme: Object, themeId: string }; export const ScrollBarSkin = (props: Props) => { - const { children, className, themeId } = props; + const { children, style, themeId } = props; const theme = props.theme[themeId]; const renderThumb = (thumbProps: any) =>
; return ( {children} From d96d0a28ea901a4ca066e7fa01ba384f441723ca Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Tue, 14 Jan 2020 22:56:47 -0500 Subject: [PATCH 013/244] [DDW-829] Adds ScrollBar story --- stories/ScrollBar.stories.js | 23 +++++++++++++++++++++++ stories/index.js | 1 + 2 files changed, 24 insertions(+) create mode 100644 stories/ScrollBar.stories.js diff --git a/stories/ScrollBar.stories.js b/stories/ScrollBar.stories.js new file mode 100644 index 00000000..a02dd486 --- /dev/null +++ b/stories/ScrollBar.stories.js @@ -0,0 +1,23 @@ +// @flow +import React from 'react'; + +// storybook +import { storiesOf } from '@storybook/react'; + +// components +import { ScrollBar } from '../source/components/ScrollBar'; + +// helpers +import { decorateWithSimpleTheme } from './helpers/theming'; + +storiesOf('ScrollBar', module) + + .addDecorator(decorateWithSimpleTheme) + + // ====== Stories ====== + + .add('plain', () => ( + +

Scroll Me

+
+ )); diff --git a/stories/index.js b/stories/index.js index 57a75c61..3254a5cc 100644 --- a/stories/index.js +++ b/stories/index.js @@ -16,6 +16,7 @@ import './NumericInput.stories'; import './Options.stories'; import './ProgressBar.stories'; import './Radio.stories'; +import './ScrollBar.stories'; import './Select.stories'; import './Stepper.stories'; import './Switch.stories'; From b8d2787e8d6fe079ce9fa59f827e80d8088c9784 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 17 Jan 2020 22:24:12 -0500 Subject: [PATCH 014/244] [DDW-829] Fixes ScrollBar height issue --- source/skins/simple/OptionsSkin.js | 7 ++++++- stories/ScrollBar.stories.js | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/skins/simple/OptionsSkin.js b/source/skins/simple/OptionsSkin.js index f785f226..21df1996 100644 --- a/source/skins/simple/OptionsSkin.js +++ b/source/skins/simple/OptionsSkin.js @@ -8,6 +8,7 @@ import { isFunction, isObject } from 'lodash'; // components import { Bubble } from '../../components/Bubble'; +import { ScrollBar } from '../../components/ScrollBar'; // skins import { BubbleSkin } from './BubbleSkin'; @@ -120,6 +121,8 @@ export const OptionsSkin = (props: Props) => { const optionsStyle = optionsMaxHeight == null ? null : { maxHeight: `${optionsMaxHeight}px` }; + const OPTION_HEIGHT = 46; // a single option's height is 46px by default + const scrollBarHeight = options.length ? options.length * OPTION_HEIGHT : OPTION_HEIGHT; return ( { onMouseEnter={() => setMouseIsOverOptions && setMouseIsOverOptions(true)} onMouseLeave={() => setMouseIsOverOptions && setMouseIsOverOptions(false)} > - {renderOptions()} + + {renderOptions()} + ); diff --git a/stories/ScrollBar.stories.js b/stories/ScrollBar.stories.js index a02dd486..5bf2f532 100644 --- a/stories/ScrollBar.stories.js +++ b/stories/ScrollBar.stories.js @@ -17,7 +17,7 @@ storiesOf('ScrollBar', module) // ====== Stories ====== .add('plain', () => ( - +

Scroll Me

)); From b82d1179667b43da0a656cd84e36ffa27cf1dc22 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Thu, 23 Jan 2020 14:15:52 -0500 Subject: [PATCH 015/244] [DDW-829] Cleans up ScrollBar storybook styles --- stories/ScrollBar.stories.js | 7 ++++++- stories/ScrollBar.stories.scss | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 stories/ScrollBar.stories.scss diff --git a/stories/ScrollBar.stories.js b/stories/ScrollBar.stories.js index 5bf2f532..7f1955ca 100644 --- a/stories/ScrollBar.stories.js +++ b/stories/ScrollBar.stories.js @@ -10,6 +10,9 @@ import { ScrollBar } from '../source/components/ScrollBar'; // helpers import { decorateWithSimpleTheme } from './helpers/theming'; +// styles +import styles from './ScrollBar.stories.scss'; + storiesOf('ScrollBar', module) .addDecorator(decorateWithSimpleTheme) @@ -18,6 +21,8 @@ storiesOf('ScrollBar', module) .add('plain', () => ( -

Scroll Me

+
+

Scroll Me

+
)); diff --git a/stories/ScrollBar.stories.scss b/stories/ScrollBar.stories.scss new file mode 100644 index 00000000..3521e855 --- /dev/null +++ b/stories/ScrollBar.stories.scss @@ -0,0 +1,7 @@ +.padding { + padding: 10px 0 0 10px; + + p { + font-family: Arial, Helvetica, sans-serif; + } +} \ No newline at end of file From 45174d8aa2d9c500053493ee2755d022a35225c1 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Thu, 23 Jan 2020 14:19:27 -0500 Subject: [PATCH 016/244] [DDW-829] Updates CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb081276..675742b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The history of all changes to react-polymorph. vNext ===== +### Features + +- Adds new `ScrollBar` component and integrates it into existing react-polymorph components [PR 129](https://github.com/input-output-hk/react-polymorph/pull/129) + 0.9.1 ===== From ce88a5ce2ed5241f9bbf76702efa73b0d0ac979b Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Thu, 23 Jan 2020 14:57:48 -0500 Subject: [PATCH 017/244] [DDW-829] Removes root class from ScrollBar's theme --- source/themes/API/scrollbar.js | 1 - source/themes/simple/SimpleScrollBar.scss | 2 -- 2 files changed, 3 deletions(-) diff --git a/source/themes/API/scrollbar.js b/source/themes/API/scrollbar.js index 661073bf..42897d2e 100644 --- a/source/themes/API/scrollbar.js +++ b/source/themes/API/scrollbar.js @@ -1,5 +1,4 @@ // @flow export const SCROLLBAR_THEME_API = { - root: '', thumb: '', }; diff --git a/source/themes/simple/SimpleScrollBar.scss b/source/themes/simple/SimpleScrollBar.scss index 41a28f3d..9b17e2ed 100644 --- a/source/themes/simple/SimpleScrollBar.scss +++ b/source/themes/simple/SimpleScrollBar.scss @@ -7,8 +7,6 @@ $scrollbar-thumb-bg-color-active: var(--rp-scrollbar-thumb-bg-color-active, rgba $scrollbar-thumb-bg-color-hover: var(--rp-scrollbar-thumb-bg-color-hover, rgba(255, 255, 255, 0.3)) !default; $scrollbar-thumb-border-radius: var(--rp-scrollbar-thumb-border-radius, 3px) !default; -.root {} - .thumb { background-color: $scrollbar-thumb-bg-color; border-radius: $scrollbar-thumb-border-radius; From 565e78d4d44af6bb249b04f87f524d231e5fae9f Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 24 Jan 2020 17:36:33 -0500 Subject: [PATCH 018/244] [DDW-829] Adds optionHeight prop to Options component --- source/components/Options.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/components/Options.js b/source/components/Options.js index e788471e..8e6c39db 100644 --- a/source/components/Options.js +++ b/source/components/Options.js @@ -33,6 +33,7 @@ type Props = { onBlur?: Function, onChange?: Function, onClose?: Function, + optionHeight: number, options: Array, optionRenderer?: Function, optionsRef?: ElementRef, @@ -71,6 +72,7 @@ class OptionsBase extends Component { noOptionsArrow: false, noOptionsCheckmark: false, noResultsMessage: 'No results', + optionHeight: 46, options: [], resetOnClose: false, theme: null, From c0fa7f2023a758d19320b364bf6fb20f907bacdd Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Fri, 24 Jan 2020 17:37:02 -0500 Subject: [PATCH 019/244] [DDW-829] Adds optionHeight prop to OptionsSkin and fixes scroll bar height calculation --- source/skins/simple/OptionsSkin.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/skins/simple/OptionsSkin.js b/source/skins/simple/OptionsSkin.js index 21df1996..db5d7261 100644 --- a/source/skins/simple/OptionsSkin.js +++ b/source/skins/simple/OptionsSkin.js @@ -25,6 +25,7 @@ type Props = { noResults: boolean, noResultsMessage: string | Element, noSelectedOptionCheckmark?: boolean, + optionHeight: number, optionRenderer: Function, options: Array, optionsRef: ElementRef<*>, @@ -51,6 +52,7 @@ export const OptionsSkin = (props: Props) => { noResults, noResultsMessage, noSelectedOptionCheckmark, + optionHeight, optionsMaxHeight, optionRenderer, options, @@ -117,12 +119,18 @@ export const OptionsSkin = (props: Props) => { return option; }; + const getScrollBarHeight = (): number => { + if (!options.length) return optionHeight; + if (optionsMaxHeight < options.length * optionHeight) { + return optionsMaxHeight; + } + return options.length * optionHeight; + }; + // Enforce max height of options dropdown if necessary const optionsStyle = optionsMaxHeight == null ? null : { maxHeight: `${optionsMaxHeight}px` }; - const OPTION_HEIGHT = 46; // a single option's height is 46px by default - const scrollBarHeight = options.length ? options.length * OPTION_HEIGHT : OPTION_HEIGHT; return ( { onMouseEnter={() => setMouseIsOverOptions && setMouseIsOverOptions(true)} onMouseLeave={() => setMouseIsOverOptions && setMouseIsOverOptions(false)} > - + {renderOptions()} From c1596377a968658aba92133c0645b82f91cd7685 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Mon, 27 Jan 2020 15:39:44 +0100 Subject: [PATCH 020/244] Add support for *.module.scss file name convention --- package.json | 4 +- scripts/prepare-sass-files-for-publishing.js | 15 ++ yarn.lock | 190 ++++++++++++------- 3 files changed, 137 insertions(+), 72 deletions(-) create mode 100644 scripts/prepare-sass-files-for-publishing.js diff --git a/package.json b/package.json index f52e1d8b..a88f9fb7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint": "eslint --format=node_modules/eslint-formatter-pretty source stories *.js", "prepare": "yarn clean && yarn build", "postinstall": "postinstall-build lib --only-as-dependency", - "sass": "cpx \"./source/themes/**/*\" ./lib/themes", + "sass": "node 'scripts/prepare-sass-files-for-publishing.js'", "sass:watch": "nodemon -e scss --watch source/themes --exec 'yarn sass'", "storybook": "start-storybook -p 6543 -c storybook", "storybook:build": "build-storybook -c storybook -o dist/storybook", @@ -48,7 +48,7 @@ "babel-loader": "8.0.6", "babel-plugin-lodash": "3.3.4", "classnames": "2.2.5", - "cpx": "1.5.0", + "cpy": "8.0.0", "cross-env": "5.2.0", "css-loader": "3.2.0", "enzyme": "3.7.0", diff --git a/scripts/prepare-sass-files-for-publishing.js b/scripts/prepare-sass-files-for-publishing.js new file mode 100644 index 00000000..eee7002d --- /dev/null +++ b/scripts/prepare-sass-files-for-publishing.js @@ -0,0 +1,15 @@ +const cpy = require('cpy'); + +const copy = (rename) => cpy('**/*.scss', '../../lib/themes', { + cwd: 'source/themes', + rename, + parents: true, +}); + +// Copy sass files "normally" to lib folder: +copy(); +// Copy them again as module.scss files: +copy((basename) => { + const fileName = basename.substring(0, basename.indexOf('.scss')); + return `${fileName}.module.scss`; +}); diff --git a/yarn.lock b/yarn.lock index 6ac247d5..68cc3a57 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1731,6 +1731,20 @@ dependencies: "@babel/types" "^7.3.0" +"@types/events@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" + integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== + +"@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" + "@types/history@*": version "4.7.3" resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.3.tgz#856c99cdc1551d22c22b18b5402719affec9839a" @@ -1761,6 +1775,11 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + "@types/node@*": version "10.1.2" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.1.2.tgz#1b928a0baa408fc8ae3ac012cc81375addc147c6" @@ -2278,11 +2297,6 @@ array-equal@^1.0.0: resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" integrity sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM= -array-filter@~0.0.0: - version "0.0.1" - resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-0.0.1.tgz#7da8cf2e26628ed732803581fd21f67cacd2eeec" - integrity sha1-fajPLiZijtcygDWB/SH2fKzS7uw= - array-find-index@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-find-index/-/array-find-index-1.0.2.tgz#df010aa1287e164bbda6f9723b0a96a1ec4187a1" @@ -2301,17 +2315,7 @@ array-includes@^3.0.3: define-properties "^1.1.2" es-abstract "^1.7.0" -array-map@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-map/-/array-map-0.0.0.tgz#88a2bab73d1cf7bcd5c1b118a003f66f665fa662" - integrity sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI= - -array-reduce@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" - integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= - -array-union@^1.0.1: +array-union@^1.0.1, array-union@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= @@ -2356,6 +2360,11 @@ arrify@^1.0.0, arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= +arrify@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" + integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== + asap@~2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" @@ -2855,7 +2864,7 @@ babel-preset-react-app@^9.0.0: babel-plugin-macros "2.6.1" babel-plugin-transform-react-remove-prop-types "0.4.24" -babel-runtime@^6.18.0, babel-runtime@^6.26.0, babel-runtime@^6.9.2: +babel-runtime@^6.18.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= @@ -3361,7 +3370,7 @@ cheerio@^1.0.0-rc.2: lodash "^4.15.0" parse5 "^3.0.1" -chokidar@^1.6.0, chokidar@^1.7.0: +chokidar@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" integrity sha1-eY5ol3gVHIB2tLNg5e3SjNortGg= @@ -3840,22 +3849,28 @@ cosmiconfig@^6.0.0: path-type "^4.0.0" yaml "^1.7.2" -cpx@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/cpx/-/cpx-1.5.0.tgz#185be018511d87270dedccc293171e37655ab88f" - integrity sha1-GFvgGFEdhycN7czCkxceN2VauI8= +cp-file@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-7.0.0.tgz#b9454cfd07fe3b974ab9ea0e5f29655791a9b8cd" + integrity sha512-0Cbj7gyvFVApzpK/uhCtQ/9kE9UnYpxMzaq5nQQC/Dh4iaj5fxp7iEFIullrYwzj8nf0qnsI1Qsx34hAeAebvw== dependencies: - babel-runtime "^6.9.2" - chokidar "^1.6.0" - duplexer "^0.1.1" - glob "^7.0.5" - glob2base "^0.0.12" - minimatch "^3.0.2" - mkdirp "^0.5.1" - resolve "^1.1.7" - safe-buffer "^5.0.1" - shell-quote "^1.6.1" - subarg "^1.0.0" + graceful-fs "^4.1.2" + make-dir "^3.0.0" + nested-error-stacks "^2.0.0" + p-event "^4.1.0" + +cpy@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/cpy/-/cpy-8.0.0.tgz#8195db0db19a9ea6aa4f229784cbf3e3f53c3158" + integrity sha512-iTjLUqtVr45e17GFAyxA0lqFinbGMblMCTtAqrPzT/IETNtDuyyhDDk8weEZ08MiCc6EcuyNq2KtGH5J2BIAoQ== + dependencies: + arrify "^2.0.1" + cp-file "^7.0.0" + globby "^9.2.0" + is-glob "^4.0.1" + junk "^3.1.0" + nested-error-stacks "^2.1.0" + p-all "^2.1.0" create-ecdh@^4.0.0: version "4.0.3" @@ -4313,6 +4328,13 @@ dir-glob@2.0.0: arrify "^1.0.1" path-type "^3.0.0" +dir-glob@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-2.2.2.tgz#fa09f0694153c8918b18ba0deafae94769fc50c4" + integrity sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw== + dependencies: + path-type "^3.0.0" + discontinuous-range@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/discontinuous-range/-/discontinuous-range-1.0.0.tgz#e38331f0844bba49b9a9cb71c771585aab1bc65a" @@ -5230,7 +5252,7 @@ fast-deep-equal@^2.0.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-glob@^2.0.2: +fast-glob@^2.0.2, fast-glob@^2.2.6: version "2.2.7" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-2.2.7.tgz#6953857c3afa475fff92ee6015d52da70a4cd39d" integrity sha512-g1KuQwHOZAmOZMuBtHdxDtju+T2RT8jgCC9aANsbpdiDDTSnjgfuVsIBNKbUeJI3oKMRExcfNDtJl4OhbffMsw== @@ -5405,11 +5427,6 @@ find-cache-dir@^3.0.0: make-dir "^3.0.0" pkg-dir "^4.1.0" -find-index@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4" - integrity sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ= - find-root@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/find-root/-/find-root-1.1.0.tgz#abcfc8ba76f708c42a97b3d685b7e9450bfb9ce4" @@ -5760,13 +5777,6 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob2base@^0.0.12: - version "0.0.12" - resolved "https://registry.yarnpkg.com/glob2base/-/glob2base-0.0.12.tgz#9d419b3e28f12e83a362164a277055922c9c0d56" - integrity sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY= - dependencies: - find-index "^0.1.1" - glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@~7.1.1: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -5869,6 +5879,20 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +globby@^9.2.0: + version "9.2.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d" + integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg== + dependencies: + "@types/glob" "^7.1.1" + array-union "^1.0.2" + dir-glob "^2.2.2" + fast-glob "^2.2.6" + glob "^7.1.3" + ignore "^4.0.3" + pify "^4.0.1" + slash "^2.0.0" + globule@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/globule/-/globule-1.2.0.tgz#1dc49c6822dd9e8a2fa00ba2a295006e8664bd09" @@ -6266,6 +6290,11 @@ ignore@^3.3.5: resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== +ignore@^4.0.3: + version "4.0.6" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" + integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== + immer@1.10.0: version "1.10.0" resolved "https://registry.yarnpkg.com/immer/-/immer-1.10.0.tgz#bad67605ba9c810275d91e1c2a47d4582e98286d" @@ -6685,6 +6714,13 @@ is-glob@^4.0.0: dependencies: is-extglob "^2.1.1" +is-glob@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" + integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== + dependencies: + is-extglob "^2.1.1" + is-hexadecimal@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.3.tgz#e8a426a69b6d31470d3a33a47bb825cda02506ee" @@ -7477,11 +7513,6 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= - jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -7504,6 +7535,11 @@ jsx-ast-utils@^2.0.0: dependencies: array-includes "^3.0.3" +junk@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1" + integrity sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ== + kind-of@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-2.0.1.tgz#018ec7a4ce7e3a86cb9141be519d24c8faa981b5" @@ -8223,7 +8259,7 @@ minimist@0.0.8: resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= -minimist@^1.1.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: +minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= @@ -8390,6 +8426,11 @@ neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== +nested-error-stacks@^2.0.0, nested-error-stacks@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz#0fbdcf3e13fe4994781280524f8b96b0cdff9c61" + integrity sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug== + nice-try@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.4.tgz#d93962f6c52f2c1558c0fbda6d512819f1efe1c4" @@ -8918,6 +8959,13 @@ osenv@0, osenv@^0.1.4: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-all@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-all/-/p-all-2.1.0.tgz#91419be56b7dee8fe4c5db875d55e0da084244a0" + integrity sha512-HbZxz5FONzz/z2gJfk6bFca0BCiSRF8jU3yCsWOen/vR6lZjfPOu/e7L3uFzTW1i0H8TlC3vqQstEJPQL4/uLA== + dependencies: + p-map "^2.0.0" + p-each-series@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" @@ -8925,6 +8973,13 @@ p-each-series@^1.0.0: dependencies: p-reduce "^1.0.0" +p-event@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-event/-/p-event-4.1.0.tgz#e92bb866d7e8e5b732293b1c8269d38e9982bf8e" + integrity sha512-4vAd06GCsgflX4wHN1JqrMzBh/8QZ4j+rzp0cd2scXRwuBEv+QR3wrVA5aLhWDLw4y2WgDKvzWF3CCLmVM1UgA== + dependencies: + p-timeout "^2.0.1" + p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" @@ -8965,11 +9020,23 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-map@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== + p-reduce@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= +p-timeout@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-timeout/-/p-timeout-2.0.1.tgz#d8dd1979595d2dc0139e1fe46b8b646cb3cdf038" + integrity sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA== + dependencies: + p-finally "^1.0.0" + p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" @@ -10504,7 +10571,7 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.1.6, resolve@^1.1.7, resolve@^1.5.0, resolve@^1.6.0: +resolve@^1.1.6, resolve@^1.5.0, resolve@^1.6.0: version "1.7.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3" integrity sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw== @@ -10889,16 +10956,6 @@ shell-quote@1.7.2: resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" integrity sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg== -shell-quote@^1.6.1: - version "1.6.1" - resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.6.1.tgz#f4781949cce402697127430ea3b3c5476f481767" - integrity sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c= - dependencies: - array-filter "~0.0.0" - array-map "~0.0.0" - array-reduce "~0.0.0" - jsonify "~0.0.0" - shelljs@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.3.tgz#a7f3319520ebf09ee81275b2368adb286659b097" @@ -11385,13 +11442,6 @@ style-loader@^0.23.1: loader-utils "^1.1.0" schema-utils "^1.0.0" -subarg@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" - integrity sha1-9izxdYHplrSPyWVpn1TAauJouNI= - dependencies: - minimist "^1.1.0" - supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" From 05cf42423912cfa328b91330ed810580dc2baf50 Mon Sep 17 00:00:00 2001 From: Danilo Prates Date: Fri, 31 Jan 2020 07:45:31 -0300 Subject: [PATCH 021/244] [DDW-829] Adds big countries list for testing --- stories/Options.stories.js | 199 ++++++++++++++++++++++++++++++++++++- 1 file changed, 195 insertions(+), 4 deletions(-) diff --git a/stories/Options.stories.js b/stories/Options.stories.js index 724ae601..bc97b86b 100644 --- a/stories/Options.stories.js +++ b/stories/Options.stories.js @@ -17,10 +17,201 @@ import CustomOptionsTheme from './theme-customizations/Options.custom.scss'; import { decorateWithSimpleTheme } from './helpers/theming'; const OPTIONS_COLLECTION = [ - { value: 'EN-gb', label: 'England' }, - { value: 'ES-es', label: 'Spain' }, - { value: 'TH-th', label: 'Thailand' }, - { value: 'EN-en', label: 'USA' } + { value: '1', label: 'Afghanistan' }, + { value: '2', label: 'Albania' }, + { value: '3', label: 'Algeria' }, + { value: '4', label: 'Andorra' }, + { value: '5', label: 'Angola' }, + { value: '6', label: 'Antigua and Barbuda' }, + { value: '7', label: 'Argentina' }, + { value: '8', label: 'Armenia' }, + { value: '9', label: 'Australia' }, + { value: '10', label: 'Austria' }, + { value: '11', label: 'Azerbaijan' }, + { value: '12', label: 'Bahamas' }, + { value: '13', label: 'Bahrain' }, + { value: '14', label: 'Bangladesh' }, + { value: '15', label: 'Barbados' }, + { value: '16', label: 'Belarus' }, + { value: '17', label: 'Belgium' }, + { value: '18', label: 'Belize' }, + { value: '19', label: 'Benin' }, + { value: '20', label: 'Bhutan' }, + { value: '21', label: 'Bolivia' }, + { value: '22', label: 'Bosnia and Herzegovina' }, + { value: '23', label: 'Botswana' }, + { value: '24', label: 'Brazil' }, + { value: '25', label: 'Brunei' }, + { value: '26', label: 'Bulgaria' }, + { value: '27', label: 'Burkina Faso' }, + { value: '28', label: 'Burundi' }, + { value: '29', label: 'Côte d\'Ivoire' }, + { value: '30', label: 'Cabo Verde' }, + { value: '31', label: 'Cambodia' }, + { value: '32', label: 'Cameroon' }, + { value: '33', label: 'Canada' }, + { value: '34', label: 'Central African Republic' }, + { value: '35', label: 'Chad' }, + { value: '36', label: 'Chile' }, + { value: '37', label: 'China' }, + { value: '38', label: 'Colombia' }, + { value: '39', label: 'Comoros' }, + { value: '40', label: 'Congo (Congo-Brazzaville)' }, + { value: '41', label: 'Costa Rica' }, + { value: '42', label: 'Croatia' }, + { value: '43', label: 'Cuba' }, + { value: '44', label: 'Cyprus' }, + { value: '45', label: 'Czechia (Czech Republic)' }, + { value: '46', label: 'Democratic Republic of the Congo' }, + { value: '47', label: 'Denmark' }, + { value: '48', label: 'Djibouti' }, + { value: '49', label: 'Dominica' }, + { value: '50', label: 'Dominican Republic' }, + { value: '51', label: 'Ecuador' }, + { value: '52', label: 'Egypt' }, + { value: '53', label: 'El Salvador' }, + { value: '54', label: 'Equatorial Guinea' }, + { value: '55', label: 'Eritrea' }, + { value: '56', label: 'Estonia' }, + { value: '57', label: 'Eswatini (fmr. "Swaziland")' }, + { value: '58', label: 'Ethiopia' }, + { value: '59', label: 'Fiji' }, + { value: '60', label: 'Finland' }, + { value: '61', label: 'France' }, + { value: '62', label: 'Gabon' }, + { value: '63', label: 'Gambia' }, + { value: '64', label: 'Georgia' }, + { value: '65', label: 'Germany' }, + { value: '66', label: 'Ghana' }, + { value: '67', label: 'Greece' }, + { value: '68', label: 'Grenada' }, + { value: '69', label: 'Guatemala' }, + { value: '70', label: 'Guinea' }, + { value: '71', label: 'Guinea-Bissau' }, + { value: '72', label: 'Guyana' }, + { value: '73', label: 'Haiti' }, + { value: '74', label: 'Holy See' }, + { value: '75', label: 'Honduras' }, + { value: '76', label: 'Hungary' }, + { value: '77', label: 'Iceland' }, + { value: '78', label: 'India' }, + { value: '79', label: 'Indonesia' }, + { value: '80', label: 'Iran' }, + { value: '81', label: 'Iraq' }, + { value: '82', label: 'Ireland' }, + { value: '83', label: 'Israel' }, + { value: '84', label: 'Italy' }, + { value: '85', label: 'Jamaica' }, + { value: '86', label: 'Japan' }, + { value: '87', label: 'Jordan' }, + { value: '88', label: 'Kazakhstan' }, + { value: '89', label: 'Kenya' }, + { value: '90', label: 'Kiribati' }, + { value: '91', label: 'Kuwait' }, + { value: '92', label: 'Kyrgyzstan' }, + { value: '93', label: 'Laos' }, + { value: '94', label: 'Latvia' }, + { value: '95', label: 'Lebanon' }, + { value: '96', label: 'Lesotho' }, + { value: '97', label: 'Liberia' }, + { value: '98', label: 'Libya' }, + { value: '99', label: 'Liechtenstein' }, + { value: '100', label: 'Lithuania' }, + { value: '101', label: 'Luxembourg' }, + { value: '102', label: 'Madagascar' }, + { value: '103', label: 'Malawi' }, + { value: '104', label: 'Malaysia' }, + { value: '105', label: 'Maldives' }, + { value: '106', label: 'Mali' }, + { value: '107', label: 'Malta' }, + { value: '108', label: 'Marshall Islands' }, + { value: '109', label: 'Mauritania' }, + { value: '110', label: 'Mauritius' }, + { value: '111', label: 'Mexico' }, + { value: '112', label: 'Micronesia' }, + { value: '113', label: 'Moldova' }, + { value: '114', label: 'Monaco' }, + { value: '115', label: 'Mongolia' }, + { value: '116', label: 'Montenegro' }, + { value: '117', label: 'Morocco' }, + { value: '118', label: 'Mozambique' }, + { value: '119', label: 'Myanmar (formerly Burma)' }, + { value: '120', label: 'Namibia' }, + { value: '121', label: 'Nauru' }, + { value: '122', label: 'Nepal' }, + { value: '123', label: 'Netherlands' }, + { value: '124', label: 'New Zealand' }, + { value: '125', label: 'Nicaragua' }, + { value: '126', label: 'Niger' }, + { value: '127', label: 'Nigeria' }, + { value: '128', label: 'North Korea' }, + { value: '129', label: 'North Macedonia' }, + { value: '130', label: 'Norway' }, + { value: '131', label: 'Oman' }, + { value: '132', label: 'Pakistan' }, + { value: '133', label: 'Palau' }, + { value: '134', label: 'Palestine State' }, + { value: '135', label: 'Panama' }, + { value: '136', label: 'Papua New Guinea' }, + { value: '137', label: 'Paraguay' }, + { value: '138', label: 'Peru' }, + { value: '139', label: 'Philippines' }, + { value: '140', label: 'Poland' }, + { value: '141', label: 'Portugal' }, + { value: '142', label: 'Qatar' }, + { value: '143', label: 'Romania' }, + { value: '144', label: 'Russia' }, + { value: '145', label: 'Rwanda' }, + { value: '146', label: 'Saint Kitts and Nevis' }, + { value: '147', label: 'Saint Lucia' }, + { value: '148', label: 'Saint Vincent and the Grenadines' }, + { value: '149', label: 'Samoa' }, + { value: '150', label: 'San Marino' }, + { value: '151', label: 'Sao Tome and Principe' }, + { value: '152', label: 'Saudi Arabia' }, + { value: '153', label: 'Senegal' }, + { value: '154', label: 'Serbia' }, + { value: '155', label: 'Seychelles' }, + { value: '156', label: 'Sierra Leone' }, + { value: '157', label: 'Singapore' }, + { value: '158', label: 'Slovakia' }, + { value: '159', label: 'Slovenia' }, + { value: '160', label: 'Solomon Islands' }, + { value: '161', label: 'Somalia' }, + { value: '162', label: 'South Africa' }, + { value: '163', label: 'South Korea' }, + { value: '164', label: 'South Sudan' }, + { value: '165', label: 'Spain' }, + { value: '166', label: 'Sri Lanka' }, + { value: '167', label: 'Sudan' }, + { value: '168', label: 'Suriname' }, + { value: '169', label: 'Sweden' }, + { value: '170', label: 'Switzerland' }, + { value: '171', label: 'Syria' }, + { value: '172', label: 'Tajikistan' }, + { value: '173', label: 'Tanzania' }, + { value: '174', label: 'Thailand' }, + { value: '175', label: 'Timor-Leste' }, + { value: '176', label: 'Togo' }, + { value: '177', label: 'Tonga' }, + { value: '178', label: 'Trinidad and Tobago' }, + { value: '179', label: 'Tunisia' }, + { value: '180', label: 'Turkey' }, + { value: '181', label: 'Turkmenistan' }, + { value: '182', label: 'Tuvalu' }, + { value: '183', label: 'Uganda' }, + { value: '184', label: 'Ukraine' }, + { value: '185', label: 'United Arab Emirates' }, + { value: '186', label: 'United Kingdom' }, + { value: '187', label: 'United States of America' }, + { value: '188', label: 'Uruguay' }, + { value: '189', label: 'Uzbekistan' }, + { value: '190', label: 'Vanuatu' }, + { value: '191', label: 'Venezuela' }, + { value: '192', label: 'Vietnam' }, + { value: '193', label: 'Yemen' }, + { value: '194', label: 'Zambia' }, + { value: '195', label: 'Zimbabwe' }, ]; const MNEMONIC_WORDS = [ From 5c5c60e4407994d6e7cb7b1557a887b4746db487 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Mon, 3 Feb 2020 21:58:20 +0100 Subject: [PATCH 022/244] [DDW-829] Use maintained custom scrollbars package --- package.json | 6 +- source/skins/simple/ScrollBarSkin.js | 15 ++-- source/themes/API/scrollbar.js | 2 +- source/themes/simple/SimpleScrollBar.scss | 57 ++++++++++++---- stories/ScrollBar.stories.js | 6 +- yarn.lock | 83 ++++++++--------------- 6 files changed, 86 insertions(+), 83 deletions(-) diff --git a/package.json b/package.json index b191ea21..401d0b0c 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "postinstall": "postinstall-build lib --only-as-dependency", "sass": "node 'scripts/prepare-sass-files-for-publishing.js'", "sass:watch": "nodemon -e scss --watch source/themes --exec 'yarn sass'", - "storybook": "start-storybook -p 6543 -c storybook", + "storybook": "start-storybook -p 6543 -c storybook --ci", "storybook:build": "build-storybook -c storybook -o dist/storybook", "test": "cross-env NODE_ENV=test jest", "test:clean": "cross-env NODE_ENV=test jest -u", @@ -25,8 +25,8 @@ "create-react-ref": "0.1.0", "filter-react-dom-props": "0.0.2", "postinstall-build": "5.0.1", - "react-custom-scrollbars": "4.2.1", - "react-modal": "3.1.12" + "react-modal": "3.1.12", + "react-scrollbars-custom": "4.0.21" }, "peerDependencies": { "classnames": ">=2", diff --git a/source/skins/simple/ScrollBarSkin.js b/source/skins/simple/ScrollBarSkin.js index 5e404768..7551cb45 100644 --- a/source/skins/simple/ScrollBarSkin.js +++ b/source/skins/simple/ScrollBarSkin.js @@ -2,7 +2,7 @@ import React from 'react'; // external libraries -import { Scrollbars } from 'react-custom-scrollbars'; +import CustomScrollBar from 'react-scrollbars-custom'; type Props = { children: Node, @@ -16,14 +16,11 @@ export const ScrollBarSkin = (props: Props) => { const { children, style, themeId } = props; const theme = props.theme[themeId]; - const renderThumb = (thumbProps: any) =>
; - return ( - - {children} - +
+ + {children} + +
); }; diff --git a/source/themes/API/scrollbar.js b/source/themes/API/scrollbar.js index 42897d2e..8f01b61f 100644 --- a/source/themes/API/scrollbar.js +++ b/source/themes/API/scrollbar.js @@ -1,4 +1,4 @@ // @flow export const SCROLLBAR_THEME_API = { - thumb: '', + root: '', }; diff --git a/source/themes/simple/SimpleScrollBar.scss b/source/themes/simple/SimpleScrollBar.scss index 9b17e2ed..a94164f1 100644 --- a/source/themes/simple/SimpleScrollBar.scss +++ b/source/themes/simple/SimpleScrollBar.scss @@ -2,20 +2,51 @@ // OVERRIDABLE CONFIGURATION VARIABLES -$scrollbar-thumb-bg-color: var(--rp-scrollbar-thumb-bg-color, rgba(255, 255, 255, 0.1)) !default; -$scrollbar-thumb-bg-color-active: var(--rp-scrollbar-thumb-bg-color-active, rgba(255, 255, 255, 0.3)) !default; -$scrollbar-thumb-bg-color-hover: var(--rp-scrollbar-thumb-bg-color-hover, rgba(255, 255, 255, 0.3)) !default; +// TRACK +$scrollbar-track-bg: var(--rp-scrollbar-track-bg, transparent) !default; +$scrollbar-track-width: var(--rp-scrollbar-track-width, 10px) !default; +// THUMB +$scrollbar-thumb-width: var(--rp-scrollbar-thumb-width, 6px) !default; +$scrollbar-thumb-bg-color: var(--rp-scrollbar-thumb-bg-color, rgba(0, 0, 0, 0.1)) !default; +$scrollbar-thumb-bg-color-active: var(--rp-scrollbar-thumb-bg-color-active, rgba(0, 0, 0, 0.3)) !default; +$scrollbar-thumb-bg-color-hover: var(--rp-scrollbar-thumb-bg-color-hover, rgba(0, 0, 0, 0.3)) !default; $scrollbar-thumb-border-radius: var(--rp-scrollbar-thumb-border-radius, 3px) !default; +$scrollbar-thumb-left-position: var(--rp-scrollbar-thumb-left-position, calc((#{$scrollbar-track-width} - #{$scrollbar-thumb-width})/2)) !default; -.thumb { - background-color: $scrollbar-thumb-bg-color; - border-radius: $scrollbar-thumb-border-radius; +.root { + :global { - &:active { - background-color: $scrollbar-thumb-bg-color-active; - } + .ScrollbarsCustom-Wrapper { + top: 0; + left: 0; + bottom: 0; + right: 0; + } - &:hover { - background-color: $scrollbar-thumb-bg-color-hover; - } -} \ No newline at end of file + .ScrollbarsCustom-Track { + position: absolute; + overflow: hidden; + user-select: none; + width: $scrollbar-track-width; + height: 100%; + right: 0; + background: $scrollbar-track-bg; + } + + .ScrollbarsCustom-Thumb { + width: $scrollbar-thumb-width; + position: relative; + left: $scrollbar-thumb-left-position; + background-color: $scrollbar-thumb-bg-color; + border-radius: $scrollbar-thumb-border-radius; + + &:active { + background-color: $scrollbar-thumb-bg-color-active; + } + + &:hover { + background-color: $scrollbar-thumb-bg-color-hover; + } + } + } +} diff --git a/stories/ScrollBar.stories.js b/stories/ScrollBar.stories.js index 7f1955ca..135b22f3 100644 --- a/stories/ScrollBar.stories.js +++ b/stories/ScrollBar.stories.js @@ -20,9 +20,11 @@ storiesOf('ScrollBar', module) // ====== Stories ====== .add('plain', () => ( - +
-

Scroll Me

+

+ Cras elementum lacus eu dictum vestibulum. Donec eros dui, cursus ut finibus vel, interdum et sem. Sed sed diam dui. Suspendisse at eros non felis faucibus consectetur. Nullam non eleifend sapien. In porttitor est in arcu auctor interdum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque eu sem euismod, dignissim orci sit amet, facilisis leo. Nulla at tempus sapien. Nunc pharetra eros at ex aliquam rutrum. Nunc quis iaculis nulla. Ut semper nisi in felis aliquam, vitae tincidunt erat tristique. Sed lobortis vulputate enim nec feugiat. Suspendisse maximus purus vitae elementum ullamcorper. Praesent fermentum, odio interdum gravida tempus, orci diam volutpat nisl, in sodales erat felis eget lorem. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean nec egestas lorem. In hac habitasse platea dictumst. Donec laoreet felis id enim tempus, id finibus mauris faucibus. Maecenas sed risus sed quam finibus sollicitudin. Donec dictum id elit in faucibus. Sed pretium cursus tempus. Duis pulvinar, felis sit amet aliquam placerat, dolor risus finibus erat, et convallis velit lacus eget lorem. Etiam bibendum ex ac finibus tincidunt. Fusce elementum semper nunc sodales egestas. Maecenas eu facilisis metus. Suspendisse at eleifend lorem, feugiat tempor ligula. Vivamus dictum metus tortor, et dictum nibh sodales eu. Nulla ut iaculis tellus, eu convallis nulla. Proin mollis dui nec quam accumsan, sed pharetra velit elementum. Suspendisse vitae purus sollicitudin, posuere justo in, mattis nisl. Cras elementum lacus eu dictum vestibulum. Donec eros dui, cursus ut finibus vel, interdum et sem. Sed sed diam dui. Suspendisse at eros non felis faucibus consectetur. Nullam non eleifend sapien +

)); diff --git a/yarn.lock b/yarn.lock index a9c4e187..34532045 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2055,11 +2055,6 @@ acorn@^6.2.1: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.0.tgz#b659d2ffbafa24baf5db1cdbb2c94a983ecd2784" integrity sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw== -add-px-to-style@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/add-px-to-style/-/add-px-to-style-1.0.0.tgz#d0c135441fa8014a8137904531096f67f28f263a" - integrity sha1-0ME1RB+oAUqBN5BFMQlvZ/KPJjo= - address@1.1.2, address@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/address/-/address-1.1.2.tgz#bf1116c9c758c51b7a933d296b72c221ed9428b6" @@ -3575,6 +3570,11 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" +cnbuilder@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/cnbuilder/-/cnbuilder-1.1.7.tgz#04ef08d278efd69bc65a95b087328455a85a2eef" + integrity sha512-8D9dpabOVOh7GX/qPZ60sJpqxHaiLqSDsuZOYH1TvoNkgMrO7BJHCbNepHHoglSdU//M2sjLHaL9Vu0qibSV2A== + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -3864,7 +3864,7 @@ cp-file@^7.0.0: nested-error-stacks "^2.0.0" p-event "^4.1.0" -cpy@^8.0.0: +cpy@8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/cpy/-/cpy-8.0.0.tgz#8195db0db19a9ea6aa4f229784cbf3e3f53c3158" integrity sha512-iTjLUqtVr45e17GFAyxA0lqFinbGMblMCTtAqrPzT/IETNtDuyyhDDk8weEZ08MiCc6EcuyNq2KtGH5J2BIAoQ== @@ -4379,15 +4379,6 @@ dom-converter@~0.1: dependencies: utila "~0.3" -dom-css@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/dom-css/-/dom-css-2.1.0.tgz#fdbc2d5a015d0a3e1872e11472bbd0e7b9e6a202" - integrity sha1-/bwtWgFdCj4YcuEUcrvQ57nmogI= - dependencies: - add-px-to-style "1.0.0" - prefix-style "2.0.1" - to-camel-case "1.0.0" - dom-serializer@0, dom-serializer@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" @@ -9481,11 +9472,6 @@ postinstall-build@5.0.1: resolved "https://registry.yarnpkg.com/postinstall-build/-/postinstall-build-5.0.1.tgz#b917a9079b26178d9a24af5a5cd8cb4a991d11b9" integrity sha1-uRepB5smF42aJK9aXNjLSpkdEbk= -prefix-style@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/prefix-style/-/prefix-style-2.0.1.tgz#66bba9a870cfda308a5dc20e85e9120932c95a06" - integrity sha1-ZrupqHDP2jCKXcIOhekSCTLJWgY= - prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -9787,13 +9773,6 @@ querystringify@^2.1.1: resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.1.1.tgz#60e5a5fd64a7f8bfa4d2ab2ed6fdf4c85bad154e" integrity sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA== -raf@^3.1.0: - version "3.4.1" - resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" - integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA== - dependencies: - performance-now "^2.1.0" - raf@^3.4.0: version "3.4.0" resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.0.tgz#a28876881b4bc2ca9117d4138163ddb80f781575" @@ -9903,15 +9882,6 @@ react-clientside-effect@^1.2.0: dependencies: "@babel/runtime" "^7.0.0" -react-custom-scrollbars@4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/react-custom-scrollbars/-/react-custom-scrollbars-4.2.1.tgz#830fd9502927e97e8a78c2086813899b2a8b66db" - integrity sha1-gw/ZUCkn6X6KeMIIaBOJmyqLZts= - dependencies: - dom-css "^2.0.0" - prop-types "^15.5.10" - raf "^3.1.0" - react-dev-utils@^9.0.0: version "9.1.0" resolved "https://registry.yarnpkg.com/react-dev-utils/-/react-dev-utils-9.1.0.tgz#3ad2bb8848a32319d760d0a84c56c14bdaae5e81" @@ -9976,6 +9946,14 @@ react-dom@^16.8.3: prop-types "^15.6.2" scheduler "^0.18.0" +react-draggable@^3.3.2: + version "3.3.2" + resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-3.3.2.tgz#966ef1d90f2387af3c2d8bd3516f601ea42ca359" + integrity sha512-oaz8a6enjbPtx5qb0oDWxtDNuybOylvto1QLydsXgKmwT7e3GXC2eMVDwEMIUYJIFqVG72XpOv673UuuAq6LhA== + dependencies: + classnames "^2.2.5" + prop-types "^15.6.0" + react-draggable@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-4.1.0.tgz#e1c5b774001e32f0bff397254e1e9d5448ac92a4" @@ -10094,6 +10072,15 @@ react-popper@^1.3.6: typed-styles "^0.0.7" warning "^4.0.2" +react-scrollbars-custom@4.0.21: + version "4.0.21" + resolved "https://registry.yarnpkg.com/react-scrollbars-custom/-/react-scrollbars-custom-4.0.21.tgz#daab3104b9707033a5be29fdc5b7408dee41a5ad" + integrity sha512-EwIVXBYsZG91Wm90a8ajSjpclXMu3XehcSGz+QbnLDQbmc+Rj/Uj+gP9bgbhyvQTKlhfjoka77VEWu9/DxOwBg== + dependencies: + cnbuilder "^1.1.7" + react-draggable "^3.3.2" + zoom-level "^1.2.4" + react-sizeme@^2.6.7: version "2.6.10" resolved "https://registry.yarnpkg.com/react-sizeme/-/react-sizeme-2.6.10.tgz#9993dcb5e67fab94a8e5d078a0d3820609010f17" @@ -11688,23 +11675,11 @@ to-arraybuffer@^1.0.0: resolved "https://registry.yarnpkg.com/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz#7d229b1fcc637e466ca081180836a7aabff83f43" integrity sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M= -to-camel-case@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/to-camel-case/-/to-camel-case-1.0.0.tgz#1a56054b2f9d696298ce66a60897322b6f423e46" - integrity sha1-GlYFSy+daWKYzmamCJcyK29CPkY= - dependencies: - to-space-case "^1.0.0" - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= -to-no-case@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/to-no-case/-/to-no-case-1.0.2.tgz#c722907164ef6b178132c8e69930212d1b4aa16a" - integrity sha1-xyKQcWTvaxeBMsjmmTAhLRtKoWo= - to-object-path@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" @@ -11730,13 +11705,6 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -to-space-case@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/to-space-case/-/to-space-case-1.0.0.tgz#b052daafb1b2b29dc770cea0163e5ec0ebc9fc17" - integrity sha1-sFLar7Gysp3HcM6gFj5ewOvJ/Bc= - dependencies: - to-no-case "^1.0.0" - toggle-selection@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" @@ -12519,3 +12487,8 @@ yargs@^7.0.0: which-module "^1.0.0" y18n "^3.2.1" yargs-parser "^5.0.0" + +zoom-level@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/zoom-level/-/zoom-level-1.2.4.tgz#52bc5ae3af945cac82f9f685e8707fa2c9b962e2" + integrity sha512-nGFUhyU3Y4jWh6l+hYCVVUxu3vrD0i/RkumJRzYGU0COMWMs2Szs84mltacd64R9zJcxwKckWQN/KKbfB1btVA== From 1917deb18177eba6996113be209b8277271f9d36 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 3 Feb 2020 18:06:11 -0500 Subject: [PATCH 023/244] [DDW-829] Fixes ESLint warning in ScrollBar story --- stories/ScrollBar.stories.js | 35 +++++++++++++++++++++++++++++++++- stories/ScrollBar.stories.scss | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/stories/ScrollBar.stories.js b/stories/ScrollBar.stories.js index 135b22f3..70daeee3 100644 --- a/stories/ScrollBar.stories.js +++ b/stories/ScrollBar.stories.js @@ -23,7 +23,40 @@ storiesOf('ScrollBar', module)

- Cras elementum lacus eu dictum vestibulum. Donec eros dui, cursus ut finibus vel, interdum et sem. Sed sed diam dui. Suspendisse at eros non felis faucibus consectetur. Nullam non eleifend sapien. In porttitor est in arcu auctor interdum. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque eu sem euismod, dignissim orci sit amet, facilisis leo. Nulla at tempus sapien. Nunc pharetra eros at ex aliquam rutrum. Nunc quis iaculis nulla. Ut semper nisi in felis aliquam, vitae tincidunt erat tristique. Sed lobortis vulputate enim nec feugiat. Suspendisse maximus purus vitae elementum ullamcorper. Praesent fermentum, odio interdum gravida tempus, orci diam volutpat nisl, in sodales erat felis eget lorem. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean nec egestas lorem. In hac habitasse platea dictumst. Donec laoreet felis id enim tempus, id finibus mauris faucibus. Maecenas sed risus sed quam finibus sollicitudin. Donec dictum id elit in faucibus. Sed pretium cursus tempus. Duis pulvinar, felis sit amet aliquam placerat, dolor risus finibus erat, et convallis velit lacus eget lorem. Etiam bibendum ex ac finibus tincidunt. Fusce elementum semper nunc sodales egestas. Maecenas eu facilisis metus. Suspendisse at eleifend lorem, feugiat tempor ligula. Vivamus dictum metus tortor, et dictum nibh sodales eu. Nulla ut iaculis tellus, eu convallis nulla. Proin mollis dui nec quam accumsan, sed pharetra velit elementum. Suspendisse vitae purus sollicitudin, posuere justo in, mattis nisl. Cras elementum lacus eu dictum vestibulum. Donec eros dui, cursus ut finibus vel, interdum et sem. Sed sed diam dui. Suspendisse at eros non felis faucibus consectetur. Nullam non eleifend sapien + Cras elementum lacus eu dictum vestibulum. + Donec eros dui, cursus ut finibus vel, interdum et sem. + Sed sed diam dui. Suspendisse at eros non felis faucibus consectetur. + Nullam non eleifend sapien. In porttitor est in arcu auctor interdum. + Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. + Pellentesque eu sem euismod, dignissim orci sit amet, facilisis leo. + Nunc pharetra eros at ex aliquam rutrum. Nunc quis iaculis nulla. + Ut semper nisi in felis aliquam, vitae tincidunt erat tristique. + Sed lobortis vulputate enim nec feugiat. + Suspendisse maximus purus vitae elementum ullamcorper. + Praesent fermentum, odio interdum gravida tempus, orci diam volutpat nisl, + in sodales erat felis eget lorem. + Pellentesque habitant morbi tristique senectus. + Aenean nec egestas lorem. In hac habitasse platea dictumst. + Donec laoreet felis id enim tempus, id finibus mauris faucibus. + Maecenas sed risus sed quam finibus sollicitudin. + Donec dictum id elit in faucibus. Sed pretium cursus tempus. + Duis pulvinar, felis sit amet aliquam placerat, dolor risus finibus erat, + et convallis velit lacus eget lorem. Etiam bibendum ex ac finibus tincidunt. + Fusce elementum semper nunc sodales egestas. Maecenas eu facilisis metus. + Suspendisse at eleifend lorem, feugiat tempor ligula. + Vivamus dictum metus tortor, et dictum nibh sodales eu. + Nulla ut iaculis tellus, eu convallis nulla. + Proin mollis dui nec quam accumsan, sed pharetra velit elementum. + Suspendisse vitae purus sollicitudin, posuere justo in, mattis nisl. + Cras elementum lacus eu dictum vestibulum. + Donec eros dui, cursus ut finibus vel, interdum et sem. Sed sed diam dui. + Suspendisse at eros non felis faucibus consectetur. + Nulla ut iaculis tellus, eu convallis nulla. + Proin mollis dui nec quam accumsan, sed pharetra velit elementum. + Suspendisse vitae purus sollicitudin, posuere justo in, mattis nisl. + Cras elementum lacus eu dictum vestibulum. + Donec eros dui, cursus ut finibus vel, interdum et sem. Sed sed diam dui. + Suspendisse at eros non felis faucibus consectetur.

diff --git a/stories/ScrollBar.stories.scss b/stories/ScrollBar.stories.scss index 3521e855..a3306603 100644 --- a/stories/ScrollBar.stories.scss +++ b/stories/ScrollBar.stories.scss @@ -3,5 +3,6 @@ p { font-family: Arial, Helvetica, sans-serif; + line-height: 30px; } } \ No newline at end of file From 64e74b9d06946ca8224c67557c886cc4042eaf4a Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 3 Feb 2020 18:10:58 -0500 Subject: [PATCH 024/244] [DDW-829] Arranges ScrollBar scss vars in ABC order --- source/themes/simple/SimpleScrollBar.scss | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/themes/simple/SimpleScrollBar.scss b/source/themes/simple/SimpleScrollBar.scss index a94164f1..4f8c2c4f 100644 --- a/source/themes/simple/SimpleScrollBar.scss +++ b/source/themes/simple/SimpleScrollBar.scss @@ -2,16 +2,17 @@ // OVERRIDABLE CONFIGURATION VARIABLES -// TRACK +// track $scrollbar-track-bg: var(--rp-scrollbar-track-bg, transparent) !default; $scrollbar-track-width: var(--rp-scrollbar-track-width, 10px) !default; -// THUMB -$scrollbar-thumb-width: var(--rp-scrollbar-thumb-width, 6px) !default; + +// thumb $scrollbar-thumb-bg-color: var(--rp-scrollbar-thumb-bg-color, rgba(0, 0, 0, 0.1)) !default; $scrollbar-thumb-bg-color-active: var(--rp-scrollbar-thumb-bg-color-active, rgba(0, 0, 0, 0.3)) !default; $scrollbar-thumb-bg-color-hover: var(--rp-scrollbar-thumb-bg-color-hover, rgba(0, 0, 0, 0.3)) !default; $scrollbar-thumb-border-radius: var(--rp-scrollbar-thumb-border-radius, 3px) !default; $scrollbar-thumb-left-position: var(--rp-scrollbar-thumb-left-position, calc((#{$scrollbar-track-width} - #{$scrollbar-thumb-width})/2)) !default; +$scrollbar-thumb-width: var(--rp-scrollbar-thumb-width, 6px) !default; .root { :global { From 5714fc792e1278fba0bdd66deba381fe2fa010ba Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 3 Feb 2020 18:34:27 -0500 Subject: [PATCH 025/244] [DDW-829] Makes ScrollBar thumb darker --- source/themes/simple/SimpleScrollBar.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/themes/simple/SimpleScrollBar.scss b/source/themes/simple/SimpleScrollBar.scss index 4f8c2c4f..a5b042ec 100644 --- a/source/themes/simple/SimpleScrollBar.scss +++ b/source/themes/simple/SimpleScrollBar.scss @@ -7,12 +7,12 @@ $scrollbar-track-bg: var(--rp-scrollbar-track-bg, transparent) !default; $scrollbar-track-width: var(--rp-scrollbar-track-width, 10px) !default; // thumb -$scrollbar-thumb-bg-color: var(--rp-scrollbar-thumb-bg-color, rgba(0, 0, 0, 0.1)) !default; -$scrollbar-thumb-bg-color-active: var(--rp-scrollbar-thumb-bg-color-active, rgba(0, 0, 0, 0.3)) !default; -$scrollbar-thumb-bg-color-hover: var(--rp-scrollbar-thumb-bg-color-hover, rgba(0, 0, 0, 0.3)) !default; +$scrollbar-thumb-bg-color: var(--rp-scrollbar-thumb-bg-color, rgba(0, 0, 0, 0.3)) !default; +$scrollbar-thumb-bg-color-active: var(--rp-scrollbar-thumb-bg-color-active, rgba(0, 0, 0, 0.6)) !default; +$scrollbar-thumb-bg-color-hover: var(--rp-scrollbar-thumb-bg-color-hover, rgba(0, 0, 0, 0.6)) !default; $scrollbar-thumb-border-radius: var(--rp-scrollbar-thumb-border-radius, 3px) !default; -$scrollbar-thumb-left-position: var(--rp-scrollbar-thumb-left-position, calc((#{$scrollbar-track-width} - #{$scrollbar-thumb-width})/2)) !default; $scrollbar-thumb-width: var(--rp-scrollbar-thumb-width, 6px) !default; +$scrollbar-thumb-left-position: var(--rp-scrollbar-thumb-left-position, calc((#{$scrollbar-track-width} - #{$scrollbar-thumb-width})/2)) !default; .root { :global { From e2e81c026d05d27f2fa0ae97b4f8531bc15d5b58 Mon Sep 17 00:00:00 2001 From: MarcusHurney Date: Mon, 3 Feb 2020 21:38:13 -0500 Subject: [PATCH 026/244] [DDW-829] Fixes ESLint error in Autocomplete behavior tests --- __tests__/Autocomplete.behavior.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/Autocomplete.behavior.test.js b/__tests__/Autocomplete.behavior.test.js index be243883..6f1a6bd6 100644 --- a/__tests__/Autocomplete.behavior.test.js +++ b/__tests__/Autocomplete.behavior.test.js @@ -36,7 +36,7 @@ const ABC_SORTED_MNEMONICS = [ describe('Autocomplete onChange simulations', () => { test('Autocomplete is closed by default and when clicked is open and displays options', () => { const wrapper = mountInSimpleTheme( - + ); const component = wrapper.find('Autocomplete').instance(); const input = wrapper.find('input'); @@ -65,7 +65,7 @@ describe('Autocomplete onChange simulations', () => { test('Autocomplete puts options in abc order and highlights first option by default when open', () => { const wrapper = mountInSimpleTheme( - + ); const component = wrapper.find('Autocomplete').instance(); const input = wrapper.find('input'); From 8f7c519afeba6bc611d32b36595a684523ef521f Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 5 Feb 2020 19:20:26 +0100 Subject: [PATCH 027/244] [DDW-829] Fix broken jest snapshots by using enzyme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While debugging a testing issue with the new scrollbar component i stumbled over the known problem of „react-test-renderer“ not being able to handle element refs correctly (since it doesn’t involve any real DOM rendering). You can read more about that issue here: https://github.com/facebook/react/issues/7740 This was the root cause and i couldnt make it work with react-test-renderer, so i refactored all the snapshot tests to use enzyme (which supports full DOM rendering). You can see the difference (react-test-renderer outputs a JSON with react component „markup“ whereas enzyme outputs only plain DOM nodes) --- __tests__/Autocomplete.test.js | 42 +- __tests__/Bubble.test.js | 33 +- __tests__/Button.test.js | 19 +- __tests__/Checkbox.test.js | 28 +- __tests__/FormField.test.js | 35 +- __tests__/Input.test.js | 28 +- __tests__/NumericInput.test.js | 42 +- __tests__/Options.test.js | 21 +- __tests__/Radio.test.js | 29 +- __tests__/Select.test.js | 58 +- __tests__/Stepper.test.js | 22 +- __tests__/Switch.test.js | 36 +- __tests__/TextArea.test.js | 36 +- __tests__/Toggler.test.js | 29 +- .../__snapshots__/Autocomplete.test.js.snap | 830 ++++--- __tests__/__snapshots__/Bubble.test.js.snap | 55 +- __tests__/__snapshots__/Button.test.js.snap | 8 +- __tests__/__snapshots__/Checkbox.test.js.snap | 45 +- .../__snapshots__/FormField.test.js.snap | 39 +- __tests__/__snapshots__/Input.test.js.snap | 37 +- .../__snapshots__/NumericInput.test.js.snap | 64 +- __tests__/__snapshots__/Options.test.js.snap | 630 +++--- __tests__/__snapshots__/Radio.test.js.snap | 45 +- __tests__/__snapshots__/Select.test.js.snap | 1537 +++++++------ __tests__/__snapshots__/Switch.test.js.snap | 79 +- __tests__/__snapshots__/TextArea.test.js.snap | 52 +- __tests__/__snapshots__/Toggler.test.js.snap | 67 +- __tests__/helpers/theming.js | 7 +- package.json | 9 +- yarn.lock | 2002 ++++++++++++----- 30 files changed, 3519 insertions(+), 2445 deletions(-) diff --git a/__tests__/Autocomplete.test.js b/__tests__/Autocomplete.test.js index 10599e7f..00f8efbc 100644 --- a/__tests__/Autocomplete.test.js +++ b/__tests__/Autocomplete.test.js @@ -11,52 +11,40 @@ const OPTIONS = [ ]; test('Autocomplete renders correctly', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Autocomplete renders with label', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Autocomplete renders with a placeholder', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Autocomplete renders with an error', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Autocomplete uses render prop - renderSelections', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( { @@ -74,14 +62,11 @@ test('Autocomplete uses render prop - renderSelections', () => { )); }} /> - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Autocomplete uses render prop - renderOptions', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( { @@ -94,8 +79,5 @@ test('Autocomplete uses render prop - renderOptions', () => { )); }} /> - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); diff --git a/__tests__/Bubble.test.js b/__tests__/Bubble.test.js index 927390e3..94e79911 100644 --- a/__tests__/Bubble.test.js +++ b/__tests__/Bubble.test.js @@ -4,44 +4,29 @@ import { Bubble } from '../source/components/Bubble'; import { renderInSimpleTheme } from './helpers/theming'; test('Bubble renders correctly', () => { - const component = renderInSimpleTheme(); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + expect(renderInSimpleTheme()).toMatchSnapshot(); }); test('Bubble renders isOpeningUpward={true}', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Bubble renders isTransparent={false}', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Bubble renders isHidden={true}', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Bubble renders isFloating={true}', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); diff --git a/__tests__/Button.test.js b/__tests__/Button.test.js index 30a49810..ce12b13a 100644 --- a/__tests__/Button.test.js +++ b/__tests__/Button.test.js @@ -4,26 +4,17 @@ import { Button } from '../source/components/Button'; import { renderInSimpleTheme } from './helpers/theming'; test('Button renders correctly', () => { - const component = renderInSimpleTheme(
)} /> - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); diff --git a/__tests__/Stepper.test.js b/__tests__/Stepper.test.js index 232f6860..805a79ca 100644 --- a/__tests__/Stepper.test.js +++ b/__tests__/Stepper.test.js @@ -1,5 +1,4 @@ import React from 'react'; -import renderer from 'react-test-renderer'; import { Stepper } from '../source/components/Stepper'; import { renderInSimpleTheme } from './helpers/theming'; @@ -7,39 +6,30 @@ import { renderInSimpleTheme } from './helpers/theming'; const STEPS = ['Wallet', 'Stake pool', 'Delegation', 'Activation']; test('Stepper renders correctly', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Stepper renders with custom label', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Stepper renders without label', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); diff --git a/__tests__/Switch.test.js b/__tests__/Switch.test.js index b9a8f400..a0782f5f 100644 --- a/__tests__/Switch.test.js +++ b/__tests__/Switch.test.js @@ -1,5 +1,4 @@ import React from 'react'; -import renderer from 'react-test-renderer'; import { Checkbox } from '../source/components/Checkbox'; import { SwitchSkin } from '../source/skins/simple/SwitchSkin'; @@ -7,66 +6,51 @@ import { IDENTIFIERS } from '../source/components'; import { renderInSimpleTheme } from './helpers/theming'; test('Switch renders correctly', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Switch renders with label', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Switch is disabled', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Switch is disabled and renders a label', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); test('Switch is checked', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme( - ); - - const tree = component.toJSON(); - expect(tree).toMatchSnapshot(); + )).toMatchSnapshot(); }); diff --git a/__tests__/TextArea.test.js b/__tests__/TextArea.test.js index 0b60d1ad..d2dee8d5 100644 --- a/__tests__/TextArea.test.js +++ b/__tests__/TextArea.test.js @@ -1,50 +1,34 @@ import React from 'react'; -import renderer from 'react-test-renderer'; import { TextArea } from '../source/components/TextArea'; import { renderInSimpleTheme } from './helpers/theming'; test('TextArea renders correctly', () => { - const component = renderInSimpleTheme( + expect(renderInSimpleTheme(
`; exports[`TextArea renders with an error 1`] = `
Please enter valid input
-
+ +
+
`; @@ -49,18 +55,15 @@ exports[`TextArea renders with an error 1`] = `
-
- Please enter valid input -
-
-