@entur/layout 3.3.3 → 3.4.0
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/dist/beta/cjs/Contrast.cjs +21 -0
- package/dist/beta/cjs/Contrast.cjs.map +1 -0
- package/dist/beta/cjs/Flex/Flex.cjs +111 -0
- package/dist/beta/cjs/Flex/Flex.cjs.map +1 -0
- package/dist/beta/cjs/Flex/FlexSpacer.cjs +25 -0
- package/dist/beta/cjs/Flex/FlexSpacer.cjs.map +1 -0
- package/dist/beta/cjs/Flex/index.cjs +12 -0
- package/dist/beta/cjs/Flex/index.cjs.map +1 -0
- package/dist/beta/cjs/Grid/Grid.cjs +80 -0
- package/dist/beta/cjs/Grid/Grid.cjs.map +1 -0
- package/dist/beta/cjs/Grid/GridItem.cjs +49 -0
- package/dist/beta/cjs/Grid/GridItem.cjs.map +1 -0
- package/dist/beta/cjs/Grid/index.cjs +12 -0
- package/dist/beta/cjs/Grid/index.cjs.map +1 -0
- package/dist/beta/cjs/LayoutWrapper/LayoutWrapper.cjs +31 -0
- package/dist/beta/cjs/LayoutWrapper/LayoutWrapper.cjs.map +1 -0
- package/dist/beta/cjs/LayoutWrapper/useLayoutValues.cjs +15 -0
- package/dist/beta/cjs/LayoutWrapper/useLayoutValues.cjs.map +1 -0
- package/dist/beta/cjs/LayoutWrapper/useResponsiveValue.cjs +78 -0
- package/dist/beta/cjs/LayoutWrapper/useResponsiveValue.cjs.map +1 -0
- package/dist/beta/cjs/LayoutWrapper/utils.cjs +49 -0
- package/dist/beta/cjs/LayoutWrapper/utils.cjs.map +1 -0
- package/dist/beta/cjs/index.cjs +18 -0
- package/dist/beta/cjs/index.cjs.map +1 -0
- package/dist/beta/cjs/templates/Sidebar.cjs +90 -0
- package/dist/beta/cjs/templates/Sidebar.cjs.map +1 -0
- package/dist/beta/cjs/templates/index.cjs +8 -0
- package/dist/beta/cjs/templates/index.cjs.map +1 -0
- package/dist/beta/cjs/templates/portal/Portal.cjs +51 -0
- package/dist/beta/cjs/templates/portal/Portal.cjs.map +1 -0
- package/dist/beta/esm/Contrast.mjs +21 -0
- package/dist/beta/esm/Contrast.mjs.map +1 -0
- package/dist/beta/esm/Flex/Flex.mjs +111 -0
- package/dist/beta/esm/Flex/Flex.mjs.map +1 -0
- package/dist/beta/esm/Flex/FlexSpacer.mjs +25 -0
- package/dist/beta/esm/Flex/FlexSpacer.mjs.map +1 -0
- package/dist/beta/esm/Flex/index.mjs +12 -0
- package/dist/beta/esm/Flex/index.mjs.map +1 -0
- package/dist/beta/esm/Grid/Grid.mjs +80 -0
- package/dist/beta/esm/Grid/Grid.mjs.map +1 -0
- package/dist/beta/esm/Grid/GridItem.mjs +49 -0
- package/dist/beta/esm/Grid/GridItem.mjs.map +1 -0
- package/dist/beta/esm/Grid/index.mjs +12 -0
- package/dist/beta/esm/Grid/index.mjs.map +1 -0
- package/dist/beta/esm/LayoutWrapper/LayoutWrapper.mjs +31 -0
- package/dist/beta/esm/LayoutWrapper/LayoutWrapper.mjs.map +1 -0
- package/dist/beta/esm/LayoutWrapper/useLayoutValues.mjs +15 -0
- package/dist/beta/esm/LayoutWrapper/useLayoutValues.mjs.map +1 -0
- package/dist/beta/esm/LayoutWrapper/useResponsiveValue.mjs +78 -0
- package/dist/beta/esm/LayoutWrapper/useResponsiveValue.mjs.map +1 -0
- package/dist/beta/esm/LayoutWrapper/utils.mjs +49 -0
- package/dist/beta/esm/LayoutWrapper/utils.mjs.map +1 -0
- package/dist/beta/esm/index.mjs +18 -0
- package/dist/beta/esm/index.mjs.map +1 -0
- package/dist/beta/esm/templates/Sidebar.mjs +90 -0
- package/dist/beta/esm/templates/Sidebar.mjs.map +1 -0
- package/dist/beta/esm/templates/index.mjs +8 -0
- package/dist/beta/esm/templates/index.mjs.map +1 -0
- package/dist/beta/esm/templates/portal/Portal.mjs +51 -0
- package/dist/beta/esm/templates/portal/Portal.mjs.map +1 -0
- package/dist/beta/styles/index.css +197 -0
- package/dist/beta/types/Flex/Flex.d.ts +65 -0
- package/dist/beta/types/Flex/FlexSpacer.d.ts +16 -0
- package/dist/beta/types/Flex/index.d.ts +24 -0
- package/dist/beta/types/Grid/Grid.d.ts +46 -0
- package/dist/beta/types/Grid/GridItem.d.ts +28 -0
- package/dist/beta/types/Grid/index.d.ts +29 -0
- package/dist/beta/types/LayoutWrapper/LayoutWrapper.d.ts +13 -0
- package/dist/beta/types/LayoutWrapper/index.d.ts +6 -0
- package/dist/beta/types/LayoutWrapper/useLayoutValues.d.ts +2 -0
- package/dist/beta/types/LayoutWrapper/useResponsiveValue.d.ts +2 -0
- package/dist/beta/types/LayoutWrapper/utils.d.ts +15 -0
- package/dist/beta/types/index.d.ts +7 -0
- package/dist/beta/types/templates/Sidebar.d.ts +21 -0
- package/dist/beta/types/templates/index.d.ts +7 -0
- package/dist/beta/types/templates/portal/Portal.d.ts +12 -0
- package/dist/beta/types/templates/portal/index.d.ts +2 -0
- package/package.json +27 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { useLayoutValues } from "./useLayoutValues.mjs";
|
|
3
|
+
const isResponsiveObject = (value) => {
|
|
4
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && ("sm" in value || "md" in value || "lg" in value);
|
|
5
|
+
};
|
|
6
|
+
const getCurrentBreakpoint = (breakpoints, windowWidth) => {
|
|
7
|
+
if (windowWidth >= breakpoints.lg) {
|
|
8
|
+
return "lg";
|
|
9
|
+
}
|
|
10
|
+
if (windowWidth >= breakpoints.md) {
|
|
11
|
+
return "md";
|
|
12
|
+
}
|
|
13
|
+
return "sm";
|
|
14
|
+
};
|
|
15
|
+
const useResponsiveValue = (value) => {
|
|
16
|
+
const { breakpoints } = useLayoutValues();
|
|
17
|
+
const [currentBreakpoint, setCurrentBreakpoint] = useState(() => {
|
|
18
|
+
if (typeof window === "undefined") {
|
|
19
|
+
return "sm";
|
|
20
|
+
}
|
|
21
|
+
return getCurrentBreakpoint(breakpoints, window.innerWidth);
|
|
22
|
+
});
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const updateBreakpoint = () => {
|
|
28
|
+
setCurrentBreakpoint(
|
|
29
|
+
getCurrentBreakpoint(breakpoints, window.innerWidth)
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
const mediaQueries = [
|
|
33
|
+
window.matchMedia(`(min-width: ${breakpoints.md}px)`),
|
|
34
|
+
window.matchMedia(`(min-width: ${breakpoints.lg}px)`)
|
|
35
|
+
];
|
|
36
|
+
updateBreakpoint();
|
|
37
|
+
const handleChange = () => {
|
|
38
|
+
updateBreakpoint();
|
|
39
|
+
};
|
|
40
|
+
mediaQueries.forEach((mq) => {
|
|
41
|
+
if (mq.addEventListener) {
|
|
42
|
+
mq.addEventListener("change", handleChange);
|
|
43
|
+
} else {
|
|
44
|
+
mq.addListener(handleChange);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return () => {
|
|
48
|
+
mediaQueries.forEach((mq) => {
|
|
49
|
+
if (mq.removeEventListener) {
|
|
50
|
+
mq.removeEventListener("change", handleChange);
|
|
51
|
+
} else {
|
|
52
|
+
mq.removeListener(handleChange);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
}, [breakpoints]);
|
|
57
|
+
if (!value) {
|
|
58
|
+
return void 0;
|
|
59
|
+
}
|
|
60
|
+
if (!isResponsiveObject(value)) {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
const responsiveValue = value[currentBreakpoint];
|
|
64
|
+
if (responsiveValue !== void 0) {
|
|
65
|
+
return responsiveValue;
|
|
66
|
+
}
|
|
67
|
+
const fallbackOrder = currentBreakpoint === "lg" ? ["lg", "md", "sm"] : currentBreakpoint === "md" ? ["md", "sm"] : ["sm"];
|
|
68
|
+
for (const bp of fallbackOrder) {
|
|
69
|
+
if (value[bp] !== void 0) {
|
|
70
|
+
return value[bp];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return void 0;
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
useResponsiveValue
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=useResponsiveValue.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useResponsiveValue.mjs","sources":["../../../../src/beta/LayoutWrapper/useResponsiveValue.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useLayoutValues } from './useLayoutValues';\nimport type { ResponsiveValue } from './utils';\n\nconst isResponsiveObject = <T>(\n value: ResponsiveValue<T>,\n): value is { sm?: T; md?: T; lg?: T } => {\n return (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n ('sm' in value || 'md' in value || 'lg' in value)\n );\n};\n\nconst getCurrentBreakpoint = (\n breakpoints: { sm: number; md: number; lg: number },\n windowWidth: number,\n): 'sm' | 'md' | 'lg' => {\n if (windowWidth >= breakpoints.lg) {\n return 'lg';\n }\n if (windowWidth >= breakpoints.md) {\n return 'md';\n }\n return 'sm';\n};\n\nexport const useResponsiveValue = <T>(\n value: ResponsiveValue<T> | undefined,\n): T | undefined => {\n const { breakpoints } = useLayoutValues();\n const [currentBreakpoint, setCurrentBreakpoint] = useState<\n 'sm' | 'md' | 'lg'\n >(() => {\n if (typeof window === 'undefined') {\n return 'sm';\n }\n return getCurrentBreakpoint(breakpoints, window.innerWidth);\n });\n\n useEffect(() => {\n if (\n typeof window === 'undefined' ||\n typeof window.matchMedia !== 'function'\n ) {\n return;\n }\n\n const updateBreakpoint = () => {\n setCurrentBreakpoint(\n getCurrentBreakpoint(breakpoints, window.innerWidth),\n );\n };\n\n const mediaQueries = [\n window.matchMedia(`(min-width: ${breakpoints.md}px)`),\n window.matchMedia(`(min-width: ${breakpoints.lg}px)`),\n ];\n\n updateBreakpoint();\n\n const handleChange = () => {\n updateBreakpoint();\n };\n\n mediaQueries.forEach(mq => {\n if (mq.addEventListener) {\n mq.addEventListener('change', handleChange);\n } else {\n mq.addListener(handleChange);\n }\n });\n\n return () => {\n mediaQueries.forEach(mq => {\n if (mq.removeEventListener) {\n mq.removeEventListener('change', handleChange);\n } else {\n mq.removeListener(handleChange);\n }\n });\n };\n }, [breakpoints]);\n\n if (!value) {\n return undefined;\n }\n\n if (!isResponsiveObject(value)) {\n return value;\n }\n\n const responsiveValue = value[currentBreakpoint];\n if (responsiveValue !== undefined) {\n return responsiveValue;\n }\n\n const fallbackOrder: Array<'lg' | 'md' | 'sm'> =\n currentBreakpoint === 'lg'\n ? ['lg', 'md', 'sm']\n : currentBreakpoint === 'md'\n ? ['md', 'sm']\n : ['sm'];\n\n for (const bp of fallbackOrder) {\n if (value[bp] !== undefined) {\n return value[bp];\n }\n }\n\n return undefined;\n};\n"],"names":[],"mappings":";;AAIA,MAAM,qBAAqB,CACzB,UACwC;AACxC,SACE,OAAO,UAAU,YACjB,UAAU,QACV,CAAC,MAAM,QAAQ,KAAK,MACnB,QAAQ,SAAS,QAAQ,SAAS,QAAQ;AAE/C;AAEA,MAAM,uBAAuB,CAC3B,aACA,gBACuB;AACvB,MAAI,eAAe,YAAY,IAAI;AACjC,WAAO;AAAA,EACT;AACA,MAAI,eAAe,YAAY,IAAI;AACjC,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAEO,MAAM,qBAAqB,CAChC,UACkB;AAClB,QAAM,EAAE,YAAA,IAAgB,gBAAA;AACxB,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAEhD,MAAM;AACN,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AACA,WAAO,qBAAqB,aAAa,OAAO,UAAU;AAAA,EAC5D,CAAC;AAED,YAAU,MAAM;AACd,QACE,OAAO,WAAW,eAClB,OAAO,OAAO,eAAe,YAC7B;AACA;AAAA,IACF;AAEA,UAAM,mBAAmB,MAAM;AAC7B;AAAA,QACE,qBAAqB,aAAa,OAAO,UAAU;AAAA,MAAA;AAAA,IAEvD;AAEA,UAAM,eAAe;AAAA,MACnB,OAAO,WAAW,eAAe,YAAY,EAAE,KAAK;AAAA,MACpD,OAAO,WAAW,eAAe,YAAY,EAAE,KAAK;AAAA,IAAA;AAGtD,qBAAA;AAEA,UAAM,eAAe,MAAM;AACzB,uBAAA;AAAA,IACF;AAEA,iBAAa,QAAQ,CAAA,OAAM;AACzB,UAAI,GAAG,kBAAkB;AACvB,WAAG,iBAAiB,UAAU,YAAY;AAAA,MAC5C,OAAO;AACL,WAAG,YAAY,YAAY;AAAA,MAC7B;AAAA,IACF,CAAC;AAED,WAAO,MAAM;AACX,mBAAa,QAAQ,CAAA,OAAM;AACzB,YAAI,GAAG,qBAAqB;AAC1B,aAAG,oBAAoB,UAAU,YAAY;AAAA,QAC/C,OAAO;AACL,aAAG,eAAe,YAAY;AAAA,QAChC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,GAAG,CAAC,WAAW,CAAC;AAEhB,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,mBAAmB,KAAK,GAAG;AAC9B,WAAO;AAAA,EACT;AAEA,QAAM,kBAAkB,MAAM,iBAAiB;AAC/C,MAAI,oBAAoB,QAAW;AACjC,WAAO;AAAA,EACT;AAEA,QAAM,gBACJ,sBAAsB,OAClB,CAAC,MAAM,MAAM,IAAI,IACjB,sBAAsB,OACtB,CAAC,MAAM,IAAI,IACX,CAAC,IAAI;AAEX,aAAW,MAAM,eAAe;AAC9B,QAAI,MAAM,EAAE,MAAM,QAAW;AAC3B,aAAO,MAAM,EAAE;AAAA,IACjB;AAAA,EACF;AAEA,SAAO;AACT;"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const VALID_SPACING_VALUES = [
|
|
2
|
+
"2xs",
|
|
3
|
+
"xs",
|
|
4
|
+
"s",
|
|
5
|
+
"s-m",
|
|
6
|
+
"m",
|
|
7
|
+
"m-l",
|
|
8
|
+
"l",
|
|
9
|
+
"xl",
|
|
10
|
+
"2xl",
|
|
11
|
+
"3xl",
|
|
12
|
+
"4xl",
|
|
13
|
+
"5xl",
|
|
14
|
+
"6xl",
|
|
15
|
+
"7xl",
|
|
16
|
+
"8xl",
|
|
17
|
+
"9xl",
|
|
18
|
+
"10xl",
|
|
19
|
+
"11xl",
|
|
20
|
+
"none"
|
|
21
|
+
];
|
|
22
|
+
const DEFAULT_BREAKPOINTS = {
|
|
23
|
+
sm: 0,
|
|
24
|
+
md: 800,
|
|
25
|
+
lg: 1200
|
|
26
|
+
};
|
|
27
|
+
const isValidSpacingValue = (value) => {
|
|
28
|
+
return typeof value === "string" && VALID_SPACING_VALUES.includes(value);
|
|
29
|
+
};
|
|
30
|
+
const getSpacingValue = (spacing, componentName = "Grid") => {
|
|
31
|
+
if (!spacing) return void 0;
|
|
32
|
+
if (spacing === "none") return "0";
|
|
33
|
+
if (!isValidSpacingValue(spacing)) {
|
|
34
|
+
if (process.env.NODE_ENV !== "production") {
|
|
35
|
+
console.warn(
|
|
36
|
+
`Invalid ${componentName} spacing value: "${spacing}". Valid values are: ${VALID_SPACING_VALUES.join(
|
|
37
|
+
", "
|
|
38
|
+
)}. Falling back to undefined.`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
return `var(--${spacing})`;
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
DEFAULT_BREAKPOINTS,
|
|
47
|
+
getSpacingValue
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../../../src/beta/LayoutWrapper/utils.ts"],"sourcesContent":["const VALID_SPACING_VALUES = [\n '2xs',\n 'xs',\n 's',\n 's-m',\n 'm',\n 'm-l',\n 'l',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n '7xl',\n '8xl',\n '9xl',\n '10xl',\n '11xl',\n 'none',\n] as const;\n\nexport type GridSpacingValue = (typeof VALID_SPACING_VALUES)[number];\n\nexport type ResponsiveValue<T> =\n | T\n | {\n sm?: T;\n md?: T;\n lg?: T;\n };\n\nexport type Breakpoints = {\n sm: number;\n md: number;\n lg: number;\n};\n\nexport const DEFAULT_BREAKPOINTS: Breakpoints = {\n sm: 0,\n md: 800,\n lg: 1200,\n};\n\nconst isValidSpacingValue = (value: unknown): value is GridSpacingValue => {\n return (\n typeof value === 'string' &&\n VALID_SPACING_VALUES.includes(value as GridSpacingValue)\n );\n};\n\nexport const getSpacingValue = (\n spacing: GridSpacingValue | undefined,\n componentName = 'Grid',\n): string | undefined => {\n if (!spacing) return undefined;\n if (spacing === 'none') return '0';\n\n if (!isValidSpacingValue(spacing)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Invalid ${componentName} spacing value: \"${spacing}\". Valid values are: ${VALID_SPACING_VALUES.join(\n ', ',\n )}. Falling back to undefined.`,\n );\n }\n return undefined;\n }\n\n return `var(--${spacing})`;\n};\n"],"names":[],"mappings":"AAAA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAkBO,MAAM,sBAAmC;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,sBAAsB,CAAC,UAA8C;AACzE,SACE,OAAO,UAAU,YACjB,qBAAqB,SAAS,KAAyB;AAE3D;AAEO,MAAM,kBAAkB,CAC7B,SACA,gBAAgB,WACO;AACvB,MAAI,CAAC,QAAS,QAAO;AACrB,MAAI,YAAY,OAAQ,QAAO;AAE/B,MAAI,CAAC,oBAAoB,OAAO,GAAG;AACjC,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAQ;AAAA,QACN,WAAW,aAAa,oBAAoB,OAAO,wBAAwB,qBAAqB;AAAA,UAC9F;AAAA,QAAA,CACD;AAAA,MAAA;AAAA,IAEL;AACA,WAAO;AAAA,EACT;AAEA,SAAO,SAAS,OAAO;AACzB;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
import { GridComponent } from "./Grid/index.mjs";
|
|
3
|
+
import { FlexComponent } from "./Flex/index.mjs";
|
|
4
|
+
import { Template } from "./templates/index.mjs";
|
|
5
|
+
import { GridItem } from "./Grid/GridItem.mjs";
|
|
6
|
+
import { LayoutWrapper } from "./LayoutWrapper/LayoutWrapper.mjs";
|
|
7
|
+
import { useLayoutValues } from "./LayoutWrapper/useLayoutValues.mjs";
|
|
8
|
+
import { FlexSpacer } from "./Flex/FlexSpacer.mjs";
|
|
9
|
+
export {
|
|
10
|
+
FlexComponent as Flex,
|
|
11
|
+
FlexSpacer,
|
|
12
|
+
GridComponent as Grid,
|
|
13
|
+
GridItem,
|
|
14
|
+
LayoutWrapper,
|
|
15
|
+
Template,
|
|
16
|
+
useLayoutValues
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { Contrast } from "../Contrast.mjs";
|
|
4
|
+
import { FlexComponent } from "../Flex/index.mjs";
|
|
5
|
+
import { GridComponent } from "../Grid/index.mjs";
|
|
6
|
+
/* empty css */
|
|
7
|
+
const SidebarLogo = ({ children, ...rest }) => {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", { ...rest, children });
|
|
9
|
+
};
|
|
10
|
+
const SidebarUser = ({ children, ...rest }) => {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", { ...rest, children });
|
|
12
|
+
};
|
|
13
|
+
const SidebarData = ({ children, ...rest }) => {
|
|
14
|
+
return /* @__PURE__ */ jsx("div", { ...rest, children });
|
|
15
|
+
};
|
|
16
|
+
const SidebarNavigation = ({
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"nav",
|
|
23
|
+
{
|
|
24
|
+
className: classNames(
|
|
25
|
+
"eds-layout-template-sidebar__navigation",
|
|
26
|
+
className
|
|
27
|
+
),
|
|
28
|
+
...rest,
|
|
29
|
+
children
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
const SidebarFooter = ({
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
...rest
|
|
37
|
+
}) => {
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
"footer",
|
|
40
|
+
{
|
|
41
|
+
className: classNames("eds-layout-template-sidebar__footer", className),
|
|
42
|
+
...rest,
|
|
43
|
+
children
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
const SidebarRoot = ({
|
|
48
|
+
children,
|
|
49
|
+
className,
|
|
50
|
+
style,
|
|
51
|
+
contrast = true,
|
|
52
|
+
...rest
|
|
53
|
+
}) => {
|
|
54
|
+
const WrapperElement = contrast ? Contrast : "div";
|
|
55
|
+
return /* @__PURE__ */ jsx(GridComponent.Item, { as: WrapperElement, colSpan: "1 / 2", rowSpan: "1 / 2", children: /* @__PURE__ */ jsx(
|
|
56
|
+
FlexComponent,
|
|
57
|
+
{
|
|
58
|
+
as: "aside",
|
|
59
|
+
direction: "column",
|
|
60
|
+
gap: "m",
|
|
61
|
+
className: classNames(
|
|
62
|
+
"eds-layout-template-sidebar",
|
|
63
|
+
{
|
|
64
|
+
"eds-layout-template-sidebar--plain": !contrast
|
|
65
|
+
},
|
|
66
|
+
className
|
|
67
|
+
),
|
|
68
|
+
style,
|
|
69
|
+
...rest,
|
|
70
|
+
children
|
|
71
|
+
}
|
|
72
|
+
) });
|
|
73
|
+
};
|
|
74
|
+
const Sidebar = Object.assign(SidebarRoot, {
|
|
75
|
+
Logo: SidebarLogo,
|
|
76
|
+
User: SidebarUser,
|
|
77
|
+
Data: SidebarData,
|
|
78
|
+
Navigation: SidebarNavigation,
|
|
79
|
+
Footer: SidebarFooter
|
|
80
|
+
});
|
|
81
|
+
Sidebar.displayName = "Template.Portal.Sidebar";
|
|
82
|
+
Sidebar.Logo.displayName = "Template.Portal.Sidebar.Logo";
|
|
83
|
+
Sidebar.User.displayName = "Template.Portal.Sidebar.User";
|
|
84
|
+
Sidebar.Data.displayName = "Template.Portal.Sidebar.Data";
|
|
85
|
+
Sidebar.Navigation.displayName = "Template.Portal.Sidebar.Navigation";
|
|
86
|
+
Sidebar.Footer.displayName = "Template.Portal.Sidebar.Footer";
|
|
87
|
+
export {
|
|
88
|
+
Sidebar
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=Sidebar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.mjs","sources":["../../../../src/beta/templates/Sidebar.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { Contrast } from '../../Contrast';\nimport { Flex } from '../Flex';\nimport { Grid } from '../Grid';\nimport './Sidebar.scss';\n\nexport type SidebarProps = React.HTMLAttributes<HTMLElement> & {\n /** Toggle contrast styling for the sidebar */\n contrast?: boolean;\n};\n\nexport type SidebarSectionProps = React.HTMLAttributes<HTMLElement>;\n\nconst SidebarLogo: React.FC<SidebarSectionProps> = ({ children, ...rest }) => {\n return <div {...rest}>{children}</div>;\n};\n\nconst SidebarUser: React.FC<SidebarSectionProps> = ({ children, ...rest }) => {\n return <div {...rest}>{children}</div>;\n};\n\nconst SidebarData: React.FC<SidebarSectionProps> = ({ children, ...rest }) => {\n return <div {...rest}>{children}</div>;\n};\n\nconst SidebarNavigation: React.FC<SidebarSectionProps> = ({\n children,\n className,\n ...rest\n}) => {\n return (\n <nav\n className={classNames(\n 'eds-layout-template-sidebar__navigation',\n className,\n )}\n {...rest}\n >\n {children}\n </nav>\n );\n};\n\nconst SidebarFooter: React.FC<SidebarSectionProps> = ({\n children,\n className,\n ...rest\n}) => {\n return (\n <footer\n className={classNames('eds-layout-template-sidebar__footer', className)}\n {...rest}\n >\n {children}\n </footer>\n );\n};\n\nconst SidebarRoot: React.FC<SidebarProps> = ({\n children,\n className,\n style,\n contrast = true,\n ...rest\n}) => {\n const WrapperElement = contrast ? Contrast : 'div';\n return (\n <Grid.Item as={WrapperElement} colSpan=\"1 / 2\" rowSpan=\"1 / 2\">\n <Flex\n as=\"aside\"\n direction=\"column\"\n gap=\"m\"\n className={classNames(\n 'eds-layout-template-sidebar',\n {\n 'eds-layout-template-sidebar--plain': !contrast,\n },\n className,\n )}\n style={style}\n {...rest}\n >\n {children}\n </Flex>\n </Grid.Item>\n );\n};\n\nexport type SidebarComponent = typeof SidebarRoot & {\n Logo: typeof SidebarLogo;\n User: typeof SidebarUser;\n Data: typeof SidebarData;\n Navigation: typeof SidebarNavigation;\n Footer: typeof SidebarFooter;\n};\n\nexport const Sidebar: SidebarComponent = Object.assign(SidebarRoot, {\n Logo: SidebarLogo,\n User: SidebarUser,\n Data: SidebarData,\n Navigation: SidebarNavigation,\n Footer: SidebarFooter,\n});\n\nSidebar.displayName = 'Template.Portal.Sidebar';\nSidebar.Logo.displayName = 'Template.Portal.Sidebar.Logo';\nSidebar.User.displayName = 'Template.Portal.Sidebar.User';\nSidebar.Data.displayName = 'Template.Portal.Sidebar.Data';\nSidebar.Navigation.displayName = 'Template.Portal.Sidebar.Navigation';\nSidebar.Footer.displayName = 'Template.Portal.Sidebar.Footer';\n"],"names":["Grid","Flex"],"mappings":";;;;;;AAcA,MAAM,cAA6C,CAAC,EAAE,UAAU,GAAG,WAAW;AAC5E,SAAO,oBAAC,OAAA,EAAK,GAAG,MAAO,SAAA,CAAS;AAClC;AAEA,MAAM,cAA6C,CAAC,EAAE,UAAU,GAAG,WAAW;AAC5E,SAAO,oBAAC,OAAA,EAAK,GAAG,MAAO,SAAA,CAAS;AAClC;AAEA,MAAM,cAA6C,CAAC,EAAE,UAAU,GAAG,WAAW;AAC5E,SAAO,oBAAC,OAAA,EAAK,GAAG,MAAO,SAAA,CAAS;AAClC;AAEA,MAAM,oBAAmD,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MAAA;AAAA,MAED,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,MAAM,gBAA+C,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,WAAW,uCAAuC,SAAS;AAAA,MACrE,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,MAAM,cAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,GAAG;AACL,MAAM;AACJ,QAAM,iBAAiB,WAAW,WAAW;AAC7C,SACE,oBAACA,cAAK,MAAL,EAAU,IAAI,gBAAgB,SAAQ,SAAQ,SAAQ,SACrD,UAAA;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,IAAG;AAAA,MACH,WAAU;AAAA,MACV,KAAI;AAAA,MACJ,WAAW;AAAA,QACT;AAAA,QACA;AAAA,UACE,sCAAsC,CAAC;AAAA,QAAA;AAAA,QAEzC;AAAA,MAAA;AAAA,MAEF;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA,GAEL;AAEJ;AAUO,MAAM,UAA4B,OAAO,OAAO,aAAa;AAAA,EAClE,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,QAAQ;AACV,CAAC;AAED,QAAQ,cAAc;AACtB,QAAQ,KAAK,cAAc;AAC3B,QAAQ,KAAK,cAAc;AAC3B,QAAQ,KAAK,cAAc;AAC3B,QAAQ,WAAW,cAAc;AACjC,QAAQ,OAAO,cAAc;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/beta/templates/index.ts"],"sourcesContent":["import { Portal } from './portal';\nimport type { PortalComponent, PortalMainProps, PortalProps } from './portal';\nimport type {\n SidebarComponent,\n SidebarProps,\n SidebarSectionProps,\n} from './Sidebar';\n\nexport type TemplateComponent = {\n Portal: PortalComponent;\n};\n\nexport const Template: TemplateComponent = {\n Portal,\n};\n\nexport type {\n PortalComponent,\n PortalMainProps,\n PortalProps,\n SidebarComponent,\n SidebarProps,\n SidebarSectionProps,\n};\n"],"names":[],"mappings":";AAYO,MAAM,WAA8B;AAAA,EACzC;AACF;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { GridComponent } from "../../Grid/index.mjs";
|
|
4
|
+
import { Sidebar } from "../Sidebar.mjs";
|
|
5
|
+
/* empty css */
|
|
6
|
+
const PortalRoot = ({
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
style,
|
|
10
|
+
...rest
|
|
11
|
+
}) => {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
GridComponent,
|
|
14
|
+
{
|
|
15
|
+
templateColumns: "var(--eds-sidebar-width, min-content) minmax(0, 1fr)",
|
|
16
|
+
gap: "m",
|
|
17
|
+
className: classNames("eds-layout-template-portal", className),
|
|
18
|
+
style,
|
|
19
|
+
...rest,
|
|
20
|
+
children
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
const PortalMain = ({
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
GridComponent.Item,
|
|
32
|
+
{
|
|
33
|
+
as: "main",
|
|
34
|
+
colSpan: "2 / -1",
|
|
35
|
+
className: classNames("eds-layout-template-portal__main", className),
|
|
36
|
+
style,
|
|
37
|
+
...rest,
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
const Portal = Object.assign(PortalRoot, {
|
|
43
|
+
Sidebar,
|
|
44
|
+
Main: PortalMain
|
|
45
|
+
});
|
|
46
|
+
Portal.displayName = "Template.Portal";
|
|
47
|
+
Portal.Main.displayName = "Template.Portal.Main";
|
|
48
|
+
export {
|
|
49
|
+
Portal
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=Portal.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Portal.mjs","sources":["../../../../../src/beta/templates/portal/Portal.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { Grid } from '../../Grid';\nimport { Sidebar, SidebarComponent } from '../Sidebar';\nimport './Portal.scss';\n\nexport type PortalProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type PortalMainProps = React.HTMLAttributes<HTMLElement>;\n\nconst PortalRoot: React.FC<PortalProps> = ({\n children,\n className,\n style,\n ...rest\n}) => {\n return (\n <Grid\n templateColumns=\"var(--eds-sidebar-width, min-content) minmax(0, 1fr)\"\n gap=\"m\"\n className={classNames('eds-layout-template-portal', className)}\n style={style}\n {...rest}\n >\n {children}\n </Grid>\n );\n};\n\nconst PortalMain: React.FC<PortalMainProps> = ({\n children,\n className,\n style,\n ...rest\n}) => {\n return (\n <Grid.Item\n as=\"main\"\n colSpan=\"2 / -1\"\n className={classNames('eds-layout-template-portal__main', className)}\n style={style}\n {...rest}\n >\n {children}\n </Grid.Item>\n );\n};\n\nexport type PortalComponent = typeof PortalRoot & {\n Sidebar: SidebarComponent;\n Main: typeof PortalMain;\n};\n\nexport const Portal: PortalComponent = Object.assign(PortalRoot, {\n Sidebar,\n Main: PortalMain,\n});\n\nPortal.displayName = 'Template.Portal';\nPortal.Main.displayName = 'Template.Portal.Main';\n"],"names":["Grid"],"mappings":";;;;;AAUA,MAAM,aAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAACA;AAAAA,IAAA;AAAA,MACC,iBAAgB;AAAA,MAChB,KAAI;AAAA,MACJ,WAAW,WAAW,8BAA8B,SAAS;AAAA,MAC7D;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA,MAAM,aAAwC,CAAC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SACE;AAAA,IAACA,cAAK;AAAA,IAAL;AAAA,MACC,IAAG;AAAA,MACH,SAAQ;AAAA,MACR,WAAW,WAAW,oCAAoC,SAAS;AAAA,MACnE;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGP;AAOO,MAAM,SAA0B,OAAO,OAAO,YAAY;AAAA,EAC/D;AAAA,EACA,MAAM;AACR,CAAC;AAED,OAAO,cAAc;AACrB,OAAO,KAAK,cAAc;"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
[data-view-mode=standard]{
|
|
3
|
+
/* number */
|
|
4
|
+
--2xs:var(--size-3);
|
|
5
|
+
--xs:var(--size-5);
|
|
6
|
+
--s:var(--size-6);
|
|
7
|
+
--s-m:var(--size-8);
|
|
8
|
+
--m:var(--size-9);
|
|
9
|
+
--m-l:var(--size-10);
|
|
10
|
+
--l:var(--size-11);
|
|
11
|
+
--xl:var(--size-12);
|
|
12
|
+
--2xl:var(--size-13);
|
|
13
|
+
--3xl:var(--size-14);
|
|
14
|
+
--4xl:var(--size-16);
|
|
15
|
+
--5xl:var(--size-17);
|
|
16
|
+
--6xl:var(--size-18);
|
|
17
|
+
--7xl:var(--size-19);
|
|
18
|
+
--8xl:var(--size-20);
|
|
19
|
+
--9xl:var(--size-21);
|
|
20
|
+
--10xl:var(--size-22);
|
|
21
|
+
--11xl:var(--size-23);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[data-view-mode=compact]{
|
|
25
|
+
/* number */
|
|
26
|
+
--2xs:var(--size-2);
|
|
27
|
+
--xs:var(--size-3);
|
|
28
|
+
--s:var(--size-5);
|
|
29
|
+
--s-m:var(--size-6);
|
|
30
|
+
--m:var(--size-8);
|
|
31
|
+
--m-l:var(--size-9);
|
|
32
|
+
--l:var(--size-10);
|
|
33
|
+
--xl:var(--size-11);
|
|
34
|
+
--2xl:var(--size-12);
|
|
35
|
+
--3xl:var(--size-13);
|
|
36
|
+
--4xl:var(--size-14);
|
|
37
|
+
--5xl:var(--size-16);
|
|
38
|
+
--6xl:var(--size-17);
|
|
39
|
+
--7xl:var(--size-18);
|
|
40
|
+
--8xl:var(--size-19);
|
|
41
|
+
--9xl:var(--size-20);
|
|
42
|
+
--10xl:var(--size-21);
|
|
43
|
+
--11xl:var(--size-22);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[data-view-mode=display]{
|
|
47
|
+
/* number */
|
|
48
|
+
--2xs:var(--size-5);
|
|
49
|
+
--xs:var(--size-8);
|
|
50
|
+
--s:var(--size-10);
|
|
51
|
+
--s-m:var(--size-11);
|
|
52
|
+
--m:var(--size-13);
|
|
53
|
+
--m-l:var(--size-15);
|
|
54
|
+
--l:var(--size-18);
|
|
55
|
+
--xl:var(--size-19);
|
|
56
|
+
--2xl:var(--size-20);
|
|
57
|
+
--3xl:var(--size-21);
|
|
58
|
+
--4xl:var(--size-23);
|
|
59
|
+
--5xl:var(--size-24);
|
|
60
|
+
--6xl:var(--size-25);
|
|
61
|
+
--7xl:var(--size-27);
|
|
62
|
+
--8xl:var(--size-28);
|
|
63
|
+
--9xl:var(--size-29);
|
|
64
|
+
--10xl:var(--size-30);
|
|
65
|
+
--11xl:var(--size-31);
|
|
66
|
+
}:where(.eds-layout-grid){
|
|
67
|
+
display:grid;
|
|
68
|
+
grid-template-columns:repeat(12, 1fr);
|
|
69
|
+
grid-template-columns:var(--grid-template-columns, repeat(12, 1fr));
|
|
70
|
+
grid-template-rows:var(--grid-template-rows);
|
|
71
|
+
grid-auto-flow:row;
|
|
72
|
+
grid-auto-flow:var(--grid-auto-flow, row);
|
|
73
|
+
-webkit-box-align:var(--grid-align-items);
|
|
74
|
+
-webkit-align-items:var(--grid-align-items);
|
|
75
|
+
-moz-box-align:var(--grid-align-items);
|
|
76
|
+
align-items:var(--grid-align-items);
|
|
77
|
+
-webkit-box-pack:var(--grid-justify-content);
|
|
78
|
+
-webkit-justify-content:var(--grid-justify-content);
|
|
79
|
+
-moz-box-pack:var(--grid-justify-content);
|
|
80
|
+
justify-content:var(--grid-justify-content);
|
|
81
|
+
-webkit-align-content:var(--grid-align-content);
|
|
82
|
+
align-content:var(--grid-align-content);
|
|
83
|
+
grid-gap:var(--grid-gap);
|
|
84
|
+
gap:var(--grid-gap);
|
|
85
|
+
grid-row-gap:var(--grid-row-gap, var(--grid-gap));
|
|
86
|
+
row-gap:var(--grid-row-gap, var(--grid-gap));
|
|
87
|
+
grid-column-gap:var(--grid-column-gap, var(--grid-gap));
|
|
88
|
+
-webkit-column-gap:var(--grid-column-gap, var(--grid-gap));
|
|
89
|
+
-moz-column-gap:var(--grid-column-gap, var(--grid-gap));
|
|
90
|
+
column-gap:var(--grid-column-gap, var(--grid-gap));
|
|
91
|
+
height:var(--grid-height);
|
|
92
|
+
}
|
|
93
|
+
:where(.eds-layout-grid .eds-layout-grid){
|
|
94
|
+
grid-template-columns:subgrid;
|
|
95
|
+
grid-template-rows:subgrid;
|
|
96
|
+
}.eds-layout-grid-item{
|
|
97
|
+
grid-column:var(--grid-item-column);
|
|
98
|
+
grid-row:var(--grid-item-row);
|
|
99
|
+
}:where(.eds-layout-flex){
|
|
100
|
+
display:-webkit-box;
|
|
101
|
+
display:-webkit-flex;
|
|
102
|
+
display:-moz-box;
|
|
103
|
+
display:flex;
|
|
104
|
+
display:var(--flex-display, flex);
|
|
105
|
+
-webkit-box-orient:horizontal;
|
|
106
|
+
-webkit-box-direction:normal;
|
|
107
|
+
-webkit-flex-direction:row;
|
|
108
|
+
-moz-box-orient:horizontal;
|
|
109
|
+
-moz-box-direction:normal;
|
|
110
|
+
flex-direction:row;
|
|
111
|
+
flex-direction:var(--flex-direction, row);
|
|
112
|
+
-webkit-flex-wrap:nowrap;
|
|
113
|
+
flex-wrap:nowrap;
|
|
114
|
+
-webkit-flex-wrap:var(--flex-wrap, nowrap);
|
|
115
|
+
flex-wrap:var(--flex-wrap, nowrap);
|
|
116
|
+
-webkit-box-align:var(--flex-align-items);
|
|
117
|
+
-webkit-align-items:var(--flex-align-items);
|
|
118
|
+
-moz-box-align:var(--flex-align-items);
|
|
119
|
+
align-items:var(--flex-align-items);
|
|
120
|
+
-webkit-box-pack:var(--flex-justify-content);
|
|
121
|
+
-webkit-justify-content:var(--flex-justify-content);
|
|
122
|
+
-moz-box-pack:var(--flex-justify-content);
|
|
123
|
+
justify-content:var(--flex-justify-content);
|
|
124
|
+
-webkit-align-content:var(--flex-align-content);
|
|
125
|
+
align-content:var(--flex-align-content);
|
|
126
|
+
gap:var(--flex-gap);
|
|
127
|
+
row-gap:var(--flex-row-gap, var(--flex-gap));
|
|
128
|
+
column-gap:var(--flex-column-gap, var(--flex-gap));
|
|
129
|
+
-webkit-column-gap:var(--flex-column-gap, var(--flex-gap));
|
|
130
|
+
-moz-column-gap:var(--flex-column-gap, var(--flex-gap));
|
|
131
|
+
-webkit-box-flex:var(--flex);
|
|
132
|
+
-webkit-flex:var(--flex);
|
|
133
|
+
-moz-box-flex:var(--flex);
|
|
134
|
+
flex:var(--flex);
|
|
135
|
+
-webkit-box-flex:var(--flex-grow);
|
|
136
|
+
-webkit-flex-grow:var(--flex-grow);
|
|
137
|
+
-moz-box-flex:var(--flex-grow);
|
|
138
|
+
flex-grow:var(--flex-grow);
|
|
139
|
+
-webkit-flex-shrink:var(--flex-shrink);
|
|
140
|
+
flex-shrink:var(--flex-shrink);
|
|
141
|
+
-webkit-flex-basis:var(--flex-basis);
|
|
142
|
+
flex-basis:var(--flex-basis);
|
|
143
|
+
width:var(--flex-width);
|
|
144
|
+
height:var(--flex-height);
|
|
145
|
+
min-width:var(--flex-min-width);
|
|
146
|
+
min-height:var(--flex-min-height);
|
|
147
|
+
max-width:var(--flex-max-width);
|
|
148
|
+
max-height:var(--flex-max-height);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.eds-layout-flex-spacer{
|
|
152
|
+
-webkit-box-flex:1;
|
|
153
|
+
-webkit-flex:1 1 0%;
|
|
154
|
+
-moz-box-flex:1;
|
|
155
|
+
flex:1 1 0%;
|
|
156
|
+
}.eds-layout-template-sidebar{
|
|
157
|
+
padding:1rem;
|
|
158
|
+
padding:var(--eds-sidebar-padding, 1rem);
|
|
159
|
+
height:100%;
|
|
160
|
+
width:20rem;
|
|
161
|
+
width:var(--eds-sidebar-width, 20rem);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.eds-layout-template-sidebar--plain{
|
|
165
|
+
background-color:var(--components-menu-sidenavigation-standard-background);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.eds-layout-template-sidebar__navigation{
|
|
169
|
+
-webkit-box-flex:1;
|
|
170
|
+
-webkit-flex:1 1 auto;
|
|
171
|
+
-moz-box-flex:1;
|
|
172
|
+
flex:1 1 auto;
|
|
173
|
+
margin-left:-webkit-calc(-1 * 1rem);
|
|
174
|
+
margin-left:-moz-calc(-1 * 1rem);
|
|
175
|
+
margin-left:calc(-1 * 1rem);
|
|
176
|
+
margin-left:-webkit-calc(-1 * var(--eds-sidebar-padding, 1rem));
|
|
177
|
+
margin-left:-moz-calc(-1 * var(--eds-sidebar-padding, 1rem));
|
|
178
|
+
margin-left:calc(-1 * var(--eds-sidebar-padding, 1rem));
|
|
179
|
+
margin-right:-webkit-calc(-1 * 1rem);
|
|
180
|
+
margin-right:-moz-calc(-1 * 1rem);
|
|
181
|
+
margin-right:calc(-1 * 1rem);
|
|
182
|
+
margin-right:-webkit-calc(-1 * var(--eds-sidebar-padding, 1rem));
|
|
183
|
+
margin-right:-moz-calc(-1 * var(--eds-sidebar-padding, 1rem));
|
|
184
|
+
margin-right:calc(-1 * var(--eds-sidebar-padding, 1rem));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.eds-layout-template-sidebar__footer{
|
|
188
|
+
margin-top:auto;
|
|
189
|
+
}.eds-layout-template-portal{
|
|
190
|
+
min-height:100vh;
|
|
191
|
+
width:100%;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.eds-layout-template-portal__main{
|
|
195
|
+
padding:1rem;
|
|
196
|
+
padding:var(--eds-portal-main-padding, 1rem);
|
|
197
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
+
import { GridSpacingValue, ResponsiveValue } from '../LayoutWrapper/utils';
|
|
4
|
+
export type FlexSpacingValue = GridSpacingValue;
|
|
5
|
+
type FlexDirection = React.CSSProperties['flexDirection'];
|
|
6
|
+
type FlexWrap = React.CSSProperties['flexWrap'];
|
|
7
|
+
type AlignItems = React.CSSProperties['alignItems'];
|
|
8
|
+
type JustifyContent = React.CSSProperties['justifyContent'];
|
|
9
|
+
type AlignContent = React.CSSProperties['alignContent'];
|
|
10
|
+
type FlexBasis = React.CSSProperties['flexBasis'];
|
|
11
|
+
type FlexValue = React.CSSProperties['flex'];
|
|
12
|
+
export type FlexOwnProps = {
|
|
13
|
+
/** CSS flex-direction value (supports responsive objects)
|
|
14
|
+
* @default "row"
|
|
15
|
+
*/
|
|
16
|
+
direction?: FlexDirection | ResponsiveValue<FlexDirection>;
|
|
17
|
+
/** CSS flex-wrap value (supports responsive objects)
|
|
18
|
+
* @default "nowrap"
|
|
19
|
+
*/
|
|
20
|
+
wrap?: FlexWrap | ResponsiveValue<FlexWrap>;
|
|
21
|
+
/** CSS align-items value (supports responsive objects) */
|
|
22
|
+
align?: AlignItems | ResponsiveValue<AlignItems>;
|
|
23
|
+
/** CSS justify-content value (supports responsive objects) */
|
|
24
|
+
justify?: JustifyContent | ResponsiveValue<JustifyContent>;
|
|
25
|
+
/** CSS align-content value (supports responsive objects) */
|
|
26
|
+
alignContent?: AlignContent | ResponsiveValue<AlignContent>;
|
|
27
|
+
/** Spacing between flex items (supports responsive objects) */
|
|
28
|
+
gap?: FlexSpacingValue | ResponsiveValue<FlexSpacingValue>;
|
|
29
|
+
/** Vertical spacing between rows (supports responsive objects) */
|
|
30
|
+
rowGap?: FlexSpacingValue | ResponsiveValue<FlexSpacingValue>;
|
|
31
|
+
/** Horizontal spacing between columns (supports responsive objects) */
|
|
32
|
+
columnGap?: FlexSpacingValue | ResponsiveValue<FlexSpacingValue>;
|
|
33
|
+
/** CSS flex shorthand value */
|
|
34
|
+
flex?: FlexValue;
|
|
35
|
+
/** CSS flex-grow value */
|
|
36
|
+
grow?: number;
|
|
37
|
+
/** CSS flex-shrink value */
|
|
38
|
+
shrink?: number;
|
|
39
|
+
/** CSS flex-basis value */
|
|
40
|
+
basis?: FlexBasis;
|
|
41
|
+
/** CSS width value */
|
|
42
|
+
width?: string;
|
|
43
|
+
/** CSS height value */
|
|
44
|
+
height?: string;
|
|
45
|
+
/** CSS min-width value */
|
|
46
|
+
minWidth?: string;
|
|
47
|
+
/** CSS min-height value */
|
|
48
|
+
minHeight?: string;
|
|
49
|
+
/** CSS max-width value */
|
|
50
|
+
maxWidth?: string;
|
|
51
|
+
/** CSS max-height value */
|
|
52
|
+
maxHeight?: string;
|
|
53
|
+
/** HTML element or React component used to render the Flex container
|
|
54
|
+
* @default "div"
|
|
55
|
+
*/
|
|
56
|
+
as?: string | React.ElementType;
|
|
57
|
+
/** Additional class names */
|
|
58
|
+
className?: string;
|
|
59
|
+
/** Content of the Flex container */
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
};
|
|
62
|
+
export type FlexProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, FlexOwnProps>;
|
|
63
|
+
declare const defaultElement = "div";
|
|
64
|
+
export declare const Flex: <E extends React.ElementType = "div">({ direction, wrap, align, justify, alignContent, gap, rowGap, columnGap, flex, grow, shrink, basis, width, height, minWidth, minHeight, maxWidth, maxHeight, as, className, children, style, ...rest }: FlexProps<E>) => JSX.Element;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
+
export type FlexSpacerOwnProps = {
|
|
4
|
+
/** HTML element or React component used to render Flex.Spacer
|
|
5
|
+
* @default "div"
|
|
6
|
+
*/
|
|
7
|
+
as?: string | React.ElementType;
|
|
8
|
+
/** Additional class name */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Spacer should not render children */
|
|
11
|
+
children?: never;
|
|
12
|
+
};
|
|
13
|
+
export type FlexSpacerProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, FlexSpacerOwnProps>;
|
|
14
|
+
declare const defaultElement = "div";
|
|
15
|
+
export declare const FlexSpacer: <E extends React.ElementType = "div">({ as, className, style, ...rest }: FlexSpacerProps<E>) => JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Flex as FlexParent } from './Flex';
|
|
2
|
+
import { FlexSpacer } from './FlexSpacer';
|
|
3
|
+
type Flex = typeof FlexParent & {
|
|
4
|
+
/**
|
|
5
|
+
* A spacer element that fills available space in Flex.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Flex>
|
|
9
|
+
* <Button>Left</Button>
|
|
10
|
+
* <Flex.Spacer />
|
|
11
|
+
* <Button>Right</Button>
|
|
12
|
+
* </Flex>
|
|
13
|
+
*/
|
|
14
|
+
Spacer: typeof FlexSpacer & {
|
|
15
|
+
displayName?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A Flex component for organizing content in a flexible layout.
|
|
20
|
+
*/
|
|
21
|
+
export declare const FlexComponent: Flex;
|
|
22
|
+
export type { FlexProps, FlexOwnProps, FlexSpacingValue } from './Flex';
|
|
23
|
+
export type { FlexSpacerProps, FlexSpacerOwnProps } from './FlexSpacer';
|
|
24
|
+
export { FlexComponent as Flex, FlexSpacer };
|