xstyled

A utility-first CSS-in-JS framework built for React. 💅👩‍🎤⚡️

MIT License

Stars
2.3K
Committers
55

Bot releases are visible (Hide)

xstyled - v3.0.0

Published by gregberge over 3 years ago

xstyled v3 is focused on features.

Object states

States are now similar to breakpoints, they are specified using object syntax:

<x.button color={{ _: 'red-500', hover: 'red-300' }} />

They can be nested:

// Mixed screens and states
<x.button color={{ _: 'red-600', md: { _: 'red-500', hover: 'red-300' } }} />
// Nested states
<x.div bg={{ first: { odd: 'blue' } } } />

And they are configurable in theme:

export const theme = {
  states: {
    hover: '&:hover',
    // ...
  },
}

Learn more in states documentation.

Plugins API

xstyled can now be fully extended with plugins using a xstyled.config.js:

import { createCss, system, compose } from '@xstyled/...'
import { borderInline } from './utilities/border-inline'

export const { css, styled, x, createGlobalStyle } = createCss(
  compose(system, borderInline),
)

Learn more in documentation.

New text utility

A new text utility has been added. It is similar to fontSize excepts that it defines both font-size and line-height. It is customizabled to handle all your typography styles.

Learn more in text utility documentation.

New utilities

animationDuration, animationTimingFunction and maskSize have been added to the core.

Remove specificity

xstyled was using a trick to ensure props were more specific than component style. The props were injected in a &&, so the class was duplicated and the specificity increased. In v3, props are now injected in the correct order, it means this specificity is not longer required.

New multiple option in style

You can now use multiple to declare style that accepts multiple styles separated by a comma. For example, box-shadow:

<x.div boxShadow="light-shadow, big-shadow" />

Breaking changes

No prefixed states

States were prefixed props in v2. You can use this regular expression to find state props in your code:

((motionSafe|motionReduce|first|last|odd|even|visited|focusWithin|hover|focus|focusVisible|focusWithin|active|disabled|placeholder|checked)[A-Z])[A-Za-z]+=

Box has been removed

Box component is no longer available, you can safely replace it by x.div.

cssProperty option of style becomes css

Since the css accepts a mixin, cssProperty was no longer a good name.

getBreakpoints becomes getScreens and useBreakpoints becomes useScreens

In v1, theme section handling screens was named breakpoints, since v2 theme section is now screens. For consistency getBreakpoints becomes getScreens and useBreakpoints becomes useScreens.

th.timingFunctions becomes th.timingFunction

Every th.* utilities are singular, th.timingFunctions was a mistake.

x.extend and createX are gone

Use createCss instead.

TypeScript theme bindings

Be sure to correctly extend xstyled theme and to follow TypeScript guide.


Detail

Bug Fixes

Features

xstyled - v3.0.0-beta.0

Published by gregberge over 3 years ago

Bug Fixes

Features

BREAKING CHANGES

  • Box has been removed, "cssProperty" has been renamed "css", "getBreakpoints" has been renamed "getScreens", "useBreakpoints" has been renamed "useScreens", "th.timingFunctions" has been renamed "th.timingFunction".
  • states: states are now passed in object.
xstyled - v2.5.0

Published by gregberge over 3 years ago

Bug Fixes

Features

xstyled - v2.4.1

Published by gregberge over 3 years ago

Bug Fixes

xstyled - v2.4.0

Published by gregberge over 3 years ago

Bug Fixes

Features

xstyled - v2.3.0

Published by gregberge over 3 years ago

