atomic-layout
Advanced tools
Comparing version 0.9.7 to 0.9.8
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("styled-components"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("react");const n={defaultUnit:"px",defaultBehavior:"up",defaultBreakpointName:"xs",breakpoints:{xs:{maxWidth:"575px"},sm:{minWidth:"576px",maxWidth:"767px"},md:{minWidth:"768px",maxWidth:"991px"},lg:{minWidth:"992px",maxWidth:"1199px"},xl:{minWidth:"1200px"}}};function o(e,t){if(!e)throw new Error(t)}function a(e,t){e||console.warn(t)}var i=new class{constructor(e){return this.defaultUnit=n.defaultUnit,this.defaultBehavior=n.defaultBehavior,this.breakpoints=n.breakpoints,this.defaultBreakpointName=n.defaultBreakpointName,this.isConfigureCalled=!1,e?this.configure(e,!1):this}configure(e,t=!0){return t&&a(!this.isConfigureCalled,"Failed to configure Layout: do not call `Layout.configure()` more than once. Layout configuration must remain consistent throughout the application."),o(e&&"object"==typeof e,`Failed to configure Layout: expected an options Object, but got: ${e}.`),Object.keys(e||{}).forEach(t=>{this[t]=e[t]}),o(this.breakpoints,"Failed to configure Layout: expected to have at least one breakpoint specified, but got none."),o(this.breakpoints.hasOwnProperty(this.defaultBreakpointName),`Failed to configure Layout: cannot use "${this.defaultBreakpointName}" as the default breakpoint (breakpoint not found).`),o(this.defaultBreakpointName,`Failed to configure Layout: expected "defaultBreakpointName" property set, but got: ${this.defaultBreakpointName}.`),this.isConfigureCalled=t,this}};function s(...e){return e.reduce((e,t)=>(...r)=>e(t(...r)))}function p(e){return null!=e}function u(e){if(!p(e))return"";return`${e}${"number"==typeof e&&0!==e?i.defaultUnit:""}`}const l=["/","auto"];function c(e){const t=/^[0-9]/.test(e),r=l.includes(e);return!t&&!r}const m=s(e=>{const t=[],r=[];return e.forEach(e=>{c(e)?t.push(e):r.push(e)}),[t.length>0?`'${t.join(" ")}'`:"",r.join(" ")].filter(Boolean).join(" ")},e=>e.split(" "),e=>e.replace(/'+/gm,""),e=>e.trim()),d=s(e=>e.join("\n"),e=>e.map(m),e=>e.split("\n"),e=>e.trim()),f={area:{props:["grid-area"]},areas:{props:["grid-template-areas"],transformValue:d},template:{props:["grid-template"],transformValue:d},templateCols:{props:["grid-template-columns"]},templateRows:{props:["grid-template-rows"]},col:{props:["grid-column"]},colStart:{props:["grid-column-start"]},colEnd:{props:["grid-column-end"]},row:{props:["grid-row"]},rowStart:{props:["grid-row-start"]},rowEnd:{props:["grid-row-end"]},gap:{props:["grid-gap"],transformValue:u},gapCol:{props:["grid-column-gap"],transformValue:u},gapRow:{props:["grid-row-gap"],transformValue:u},gutter:{props:["grid-gap"],transformValue:u},gutterCol:{props:["grid-column-gap"],transformValue:u},gutterRow:{props:["grid-row-gap"],transformValue:u},autoRows:{props:["grid-auto-rows"],transformValue:u},autoCols:{props:["grid-auto-columns"],transformValue:u},autoFlow:{props:["grid-auto-flow"]},align:{props:["align-self"]},alignItems:{props:["align-items"]},justify:{props:["justify-self"]},justifyItems:{props:["justify-items"]},justifyContent:{props:["justify-content"]},place:{props:["place-self"]},placeItems:{props:["place-items"]},placeContent:{props:["place-content"]},flexDirection:{props:["flex-direction"]},flexShrink:{props:["flex-shrink"]},flexGrow:{props:["flex-grow"]},flexWrap:{props:["flex-wrap"]},height:{props:["height"],transformValue:u},minHeight:{props:["min-height"],transformValue:u},maxHeight:{props:["max-height"],transformValue:u},width:{props:["width"],transformValue:u},minWidth:{props:["min-width"],transformValue:u},maxWidth:{props:["max-width"],transformValue:u},margin:{props:["margin"],transformValue:u},marginTop:{props:["margin-top"],transformValue:u},marginRight:{props:["margin-right"],transformValue:u},marginBottom:{props:["margin-bottom"],transformValue:u},marginLeft:{props:["margin-left"],transformValue:u},marginVertical:{props:["margin-top","margin-bottom"],transformValue:u},marginHorizontal:{props:["margin-right","margin-left"],transformValue:u},padding:{props:["padding"],transformValue:u},paddingTop:{props:["padding-top"],transformValue:u},paddingRight:{props:["padding-right"],transformValue:u},paddingBottom:{props:["padding-bottom"],transformValue:u},paddingLeft:{props:["padding-left"],transformValue:u},paddingVertical:{props:["padding-top","padding-bottom"],transformValue:u},paddingHorizontal:{props:["padding-right","padding-left"],transformValue:u}};function g(e){return e.slice(0,1).toLowerCase()+e.slice(1,e.length)}function h(e){const t=Object.keys(i.breakpoints).join("|"),r=["down","only"].join("|"),n=new RegExp(`(${t})$`,"gi"),o=new RegExp(`(${r})$`,"gi"),a=e.match(o),s=a?a[0]:"",p=e.replace(s,"").match(n),u=p?p[0]:"",l=e.replace(u,"").replace(s,""),c=u?g(u):i.defaultBreakpointName,m=c===i.defaultBreakpointName;return{originPropName:e,purePropName:l,behavior:s?g(s):i.defaultBehavior,breakpoint:{name:c,isDefault:m}}}function b(e){return e.replace(/[A-Z]/g,e=>`-${e}`.toLowerCase())}function x(e){return Object.entries(e).filter(([e,t])=>p(t)).map(([e,t])=>[b(e),t])}const y=e=>t=>t.filter(([t])=>((e,t)=>{const[r,n]=e.split("-");return!["height","width"].includes(n)||"min"===r&&["up","only"].includes(t)||"max"===r&&["down","only"].includes(t)})(t,e)),k=e=>t=>t.map(e).join(" and ");function w(e,t){return s(k(([e,t])=>`(${e}:${String(u(t))})`),y(t),x)(e)}const j=(e,t,r,n)=>{const o=e.map(e=>`${e}:${String(t)};`).join(""),a=i.breakpoints[r.name];return a&&!(r.isDefault&&n===i.defaultBehavior)?`@media ${w(a,n)} {${o}}`:o};function v(e){return Object.keys(e).map(h).filter(({purePropName:e})=>f.hasOwnProperty(e)).filter(({originPropName:t})=>p(e[t])).map(({purePropName:t,originPropName:r,breakpoint:n,behavior:o})=>{const{props:a,transformValue:i}=f[t],s=e[r],p=i?i(s):s;return j(a,p,n,o)}).join(" ")}const V=t.div` | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("styled-components"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("react");const n={defaultUnit:"px",defaultBehavior:"up",defaultBreakpointName:"xs",breakpoints:{xs:{maxWidth:"575px"},sm:{minWidth:"576px",maxWidth:"767px"},md:{minWidth:"768px",maxWidth:"991px"},lg:{minWidth:"992px",maxWidth:"1199px"},xl:{minWidth:"1200px"}}};function o(e,t){if(!e)throw new Error(t)}function a(e,t){e||console.warn(t)}var i=new class{constructor(e){return this.defaultUnit=n.defaultUnit,this.defaultBehavior=n.defaultBehavior,this.breakpoints=n.breakpoints,this.defaultBreakpointName=n.defaultBreakpointName,this.isConfigureCalled=!1,e?this.configure(e,!1):this}configure(e,t=!0){return t&&a(!this.isConfigureCalled,"Failed to configure Layout: do not call `Layout.configure()` more than once. Layout configuration must remain consistent throughout the application."),o(e&&"object"==typeof e,`Failed to configure Layout: expected an options Object, but got: ${e}.`),Object.keys(e||{}).forEach(t=>{this[t]=e[t]}),o(this.breakpoints,"Failed to configure Layout: expected to have at least one breakpoint specified, but got none."),o(this.breakpoints.hasOwnProperty(this.defaultBreakpointName),`Failed to configure Layout: cannot use "${this.defaultBreakpointName}" as the default breakpoint (breakpoint not found).`),o(this.defaultBreakpointName,`Failed to configure Layout: expected "defaultBreakpointName" property set, but got: ${this.defaultBreakpointName}.`),this.isConfigureCalled=t,this}};function s(...e){return e.reduce((e,t)=>(...r)=>e(t(...r)))}function p(e){return null!=e}function u(e){if(!p(e))return"";return`${e}${"number"==typeof e&&0!==e?i.defaultUnit:""}`}const l=["/","auto"];function c(e){const t=/^[0-9]/.test(e),r=l.includes(e);return!t&&!r}const m=s(e=>{const t=[],r=[];return e.forEach(e=>{c(e)?t.push(e):r.push(e)}),[t.length>0?`'${t.join(" ")}'`:"",r.join(" ")].filter(Boolean).join(" ")},e=>e.split(" "),e=>e.replace(/'+/gm,""),e=>e.trim()),d=s(e=>e.join("\n"),e=>e.map(m),e=>e.split("\n"),e=>e.trim()),f={area:{props:["grid-area"]},areas:{props:["grid-template-areas"],transformValue:d},template:{props:["grid-template"],transformValue:d},templateCols:{props:["grid-template-columns"]},templateRows:{props:["grid-template-rows"]},col:{props:["grid-column"]},colStart:{props:["grid-column-start"]},colEnd:{props:["grid-column-end"]},row:{props:["grid-row"]},rowStart:{props:["grid-row-start"]},rowEnd:{props:["grid-row-end"]},gap:{props:["grid-gap"],transformValue:u},gapCol:{props:["grid-column-gap"],transformValue:u},gapRow:{props:["grid-row-gap"],transformValue:u},gutter:{props:["grid-gap"],transformValue:u},gutterCol:{props:["grid-column-gap"],transformValue:u},gutterRow:{props:["grid-row-gap"],transformValue:u},autoRows:{props:["grid-auto-rows"],transformValue:u},autoCols:{props:["grid-auto-columns"],transformValue:u},autoFlow:{props:["grid-auto-flow"]},align:{props:["align-self"]},alignItems:{props:["align-items"]},alignContent:{props:["align-content"]},justify:{props:["justify-self"]},justifyItems:{props:["justify-items"]},justifyContent:{props:["justify-content"]},place:{props:["place-self"]},placeItems:{props:["place-items"]},placeContent:{props:["place-content"]},flexDirection:{props:["flex-direction"]},flexShrink:{props:["flex-shrink"]},flexGrow:{props:["flex-grow"]},flexWrap:{props:["flex-wrap"]},height:{props:["height"],transformValue:u},minHeight:{props:["min-height"],transformValue:u},maxHeight:{props:["max-height"],transformValue:u},width:{props:["width"],transformValue:u},minWidth:{props:["min-width"],transformValue:u},maxWidth:{props:["max-width"],transformValue:u},margin:{props:["margin"],transformValue:u},marginTop:{props:["margin-top"],transformValue:u},marginRight:{props:["margin-right"],transformValue:u},marginBottom:{props:["margin-bottom"],transformValue:u},marginLeft:{props:["margin-left"],transformValue:u},marginVertical:{props:["margin-top","margin-bottom"],transformValue:u},marginHorizontal:{props:["margin-right","margin-left"],transformValue:u},padding:{props:["padding"],transformValue:u},paddingTop:{props:["padding-top"],transformValue:u},paddingRight:{props:["padding-right"],transformValue:u},paddingBottom:{props:["padding-bottom"],transformValue:u},paddingLeft:{props:["padding-left"],transformValue:u},paddingVertical:{props:["padding-top","padding-bottom"],transformValue:u},paddingHorizontal:{props:["padding-right","padding-left"],transformValue:u}};function g(e){return e.slice(0,1).toLowerCase()+e.slice(1,e.length)}function h(e){const t=Object.keys(i.breakpoints).join("|"),r=["down","only"].join("|"),n=new RegExp(`(${t})$`,"gi"),o=new RegExp(`(${r})$`,"gi"),a=e.match(o),s=a?a[0]:"",p=e.replace(s,"").match(n),u=p?p[0]:"",l=e.replace(u,"").replace(s,""),c=u?g(u):i.defaultBreakpointName,m=c===i.defaultBreakpointName;return{originPropName:e,purePropName:l,behavior:s?g(s):i.defaultBehavior,breakpoint:{name:c,isDefault:m}}}function b(e){return e.replace(/[A-Z]/g,e=>`-${e}`.toLowerCase())}function x(e){return Object.entries(e).filter(([e,t])=>p(t)).map(([e,t])=>[b(e),t])}const y=e=>t=>t.filter(([t])=>((e,t)=>{const[r,n]=e.split("-");return!["height","width"].includes(n)||"min"===r&&["up","only"].includes(t)||"max"===r&&["down","only"].includes(t)})(t,e)),k=e=>t=>t.map(e).join(" and ");function w(e,t){return s(k(([e,t])=>`(${e}:${String(u(t))})`),y(t),x)(e)}const j=(e,t,r,n)=>{const o=e.map(e=>`${e}:${String(t)};`).join(""),a=i.breakpoints[r.name];return a&&!(r.isDefault&&n===i.defaultBehavior)?`@media ${w(a,n)} {${o}}`:o};function v(e){return Object.keys(e).map(h).filter(({purePropName:e})=>f.hasOwnProperty(e)).filter(({originPropName:t})=>p(e[t])).map(({purePropName:t,originPropName:r,breakpoint:n,behavior:o})=>{const{props:a,transformValue:i}=f[t],s=e[r],p=i?i(s):s;return j(a,p,n,o)}).join(" ")}const V=t.div` | ||
display: ${({flex:e,inline:t})=>e?t?"inline-flex":"flex":t?"inline-block":"block"}; | ||
@@ -3,0 +3,0 @@ |
@@ -59,8 +59,9 @@ import styled from 'styled-components'; | ||
if (Object.getOwnPropertySymbols) { | ||
keys.push.apply(keys, Object.getOwnPropertySymbols(object)); | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
if (enumerableOnly) keys = keys.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
return keys; | ||
@@ -71,4 +72,5 @@ } | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
ownKeys(source, true).forEach(function (key) { | ||
@@ -78,6 +80,6 @@ _defineProperty(target, key, source[key]); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(arguments[i])); | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(arguments[i], key)); | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
@@ -459,2 +461,5 @@ } | ||
}, | ||
alignContent: { | ||
props: ['align-content'] | ||
}, | ||
justify: { | ||
@@ -1408,3 +1413,4 @@ props: ['justify-self'] | ||
/** | ||
* Executes a given callback on debounced window resize. | ||
* Executes a callback on viewport change (window resize). | ||
* Callback calls are debounced by default. | ||
*/ | ||
@@ -1424,2 +1430,7 @@ | ||
/** | ||
* Executes a given callback upon any breakpoint change. | ||
* Callback calls are debounced by default. | ||
*/ | ||
var useBreakpointChange = function useBreakpointChange(callback, debounceDuration) { | ||
@@ -1426,0 +1437,0 @@ var breakpoints = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Layout$1.breakpoints; |
{ | ||
"name": "atomic-layout", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"description": "Physical representation of layout composition to create declarative, responsive layouts in React.", | ||
@@ -26,3 +26,3 @@ "license": "MIT", | ||
"cypress": "node_modules/.bin/cypress open --env envName=dev", | ||
"cypress:cli": "node_modules/.bin/cypress run --spec cypress/integration/index.js --browser chrome", | ||
"cypress:cli": "node_modules/.bin/cypress run --spec examples/all.test.js --browser chrome --env envName=ci", | ||
"test:unit": "cross-env BABEL_ENV=test jest --runInBand", | ||
@@ -74,20 +74,20 @@ "test:e2e": "yarn cypress:cli", | ||
"devDependencies": { | ||
"@babel/core": "^7.5.0", | ||
"@babel/plugin-proposal-class-properties": "^7.5.0", | ||
"@babel/core": "^7.5.5", | ||
"@babel/plugin-proposal-class-properties": "^7.5.5", | ||
"@babel/plugin-proposal-export-default-from": "^7.5.2", | ||
"@babel/plugin-proposal-export-namespace-from": "^7.5.2", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.5.2", | ||
"@babel/preset-env": "^7.5.2", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.5.5", | ||
"@babel/preset-env": "^7.5.5", | ||
"@babel/preset-react": "^7.0.0", | ||
"@babel/preset-typescript": "^7.1.0", | ||
"@cypress/webpack-preprocessor": "^4.1.0", | ||
"@storybook/addon-actions": "^5.1.9", | ||
"@storybook/addon-links": "^5.1.9", | ||
"@storybook/react": "^5.1.9", | ||
"@testing-library/jest-dom": "^4.0.0", | ||
"@storybook/addon-actions": "5.1.9", | ||
"@storybook/addon-links": "5.1.9", | ||
"@storybook/react": "5.1.9", | ||
"@testing-library/jest-dom": "^4.1.0", | ||
"@testing-library/react": "^8.0.4", | ||
"@types/jest": "^24.0.15", | ||
"@types/react": "^16.8.23", | ||
"@types/react-dom": "^16.0.11", | ||
"@types/styled-components": "^4.1.16", | ||
"@types/jest": "^24.0.18", | ||
"@types/react": "^16.9.2", | ||
"@types/react-dom": "^16.9.0", | ||
"@types/styled-components": "^4.1.18", | ||
"@zerollup/ts-transform-paths": "^1.7.3", | ||
@@ -99,8 +99,8 @@ "babel-core": "^7.0.0-bridge.0", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.4", | ||
"coveralls": "^3.0.6", | ||
"cross-env": "^5.2.0", | ||
"cypress": "^3.3.2", | ||
"husky": "^3.0.0", | ||
"jest": "^24.8.0", | ||
"lint-staged": "^9.1.0", | ||
"cypress": "^3.4.1", | ||
"husky": "^3.0.4", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.2.3", | ||
"match-media-mock": "^0.1.1", | ||
@@ -111,5 +111,5 @@ "prettier": "^1.18.2", | ||
"rimraf": "^2.6.3", | ||
"rollup": "^1.16.7", | ||
"rollup": "^1.20.1", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.0.1", | ||
"rollup-plugin-commonjs": "^10.0.2", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
@@ -125,3 +125,3 @@ "rollup-plugin-replace": "^2.2.0", | ||
"tslib": "^1.10.0", | ||
"tslint": "^5.18.0", | ||
"tslint": "^5.19.0", | ||
"tslint-config-prettier": "^1.17.0", | ||
@@ -128,0 +128,0 @@ "tslint-react": "^4.0.0", |
import { Breakpoints } from "../const/defaultOptions"; | ||
/** | ||
* Executes a given callback upon any breakpoint change. | ||
* Callback calls are debounced by default. | ||
*/ | ||
declare const useBreakpointChange: (callback: (breakpointName: string) => void, debounceDuration?: number, breakpoints?: Breakpoints) => void; | ||
export default useBreakpointChange; |
/** | ||
* Executes a given callback on debounced window resize. | ||
* Executes a callback on viewport change (window resize). | ||
* Callback calls are debounced by default. | ||
*/ | ||
declare const useViewportChange: (callback: () => void, debounceDuration?: number) => void; | ||
export default useViewportChange; |
@@ -1,1 +0,1 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("styled-components"),require("react")):"function"==typeof define&&define.amd?define(["exports","styled-components","react"],e):e((r=r||self).AtomicLayout={},r.styled,r.React)}(this,function(r,e,n){"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}function o(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,t.key,t)}}function a(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function i(r,e){var n=Object.keys(r);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(r)),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),n}function u(r){for(var e=1;e<arguments.length;e++)if(e%2){var n=null!=arguments[e]?arguments[e]:{};i(n,!0).forEach(function(e){a(r,e,n[e])})}else Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(arguments[e])):i(n).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(arguments[e],n))});return r}function c(r,e){if(null==r)return{};var n,t,o=function(r,e){if(null==r)return{};var n,t,o={},a=Object.keys(r);for(t=0;t<a.length;t++)n=a[t],e.indexOf(n)>=0||(o[n]=r[n]);return o}(r,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(t=0;t<a.length;t++)n=a[t],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(r,n)&&(o[n]=r[n])}return o}function p(r,e){return e||(e=r.slice(0)),Object.freeze(Object.defineProperties(r,{raw:{value:Object.freeze(e)}}))}function f(r,e){return l(r)||function(r,e){var n=[],t=!0,o=!1,a=void 0;try{for(var i,u=r[Symbol.iterator]();!(t=(i=u.next()).done)&&(n.push(i.value),!e||n.length!==e);t=!0);}catch(r){o=!0,a=r}finally{try{t||null==u.return||u.return()}finally{if(o)throw a}}return n}(r,e)||m()}function s(r){return function(r){if(Array.isArray(r)){for(var e=0,n=new Array(r.length);e<r.length;e++)n[e]=r[e];return n}}(r)||d(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function l(r){if(Array.isArray(r))return r}function d(r){if(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r))return Array.from(r)}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}e=e&&e.hasOwnProperty("default")?e.default:e;var g={defaultUnit:"px",defaultBehavior:"up",defaultBreakpointName:"xs",breakpoints:{xs:{maxWidth:"575px"},sm:{minWidth:"576px",maxWidth:"767px"},md:{minWidth:"768px",maxWidth:"991px"},lg:{minWidth:"992px",maxWidth:"1199px"},xl:{minWidth:"1200px"}}};function h(r,e){if(!r)throw new Error(e)}function v(r,e){r||console.warn(e)}var b=new(function(){function r(e){return function(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),this.defaultUnit=g.defaultUnit,this.defaultBehavior=g.defaultBehavior,this.breakpoints=g.breakpoints,this.defaultBreakpointName=g.defaultBreakpointName,this.isConfigureCalled=!1,e?this.configure(e,!1):this}var e,n,a;return e=r,(n=[{key:"configure",value:function(r){var e=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return n&&v(!this.isConfigureCalled,"Failed to configure Layout: do not call `Layout.configure()` more than once. Layout configuration must remain consistent throughout the application."),h(r&&"object"===t(r),"Failed to configure Layout: expected an options Object, but got: ".concat(r,".")),Object.keys(r||{}).forEach(function(n){e[n]=r[n]}),h(this.breakpoints,"Failed to configure Layout: expected to have at least one breakpoint specified, but got none."),h(this.breakpoints.hasOwnProperty(this.defaultBreakpointName),'Failed to configure Layout: cannot use "'.concat(this.defaultBreakpointName,'" as the default breakpoint (breakpoint not found).')),h(this.defaultBreakpointName,'Failed to configure Layout: expected "defaultBreakpointName" property set, but got: '.concat(this.defaultBreakpointName,".")),this.isConfigureCalled=n,this}}])&&o(e.prototype,n),a&&o(e,a),r}());function y(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];return e.reduce(function(r,e){return function(){return r(e.apply(void 0,arguments))}})}function w(r){return null!=r}function j(r){if(!w(r))return"";var e="number"==typeof r&&0!==r?b.defaultUnit:"";return"".concat(r).concat(e)}var k=["/","auto"];function x(r){var e=/^[0-9]/.test(r),n=k.includes(r);return!e&&!n}var O=y(function(r){var e=[],n=[];return r.forEach(function(r){x(r)?e.push(r):n.push(r)}),[e.length>0?"'".concat(e.join(" "),"'"):"",n.join(" ")].filter(Boolean).join(" ")},function(r){return r.split(" ")},function(r){return r.replace(/'+/gm,"")},function(r){return r.trim()}),V=y(function(r){return r.join("\n")},function(r){return r.map(O)},function(r){return r.split("\n")},function(r){return r.trim()}),P={area:{props:["grid-area"]},areas:{props:["grid-template-areas"],transformValue:V},template:{props:["grid-template"],transformValue:V},templateCols:{props:["grid-template-columns"]},templateRows:{props:["grid-template-rows"]},col:{props:["grid-column"]},colStart:{props:["grid-column-start"]},colEnd:{props:["grid-column-end"]},row:{props:["grid-row"]},rowStart:{props:["grid-row-start"]},rowEnd:{props:["grid-row-end"]},gap:{props:["grid-gap"],transformValue:j},gapCol:{props:["grid-column-gap"],transformValue:j},gapRow:{props:["grid-row-gap"],transformValue:j},gutter:{props:["grid-gap"],transformValue:j},gutterCol:{props:["grid-column-gap"],transformValue:j},gutterRow:{props:["grid-row-gap"],transformValue:j},autoRows:{props:["grid-auto-rows"],transformValue:j},autoCols:{props:["grid-auto-columns"],transformValue:j},autoFlow:{props:["grid-auto-flow"]},align:{props:["align-self"]},alignItems:{props:["align-items"]},justify:{props:["justify-self"]},justifyItems:{props:["justify-items"]},justifyContent:{props:["justify-content"]},place:{props:["place-self"]},placeItems:{props:["place-items"]},placeContent:{props:["place-content"]},flexDirection:{props:["flex-direction"]},flexShrink:{props:["flex-shrink"]},flexGrow:{props:["flex-grow"]},flexWrap:{props:["flex-wrap"]},height:{props:["height"],transformValue:j},minHeight:{props:["min-height"],transformValue:j},maxHeight:{props:["max-height"],transformValue:j},width:{props:["width"],transformValue:j},minWidth:{props:["min-width"],transformValue:j},maxWidth:{props:["max-width"],transformValue:j},margin:{props:["margin"],transformValue:j},marginTop:{props:["margin-top"],transformValue:j},marginRight:{props:["margin-right"],transformValue:j},marginBottom:{props:["margin-bottom"],transformValue:j},marginLeft:{props:["margin-left"],transformValue:j},marginVertical:{props:["margin-top","margin-bottom"],transformValue:j},marginHorizontal:{props:["margin-right","margin-left"],transformValue:j},padding:{props:["padding"],transformValue:j},paddingTop:{props:["padding-top"],transformValue:j},paddingRight:{props:["padding-right"],transformValue:j},paddingBottom:{props:["padding-bottom"],transformValue:j},paddingLeft:{props:["padding-left"],transformValue:j},paddingVertical:{props:["padding-top","padding-bottom"],transformValue:j},paddingHorizontal:{props:["padding-right","padding-left"],transformValue:j}};function B(r){return r.slice(0,1).toLowerCase()+r.slice(1,r.length)}function S(r){var e=Object.keys(b.breakpoints).join("|"),n=["down","only"].join("|"),t=new RegExp("(".concat(e,")$"),"gi"),o=new RegExp("(".concat(n,")$"),"gi"),a=r.match(o),i=a?a[0]:"",u=r.replace(i,"").match(t),c=u?u[0]:"",p=r.replace(c,"").replace(i,""),f=c?B(c):b.defaultBreakpointName,s=f===b.defaultBreakpointName;return{originPropName:r,purePropName:p,behavior:i?B(i):b.defaultBehavior,breakpoint:{name:f,isDefault:s}}}function N(r){return Object.entries(r).filter(function(r){var e=f(r,2);e[0];return w(e[1])}).map(function(r){var e,n=f(r,2),t=n[0],o=n[1];return[(e=t,e.replace(/[A-Z]/g,function(r){return"-".concat(r).toLowerCase()})),o]})}var E=function(r){return function(e){return e.filter(function(e){return function(r,e){var n=f(r.split("-"),2),t=n[0],o=n[1];return!["height","width"].includes(o)||"min"===t&&["up","only"].includes(e)||"max"===t&&["down","only"].includes(e)}(f(e,1)[0],r)})}},C=function(r){return function(e){return e.map(r).join(" and ")}};function L(r,e){return y(C(function(r){var e=f(r,2),n=e[0],t=e[1];return"(".concat(n,":").concat(String(j(t)),")")}),E(e),N)(r)}var A=function(r,e,n,t){var o=r.map(function(r){return"".concat(r,":").concat(String(e),";")}).join(""),a=b.breakpoints[n.name];return a&&!(n.isDefault&&t===b.defaultBehavior)?"@media ".concat(L(a,t)," {").concat(o,"}"):o};function W(r){return Object.keys(r).map(S).filter(function(r){var e=r.purePropName;return P.hasOwnProperty(e)}).filter(function(e){var n=e.originPropName;return w(r[n])}).map(function(e){var n=e.purePropName,t=e.originPropName,o=e.breakpoint,a=e.behavior,i=P[n],u=i.props,c=i.transformValue,p=r[t],f=c?c(p):p;return A(u,f,o,a)}).join(" ")}function R(){var r=p(["\n display: ",";\n\n && {\n ",";\n }\n"]);return R=function(){return r},r}var F=e.div(R(),function(r){var e=r.flex,n=r.inline;return e?n?"inline-flex":"flex":n?"inline-block":"block"},W);var D=function(r){var e=r.children,t=c(r,["children"]),o=n.useMemo(function(){return function(r){return y(C(function(r){var e=f(r,2),n=e[0],t=e[1],o=/^\d/.test(String(t))?j(t):t;return"(".concat(n,":").concat(o,")")}),N)(r)}(t)},[t]),a=f(n.useState(!1),2),i=a[0],u=a[1],p=function(r){u(r.matches)};return n.useEffect(function(){var r=matchMedia(o);return p(r),r.addListener(p),function(){return r.removeListener(p)}},Object.keys(t)),e(i)};function M(r,e){return function(n){return r(n)?e(n):n}}function T(r){return function(e){return r.apply(null,e)}}function z(r){var e=r.match(/^(min|max)/);return e?e[0]:""}function I(r,e,n){var t=e.behavior,o=r.behavior,i="up"===t,c=t===o,p=i&&"down"===o,f=i,s=u({},e,{},r);return Object.keys(s).reduce(function(t,o){var i=s[o],l=z(o);if("behavior"===o&&!n&&f&&(i="down"),"max"===l&&!n&&f){var d=r[o.replace(/^max/,"min")];i="calc(".concat(j(d)," - 1px)")}return"min"===l&&(n?(c||p)&&(i=e[o]):f&&(i=e[o])),u({},t,a({},o,i))},{behavior:g.defaultBehavior})}function U(r){return Object.keys(r).reduce(function(e,n){return u({},e,a({},n,"max"===z(n)?void 0:r[n]))},{})}var H=function(r){return r.replace(/^min|max/,"_")};var _=function(r,e){return function(r){var n,t=l(n=r)||d(n)||m(),o=(t[0],t.slice(1));return[e(r)].concat(s(o))}},q=function(r){return function(e,n,t,o){var a,i,p,f=t===o.length-1,s=n.areas,l=n.behavior,d=n.breakpoint,m=s.includes(r),g=e[e.length-1],h=u({},d,{behavior:l}),v=g||{behavior:""},b=(v.behavior,c(v,["behavior"]));return[h,g,m,f,Boolean(g)&&(a=b,i=d,(p=Object.keys(a).concat(Object.keys(i))).every(function(r,e){var n=H(r);return n===H(p[e-1]||n)})),e]}},$=function(r){var e=f(r,5);e[0],e[1],e[2],e[3];return e[4]},G=function(r){var e=f(r,4),n=e[0];e[1],e[2];return e[3]&&"up"===n.behavior},Q=function(r){var e=f(r,6),n=e[0],t=e[1],o=e[2],a=(e[3],e[4]),i=e[5],u=(t||{behavior:""}).behavior,c=n.behavior,p="up"===u,s=o&&(u===c||p&&"down"===c);a||(s=!1);var l,d=[n];return o||(d=p?[n,null]:[null],p&&(s=!0)),(s?(l=i).slice(0,l.length-1):i).concat(d)},Z=function(r,e){return e.reduce(y(Q,M(G,_(0,T(U))),M($,_(0,T(I))),q(r)),[])},J=function(r,e){var t=function(t){var o=t.children,a=c(t,["children"]);return e.filter(Boolean).reduce(function(e,t,i){t.behavior;var u=c(t,["behavior"]);return e.concat(n.createElement(D,Object.assign({},u,{key:"".concat(r.displayName,"_").concat(i)}),function(e){return e&&n.createElement(r,Object.assign({},a),o)}))},[])};return t.displayName="Placeholder(".concat(r.displayName,")"),t},K=function(r){return function(e){return n.createElement(F,Object.assign({area:r},e))}};var X,Y,rr=y(function(r){return r.sort()},function(r){return Array.from(new Set(r))},function(r){return r.filter(x)},function(r){return r.filter(Boolean)},function(r){return r.split(" ")},function(r){return r.replace(/\s+/g," ")},function(r){return r.replace(/\r?\n|\'+/g," ")}),er=y((X=function(r){return function(r){var e=r.length,n=0,t=0;if(e>0)for(;t<e;)n=(n<<5)-n+r.charCodeAt(t++)|0;return n}(Object.entries(r).reduce(function(r,e){var n=f(e,2),t=n[0],o=n[1];return r.concat("".concat(t,":").concat(o.join()))},[]).join()).toString()},Y={},function(r){return function(){var e=X.apply(void 0,arguments);return e in Y||(Y[e]=r.apply(void 0,arguments)),Y[e]}})(y(function(r){var e=r.areas,n=r.templates,o=e.reduce(function(r,e){var t=Z(e,n),o=1===t.length&&t.every(function(r){return!r.minWidth&&!r.maxWidth}),i=K(e),c=e.replace(/^./,function(r){return r.toUpperCase()});return i.displayName=c,u({},r,a({},c,o?i:J(i,t)))},{});return"undefined"==typeof Proxy?o:new Proxy(o,{get:function(r,e){return e in r||"symbol"===t(e)?r[e]:function(){return null}}})},function(r){var e=Object.entries(r).reduce(function(r,e){var n=f(e,2),t=n[0],o=n[1],a=S(t),i=a.breakpoint,u=a.behavior;return{areas:r.areas.concat(o),templates:r.templates.concat({breakpoint:b.breakpoints[i.name],behavior:u,areas:o})}},{areas:[],templates:[]}),n=e.areas,t=e.templates;return{areas:Array.from(new Set(n)),templates:t}})),function(r){return Object.keys(r).filter(function(r){var e=S(r).purePropName;return["areas","template"].includes(e)}).reduce(function(e,n){return u({},e,a({},n,rr(r[n])))},{})});function nr(){var r=p(["\n && {\n ",";\n display: ",";\n }\n"]);return nr=function(){return r},r}var tr=e.div(nr(),W,function(r){return r.inline?"inline-grid":"grid"});function or(r){return Object.entries(r).map(function(r){var e=f(r,2),n=e[0],t=e[1];return[z(n),n,t]}).filter(function(r){return"max"!==f(r,1)[0]}).reduce(function(r,e){var n=f(e,3),t=n[0],o=n[1],i=n[2],c="min"===t,p=c?o.replace(/^min/,"max"):o,s=f(/(\d+)(.+)?/.exec(i),3),l=s[1],d=s[2],m=c?parseFloat(l)-1:l;return u({},r,a({},p,d?"".concat(m).concat(d):m))},{})}var ar=function(r){return"string"==typeof r?b.breakpoints[r]:r};function ir(r){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];var i=function(){return e=null,r.apply(void 0,o)};clearTimeout(e),e=setTimeout(i,n)}}var ur,cr,pr=function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,t=ir(r,e);n.useEffect(function(){return t(),window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}},[])},fr=function(r,e){var n,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b.breakpoints;pr(function(){var e=Object.keys(t).find(function(r){var e=L(t[r],"only");return matchMedia(e).matches});n!==e&&(r(e),n=e)},e)},sr=(ur=b.breakpoints,cr=Object.keys(ur),function(r,e){var n=Object.keys(r).filter(function(r){var e=cr.includes(r);return e||console.warn('useBreakpoints: Breakpoint "%s" is not found. Add it via "Layout.configure()", or use one of the existing breakpoints (%s).',r,cr.join(", ")),e}).find(function(r){var e=ur[r],n=L(e,"only");return e&&matchMedia(n).matches});return n?r[n]:e});r.Box=F,r.Composition=function(r){var e=r.children,o=c(r,["children"]),a=er(o),i=Object.keys(a).length>0,u=t(e),p="function"===u;return v(!(i&&!p),"Failed to render 'Composition' with template areas [\"".concat(Object.keys(a).join('", "'),'"]: expected children to be a function, but got: ').concat(u,". Please provide render function as children, or remove assigned template props.")),n.createElement(tr,Object.assign({},o),i&&p?e(a):e)},r.MediaQuery=D,r.Only=function(r){var e=r.children,t=r.except,o=r.for,a=r.from,i=r.to,p=function(r,e){return function(){for(var t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];var i=J(F,o);return n.createElement(i,Object.assign({},e),r)}}(e,c(r,["children","except","for","from","to"]));if(o)return p(ar(o));var f=ar(a),s=ar(i);return f&&s&&!t?p(I(u({behavior:"down"},s),u({behavior:"up"},f),!1)):f&&s&&t?p(or(f),U(s)):f&&!s?p(U(f)):!f&&s?p(or(s)):e},r.default=b,r.useBreakpointChange=fr,r.useResponsiveProps=function(r){var e=f(n.useState({}),2),t=e[0],o=e[1];return fr(function(){var e=Object.keys(r).map(S).filter(function(r){var e=r.breakpoint,n=r.behavior,t=L(b.breakpoints[e.name],n);return matchMedia(t).matches}).reduce(function(e,n){var t=n.originPropName;return u({},e,a({},n.purePropName,r[t]))},{});o(e)}),t},r.useResponsiveValue=function(r,e){var t=f(n.useState(e),2),o=t[0],a=t[1];return fr(function(){var n=sr(r,e);a(n)}),o},r.useViewportChange=pr,r.withBreakpoints=sr,Object.defineProperty(r,"__esModule",{value:!0})}); | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("styled-components"),require("react")):"function"==typeof define&&define.amd?define(["exports","styled-components","react"],n):n((r=r||self).AtomicLayout={},r.styled,r.React)}(this,function(r,n,e){"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}function o(r,n){for(var e=0;e<n.length;e++){var t=n[e];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,t.key,t)}}function a(r,n,e){return n in r?Object.defineProperty(r,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[n]=e,r}function i(r,n){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);n&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),e.push.apply(e,t)}return e}function u(r){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?i(e,!0).forEach(function(n){a(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):i(e).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function c(r,n){if(null==r)return{};var e,t,o=function(r,n){if(null==r)return{};var e,t,o={},a=Object.keys(r);for(t=0;t<a.length;t++)e=a[t],n.indexOf(e)>=0||(o[e]=r[e]);return o}(r,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(t=0;t<a.length;t++)e=a[t],n.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(r,e)&&(o[e]=r[e])}return o}function p(r,n){return n||(n=r.slice(0)),Object.freeze(Object.defineProperties(r,{raw:{value:Object.freeze(n)}}))}function f(r,n){return l(r)||function(r,n){var e=[],t=!0,o=!1,a=void 0;try{for(var i,u=r[Symbol.iterator]();!(t=(i=u.next()).done)&&(e.push(i.value),!n||e.length!==n);t=!0);}catch(r){o=!0,a=r}finally{try{t||null==u.return||u.return()}finally{if(o)throw a}}return e}(r,n)||m()}function s(r){return function(r){if(Array.isArray(r)){for(var n=0,e=new Array(r.length);n<r.length;n++)e[n]=r[n];return e}}(r)||d(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function l(r){if(Array.isArray(r))return r}function d(r){if(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r))return Array.from(r)}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}n=n&&n.hasOwnProperty("default")?n.default:n;var g={defaultUnit:"px",defaultBehavior:"up",defaultBreakpointName:"xs",breakpoints:{xs:{maxWidth:"575px"},sm:{minWidth:"576px",maxWidth:"767px"},md:{minWidth:"768px",maxWidth:"991px"},lg:{minWidth:"992px",maxWidth:"1199px"},xl:{minWidth:"1200px"}}};function h(r,n){if(!r)throw new Error(n)}function v(r,n){r||console.warn(n)}var b=new(function(){function r(n){return function(r,n){if(!(r instanceof n))throw new TypeError("Cannot call a class as a function")}(this,r),this.defaultUnit=g.defaultUnit,this.defaultBehavior=g.defaultBehavior,this.breakpoints=g.breakpoints,this.defaultBreakpointName=g.defaultBreakpointName,this.isConfigureCalled=!1,n?this.configure(n,!1):this}var n,e,a;return n=r,(e=[{key:"configure",value:function(r){var n=this,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e&&v(!this.isConfigureCalled,"Failed to configure Layout: do not call `Layout.configure()` more than once. Layout configuration must remain consistent throughout the application."),h(r&&"object"===t(r),"Failed to configure Layout: expected an options Object, but got: ".concat(r,".")),Object.keys(r||{}).forEach(function(e){n[e]=r[e]}),h(this.breakpoints,"Failed to configure Layout: expected to have at least one breakpoint specified, but got none."),h(this.breakpoints.hasOwnProperty(this.defaultBreakpointName),'Failed to configure Layout: cannot use "'.concat(this.defaultBreakpointName,'" as the default breakpoint (breakpoint not found).')),h(this.defaultBreakpointName,'Failed to configure Layout: expected "defaultBreakpointName" property set, but got: '.concat(this.defaultBreakpointName,".")),this.isConfigureCalled=e,this}}])&&o(n.prototype,e),a&&o(n,a),r}());function y(){for(var r=arguments.length,n=new Array(r),e=0;e<r;e++)n[e]=arguments[e];return n.reduce(function(r,n){return function(){return r(n.apply(void 0,arguments))}})}function w(r){return null!=r}function j(r){if(!w(r))return"";var n="number"==typeof r&&0!==r?b.defaultUnit:"";return"".concat(r).concat(n)}var k=["/","auto"];function x(r){var n=/^[0-9]/.test(r),e=k.includes(r);return!n&&!e}var O=y(function(r){var n=[],e=[];return r.forEach(function(r){x(r)?n.push(r):e.push(r)}),[n.length>0?"'".concat(n.join(" "),"'"):"",e.join(" ")].filter(Boolean).join(" ")},function(r){return r.split(" ")},function(r){return r.replace(/'+/gm,"")},function(r){return r.trim()}),V=y(function(r){return r.join("\n")},function(r){return r.map(O)},function(r){return r.split("\n")},function(r){return r.trim()}),P={area:{props:["grid-area"]},areas:{props:["grid-template-areas"],transformValue:V},template:{props:["grid-template"],transformValue:V},templateCols:{props:["grid-template-columns"]},templateRows:{props:["grid-template-rows"]},col:{props:["grid-column"]},colStart:{props:["grid-column-start"]},colEnd:{props:["grid-column-end"]},row:{props:["grid-row"]},rowStart:{props:["grid-row-start"]},rowEnd:{props:["grid-row-end"]},gap:{props:["grid-gap"],transformValue:j},gapCol:{props:["grid-column-gap"],transformValue:j},gapRow:{props:["grid-row-gap"],transformValue:j},gutter:{props:["grid-gap"],transformValue:j},gutterCol:{props:["grid-column-gap"],transformValue:j},gutterRow:{props:["grid-row-gap"],transformValue:j},autoRows:{props:["grid-auto-rows"],transformValue:j},autoCols:{props:["grid-auto-columns"],transformValue:j},autoFlow:{props:["grid-auto-flow"]},align:{props:["align-self"]},alignItems:{props:["align-items"]},alignContent:{props:["align-content"]},justify:{props:["justify-self"]},justifyItems:{props:["justify-items"]},justifyContent:{props:["justify-content"]},place:{props:["place-self"]},placeItems:{props:["place-items"]},placeContent:{props:["place-content"]},flexDirection:{props:["flex-direction"]},flexShrink:{props:["flex-shrink"]},flexGrow:{props:["flex-grow"]},flexWrap:{props:["flex-wrap"]},height:{props:["height"],transformValue:j},minHeight:{props:["min-height"],transformValue:j},maxHeight:{props:["max-height"],transformValue:j},width:{props:["width"],transformValue:j},minWidth:{props:["min-width"],transformValue:j},maxWidth:{props:["max-width"],transformValue:j},margin:{props:["margin"],transformValue:j},marginTop:{props:["margin-top"],transformValue:j},marginRight:{props:["margin-right"],transformValue:j},marginBottom:{props:["margin-bottom"],transformValue:j},marginLeft:{props:["margin-left"],transformValue:j},marginVertical:{props:["margin-top","margin-bottom"],transformValue:j},marginHorizontal:{props:["margin-right","margin-left"],transformValue:j},padding:{props:["padding"],transformValue:j},paddingTop:{props:["padding-top"],transformValue:j},paddingRight:{props:["padding-right"],transformValue:j},paddingBottom:{props:["padding-bottom"],transformValue:j},paddingLeft:{props:["padding-left"],transformValue:j},paddingVertical:{props:["padding-top","padding-bottom"],transformValue:j},paddingHorizontal:{props:["padding-right","padding-left"],transformValue:j}};function B(r){return r.slice(0,1).toLowerCase()+r.slice(1,r.length)}function S(r){var n=Object.keys(b.breakpoints).join("|"),e=["down","only"].join("|"),t=new RegExp("(".concat(n,")$"),"gi"),o=new RegExp("(".concat(e,")$"),"gi"),a=r.match(o),i=a?a[0]:"",u=r.replace(i,"").match(t),c=u?u[0]:"",p=r.replace(c,"").replace(i,""),f=c?B(c):b.defaultBreakpointName,s=f===b.defaultBreakpointName;return{originPropName:r,purePropName:p,behavior:i?B(i):b.defaultBehavior,breakpoint:{name:f,isDefault:s}}}function N(r){return Object.entries(r).filter(function(r){var n=f(r,2);n[0];return w(n[1])}).map(function(r){var n,e=f(r,2),t=e[0],o=e[1];return[(n=t,n.replace(/[A-Z]/g,function(r){return"-".concat(r).toLowerCase()})),o]})}var C=function(r){return function(n){return n.filter(function(n){return function(r,n){var e=f(r.split("-"),2),t=e[0],o=e[1];return!["height","width"].includes(o)||"min"===t&&["up","only"].includes(n)||"max"===t&&["down","only"].includes(n)}(f(n,1)[0],r)})}},E=function(r){return function(n){return n.map(r).join(" and ")}};function L(r,n){return y(E(function(r){var n=f(r,2),e=n[0],t=n[1];return"(".concat(e,":").concat(String(j(t)),")")}),C(n),N)(r)}var A=function(r,n,e,t){var o=r.map(function(r){return"".concat(r,":").concat(String(n),";")}).join(""),a=b.breakpoints[e.name];return a&&!(e.isDefault&&t===b.defaultBehavior)?"@media ".concat(L(a,t)," {").concat(o,"}"):o};function W(r){return Object.keys(r).map(S).filter(function(r){var n=r.purePropName;return P.hasOwnProperty(n)}).filter(function(n){var e=n.originPropName;return w(r[e])}).map(function(n){var e=n.purePropName,t=n.originPropName,o=n.breakpoint,a=n.behavior,i=P[e],u=i.props,c=i.transformValue,p=r[t],f=c?c(p):p;return A(u,f,o,a)}).join(" ")}function R(){var r=p(["\n display: ",";\n\n && {\n ",";\n }\n"]);return R=function(){return r},r}var F=n.div(R(),function(r){var n=r.flex,e=r.inline;return n?e?"inline-flex":"flex":e?"inline-block":"block"},W);var D=function(r){var n=r.children,t=c(r,["children"]),o=e.useMemo(function(){return function(r){return y(E(function(r){var n=f(r,2),e=n[0],t=n[1],o=/^\d/.test(String(t))?j(t):t;return"(".concat(e,":").concat(o,")")}),N)(r)}(t)},[t]),a=f(e.useState(!1),2),i=a[0],u=a[1],p=function(r){u(r.matches)};return e.useEffect(function(){var r=matchMedia(o);return p(r),r.addListener(p),function(){return r.removeListener(p)}},Object.keys(t)),n(i)};function M(r,n){return function(e){return r(e)?n(e):e}}function T(r){return function(n){return r.apply(null,n)}}function z(r){var n=r.match(/^(min|max)/);return n?n[0]:""}function I(r,n,e){var t=n.behavior,o=r.behavior,i="up"===t,c=t===o,p=i&&"down"===o,f=i,s=u({},n,{},r);return Object.keys(s).reduce(function(t,o){var i=s[o],l=z(o);if("behavior"===o&&!e&&f&&(i="down"),"max"===l&&!e&&f){var d=r[o.replace(/^max/,"min")];i="calc(".concat(j(d)," - 1px)")}return"min"===l&&(e?(c||p)&&(i=n[o]):f&&(i=n[o])),u({},t,a({},o,i))},{behavior:g.defaultBehavior})}function U(r){return Object.keys(r).reduce(function(n,e){return u({},n,a({},e,"max"===z(e)?void 0:r[e]))},{})}var H=function(r){return r.replace(/^min|max/,"_")};var _=function(r,n){return function(r){var e,t=l(e=r)||d(e)||m(),o=(t[0],t.slice(1));return[n(r)].concat(s(o))}},q=function(r){return function(n,e,t,o){var a,i,p,f=t===o.length-1,s=e.areas,l=e.behavior,d=e.breakpoint,m=s.includes(r),g=n[n.length-1],h=u({},d,{behavior:l}),v=g||{behavior:""},b=(v.behavior,c(v,["behavior"]));return[h,g,m,f,Boolean(g)&&(a=b,i=d,(p=Object.keys(a).concat(Object.keys(i))).every(function(r,n){var e=H(r);return e===H(p[n-1]||e)})),n]}},$=function(r){var n=f(r,5);n[0],n[1],n[2],n[3];return n[4]},G=function(r){var n=f(r,4),e=n[0];n[1],n[2];return n[3]&&"up"===e.behavior},Q=function(r){var n=f(r,6),e=n[0],t=n[1],o=n[2],a=(n[3],n[4]),i=n[5],u=(t||{behavior:""}).behavior,c=e.behavior,p="up"===u,s=o&&(u===c||p&&"down"===c);a||(s=!1);var l,d=[e];return o||(d=p?[e,null]:[null],p&&(s=!0)),(s?(l=i).slice(0,l.length-1):i).concat(d)},Z=function(r,n){return n.reduce(y(Q,M(G,_(0,T(U))),M($,_(0,T(I))),q(r)),[])},J=function(r,n){var t=function(t){var o=t.children,a=c(t,["children"]);return n.filter(Boolean).reduce(function(n,t,i){t.behavior;var u=c(t,["behavior"]);return n.concat(e.createElement(D,Object.assign({},u,{key:"".concat(r.displayName,"_").concat(i)}),function(n){return n&&e.createElement(r,Object.assign({},a),o)}))},[])};return t.displayName="Placeholder(".concat(r.displayName,")"),t},K=function(r){return function(n){return e.createElement(F,Object.assign({area:r},n))}};var X,Y,rr=y(function(r){return r.sort()},function(r){return Array.from(new Set(r))},function(r){return r.filter(x)},function(r){return r.filter(Boolean)},function(r){return r.split(" ")},function(r){return r.replace(/\s+/g," ")},function(r){return r.replace(/\r?\n|\'+/g," ")}),nr=y((X=function(r){return function(r){var n=r.length,e=0,t=0;if(n>0)for(;t<n;)e=(e<<5)-e+r.charCodeAt(t++)|0;return e}(Object.entries(r).reduce(function(r,n){var e=f(n,2),t=e[0],o=e[1];return r.concat("".concat(t,":").concat(o.join()))},[]).join()).toString()},Y={},function(r){return function(){var n=X.apply(void 0,arguments);return n in Y||(Y[n]=r.apply(void 0,arguments)),Y[n]}})(y(function(r){var n=r.areas,e=r.templates,o=n.reduce(function(r,n){var t=Z(n,e),o=1===t.length&&t.every(function(r){return!r.minWidth&&!r.maxWidth}),i=K(n),c=n.replace(/^./,function(r){return r.toUpperCase()});return i.displayName=c,u({},r,a({},c,o?i:J(i,t)))},{});return"undefined"==typeof Proxy?o:new Proxy(o,{get:function(r,n){return n in r||"symbol"===t(n)?r[n]:function(){return null}}})},function(r){var n=Object.entries(r).reduce(function(r,n){var e=f(n,2),t=e[0],o=e[1],a=S(t),i=a.breakpoint,u=a.behavior;return{areas:r.areas.concat(o),templates:r.templates.concat({breakpoint:b.breakpoints[i.name],behavior:u,areas:o})}},{areas:[],templates:[]}),e=n.areas,t=n.templates;return{areas:Array.from(new Set(e)),templates:t}})),function(r){return Object.keys(r).filter(function(r){var n=S(r).purePropName;return["areas","template"].includes(n)}).reduce(function(n,e){return u({},n,a({},e,rr(r[e])))},{})});function er(){var r=p(["\n && {\n ",";\n display: ",";\n }\n"]);return er=function(){return r},r}var tr=n.div(er(),W,function(r){return r.inline?"inline-grid":"grid"});function or(r){return Object.entries(r).map(function(r){var n=f(r,2),e=n[0],t=n[1];return[z(e),e,t]}).filter(function(r){return"max"!==f(r,1)[0]}).reduce(function(r,n){var e=f(n,3),t=e[0],o=e[1],i=e[2],c="min"===t,p=c?o.replace(/^min/,"max"):o,s=f(/(\d+)(.+)?/.exec(i),3),l=s[1],d=s[2],m=c?parseFloat(l)-1:l;return u({},r,a({},p,d?"".concat(m).concat(d):m))},{})}var ar=function(r){return"string"==typeof r?b.breakpoints[r]:r};function ir(r){var n,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){for(var t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];var i=function(){return n=null,r.apply(void 0,o)};clearTimeout(n),n=setTimeout(i,e)}}var ur,cr,pr=function(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:50,t=ir(r,n);e.useEffect(function(){return t(),window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}},[])},fr=function(r,n){var e,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b.breakpoints;pr(function(){var n=Object.keys(t).find(function(r){var n=L(t[r],"only");return matchMedia(n).matches});e!==n&&(r(n),e=n)},n)},sr=(ur=b.breakpoints,cr=Object.keys(ur),function(r,n){var e=Object.keys(r).filter(function(r){var n=cr.includes(r);return n||console.warn('useBreakpoints: Breakpoint "%s" is not found. Add it via "Layout.configure()", or use one of the existing breakpoints (%s).',r,cr.join(", ")),n}).find(function(r){var n=ur[r],e=L(n,"only");return n&&matchMedia(e).matches});return e?r[e]:n});r.Box=F,r.Composition=function(r){var n=r.children,o=c(r,["children"]),a=nr(o),i=Object.keys(a).length>0,u=t(n),p="function"===u;return v(!(i&&!p),"Failed to render 'Composition' with template areas [\"".concat(Object.keys(a).join('", "'),'"]: expected children to be a function, but got: ').concat(u,". Please provide render function as children, or remove assigned template props.")),e.createElement(tr,Object.assign({},o),i&&p?n(a):n)},r.MediaQuery=D,r.Only=function(r){var n=r.children,t=r.except,o=r.for,a=r.from,i=r.to,p=function(r,n){return function(){for(var t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];var i=J(F,o);return e.createElement(i,Object.assign({},n),r)}}(n,c(r,["children","except","for","from","to"]));if(o)return p(ar(o));var f=ar(a),s=ar(i);return f&&s&&!t?p(I(u({behavior:"down"},s),u({behavior:"up"},f),!1)):f&&s&&t?p(or(f),U(s)):f&&!s?p(U(f)):!f&&s?p(or(s)):n},r.default=b,r.useBreakpointChange=fr,r.useResponsiveProps=function(r){var n=f(e.useState({}),2),t=n[0],o=n[1];return fr(function(){var n=Object.keys(r).map(S).filter(function(r){var n=r.breakpoint,e=r.behavior,t=L(b.breakpoints[n.name],e);return matchMedia(t).matches}).reduce(function(n,e){var t=e.originPropName;return u({},n,a({},e.purePropName,r[t]))},{});o(n)}),t},r.useResponsiveValue=function(r,n){var t=f(e.useState(n),2),o=t[0],a=t[1];return fr(function(){var e=sr(r,n);a(e)}),o},r.useViewportChange=pr,r.withBreakpoints=sr,Object.defineProperty(r,"__esModule",{value:!0})}); |
Sorry, the diff of this file is not supported yet
115730
2058