@kvdbil/components 14.2.3 → 14.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components"),t=require("../../shared/media-queries.js");function i(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var s=i(e);const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components"),t=require("../../shared/media-queries.js");function i(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var s=i(e);const n=(o,l)=>l!=="gap"&&l!=="row-gap"||typeof o!="number"?o:`${o}rem`,a=i(r).default.div(({$direction:o,$justify:l,$align:$,$gap:c,$rowGap:f,$wrap:d,$basis:g,$grow:w,$shrink:m})=>r.css`
|
|
2
2
|
display: flex;
|
|
3
3
|
|
|
4
4
|
${o&&["column","column-reverse"].includes(String(o))&&r.css`
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
}
|
|
8
8
|
`}
|
|
9
9
|
|
|
10
|
-
${[[o,"flex-direction"],[l,"justify-content"],[
|
|
11
|
-
${
|
|
12
|
-
|
|
13
|
-
${
|
|
14
|
-
|
|
10
|
+
${[[o,"flex-direction"],[l,"justify-content"],[$,"align-items"],[c,"gap"],[f,"row-gap"],[f,"row-gap"],[d,"flex-wrap"],[g,"flex-basis"],[w,"flex-grow"],[m,"flex-shrink"]].map(([u,p])=>{if(typeof u=="string"||typeof u=="number")return r.css`
|
|
11
|
+
${p}: ${n(u,p)};
|
|
12
|
+
`;if(typeof u=="object"){const y=[],{initial:b,...h}=u;return b&&y.push(r.css`
|
|
13
|
+
${p}: ${n(b,p)};
|
|
14
|
+
`),Object.entries(h).forEach(([j,x])=>{y.push(r.css`
|
|
15
|
+
${t.mq(j)} {
|
|
16
|
+
${p}: ${n(x,p)};
|
|
15
17
|
}
|
|
16
|
-
`)
|
|
17
|
-
`);exports.default=({direction:o,justify:l,align:
|
|
18
|
+
`)}),y}return""})}
|
|
19
|
+
`);exports.default=({direction:o,justify:l,align:$,gap:c,rowGap:f,wrap:d,basis:g,grow:w,shrink:m,...u})=>s.default.createElement(a,{$direction:o!=null?o:"row",$justify:l!=null?l:"center",$align:$!=null?$:"center",$gap:c!=null?c:"1rem",$rowGap:f,$wrap:d,$basis:g,$grow:w,$shrink:m,...u});
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import p from"react";import b,{css as r}from"styled-components";import{mq as j}from"../../shared/media-queries.js";const y="row",k="1rem",g="center",$=(e,t)=>(t==="gap"||t==="row-gap")&&typeof e=="number"?`${e}rem`:e,q=({$direction:e,$justify:t,$align:a,$gap:i,$rowGap:s,$wrap:o,$basis:f,$grow:u,$shrink:m})=>r`
|
|
2
2
|
display: flex;
|
|
3
3
|
|
|
4
|
-
${e&&["column","column-reverse"].includes(String(e))&&
|
|
4
|
+
${e&&["column","column-reverse"].includes(String(e))&&r`
|
|
5
5
|
& > * {
|
|
6
6
|
width: 100%;
|
|
7
7
|
}
|
|
8
8
|
`}
|
|
9
9
|
|
|
10
|
-
${[[e,"flex-direction"],[t,"justify-content"],[
|
|
11
|
-
${
|
|
12
|
-
|
|
13
|
-
${
|
|
14
|
-
|
|
10
|
+
${[[e,"flex-direction"],[t,"justify-content"],[a,"align-items"],[i,"gap"],[s,"row-gap"],[s,"row-gap"],[o,"flex-wrap"],[f,"flex-basis"],[u,"flex-grow"],[m,"flex-shrink"]].map(([n,l])=>{if(typeof n=="string"||typeof n=="number")return r`
|
|
11
|
+
${l}: ${$(n,l)};
|
|
12
|
+
`;if(typeof n=="object"){const c=[],{initial:d,...w}=n;return d&&c.push(r`
|
|
13
|
+
${l}: ${$(d,l)};
|
|
14
|
+
`),Object.entries(w).forEach(([x,h])=>{c.push(r`
|
|
15
|
+
${j(x)} {
|
|
16
|
+
${l}: ${$(h,l)};
|
|
15
17
|
}
|
|
16
|
-
`)
|
|
17
|
-
`,
|
|
18
|
+
`)}),c}else return""})}
|
|
19
|
+
`,E=b.div(q),F=({direction:e,justify:t,align:a,gap:i,rowGap:s,wrap:o,basis:f,grow:u,shrink:m,...n})=>p.createElement(E,{$direction:e!=null?e:y,$justify:t!=null?t:g,$align:a!=null?a:g,$gap:i!=null?i:k,$rowGap:s,$wrap:o,$basis:f,$grow:u,$shrink:m,...n});export{F as default};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import { SCREEN_SIZE } from '../../shared/media-queries';
|
|
|
10
10
|
* direction: 'row' | 'column' | 'row-reverse' | 'column-reverse'
|
|
11
11
|
* direction: { mobileS: 'column', tablet: 'row' }
|
|
12
12
|
*/
|
|
13
|
-
declare type CSSPropertyWithResponsive<P extends keyof CSSProperties> = CSSProperties[P] | Partial<Record<Partial<SCREEN_SIZE
|
|
13
|
+
declare type CSSPropertyWithResponsive<P extends keyof CSSProperties> = CSSProperties[P] | Partial<Record<Partial<SCREEN_SIZE> | 'initial', CSSProperties[P]>>;
|
|
14
14
|
export interface FlexProps {
|
|
15
15
|
direction?: CSSPropertyWithResponsive<'flexDirection'>;
|
|
16
16
|
justify?: CSSPropertyWithResponsive<'justifyContent'>;
|