@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.
Files changed (78) hide show
  1. package/dist/beta/cjs/Contrast.cjs +21 -0
  2. package/dist/beta/cjs/Contrast.cjs.map +1 -0
  3. package/dist/beta/cjs/Flex/Flex.cjs +111 -0
  4. package/dist/beta/cjs/Flex/Flex.cjs.map +1 -0
  5. package/dist/beta/cjs/Flex/FlexSpacer.cjs +25 -0
  6. package/dist/beta/cjs/Flex/FlexSpacer.cjs.map +1 -0
  7. package/dist/beta/cjs/Flex/index.cjs +12 -0
  8. package/dist/beta/cjs/Flex/index.cjs.map +1 -0
  9. package/dist/beta/cjs/Grid/Grid.cjs +80 -0
  10. package/dist/beta/cjs/Grid/Grid.cjs.map +1 -0
  11. package/dist/beta/cjs/Grid/GridItem.cjs +49 -0
  12. package/dist/beta/cjs/Grid/GridItem.cjs.map +1 -0
  13. package/dist/beta/cjs/Grid/index.cjs +12 -0
  14. package/dist/beta/cjs/Grid/index.cjs.map +1 -0
  15. package/dist/beta/cjs/LayoutWrapper/LayoutWrapper.cjs +31 -0
  16. package/dist/beta/cjs/LayoutWrapper/LayoutWrapper.cjs.map +1 -0
  17. package/dist/beta/cjs/LayoutWrapper/useLayoutValues.cjs +15 -0
  18. package/dist/beta/cjs/LayoutWrapper/useLayoutValues.cjs.map +1 -0
  19. package/dist/beta/cjs/LayoutWrapper/useResponsiveValue.cjs +78 -0
  20. package/dist/beta/cjs/LayoutWrapper/useResponsiveValue.cjs.map +1 -0
  21. package/dist/beta/cjs/LayoutWrapper/utils.cjs +49 -0
  22. package/dist/beta/cjs/LayoutWrapper/utils.cjs.map +1 -0
  23. package/dist/beta/cjs/index.cjs +18 -0
  24. package/dist/beta/cjs/index.cjs.map +1 -0
  25. package/dist/beta/cjs/templates/Sidebar.cjs +90 -0
  26. package/dist/beta/cjs/templates/Sidebar.cjs.map +1 -0
  27. package/dist/beta/cjs/templates/index.cjs +8 -0
  28. package/dist/beta/cjs/templates/index.cjs.map +1 -0
  29. package/dist/beta/cjs/templates/portal/Portal.cjs +51 -0
  30. package/dist/beta/cjs/templates/portal/Portal.cjs.map +1 -0
  31. package/dist/beta/esm/Contrast.mjs +21 -0
  32. package/dist/beta/esm/Contrast.mjs.map +1 -0
  33. package/dist/beta/esm/Flex/Flex.mjs +111 -0
  34. package/dist/beta/esm/Flex/Flex.mjs.map +1 -0
  35. package/dist/beta/esm/Flex/FlexSpacer.mjs +25 -0
  36. package/dist/beta/esm/Flex/FlexSpacer.mjs.map +1 -0
  37. package/dist/beta/esm/Flex/index.mjs +12 -0
  38. package/dist/beta/esm/Flex/index.mjs.map +1 -0
  39. package/dist/beta/esm/Grid/Grid.mjs +80 -0
  40. package/dist/beta/esm/Grid/Grid.mjs.map +1 -0
  41. package/dist/beta/esm/Grid/GridItem.mjs +49 -0
  42. package/dist/beta/esm/Grid/GridItem.mjs.map +1 -0
  43. package/dist/beta/esm/Grid/index.mjs +12 -0
  44. package/dist/beta/esm/Grid/index.mjs.map +1 -0
  45. package/dist/beta/esm/LayoutWrapper/LayoutWrapper.mjs +31 -0
  46. package/dist/beta/esm/LayoutWrapper/LayoutWrapper.mjs.map +1 -0
  47. package/dist/beta/esm/LayoutWrapper/useLayoutValues.mjs +15 -0
  48. package/dist/beta/esm/LayoutWrapper/useLayoutValues.mjs.map +1 -0
  49. package/dist/beta/esm/LayoutWrapper/useResponsiveValue.mjs +78 -0
  50. package/dist/beta/esm/LayoutWrapper/useResponsiveValue.mjs.map +1 -0
  51. package/dist/beta/esm/LayoutWrapper/utils.mjs +49 -0
  52. package/dist/beta/esm/LayoutWrapper/utils.mjs.map +1 -0
  53. package/dist/beta/esm/index.mjs +18 -0
  54. package/dist/beta/esm/index.mjs.map +1 -0
  55. package/dist/beta/esm/templates/Sidebar.mjs +90 -0
  56. package/dist/beta/esm/templates/Sidebar.mjs.map +1 -0
  57. package/dist/beta/esm/templates/index.mjs +8 -0
  58. package/dist/beta/esm/templates/index.mjs.map +1 -0
  59. package/dist/beta/esm/templates/portal/Portal.mjs +51 -0
  60. package/dist/beta/esm/templates/portal/Portal.mjs.map +1 -0
  61. package/dist/beta/styles/index.css +197 -0
  62. package/dist/beta/types/Flex/Flex.d.ts +65 -0
  63. package/dist/beta/types/Flex/FlexSpacer.d.ts +16 -0
  64. package/dist/beta/types/Flex/index.d.ts +24 -0
  65. package/dist/beta/types/Grid/Grid.d.ts +46 -0
  66. package/dist/beta/types/Grid/GridItem.d.ts +28 -0
  67. package/dist/beta/types/Grid/index.d.ts +29 -0
  68. package/dist/beta/types/LayoutWrapper/LayoutWrapper.d.ts +13 -0
  69. package/dist/beta/types/LayoutWrapper/index.d.ts +6 -0
  70. package/dist/beta/types/LayoutWrapper/useLayoutValues.d.ts +2 -0
  71. package/dist/beta/types/LayoutWrapper/useResponsiveValue.d.ts +2 -0
  72. package/dist/beta/types/LayoutWrapper/utils.d.ts +15 -0
  73. package/dist/beta/types/index.d.ts +7 -0
  74. package/dist/beta/types/templates/Sidebar.d.ts +21 -0
  75. package/dist/beta/types/templates/index.d.ts +7 -0
  76. package/dist/beta/types/templates/portal/Portal.d.ts +12 -0
  77. package/dist/beta/types/templates/portal/index.d.ts +2 -0
  78. package/package.json +27 -3
