@kvdbil/components 9.1.2 → 9.1.3
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.
- package/cjs/components/Spacer/index.js +12 -0
- package/cjs/components/Stack/index.js +1 -0
- package/cjs/shared/media-queries.js +1 -1
- package/esm/components/Spacer/index.js +12 -0
- package/esm/components/Stack/index.js +1 -0
- package/esm/shared/media-queries.js +1 -1
- package/package.json +1 -1
- package/types/components/Spacer/index.d.ts +7 -0
- package/types/components/Stack/index.d.ts +31 -0
- package/types/shared/media-queries.d.ts +4 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../shared/media-queries.js");function l(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}const n=l(e).default.div`
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: ${r=>{var i;return(i=r.height)!=null?i:1}}rem;
|
|
4
|
+
|
|
5
|
+
${t.mq(null,"tablet")} {
|
|
6
|
+
${r=>r.hideOnMobile&&"display: none;"}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
${t.mq(null,"laptop")} {
|
|
10
|
+
${r=>r.hideOnDesktop&&"display: none;"}
|
|
11
|
+
}
|
|
12
|
+
`;exports.default=n;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components"),t=require("../../shared/media-queries.js");function o(l){return l&&typeof l=="object"&&"default"in l?l:{default:l}}var i=o(e);const n=l=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[l],s=(l,f)=>t.mqSizesOrder[l]<t.mqSizesOrder[f]?-1:t.mqSizesOrder[l]>t.mqSizesOrder[f]?1:0,c=o(r).default("div")(({ownerState:{direction:l,spacing:f}})=>typeof l=="string"&&typeof f=="number"?{display:"flex",flexDirection:l,"> *:not(:first-child)":{margin:0,[`margin${n(l)}`]:`${f}rem`}}:typeof l=="object"||typeof f=="object"?{...((a,u)=>{var m,y;const j=typeof a=="object"?Object.keys(a).sort(s):Object.keys(u).sort(s);let d={};for(const p of j){const b=typeof a=="object"?(m=a[p])!=null?m:"row":a,g=n(b),q=typeof u=="object"?(y=u[p])!=null?y:1:u,v={[t.mq(p)]:{display:"flex",flexDirection:b,"> *:not(:first-child)":{margin:0,[`margin${g}`]:`${q}rem`}}};d={...d,...v}}return{...d}})(l,f!=null?f:1)}:{display:"flex"});exports.default=({children:l,direction:f,spacing:a=1})=>{const u={direction:f,spacing:a};return i.default.createElement(c,{ownerState:u},l)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={mobileS:"320px",mobileM:"375px",mobileL:"425px",tablet:"768px",laptop:"1024px",laptopL:"1440px",laptopXL:"1680px",desktop:"2560px"},t={mobileS:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={mobileS:"320px",mobileM:"375px",mobileL:"425px",tablet:"768px",laptop:"1024px",laptopL:"1440px",laptopXL:"1680px",desktop:"2560px"},t={mobileS:p=>`(${p}-width: ${e.mobileS})`,mobileM:p=>`(${p}-width: ${e.mobileM})`,mobileL:p=>`(${p}-width: ${e.mobileL})`,tablet:p=>`(${p}-width: ${e.tablet})`,laptop:p=>`(${p}-width: ${e.laptop})`,laptopL:p=>`(${p}-width: ${e.laptopL})`,desktop:p=>`(${p}-width: ${e.desktop})`,desktopL:p=>`(${p}-width: ${e.desktop})`};exports.mediaQueries=t,exports.mq=(p,i)=>p&&i?`@media (min-width: ${e[p]}) and (max-width: ${e[i]})`:p?`@media (min-width: ${e[p]})`:i?`@media (max-width: ${e[i]})`:(console.error("Invalid use of mq. Available breakpoints are:",e),"@media screen"),exports.mqSizes=e,exports.mqSizesOrder={mobileS:1,mobileM:2,mobileL:3,tablet:4,laptop:5,laptopL:6,laptopXL:7,desktop:8};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import i from"styled-components";import{mq as l}from"../../shared/media-queries.js";const n=i.div`
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: ${e=>{var t;return(t=e.height)!=null?t:1}}rem;
|
|
4
|
+
|
|
5
|
+
${l(null,"tablet")} {
|
|
6
|
+
${e=>e.hideOnMobile&&"display: none;"}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
${l(null,"laptop")} {
|
|
10
|
+
${e=>e.hideOnDesktop&&"display: none;"}
|
|
11
|
+
}
|
|
12
|
+
`;export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"react";import b from"styled-components";import{mq as k,mqSizesOrder as n}from"../../shared/media-queries.js";const f=t=>({row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"})[t],a=(t,e)=>n[t]<n[e]?-1:n[t]>n[e]?1:0,j=(t,e)=>{var o,r;const m=typeof t=="object"?Object.keys(t).sort(a):Object.keys(e).sort(a);let s={};for(const l of m){const c=typeof t=="object"?(o=t[l])!=null?o:"row":t,u=f(c),y=typeof e=="object"?(r=e[l])!=null?r:1:e,i={[k(l)]:{display:"flex",flexDirection:c,"> *:not(:first-child)":{margin:0,[`margin${u}`]:`${y}rem`}}};s={...s,...i}}return{...s}},d=({ownerState:{direction:t,spacing:e}})=>typeof t=="string"&&typeof e=="number"?{display:"flex",flexDirection:t,"> *:not(:first-child)":{margin:0,[`margin${f(t)}`]:`${e}rem`}}:typeof t=="object"||typeof e=="object"?{...j(t,e!=null?e:1)}:{display:"flex"},S=b("div")(d),w=({children:t,direction:e,spacing:o=1})=>{const r={direction:e,spacing:o};return p.createElement(S,{ownerState:r},t)};export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t={mobileS:"320px",mobileM:"375px",mobileL:"425px",tablet:"768px",laptop:"1024px",laptopL:"1440px",laptopXL:"1680px",desktop:"2560px"},p={mobileS:1,mobileM:2,mobileL:3,tablet:4,laptop:5,laptopL:6,laptopXL:7,desktop:8},o={mobileS:e=>`(${e}-width: ${t.mobileS})`,mobileM:e=>`(${e}-width: ${t.mobileM})`,mobileL:e=>`(${e}-width: ${t.mobileL})`,tablet:e=>`(${e}-width: ${t.tablet})`,laptop:e=>`(${e}-width: ${t.laptop})`,laptopL:e=>`(${e}-width: ${t.laptopL})`,desktop:e=>`(${e}-width: ${t.desktop})`,desktopL:e=>`(${e}-width: ${t.desktop})`},l=(e,i)=>e&&i?`@media (min-width: ${t[e]}) and (max-width: ${t[i]})`:e?`@media (min-width: ${t[e]})`:i?`@media (max-width: ${t[i]})`:(console.error("Invalid use of mq. Available breakpoints are:",t),"@media screen");export{o as mediaQueries,l as mq,t as mqSizes,p as mqSizesOrder};
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface SpacerProps {
|
|
2
|
+
height?: number;
|
|
3
|
+
hideOnMobile?: boolean;
|
|
4
|
+
hideOnDesktop?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare const Spacer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, SpacerProps, never>;
|
|
7
|
+
export default Spacer;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type FlexDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
3
|
+
declare type ResponsiveDirection = {
|
|
4
|
+
mobileS?: FlexDirection;
|
|
5
|
+
mobileM?: FlexDirection;
|
|
6
|
+
mobileL?: FlexDirection;
|
|
7
|
+
tablet?: FlexDirection;
|
|
8
|
+
laptop?: FlexDirection;
|
|
9
|
+
laptopL?: FlexDirection;
|
|
10
|
+
laptopXL?: FlexDirection;
|
|
11
|
+
desktop?: FlexDirection;
|
|
12
|
+
};
|
|
13
|
+
declare type ResponsiveSpacing = {
|
|
14
|
+
mobileS?: number;
|
|
15
|
+
mobileM?: number;
|
|
16
|
+
mobileL?: number;
|
|
17
|
+
tablet?: number;
|
|
18
|
+
laptop?: number;
|
|
19
|
+
laptopL?: number;
|
|
20
|
+
laptopXL?: number;
|
|
21
|
+
desktop?: number;
|
|
22
|
+
};
|
|
23
|
+
interface OwnerState {
|
|
24
|
+
direction: ResponsiveDirection | FlexDirection;
|
|
25
|
+
spacing?: ResponsiveSpacing | number;
|
|
26
|
+
}
|
|
27
|
+
export interface StackProps extends OwnerState {
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const Stack: ({ children, direction, spacing }: StackProps) => JSX.Element;
|
|
31
|
+
export default Stack;
|
|
@@ -9,6 +9,9 @@ interface MqSizes {
|
|
|
9
9
|
desktop: '2560px';
|
|
10
10
|
}
|
|
11
11
|
declare const mqSizes: MqSizes;
|
|
12
|
+
declare const mqSizesOrder: {
|
|
13
|
+
[key: string]: number;
|
|
14
|
+
};
|
|
12
15
|
export declare type SCREEN_SIZE = keyof typeof mqSizes;
|
|
13
16
|
declare const mediaQueries: {
|
|
14
17
|
mobileS: (limit: string) => string;
|
|
@@ -21,4 +24,4 @@ declare const mediaQueries: {
|
|
|
21
24
|
desktopL: (limit: string) => string;
|
|
22
25
|
};
|
|
23
26
|
declare const mq: (from: SCREEN_SIZE | null, to?: keyof MqSizes | undefined) => string;
|
|
24
|
-
export { mq, mqSizes, mediaQueries };
|
|
27
|
+
export { mq, mqSizes, mqSizesOrder, mediaQueries };
|