Bug Fixes

  • emotion: pass options through (#202) (781704c)
  • styled: use space in column-gap & row-gap (517c08e), closes #200
  • transform: confused by comments, whitespace (93cba6a)
  • types: add missing alignContent prop (eb3c47f), closes #205
  • types: invalid color prop (0660565)

Features

  • add float property (0335114), closes #192
  • add maxW, maxH, minW, minH shortcuts (fde802e), closes #199
  • durations: bind durations to theme.durations (362dea3)
  • transform: min/max widths in media queries (aa1f518)

Performance Improvements

  • add media query to benchmark (af10f5a)
xstyled - v2.2.3

Published by gregberge over 3 years ago

Bug Fixes

  • fix style merging problem (c6aa69c)
xstyled - v2.2.2

Published by gregberge over 3 years ago

Bug Fixes

  • fix & optimize style sorting (76ed20a)

Performance Improvements

xstyled - v2.2.1

Published by gregberge over 3 years ago

Bug Fixes

xstyled - v2.2.0

Published by gregberge almost 4 years ago

Bug Fixes

  • typings: fix massive type in createX (#173) (273e395)

Features

  • typings: type of colors object being more specific (#174) (379e54d)
xstyled - v2.1.0

Published by gregberge almost 4 years ago

Bug Fixes

Features

  • emotion: add preflight component to emotion (#167) (b56e6b6)
xstyled - 🚀 v2.0.0

Published by gregberge almost 4 years ago

Features

  • TypeScript typings
  • Emotion v11
  • Get rid of forwardedAs (use as instead)
  • Allow configuration of rootFontSize for rpx utilities
  • Introduce a defaultTheme
  • Add state support (motionSafe, motionReduce, first, last, odd, even, visited, checked, focusWithin, hover, focus, focusVisible, active, disabled, placeholder)
  • Support shorthand styles
  • Add gridTemplateColumns and gridTemplateRows support in theme
  • Introduce default value if value is true
  • Support string value as number for pixels and durations
  • Support <Box.{element}> syntax
  • Add transitionProperties and timingFunctions support in theme
  • Add inset support in theme
  • Support arrays for list properties in theme
  • Add getDuration getter
  • Add Preflight: a set of global style to start a project
  • Support default value in th and th.*
  • Allow to create complex style generator using style utility
  • Add aliasColorand generateHexAlphaVariants utilities
  • Add useTh and other hooks to get theme props
  • Add x.extend and createX utilities

New Utilities

  • Add svg utilities: fill, stroke
  • Add space utilties: spaceX, spaceX
  • Add sizing utilities: w, h
  • Add lists utilities: listStyleType, listStyleTypePosition
  • Add borders utilities: outline, divideX, divideY, divideXReverse, divideYReverse, divideStyle, divideColor, ring, ringInset, ringColor
  • Add typography utilities: textDecoration, textOverflow, whiteSpace
  • Add layout utilities: overflowX, overflowY, boxSizing, container, visibility, overscrollBehavior, objectFit
  • Add grid utilities: gap
  • Add tables utilities: tableLayout, borderCollapse
  • Add transitions utilities: transitionProperty, transitionDuration, transitionTimingFunction, transitionDelay
  • Add animations utilities: animation
  • Add interactivity utilities: appearance, cursor, pointerEvents, resize, userSelect
  • Add transforms utilities: transform, transformOrigin, translateX, translateY, rotate, skewX, skewY, scale, scaleX, scaleY
  • Add backgrounds utilities: backgroundAttachment, backgroundClip, gradientFrom, gradientVia, gradientTo

Breaking Changes

  • Emotion v10 is no longer supported
  • Remove default space
  • Remove default breakpoints
  • Rename breakpoints theme section to screens
  • Remove variant utility
  • Remove width and height utility (only aliases remain w and h)
  • Replace gridGap by gap
  • Remove border{direction} and border{direction}Color utilities
  • Reorganize all utilities

Read Upgrade Guide to know more about breaking changes.

xstyled - v1.19.1

Published by gregberge almost 4 years ago

Bug Fixes

  • breakpoints: multiple responsive style props (#141) (b884076)
  • prop-types: add bool option to the prop-types to use it with col and row props (#142) (3a835ba)
xstyled - v1.19.0

Published by gregberge about 4 years ago

Bug Fixes

Features

xstyled - v1.18.1

Published by gregberge about 4 years ago

Bug Fixes

  • styled-components: local storage not available (#129) (304602c)
xstyled - v1.18.0

Published by gregberge about 4 years ago

Bug Fixes

  • breakpoints: races in useViewportWidth (#114) (fc70500)

Features

  • xstyled: support multiple values in box-shadow, text-shadow (#128) (c8487fc), closes #127
xstyled - v1.17.2

Published by gregberge over 4 years ago

Bug Fixes

  • breakpoints: useThemeUp inclusive min (#113) (722d5fc)
xstyled - v1.17.1

Published by gregberge over 4 years ago

Bug Fixes

  • styled-components: fix keyframes error in v5 (ccf3469)
xstyled - v1.17.0

Published by gregberge over 4 years ago

Bug Fixes

Features

  • add border-x-x-radius, outline-style, outline-width support (693dc5d)
  • alias backgroundColor prop with bg (c23bfff), closes #89
  • support fontStyle in props (1777736), closes #91
xstyled - v1.16.0

Published by gregberge over 4 years ago

Features

  • support styled-components v5 (e1bd0eb), closes #86
  • core: add outline-color to propGetters (#82) (36d9585)
Badges
Extracted from project README
License npm package npm downloads CircleCI codecov