@@ -0,0 +1,46 @@
1
+ import { default as React } from 'react';
2
+ import { PolymorphicComponentProps } from '@entur/utils';
3
+ import { GridSpacingValue, ResponsiveValue } from '../LayoutWrapper/utils';
4
+ type AlignItems = React.CSSProperties['alignItems'];
5
+ type JustifyContent = React.CSSProperties['justifyContent'];
6
+ type AlignContent = React.CSSProperties['alignContent'];
7
+ export type GridOwnProps = {
8
+ /** CSS grid-template-columns value (supports responsive objects)
9
+ * @default "repeat(12, 1fr)"
10
+ */
11
+ templateColumns?: string | ResponsiveValue<string>;
12
+ /** Spacing between grid items (supports responsive objects)
13
+ * @default "m"
14
+ */
15
+ gap?: GridSpacingValue | ResponsiveValue<GridSpacingValue>;
16
+ /** Vertical spacing between grid rows (supports responsive objects) */
17
+ rowGap?: GridSpacingValue | ResponsiveValue<GridSpacingValue>;
18
+ /** Horizontal spacing between grid columns (supports responsive objects) */
19
+ columnGap?: GridSpacingValue | ResponsiveValue<GridSpacingValue>;
20
+ /** CSS grid-template-rows value (supports responsive objects) */
21
+ templateRows?: string | ResponsiveValue<string>;
22
+ /** CSS grid-auto-flow value (supports responsive objects)
23
+ * @default "row"
24
+ */
25
+ autoFlow?: 'row' | 'column' | 'dense' | 'row dense' | 'column dense' | ResponsiveValue<'row' | 'column' | 'dense' | 'row dense' | 'column dense'>;
26
+ /** CSS align-items value (supports responsive objects) */
27
+ align?: AlignItems | ResponsiveValue<AlignItems>;
28
+ /** CSS justify-content value (supports responsive objects) */
29
+ justify?: JustifyContent | ResponsiveValue<JustifyContent>;
30
+ /** CSS align-content value (supports responsive objects) */
31
+ alignContent?: AlignContent | ResponsiveValue<AlignContent>;
32
+ /** The height of the grid container */
33
+ height?: string;
34
+ /** HTML element or React component used to render the Grid
35
+ * @default "div"
36
+ */
37
+ as?: string | React.ElementType;
38
+ /** Additional class names */
39
+ className?: string;
40
+ /** Content of the Grid container */
41
+ children?: React.ReactNode;
42
+ };
43
+ export type GridProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, GridOwnProps>;
44
+ declare const defaultElement = "div";
45
+ export declare const Grid: <E extends React.ElementType = "div">({ templateColumns, templateRows, gap, rowGap, columnGap, autoFlow, align, justify, alignContent, height, as, className, children, style, ...rest }: GridProps<E>) => JSX.Element;
46
+ export {};
@@ -0,0 +1,28 @@
1
+ import { default as React } from 'react';
2
+ import { PolymorphicComponentProps } from '@entur/utils';
3
+ import { ResponsiveValue } from '../LayoutWrapper/utils';
4
+ export type GridItemOwnProps = {
5
+ /** Number of columns the item should span (supports responsive objects)
6
+ * If number: adds "span" prefix (e.g., 6 → "span 6")
7
+ * If string: used directly (e.g., "span 3" or "1 / 3")
8
+ */
9
+ colSpan?: number | string | ResponsiveValue<number | string>;
10
+ /** Number of rows the item should span (supports responsive objects)
11
+ * @default 1
12
+ * If number: adds "span" prefix (e.g., 2 → "span 2")
13
+ * If string: used directly (e.g., "span 2" or "1 / 3")
14
+ */
15
+ rowSpan?: number | string | ResponsiveValue<number | string>;
16
+ /** HTML element or React component used to render the Grid item
17
+ * @default "div"
18
+ */
19
+ as?: string | React.ElementType;
20
+ /** Additional class names */
21
+ className?: string;
22
+ /** Content of the Grid item */
23
+ children?: React.ReactNode;
24
+ };
25
+ export type GridItemProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, GridItemOwnProps>;
26
+ declare const defaultElement = "div";
27
+ export declare const GridItem: <E extends React.ElementType = "div">({ colSpan, rowSpan, as, className, children, style, ...rest }: GridItemProps<E>) => JSX.Element;
28
+ export {};
@@ -0,0 +1,29 @@
1
+ import { Grid as GridParent } from './Grid';
2
+ import { GridItem } from './GridItem';
3
+ type Grid = typeof GridParent & {
4
+ /**
5
+ * An item inside a Grid.
6
+ *
7
+ * @example
8
+ * <Grid.Item colSpan={6}>Content</Grid.Item>
9
+ */
10
+ Item: typeof GridItem & {
11
+ displayName?: string;
12
+ };
13
+ };
14
+ /**
15
+ * A CSS Grid component for organizing content in a grid.
16
+ *
17
+ * @example
18
+ * <Grid>
19
+ * <Grid.Item colSpan={6}>Content</Grid.Item>
20
+ * <Grid.Item colSpan={6}>Content</Grid.Item>
21
+ * </Grid>
22
+ */
23
+ export declare const GridComponent: Grid;
24
+ export type { GridProps, GridOwnProps } from './Grid';
25
+ export type { GridSpacingValue, ResponsiveValue } from '../LayoutWrapper/utils';
26
+ export type { GridItemProps, GridItemOwnProps } from './GridItem';
27
+ export { GridComponent as Grid, GridItem };
28
+ export { LayoutWrapper } from '../LayoutWrapper/LayoutWrapper';
29
+ export { useLayoutValues } from '../LayoutWrapper/useLayoutValues';
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ import { Breakpoints } from './utils';
3
+ export type LayoutValues = {
4
+ breakpoints: Breakpoints;
5
+ };
6
+ export type LayoutWrapperProps = {
7
+ /** Custom breakpoint values to override defaults */
8
+ breakpoints?: Partial<Breakpoints>;
9
+ /** Children components that can use layout values */
10
+ children: React.ReactNode;
11
+ };
12
+ export declare const LayoutWrapper: ({ breakpoints: customBreakpoints, children, }: LayoutWrapperProps) => JSX.Element;
13
+ export declare const useLayoutContext: () => LayoutValues | null;
@@ -0,0 +1,6 @@
1
+ export { LayoutWrapper } from './LayoutWrapper';
2
+ export { useLayoutValues } from './useLayoutValues';
3
+ export { useResponsiveValue } from './useResponsiveValue';
4
+ export type { LayoutValues, LayoutWrapperProps } from './LayoutWrapper';
5
+ export type { Breakpoints, GridSpacingValue, ResponsiveValue } from './utils';
6
+ export { DEFAULT_BREAKPOINTS, getSpacingValue } from './utils';
@@ -0,0 +1,2 @@
1
+ import { LayoutValues } from './LayoutWrapper';
2
+ export declare const useLayoutValues: () => LayoutValues;
@@ -0,0 +1,2 @@
1
+ import { ResponsiveValue } from './utils';
2
+ export declare const useResponsiveValue: <T>(value: ResponsiveValue<T> | undefined) => T | undefined;
@@ -0,0 +1,15 @@
1
+ declare const VALID_SPACING_VALUES: readonly ["2xs", "xs", "s", "s-m", "m", "m-l", "l", "xl", "2xl", "3xl", "4xl", "5xl", "6xl", "7xl", "8xl", "9xl", "10xl", "11xl", "none"];
2
+ export type GridSpacingValue = (typeof VALID_SPACING_VALUES)[number];
3
+ export type ResponsiveValue<T> = T | {
4
+ sm?: T;
5
+ md?: T;
6
+ lg?: T;
7
+ };
8
+ export type Breakpoints = {
9
+ sm: number;
10
+ md: number;
11
+ lg: number;
12
+ };
13
+ export declare const DEFAULT_BREAKPOINTS: Breakpoints;
14
+ export declare const getSpacingValue: (spacing: GridSpacingValue | undefined, componentName?: string) => string | undefined;
15
+ export {};
@@ -0,0 +1,7 @@
1
+ export { Grid, GridItem } from './Grid';
2
+ export { LayoutWrapper, useLayoutValues } from './LayoutWrapper';
3
+ export { Flex, FlexSpacer } from './Flex';
4
+ export { Template } from './templates';
5
+ export type { GridProps, GridOwnProps, GridItemProps, GridItemOwnProps, GridSpacingValue, ResponsiveValue, } from './Grid';
6
+ export type { FlexProps, FlexOwnProps, FlexSpacingValue, FlexSpacerProps, FlexSpacerOwnProps, } from './Flex';
7
+ export type { PortalComponent, PortalMainProps, PortalProps, SidebarComponent, SidebarProps, SidebarSectionProps, TemplateComponent, } from './templates';
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ export type SidebarProps = React.HTMLAttributes<HTMLElement> & {
3
+ /** Toggle contrast styling for the sidebar */
4
+ contrast?: boolean;
5
+ };
6
+ export type SidebarSectionProps = React.HTMLAttributes<HTMLElement>;
7
+ declare const SidebarLogo: React.FC<SidebarSectionProps>;
8
+ declare const SidebarUser: React.FC<SidebarSectionProps>;
9
+ declare const SidebarData: React.FC<SidebarSectionProps>;
10
+ declare const SidebarNavigation: React.FC<SidebarSectionProps>;
11
+ declare const SidebarFooter: React.FC<SidebarSectionProps>;
12
+ declare const SidebarRoot: React.FC<SidebarProps>;
13
+ export type SidebarComponent = typeof SidebarRoot & {
14
+ Logo: typeof SidebarLogo;
15
+ User: typeof SidebarUser;
16
+ Data: typeof SidebarData;
17
+ Navigation: typeof SidebarNavigation;
18
+ Footer: typeof SidebarFooter;
19
+ };
20
+ export declare const Sidebar: SidebarComponent;
21
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PortalComponent, PortalMainProps, PortalProps } from './portal';
2
+ import { SidebarComponent, SidebarProps, SidebarSectionProps } from './Sidebar';
3
+ export type TemplateComponent = {
4
+ Portal: PortalComponent;
5
+ };
6
+ export declare const Template: TemplateComponent;
7
+ export type { PortalComponent, PortalMainProps, PortalProps, SidebarComponent, SidebarProps, SidebarSectionProps, };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { SidebarComponent } from '../Sidebar';
3
+ export type PortalProps = React.HTMLAttributes<HTMLDivElement>;
4
+ export type PortalMainProps = React.HTMLAttributes<HTMLElement>;
5
+ declare const PortalRoot: React.FC<PortalProps>;
6
+ declare const PortalMain: React.FC<PortalMainProps>;
7
+ export type PortalComponent = typeof PortalRoot & {
8
+ Sidebar: SidebarComponent;
9
+ Main: typeof PortalMain;
10
+ };
11
+ export declare const Portal: PortalComponent;
12
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Portal } from './Portal';
2
+ export type { PortalComponent, PortalMainProps, PortalProps } from './Portal';
package/package.json CHANGED
@@ -1,10 +1,31 @@
1
1
  {
2
2
  "name": "@entur/layout",
3
- "version": "3.3.3",
3
+ "version": "3.4.0",
4
4
  "license": "EUPL-1.2",
5
5
  "main": "dist/layout.cjs.js",
6
6
  "module": "dist/layout.esm.js",
7
7
  "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/layout.esm.js",
12
+ "require": "./dist/layout.cjs.js",
13
+ "default": "./dist/layout.esm.js"
14
+ },
15
+ "./beta": {
16
+ "types": "./dist/beta/types/index.d.ts",
17
+ "import": "./dist/beta/esm/index.mjs",
18
+ "require": "./dist/beta/cjs/index.cjs",
19
+ "default": "./dist/beta/esm/index.mjs"
20
+ },
21
+ "./beta/styles": "./dist/beta/styles/index.css",
22
+ "./dist/*": "./dist/*",
23
+ "./dist/beta": null,
24
+ "./dist/beta/*": null
25
+ },
26
+ "sideEffects": [
27
+ "./dist/**/*.css"
28
+ ],
8
29
  "files": [
9
30
  "dist"
10
31
  ],
@@ -18,7 +39,10 @@
18
39
  },
19
40
  "scripts": {
20
41
  "start": "vite build --watch",
21
- "build": "vite build",
42
+ "start:beta": "vite build --config vite.config.beta.ts --watch",
43
+ "build": "yarn build:main && yarn build:beta",
44
+ "build:main": "vite build",
45
+ "build:beta": "vite build --config vite.config.beta.ts",
22
46
  "test": "jest",
23
47
  "lint": "eslint src"
24
48
  },
@@ -46,5 +70,5 @@
46
70
  "vite": "^7.1.3",
47
71
  "vite-plugin-dts": "^4.5.4"
48
72
  },
49
- "gitHead": "0cea7db16c0411fe1f55f12ffb9c06cdc6e44ad3"
73
+ "gitHead": "6ccfa209ff0606983e817dc86e9081c1a0b1a6f0"
50
74
  }