Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
60ca2c9
-added fela plugin for disabling animations
May 23, 2019
c5d2da9
-fixed Animation issue
May 23, 2019
663daa0
-removed disableAnimations from the Provider
May 23, 2019
67d116f
-added neverDisableAnimation on the components
May 23, 2019
e03d018
-reverted neverDisableAnimations logic
May 27, 2019
baeb480
-added rtl, disableAnimations and renderer as a separate props to the…
May 27, 2019
6242f12
-fixed tests
May 27, 2019
e533439
-fixed imports in Provider
May 27, 2019
4fd2594
-added tests for mergeBooleanValues and mergeContexts
May 27, 2019
863420b
-updated ProviderConsumer test
May 27, 2019
ba8fc9c
-reverted changes in the Provider.Consumer component
May 28, 2019
b914cfc
-fixes
May 28, 2019
4fe73fb
-fixed test description
May 28, 2019
8272a21
-added renderer test
May 28, 2019
d8c4971
-added type check for RULE in the fela plugin
May 28, 2019
22abdc5
-addressed PR comments
May 29, 2019
87598ff
-updated typings
May 29, 2019
8a127ae
-addressing comments
May 29, 2019
64a4fb3
-fixed import
May 29, 2019
993be69
Merge branch 'master' into feat/disable-animations
May 30, 2019
2cb703b
-change createAnimationStyles signiture to use theme instead of context
May 30, 2019
d8c1a97
-improved Provider test
May 30, 2019
8bbb92a
-addressed PR comments
Jun 3, 2019
37c6ab5
Merge branch 'master' into feat/disable-animations
Jun 3, 2019
00bef47
-merge conflicts
Jun 3, 2019
864e38d
-added Provider example for rtl and disableAnimations
Jun 3, 2019
4b90696
-renamed examples
Jun 3, 2019
498394f
Merge branch 'master' into feat/disable-animations
Jun 4, 2019
94d1875
-updated changelog
Jun 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### BREAKING CHANGES
- Rename `toolbarBehavior` to `menuAsToolbarBehavior` and `toolbarButtonBehavior` to `menuItemAsToolbarButtonBehavior` ([#1393](https://github.com/stardust-ui/react/pull/1393))
- Rename types related to accessibility ([#1421](https://github.com/stardust-ui/react/pull/1421))
- Moved the `rtl` and `renderer` props from the `theme` prop object to the `Provider`'s props API @mnajdova ([#1377](https://github.com/stardust-ui/react/pull/1377))

### Features
- Add `Toolbar` component @miroslavstastny ([#1408](https://github.com/stardust-ui/react/pull/1408))
- Add `disableAnimations` boolean prop on the `Provider` @mnajdova ([#1377](https://github.com/stardust-ui/react/pull/1377))

<!--------------------------------[ v0.32.0 ]------------------------------- -->
## [v0.32.0](https://github.com/stardust-ui/react/tree/v0.32.0) (2019-06-03)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,12 @@ class ComponentExample extends React.Component<ComponentExampleProps, ComponentE
componentVariables: mergeThemeVariables(theme.componentVariables, {
[this.getDisplayName()]: componentVariables,
}),
rtl: showRtl,
}

const providerVariables = showTransparent ? { background: 'initial' } : undefined

return (
<Provider theme={newTheme} variables={providerVariables}>
<Provider theme={newTheme} rtl={showRtl} variables={providerVariables}>
{element}
</Provider>
)
Expand Down
20 changes: 9 additions & 11 deletions docs/src/components/ExternalExampleLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider, themes, ThemeInput } from '@stardust-ui/react'
import { Provider, themes } from '@stardust-ui/react'
import * as _ from 'lodash'
import * as React from 'react'
import { match } from 'react-router'
Expand Down Expand Up @@ -55,10 +55,16 @@ class ExternalExampleLayout extends React.Component<
if (!examplePath) return <PageNotFound />

const exampleSource: ExampleSource = exampleSourcesContext(examplePath)
const theme = this.getTheme()

const { themeName } = this.state
const theme = (themeName && themes[themeName]) || {}

return (
<Provider key={this.state.renderId} theme={theme}>
<Provider
key={this.state.renderId}
theme={theme}
rtl={this.props.match.params.rtl === 'true'}
>
<SourceRender
babelConfig={babelConfig}
source={exampleSource.js}
Expand All @@ -77,14 +83,6 @@ class ExternalExampleLayout extends React.Component<
</Provider>
)
}

private getTheme = (): ThemeInput => {
const { themeName } = this.state
const theme: ThemeInput = (themeName && themes[themeName]) || {}

theme.rtl = this.props.match.params.rtl === 'true'
return theme
}
}

export default ExternalExampleLayout
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as React from 'react'
import { Animation, Icon, Provider } from '@stardust-ui/react'

const spinner = {
keyframe: {
from: {
transform: 'rotate(0deg)',
},
to: {
transform: 'rotate(360deg)',
},
},
duration: '5s',
iterationCount: 'infinite',
}

const AnimatedIcon = () => (
<Animation name="spinner">
<Icon name="umbrella" circular bordered />
</Animation>
)

const ProviderExampleAnimation = () => (
<Provider theme={{ animations: { spinner } }}>
{'This icon will be animated'}
<br />
<AnimatedIcon />
<Provider disableAnimations>
{'This icon will not be animated, as animations are disabled in this tree'}
<br />
<AnimatedIcon />
</Provider>
</Provider>
)

export default ProviderExampleAnimation
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react'
import { Provider } from '@stardust-ui/react'

const ProviderRtlExample = () => (
<Provider rtl>
<div>{'مثال النص'}</div>
</Provider>
)

export default ProviderRtlExample
10 changes: 10 additions & 0 deletions docs/src/examples/components/Provider/Types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ const Types = () => (
description="A Provider defines the theme for your components."
examplePath="components/Provider/Types/ProviderExample"
/>
<ComponentExample
title="Rtl"
description="A Provider can specify that the content inside it should be in rtl mode."
examplePath="components/Provider/Types/ProviderRtlExample"
/>
<ComponentExample
title="Disable animations"
description="A Provider can specify that the animations inside it's content should be disabled."
examplePath="components/Provider/Types/ProviderDisableAnimationsExample"
/>
</ExampleSection>
<NonPublicSection title="Types for visual tests">
<ComponentExample examplePath="components/Provider/Types/ProviderExampleScrollbar" />
Expand Down
12 changes: 4 additions & 8 deletions docs/src/prototypes/meetingOptions/components/MSTeamsLink.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import * as React from 'react'
import { Provider, Text } from '@stardust-ui/react'
import { Text } from '@stardust-ui/react'

export default props => {
const { content, children } = props
return (
<Provider.Consumer
render={({ siteVariables }) => (
<Text as="a" content={content} color="brand">
{children}
</Text>
)}
/>
<Text as="a" content={content} color="brand">
{children}
</Text>
)
}
23 changes: 4 additions & 19 deletions packages/react/src/components/Animation/Animation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as PropTypes from 'prop-types'
import * as React from 'react'
import cx from 'classnames'

import {
UIComponent,
Expand All @@ -8,8 +9,6 @@ import {
commonPropTypes,
ChildrenComponentProps,
} from '../../lib'
import { AnimationProp } from '../../themes/types'
import createAnimationStyles from '../../lib/createAnimationStyles'
import { WithAsProp, withSafeTypeForAs } from '../../types'

export interface AnimationProps
Expand Down Expand Up @@ -104,28 +103,14 @@ class Animation extends UIComponent<WithAsProp<AnimationProps>, any> {
timingFunction: PropTypes.string,
}

renderComponent({ ElementType, classes, unhandledProps, styles, variables, theme }) {
const { children, name } = this.props

const animation: AnimationProp = {
name,
keyframeParams: this.props.keyframeParams,
duration: this.props.duration,
delay: this.props.delay,
iterationCount: this.props.iterationCount,
direction: this.props.direction,
fillMode: this.props.fillMode,
playState: this.props.playState,
timingFunction: this.props.timingFunction,
}

const animationStyle = createAnimationStyles(animation, theme)
renderComponent({ ElementType, classes, unhandledProps }) {
const { children } = this.props

const child =
childrenExist(children) && (React.Children.only(children) as React.ReactElement<any>)
const result = child
? React.cloneElement(child, {
style: { ...animationStyle, ...(child.props && child.props.style) },
className: cx(child.props.className, classes.children),
})
: ''

Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Icon extends UIComponent<WithAsProp<IconProps>, any> {

renderComponent({ ElementType, classes, unhandledProps, accessibility, theme, rtl, styles }) {
const { name } = this.props
const { icons = {} } = theme
const { icons = {} } = theme || {}

const maybeIcon = icons[name]
const isSvgIcon = maybeIcon && maybeIcon.isSvg
Expand Down
16 changes: 8 additions & 8 deletions packages/react/src/components/ItemLayout/ItemLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
rtlTextContainer,
} from '../../lib'
import Layout from '../Layout/Layout'
import { ComponentSlotClasses, ICSSInJSStyle } from '../../themes/types'
import { ComponentSlotClasses } from '../../themes/types'
import { WithAsProp, withSafeTypeForAs } from '../../types'

export interface ItemLayoutSlotClassNames {
Expand Down Expand Up @@ -49,19 +49,19 @@ export interface ItemLayoutProps extends UIComponentProps, ContentComponentProps
classes: ComponentSlotClasses,
) => React.ReactNode
/** Styled applied to the root element of the rendered component. */
rootCSS?: ICSSInJSStyle
rootCSS?: React.CSSProperties
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As these are applied on div elements, we need the React.CSSProperties as a type

/** Styled applied to the media element of the rendered component. */
mediaCSS?: ICSSInJSStyle
mediaCSS?: React.CSSProperties
/** Styled applied to the header element of the rendered component. */
headerCSS?: ICSSInJSStyle
headerCSS?: React.CSSProperties
/** Styled applied to the header media element of the rendered component. */
headerMediaCSS?: ICSSInJSStyle
headerMediaCSS?: React.CSSProperties
/** Styled applied to the content element of the rendered component. */
contentCSS?: ICSSInJSStyle
contentCSS?: React.CSSProperties
/** Styled applied to the content element of the rendered component. */
contentMediaCSS?: ICSSInJSStyle
contentMediaCSS?: React.CSSProperties
/** Styled applied to the end media element of the rendered component. */
endMediaCSS?: ICSSInJSStyle
endMediaCSS?: React.CSSProperties
}

class ItemLayout extends UIComponent<WithAsProp<ItemLayoutProps>, any> {
Expand Down
Loading