reflexy v1.16.1
Reflexy 
Reflexy is react components library for flexbox and responsive layouts:
- Flex - flexbox layout with paddings and margins support.
- styled/Flex - styled version of - Flexpowered by @mui.
- styled/StyledReflexyWebpackPlugin- webpack plugin for replace regular imports of- Flexwith- styled/Flex. Just import- Flexlike- import { Flex, FlexWithRef } from 'reflexy';or- import { ResponsiveFlex } from 'reflexy/responsive';and- styled/Flexwill be used instead.
- FlexWithRef-- Flexwith forwarded ref.
- TweakableElementWrapper- Wrapper for react element in order to use it with- componentprop of- Flex.
- responsive/Responsive- container with breakpoints.
- responsive/ResponsiveRender- conditional render by breakpoints.
- responsive/ResponsiveFlex - Like Flexbut with breakpoints.
- responsive/useMediaQuery- React hook for media queries.
- responsive/MediaQuery- utils for work with media queries and breakpoints.
Custom media queries
Used in CSS.
| Name | Value | 
|---|---|
| --xxs | only screen and (max-width: 479px) | 
| --xs | only screen and (min-width: 480px) and (max-width: 767px) | 
| --s | only screen and (min-width: 768px) and (max-width: 991px) | 
| --m | only screen and (min-width: 992px) and (max-width: 1279px) | 
| --l | only screen and (min-width: 1280px) and (max-width: 1919px) | 
| --xl | only screen and (min-width: 1920px) and (max-width: 2559px) | 
| --xxl | only screen and (min-width: 2560px) | 
Custom media queries can be used with [postcss-custom-media](https://github.com/postcss/postcss-custom-media#importfrom). Example of configuration with [preset-env](https://preset-env.cssdb.org/):
const exportMediaQueries = require('reflexy/responsive/exportMediaQueries');
module.exports = {
  plugins: {
    'postcss-preset-env': {
      features: {
        'custom-media-queries': {
          importFrom: [{ customMedia: exportMediaQueries() }],
        },
      },
    },
  },
};Installation
yarn add react reflexy
# or
npm install --save react reflexyIf you use styled version you should also install
@muipackages.
Reflexy has own css files so you need provide loader for css files placed in node_modules folder (only if you do not use styled version). With webpack it could be [css-loader](https://github.com/webpack-contrib/css-loader):
{
  test: /\.css$/,
  include: path.join(__dirname, 'node_modules'),
  // or
  include: /reflexy/,
  use: [
    // ...
    { loader: 'css-loader', options: { modules: true } }, // enabled css-modules is necessary
    // ...
  ],
},Flex
Usage
import { Flex, TweakableElementWrapper } from 'reflexy';
<Flex row justifyContent="center">
  ...
</Flex>
<Flex row justifyContent="center" component={TweakableElementWrapper} element={<button />}>
  ...
</Flex>
<Flex row justifyContent="center" component="button" onClick={...}>
  ...
</Flex>
<Flex row justifyContent="center" ref={ref}>
  ...
</Flex>
<Flex row justifyContent="center" component={CustomComponent} componentProp1={...} componentProp2={...}>
  ...
</Flex>
<Flex ml pb>
  ...
</Flex>;Props
Default style is just display: flex.
| Prop | Type | Description | 
|---|---|---|
| flex? | boolean | Sets displaytoflex. | 
| inline? | boolean | Sets displaytoinline-flex. | 
| row? | boolean | Sets flow-directiontorow. | 
| column? | boolean | Sets flow-directiontocolumn. Takes a precedence overrow. | 
| reverse? | boolean | Used with roworcol. Setsflow-directiontocolumn-reverseorrow-reverse. | 
| wrap? | boolean \| 'inherit' \| 'initial' \| 'unset' \| 'nowrap' \| 'wrap' \| 'wrap-reverse' | Sets flex-wrapto corresponding value. Also accepts boolean value:trueequals towrap,falseequals tonowrap. | 
| alignContent? | 'inherit' \| 'initial' \| 'unset' \| 'center' \| 'flex-start' \| 'flex-end' \| 'space-between' \| 'space-around' \| 'space-evenly' \| 'stretch' | Sets align-contentto corresponding value. | 
| alignItems? | 'inherit' \| 'initial' \| 'unset' \| 'center' \| 'flex-start' \| 'flex-end' \| 'stretch' \| 'baseline' | Sets align-itemsto corresponding value. | 
| alignSelf? | 'inherit' \| 'initial' \| 'unset' \| 'center' \| 'flex-start' \| 'flex-end' \| 'stretch' \| 'baseline' \| 'auto' \| 'initial' \| 'inherit' | Sets align-selfto corresponding value. | 
| justifyContent? | 'inherit' \| 'initial' \| 'unset' \| 'center' \| 'flex-start' \| 'flex-end' \| 'space-between' \| 'space-around' \| 'space-evenly' | Sets justify-contentto corresponding value. | 
| center? | boolean | Sets justifyContentandalignItemstocenter.justifyContentandalignItemstake a precedence overcenter. | 
| basis? | 'inherit' \| 'initial' \| 'unset' \| 'auto' \| 'content' \| 'number' | Sets flex-basisto corresponding value. | 
| grow? | 0..24 \| boolean | Sets flex-growto corresponding value.trueis equals to1,falseis equals to0. | 
| shrink? | 0..24 \| boolean | Sets flex-shrinkto corresponding value.trueis equals to1,falseis equals to0. | 
| order? | number | Sets orderto corresponding value. | 
| hfill? | boolean \| number in range 0.0 to 1.0 inclusive | Stretch by horizontal or sets width in percentage (numbers in range 0.0 to 1.0 inclusive). | 
| vfill? | boolean \| number in range 0.0 to 1.0 inclusive | Stretch by vertical or sets height in percentage (numbers in range 0.0 to 1.0 inclusive). | 
| fill? | boolean | Stretch by vertical and horizontal. | 
| shrinkByContent? | boolean | Sets min-width: 0andmin-height: 0. By default, a flex item cannot be smaller than the size of its content. The initial setting on flex items ismin-width: autoandmin-height: auto. One way to enable flex items to shrink past their content is to set a flex item tomin-width: 0ormin-height: 0.trueby default | 
| shrinkWidth? | boolean | Sets min-widthto0. Takes a precedence overshrinkByContent. | 
| shrinkHeight? | boolean | Sets min-heightto0. Takes a precedence overshrinkByContent. | 
| className? | string | CSS class name. | 
| style? | React.CSSProperties | Inline styles. | 
| component? | React.ElementType<P> | Sets custom react component as a container. Component must accept className and style through props. | 
| unit? | string | Measure unit of space | 
| mSize? | 'xs' \| 's' \| 'm' \| 'l' \| 'xl' \| 'xxl' \| number | Size of margin | 
| m? | typeof mSize \| boolean | margin. Scaling value. | 
| mt? | typeof mSize \| boolean | margin-top | 
| mr? | typeof mSize \| boolean | margin-right | 
| mb? | typeof mSize \| boolean | margin-bottom | 
| ml? | typeof mSize \| boolean | margin-left | 
| mx? | typeof mSize \| boolean | marginby x axis:margin-left&margin-right | 
| my? | typeof mSize \| boolean | marginby y axis:margin-top&margin-bottom | 
| pSize? | 'xs' \| 's' \| 'm' \| 'l' \| 'xl' \| 'xxl' \| number | Size of padding | 
| p? | typeof pSize \| boolean | padding. Scaling value. | 
| pt? | typeof pSize \| boolean | padding-top | 
| pr? | typeof pSize \| boolean | padding-right | 
| pb? | typeof pSize \| boolean | padding-bottom | 
| pl? | typeof pSize \| boolean | padding-left | 
| px? | typeof pSize \| boolean | paddingby x axis:padding-left&padding-right | 
| py? | typeof pSize \| boolean | paddingby y axis:padding-top&padding-bottom | 
Flex Statics
| Prop | Type | Description | 
|---|---|---|
| defaultUnit | string | Measure unit of space. Default: rem. | 
| defaultSize | 'xs' \| 's' \| 'm' \| 'l' \| 'xl' \| 'xxl' | Default: 'm'. | 
| defaultSizes | Record<'xs' \| 's' \| 'm' \| 'l' \| 'xl' \| 'xxl', number> | Space sizes. Default: { xs: 0.25, s: 0.5, m: 1, l: 1.5, xl: 2, xxl: 2.5 }. | 
ResponsiveFlex
Usage
import { ResponsiveFlex } from 'reflexy/responsive';
// `breakpoints` values will override default values for `row` and `order`.
<ResponsiveFlex
  row
  order={1}
  breakpoints={{
    l: { column: true, order: 2 },
    xxs: { alignItems: 'center', order: 4 },
  }}
>
  ...
</ResponsiveFlex>;Props
All props of [Flex](#Flex) and:
| Prop | Type | Description | 
|---|---|---|
| merge? | boolean \| BreakpointsMergeType | down- merge from top to down until current view size.top- merge from down to top until current view size.truetreats asdown.false- no merge, use only exact breakpoint. Defaulttrue. | 
| breakpoints | { [P in ViewSize.Keys]?: FlexAllProps<C> } | Props per breakpoint. | 
ViewSize
Same as [Custom media queries](#mq) but names without prefix --.
License
[MIT](https://opensource.org/licenses/mit-license.php)
9 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago