@entur/layout 3.4.1 → 3.5.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/Flex/Flex.cjs +105 -101
- package/dist/beta/cjs/Flex/Flex.cjs.map +1 -1
- package/dist/beta/cjs/Grid/Grid.cjs +74 -70
- package/dist/beta/cjs/Grid/Grid.cjs.map +1 -1
- package/dist/beta/cjs/Grid/GridItem.cjs +35 -31
- package/dist/beta/cjs/Grid/GridItem.cjs.map +1 -1
- package/dist/beta/cjs/index.cjs +8 -6
- package/dist/beta/cjs/index.cjs.map +1 -1
- package/dist/beta/cjs/templates/Sidebar.cjs +151 -65
- package/dist/beta/cjs/templates/Sidebar.cjs.map +1 -1
- package/dist/beta/cjs/templates/SidebarContext.cjs +10 -0
- package/dist/beta/cjs/templates/SidebarContext.cjs.map +1 -0
- package/dist/beta/cjs/templates/index.cjs.map +1 -1
- package/dist/beta/cjs/templates/portal/Portal.cjs +56 -36
- package/dist/beta/cjs/templates/portal/Portal.cjs.map +1 -1
- package/dist/beta/esm/Flex/Flex.mjs +105 -101
- package/dist/beta/esm/Flex/Flex.mjs.map +1 -1
- package/dist/beta/esm/Grid/Grid.mjs +74 -70
- package/dist/beta/esm/Grid/Grid.mjs.map +1 -1
- package/dist/beta/esm/Grid/GridItem.mjs +35 -31
- package/dist/beta/esm/Grid/GridItem.mjs.map +1 -1
- package/dist/beta/esm/index.mjs +8 -6
- package/dist/beta/esm/index.mjs.map +1 -1
- package/dist/beta/esm/templates/Sidebar.mjs +154 -68
- package/dist/beta/esm/templates/Sidebar.mjs.map +1 -1
- package/dist/beta/esm/templates/SidebarContext.mjs +10 -0
- package/dist/beta/esm/templates/SidebarContext.mjs.map +1 -0
- package/dist/beta/esm/templates/index.mjs.map +1 -1
- package/dist/beta/esm/templates/portal/Portal.mjs +57 -37
- package/dist/beta/esm/templates/portal/Portal.mjs.map +1 -1
- package/dist/beta/styles/index.css +152 -19
- package/dist/beta/types/Flex/Flex.d.ts +3 -1
- package/dist/beta/types/Grid/Grid.d.ts +3 -1
- package/dist/beta/types/Grid/GridItem.d.ts +3 -1
- package/dist/beta/types/index.d.ts +2 -2
- package/dist/beta/types/templates/Sidebar.d.ts +46 -8
- package/dist/beta/types/templates/SidebarContext.d.ts +9 -0
- package/dist/beta/types/templates/index.d.ts +3 -2
- package/dist/beta/types/templates/portal/Portal.d.ts +32 -4
- package/dist/beta/types/templates/portal/index.d.ts +1 -1
- package/package.json +6 -6
|
@@ -1 +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;"}
|
|
1
|
+
{"version":3,"file":"Sidebar.mjs","sources":["../../../../src/beta/templates/Sidebar.tsx"],"sourcesContent":["import React from 'react';\nimport type { PolymorphicComponentProps } from '@entur/utils';\nimport { useControllableProp } from '@entur/utils';\nimport classNames from 'classnames';\nimport { LeftArrowIcon, RightArrowIcon } from '@entur/icons';\nimport { Contrast } from '../../Contrast';\nimport { Flex } from '../Flex';\nimport { Grid } from '../Grid';\nimport { SidebarContext } from './SidebarContext';\nimport './Sidebar.scss';\n\ntype SidebarOwnProps = {\n /** Toggle contrast styling for the sidebar */\n contrast?: boolean;\n /** Enable collapse functionality */\n collapsible?: boolean;\n /** Controlled collapsed state */\n collapsed?: boolean;\n /** Callback when the sidebar is toggled */\n onCollapseToggle?: (collapsed: boolean) => void;\n /** aria-label for the toggle button when the sidebar is collapsed\n * @default 'Åpne sidemeny'\n */\n openSidebarAriaLabel?: string;\n /** aria-label for the toggle button when the sidebar is expanded\n * @default 'Lukk sidemeny'\n */\n closeSidebarAriaLabel?: string;\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\ntype SidebarSectionOwnProps = {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\nconst defaultSidebarElement = 'aside';\nconst defaultSectionElement = 'div';\nconst defaultNavigationElement = 'nav';\nconst defaultFooterElement = 'footer';\n\nexport type SidebarProps<\n T extends React.ElementType = typeof defaultSidebarElement,\n> = PolymorphicComponentProps<T, SidebarOwnProps>;\n\nexport type SidebarSectionProps<\n T extends React.ElementType = typeof defaultSectionElement,\n> = PolymorphicComponentProps<T, SidebarSectionOwnProps>;\n\nconst SidebarLogo = React.forwardRef(\n <E extends React.ElementType = typeof defaultSectionElement>(\n { children, as, ...rest }: SidebarSectionProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n const Element: React.ElementType = as || defaultSectionElement;\n return (\n <Element ref={ref} {...rest}>\n {children}\n </Element>\n );\n },\n);\n\nconst SidebarUser = React.forwardRef(\n <E extends React.ElementType = typeof defaultSectionElement>(\n { children, as, ...rest }: SidebarSectionProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n const Element: React.ElementType = as || defaultSectionElement;\n return (\n <Element ref={ref} {...rest}>\n {children}\n </Element>\n );\n },\n);\n\nconst SidebarData = React.forwardRef(\n <E extends React.ElementType = typeof defaultSectionElement>(\n { children, as, ...rest }: SidebarSectionProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n const Element: React.ElementType = as || defaultSectionElement;\n return (\n <Element ref={ref} {...rest}>\n {children}\n </Element>\n );\n },\n);\n\nconst SidebarNavigation = React.forwardRef(\n <E extends React.ElementType = typeof defaultNavigationElement>(\n { children, className, as, ...rest }: SidebarSectionProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n const Element: React.ElementType = as || defaultNavigationElement;\n return (\n <Element\n ref={ref}\n className={classNames(\n 'eds-layout-template-sidebar__navigation',\n className,\n )}\n {...rest}\n >\n {children}\n </Element>\n );\n },\n);\n\nconst SidebarFooter = React.forwardRef(\n <E extends React.ElementType = typeof defaultFooterElement>(\n { children, className, as, ...rest }: SidebarSectionProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n const Element: React.ElementType = as || defaultFooterElement;\n return (\n <Element\n ref={ref}\n className={classNames('eds-layout-template-sidebar__footer', className)}\n {...rest}\n >\n {children}\n </Element>\n );\n },\n);\n\nconst CollapseToggle: React.FC<{\n isCollapsed: boolean;\n onToggle: () => void;\n openLabel: string;\n closeLabel: string;\n}> = ({ isCollapsed, onToggle, openLabel, closeLabel }) => (\n <button\n type=\"button\"\n className=\"eds-layout-template-sidebar__collapse-toggle\"\n onClick={onToggle}\n aria-expanded={!isCollapsed}\n aria-label={isCollapsed ? openLabel : closeLabel}\n >\n {isCollapsed ? <RightArrowIcon size={16} /> : <LeftArrowIcon size={16} />}\n </button>\n);\n\nconst SidebarRoot = React.forwardRef(\n <E extends React.ElementType = typeof defaultSidebarElement>(\n {\n children,\n className,\n style,\n contrast = true,\n collapsible = false,\n collapsed,\n onCollapseToggle,\n openSidebarAriaLabel = 'Åpne sidemeny',\n closeSidebarAriaLabel = 'Lukk sidemeny',\n as,\n ...rest\n }: SidebarProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n const handleCollapseToggle: (value?: boolean) => void = value => {\n if (value === undefined || !onCollapseToggle) {\n return;\n }\n onCollapseToggle(value);\n };\n\n const [isCollapsed, setIsCollapsed] = useControllableProp({\n prop: collapsible ? collapsed : undefined,\n defaultValue: false,\n updater: handleCollapseToggle,\n });\n\n const WrapperElement = contrast ? Contrast : 'div';\n\n const sidebarClassNames = classNames(\n 'eds-layout-template-sidebar',\n {\n 'eds-layout-template-sidebar--plain': !contrast,\n 'eds-layout-template-sidebar--collapsible': collapsible,\n 'eds-layout-template-sidebar--collapsed': collapsible && isCollapsed,\n },\n className,\n );\n\n if (!collapsible) {\n return (\n <Grid.Item as={WrapperElement} colSpan=\"1 / 2\">\n <Flex\n ref={ref}\n as={as || defaultSidebarElement}\n direction=\"column\"\n gap=\"m\"\n className={sidebarClassNames}\n style={style}\n {...rest}\n >\n {children}\n </Flex>\n </Grid.Item>\n );\n }\n\n const collapsedStyle = isCollapsed\n ? ({ ...style, '--eds-sidebar-width': '2rem' } as React.CSSProperties)\n : style;\n\n return (\n <Grid.Item\n as={WrapperElement}\n colSpan=\"1 / 2\"\n className=\"eds-layout-template-sidebar-wrapper\"\n >\n <SidebarContext.Provider value={{ isCollapsed }}>\n <Flex\n ref={ref}\n as={as || defaultSidebarElement}\n direction=\"column\"\n gap=\"m\"\n className={sidebarClassNames}\n style={collapsedStyle}\n {...rest}\n >\n <div className=\"eds-layout-template-sidebar__content\">\n {children}\n </div>\n </Flex>\n <CollapseToggle\n isCollapsed={isCollapsed}\n onToggle={() => setIsCollapsed(!isCollapsed)}\n openLabel={openSidebarAriaLabel}\n closeLabel={closeSidebarAriaLabel}\n />\n </SidebarContext.Provider>\n </Grid.Item>\n );\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":"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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
const SidebarContext = React.createContext({
|
|
3
|
+
isCollapsed: false
|
|
4
|
+
});
|
|
5
|
+
const useSidebarCollapsed = () => React.useContext(SidebarContext);
|
|
6
|
+
export {
|
|
7
|
+
SidebarContext,
|
|
8
|
+
useSidebarCollapsed
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=SidebarContext.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarContext.mjs","sources":["../../../../src/beta/templates/SidebarContext.tsx"],"sourcesContent":["import React from 'react';\n\nexport const SidebarContext = React.createContext<{\n isCollapsed: boolean;\n}>({\n isCollapsed: false,\n});\n\n/** Hook to read the collapsed state of the nearest `Template.Portal.Sidebar`.\n * Returns `{ isCollapsed: false }` when used outside a collapsible sidebar. */\nexport const useSidebarCollapsed: () => { isCollapsed: boolean } = () =>\n React.useContext(SidebarContext);\n"],"names":[],"mappings":";AAEO,MAAM,iBAAiB,MAAM,cAEjC;AAAA,EACD,aAAa;AACf,CAAC;AAIM,MAAM,sBAAsD,MACjE,MAAM,WAAW,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/beta/templates/index.ts"],"sourcesContent":["import { Portal } from './portal';\nimport type {
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/beta/templates/index.ts"],"sourcesContent":["import { Portal } from './portal';\nimport type {\n PortalComponent,\n PortalMainProps,\n PortalProps,\n PortalStatusBarProps,\n} from './portal';\nimport type {\n SidebarComponent,\n SidebarProps,\n SidebarSectionProps,\n} from './Sidebar';\n\nexport { useSidebarCollapsed } from './SidebarContext';\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 PortalStatusBarProps,\n SidebarComponent,\n SidebarProps,\n SidebarSectionProps,\n};\n"],"names":[],"mappings":";AAmBO,MAAM,WAA8B;AAAA,EACzC;AACF;"}
|
|
@@ -1,49 +1,69 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import classNames from "classnames";
|
|
3
|
-
import { GridComponent } from "../../Grid/index.mjs";
|
|
4
|
+
import { Grid as GridComponent } from "../../Grid/index.mjs";
|
|
4
5
|
import { Sidebar } from "../Sidebar.mjs";
|
|
5
6
|
/* empty css */
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
style,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
7
|
+
const defaultStatusBarElement = "div";
|
|
8
|
+
const defaultPortalMainElement = "main";
|
|
9
|
+
const PortalRoot = React.forwardRef(
|
|
10
|
+
({ children, className, style, as, ...rest }, ref) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
|
+
GridComponent,
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
as,
|
|
16
|
+
templateColumns: "var(--eds-sidebar-width, min-content) minmax(0, 1fr)",
|
|
17
|
+
gap: "none",
|
|
18
|
+
columnGap: "m",
|
|
19
|
+
className: classNames("eds-layout-template-portal", className),
|
|
20
|
+
style,
|
|
21
|
+
...rest,
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
const PortalStatusBar = React.forwardRef(
|
|
28
|
+
({ children, className, as, ...rest }, ref) => {
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
GridComponent.Item,
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
as: as || defaultStatusBarElement,
|
|
34
|
+
className: classNames(
|
|
35
|
+
"eds-layout-template-portal__status-bar",
|
|
36
|
+
className
|
|
37
|
+
),
|
|
38
|
+
...rest,
|
|
39
|
+
children
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
const PortalMain = React.forwardRef(
|
|
45
|
+
({ children, className, style, as, ...rest }, ref) => {
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
GridComponent.Item,
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
as: as || defaultPortalMainElement,
|
|
51
|
+
colSpan: "2 / -1",
|
|
52
|
+
className: classNames("eds-layout-template-portal__main", className),
|
|
53
|
+
style,
|
|
54
|
+
...rest,
|
|
55
|
+
children
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
42
60
|
const Portal = Object.assign(PortalRoot, {
|
|
61
|
+
StatusBar: PortalStatusBar,
|
|
43
62
|
Sidebar,
|
|
44
63
|
Main: PortalMain
|
|
45
64
|
});
|
|
46
65
|
Portal.displayName = "Template.Portal";
|
|
66
|
+
Portal.StatusBar.displayName = "Template.Portal.StatusBar";
|
|
47
67
|
Portal.Main.displayName = "Template.Portal.Main";
|
|
48
68
|
export {
|
|
49
69
|
Portal
|
|
@@ -1 +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.
|
|
1
|
+
{"version":3,"file":"Portal.mjs","sources":["../../../../../src/beta/templates/portal/Portal.tsx"],"sourcesContent":["import React from 'react';\nimport type { PolymorphicComponentProps } from '@entur/utils';\nimport classNames from 'classnames';\nimport { Grid } from '../../Grid';\nimport { Sidebar, SidebarComponent } from '../Sidebar';\nimport './Portal.scss';\n\ntype PortalOwnProps = {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\ntype PortalStatusBarOwnProps = {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\ntype PortalMainOwnProps = {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\nconst defaultStatusBarElement = 'div';\nconst defaultPortalMainElement = 'main';\n\nexport type PortalProps<T extends React.ElementType = typeof Grid> =\n PolymorphicComponentProps<T, PortalOwnProps>;\n\nexport type PortalStatusBarProps<\n T extends React.ElementType = typeof defaultStatusBarElement,\n> = PolymorphicComponentProps<T, PortalStatusBarOwnProps>;\n\nexport type PortalMainProps<\n T extends React.ElementType = typeof defaultPortalMainElement,\n> = PolymorphicComponentProps<T, PortalMainOwnProps>;\n\nconst PortalRoot = React.forwardRef(\n <E extends React.ElementType = typeof Grid>(\n { children, className, style, as, ...rest }: PortalProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n return (\n <Grid\n ref={ref}\n as={as}\n templateColumns=\"var(--eds-sidebar-width, min-content) minmax(0, 1fr)\"\n gap=\"none\"\n columnGap=\"m\"\n className={classNames('eds-layout-template-portal', className)}\n style={style}\n {...rest}\n >\n {children}\n </Grid>\n );\n },\n);\n\nconst PortalStatusBar = React.forwardRef(\n <E extends React.ElementType = typeof defaultStatusBarElement>(\n { children, className, as, ...rest }: PortalStatusBarProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n return (\n <Grid.Item\n ref={ref}\n as={as || defaultStatusBarElement}\n className={classNames(\n 'eds-layout-template-portal__status-bar',\n className,\n )}\n {...rest}\n >\n {children}\n </Grid.Item>\n );\n },\n);\n\nconst PortalMain = React.forwardRef(\n <E extends React.ElementType = typeof defaultPortalMainElement>(\n { children, className, style, as, ...rest }: PortalMainProps<E>,\n ref?: React.Ref<Element>,\n ) => {\n return (\n <Grid.Item\n ref={ref}\n as={as || defaultPortalMainElement}\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);\n\nexport type PortalComponent = typeof PortalRoot & {\n StatusBar: typeof PortalStatusBar;\n Sidebar: SidebarComponent;\n Main: typeof PortalMain;\n};\n\nexport const Portal: PortalComponent = Object.assign(PortalRoot, {\n StatusBar: PortalStatusBar,\n Sidebar,\n Main: PortalMain,\n});\n\nPortal.displayName = 'Template.Portal';\nPortal.StatusBar.displayName = 'Template.Portal.StatusBar';\nPortal.Main.displayName = 'Template.Portal.Main';\n"],"names":["Grid"],"mappings":";;;;;;AAyBA,MAAM,0BAA0B;AAChC,MAAM,2BAA2B;AAajC,MAAM,aAAa,MAAM;AAAA,EACvB,CACE,EAAE,UAAU,WAAW,OAAO,IAAI,GAAG,KAAA,GACrC,QACG;AACH,WACE;AAAA,MAACA;AAAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,iBAAgB;AAAA,QAChB,KAAI;AAAA,QACJ,WAAU;AAAA,QACV,WAAW,WAAW,8BAA8B,SAAS;AAAA,QAC7D;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,MAAM,kBAAkB,MAAM;AAAA,EAC5B,CACE,EAAE,UAAU,WAAW,IAAI,GAAG,KAAA,GAC9B,QACG;AACH,WACE;AAAA,MAACA,cAAK;AAAA,MAAL;AAAA,QACC;AAAA,QACA,IAAI,MAAM;AAAA,QACV,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,MAAM,aAAa,MAAM;AAAA,EACvB,CACE,EAAE,UAAU,WAAW,OAAO,IAAI,GAAG,KAAA,GACrC,QACG;AACH,WACE;AAAA,MAACA,cAAK;AAAA,MAAL;AAAA,QACC;AAAA,QACA,IAAI,MAAM;AAAA,QACV,SAAQ;AAAA,QACR,WAAW,WAAW,oCAAoC,SAAS;AAAA,QACnE;AAAA,QACC,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAQO,MAAM,SAA0B,OAAO,OAAO,YAAY;AAAA,EAC/D,WAAW;AAAA,EACX;AAAA,EACA,MAAM;AACR,CAAC;AAED,OAAO,cAAc;AACrB,OAAO,UAAU,cAAc;AAC/B,OAAO,KAAK,cAAc;"}
|
|
@@ -63,7 +63,19 @@
|
|
|
63
63
|
--9xl:var(--size-29);
|
|
64
64
|
--10xl:var(--size-30);
|
|
65
65
|
--11xl:var(--size-31);
|
|
66
|
-
}
|
|
66
|
+
}.eds-layout-grid{
|
|
67
|
+
--grid-template-columns:initial;
|
|
68
|
+
--grid-template-rows:initial;
|
|
69
|
+
--grid-auto-flow:initial;
|
|
70
|
+
--grid-align-items:initial;
|
|
71
|
+
--grid-justify-content:initial;
|
|
72
|
+
--grid-align-content:initial;
|
|
73
|
+
--grid-gap:initial;
|
|
74
|
+
--grid-row-gap:initial;
|
|
75
|
+
--grid-column-gap:initial;
|
|
76
|
+
--grid-height:initial;
|
|
77
|
+
}
|
|
78
|
+
:where(.eds-layout-grid){
|
|
67
79
|
display:grid;
|
|
68
80
|
grid-template-columns:repeat(12, 1fr);
|
|
69
81
|
grid-template-columns:var(--grid-template-columns, repeat(12, 1fr));
|
|
@@ -89,11 +101,9 @@
|
|
|
89
101
|
-moz-column-gap:var(--grid-column-gap, var(--grid-gap));
|
|
90
102
|
column-gap:var(--grid-column-gap, var(--grid-gap));
|
|
91
103
|
height:var(--grid-height);
|
|
92
|
-
}
|
|
93
|
-
:where(.eds-layout-grid .eds-layout-grid){
|
|
94
|
-
grid-template-columns:subgrid;
|
|
95
|
-
grid-template-rows:subgrid;
|
|
96
104
|
}.eds-layout-grid-item{
|
|
105
|
+
--grid-item-column:initial;
|
|
106
|
+
--grid-item-row:initial;
|
|
97
107
|
grid-column:var(--grid-item-column);
|
|
98
108
|
grid-row:var(--grid-item-row);
|
|
99
109
|
}:where(.eds-layout-flex){
|
|
@@ -154,12 +164,24 @@
|
|
|
154
164
|
-moz-box-flex:1;
|
|
155
165
|
flex:1 1 0%;
|
|
156
166
|
}.eds-layout-template-sidebar{
|
|
157
|
-
padding:
|
|
158
|
-
padding:var(--eds-sidebar-padding,
|
|
167
|
+
padding:2rem;
|
|
168
|
+
padding:var(--eds-sidebar-padding, 2rem);
|
|
159
169
|
height:100%;
|
|
160
170
|
width:20rem;
|
|
161
171
|
width:var(--eds-sidebar-width, 20rem);
|
|
162
172
|
}
|
|
173
|
+
.eds-layout-template-sidebar--collapsible{
|
|
174
|
+
overflow:hidden;
|
|
175
|
+
contain:inline-size;
|
|
176
|
+
-webkit-transition:width ease-in-out 0.2s;
|
|
177
|
+
-o-transition:width ease-in-out 0.2s;
|
|
178
|
+
-moz-transition:width ease-in-out 0.2s;
|
|
179
|
+
transition:width ease-in-out 0.2s;
|
|
180
|
+
}
|
|
181
|
+
.eds-layout-template-sidebar--collapsed{
|
|
182
|
+
padding:2rem 0;
|
|
183
|
+
padding:var(--eds-sidebar-padding, 2rem) 0;
|
|
184
|
+
}
|
|
163
185
|
|
|
164
186
|
.eds-layout-template-sidebar--plain{
|
|
165
187
|
background-color:var(--components-menu-sidenavigation-standard-background);
|
|
@@ -170,26 +192,137 @@
|
|
|
170
192
|
-webkit-flex:1 1 auto;
|
|
171
193
|
-moz-box-flex:1;
|
|
172
194
|
flex:1 1 auto;
|
|
173
|
-
margin-left:-webkit-calc(-1 *
|
|
174
|
-
margin-left:-moz-calc(-1 *
|
|
175
|
-
margin-left:calc(-1 *
|
|
176
|
-
margin-left:-webkit-calc(-1 * var(--eds-sidebar-padding,
|
|
177
|
-
margin-left:-moz-calc(-1 * var(--eds-sidebar-padding,
|
|
178
|
-
margin-left:calc(-1 * var(--eds-sidebar-padding,
|
|
179
|
-
margin-right:-webkit-calc(-1 *
|
|
180
|
-
margin-right:-moz-calc(-1 *
|
|
181
|
-
margin-right:calc(-1 *
|
|
182
|
-
margin-right:-webkit-calc(-1 * var(--eds-sidebar-padding,
|
|
183
|
-
margin-right:-moz-calc(-1 * var(--eds-sidebar-padding,
|
|
184
|
-
margin-right:calc(-1 * var(--eds-sidebar-padding,
|
|
195
|
+
margin-left:-webkit-calc(-1 * 2rem);
|
|
196
|
+
margin-left:-moz-calc(-1 * 2rem);
|
|
197
|
+
margin-left:calc(-1 * 2rem);
|
|
198
|
+
margin-left:-webkit-calc(-1 * var(--eds-sidebar-padding, 2rem));
|
|
199
|
+
margin-left:-moz-calc(-1 * var(--eds-sidebar-padding, 2rem));
|
|
200
|
+
margin-left:calc(-1 * var(--eds-sidebar-padding, 2rem));
|
|
201
|
+
margin-right:-webkit-calc(-1 * 2rem);
|
|
202
|
+
margin-right:-moz-calc(-1 * 2rem);
|
|
203
|
+
margin-right:calc(-1 * 2rem);
|
|
204
|
+
margin-right:-webkit-calc(-1 * var(--eds-sidebar-padding, 2rem));
|
|
205
|
+
margin-right:-moz-calc(-1 * var(--eds-sidebar-padding, 2rem));
|
|
206
|
+
margin-right:calc(-1 * var(--eds-sidebar-padding, 2rem));
|
|
185
207
|
}
|
|
186
208
|
|
|
187
209
|
.eds-layout-template-sidebar__footer{
|
|
188
210
|
margin-top:auto;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.eds-layout-template-sidebar__content{
|
|
214
|
+
display:-webkit-box;
|
|
215
|
+
display:-webkit-flex;
|
|
216
|
+
display:-moz-box;
|
|
217
|
+
display:flex;
|
|
218
|
+
-webkit-box-orient:vertical;
|
|
219
|
+
-webkit-box-direction:normal;
|
|
220
|
+
-webkit-flex-direction:column;
|
|
221
|
+
-moz-box-orient:vertical;
|
|
222
|
+
-moz-box-direction:normal;
|
|
223
|
+
flex-direction:column;
|
|
224
|
+
gap:var(--m);
|
|
225
|
+
-webkit-box-flex:1;
|
|
226
|
+
-webkit-flex:1 0 auto;
|
|
227
|
+
-moz-box-flex:1;
|
|
228
|
+
flex:1 0 auto;
|
|
229
|
+
min-width:-webkit-calc(20rem - 2 * 2rem);
|
|
230
|
+
min-width:-moz-calc(20rem - 2 * 2rem);
|
|
231
|
+
min-width:calc(20rem - 2 * 2rem);
|
|
232
|
+
min-width:-webkit-calc(var(--eds-sidebar-width, 20rem) - 2 * var(--eds-sidebar-padding, 2rem));
|
|
233
|
+
min-width:-moz-calc(var(--eds-sidebar-width, 20rem) - 2 * var(--eds-sidebar-padding, 2rem));
|
|
234
|
+
min-width:calc(var(--eds-sidebar-width, 20rem) - 2 * var(--eds-sidebar-padding, 2rem));
|
|
235
|
+
opacity:1;
|
|
236
|
+
-webkit-transition:opacity ease-in 0.1s 0.2s;
|
|
237
|
+
-o-transition:opacity ease-in 0.1s 0.2s;
|
|
238
|
+
-moz-transition:opacity ease-in 0.1s 0.2s;
|
|
239
|
+
transition:opacity ease-in 0.1s 0.2s;
|
|
240
|
+
}
|
|
241
|
+
.eds-layout-template-sidebar--collapsed .eds-layout-template-sidebar__content{
|
|
242
|
+
opacity:0;
|
|
243
|
+
visibility:hidden;
|
|
244
|
+
-webkit-transition:opacity ease-out 0.1s, visibility 0s 0.1s;
|
|
245
|
+
-o-transition:opacity ease-out 0.1s, visibility 0s 0.1s;
|
|
246
|
+
-moz-transition:opacity ease-out 0.1s, visibility 0s 0.1s;
|
|
247
|
+
transition:opacity ease-out 0.1s, visibility 0s 0.1s;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.eds-layout-template-sidebar-wrapper{
|
|
251
|
+
position:relative;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.eds-layout-template-sidebar__collapse-toggle{
|
|
255
|
+
position:absolute;
|
|
256
|
+
right:-1rem;
|
|
257
|
+
bottom:2rem;
|
|
258
|
+
height:2rem;
|
|
259
|
+
width:2rem;
|
|
260
|
+
-webkit-border-radius:50%;
|
|
261
|
+
-moz-border-radius:50%;
|
|
262
|
+
border-radius:50%;
|
|
263
|
+
border:none;
|
|
264
|
+
cursor:pointer;
|
|
265
|
+
background-color:var(--basecolors-frame-default);
|
|
266
|
+
color:var(--text-dark);
|
|
267
|
+
-webkit-box-shadow:0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
|
|
268
|
+
-moz-box-shadow:0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
|
|
269
|
+
box-shadow:0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.25);
|
|
270
|
+
display:-webkit-box;
|
|
271
|
+
display:-webkit-flex;
|
|
272
|
+
display:-moz-box;
|
|
273
|
+
display:flex;
|
|
274
|
+
-webkit-box-align:center;
|
|
275
|
+
-webkit-align-items:center;
|
|
276
|
+
-moz-box-align:center;
|
|
277
|
+
align-items:center;
|
|
278
|
+
-webkit-box-pack:center;
|
|
279
|
+
-webkit-justify-content:center;
|
|
280
|
+
-moz-box-pack:center;
|
|
281
|
+
justify-content:center;
|
|
282
|
+
z-index:10;
|
|
283
|
+
padding:0;
|
|
284
|
+
}
|
|
285
|
+
.eds-contrast .eds-layout-template-sidebar__collapse-toggle{
|
|
286
|
+
background-color:var(--basecolors-frame-contrastalt);
|
|
287
|
+
color:var(--basecolors-text-light);
|
|
288
|
+
}
|
|
289
|
+
.eds-layout-template-sidebar__collapse-toggle svg{
|
|
290
|
+
margin:0;
|
|
291
|
+
}
|
|
292
|
+
.eds-layout-template-sidebar__collapse-toggle:focus-visible{
|
|
293
|
+
outline:2px solid #181c56;
|
|
294
|
+
outline-color:var(--basecolors-stroke-focus-standard);
|
|
295
|
+
outline-offset:0.125rem;
|
|
296
|
+
}
|
|
297
|
+
.eds-contrast .eds-layout-template-sidebar__collapse-toggle:focus-visible{
|
|
298
|
+
outline-color:var(--basecolors-stroke-focus-contrast);
|
|
189
299
|
}.eds-layout-template-portal{
|
|
190
300
|
min-height:100vh;
|
|
191
301
|
width:100%;
|
|
192
302
|
}
|
|
303
|
+
.eds-layout-template-portal:has(.eds-layout-template-sidebar--collapsible){
|
|
304
|
+
-webkit-transition:grid-template-columns ease-in-out 0.2s;
|
|
305
|
+
-o-transition:grid-template-columns ease-in-out 0.2s;
|
|
306
|
+
-moz-transition:grid-template-columns ease-in-out 0.2s;
|
|
307
|
+
transition:grid-template-columns ease-in-out 0.2s;
|
|
308
|
+
transition:grid-template-columns ease-in-out 0.2s, -ms-grid-columns ease-in-out 0.2s;
|
|
309
|
+
}
|
|
310
|
+
.eds-layout-template-portal:has(.eds-layout-template-sidebar--collapsed){
|
|
311
|
+
grid-template-columns:2rem minmax(0, 1fr);
|
|
312
|
+
}
|
|
313
|
+
.eds-layout-template-portal:has(> .eds-layout-template-portal__status-bar){
|
|
314
|
+
--grid-template-rows:auto 1fr;
|
|
315
|
+
}
|
|
316
|
+
.eds-layout-template-portal:has(> .eds-layout-template-portal__status-bar) > .eds-layout-template-portal__status-bar{
|
|
317
|
+
--grid-item-column:1 / -1;
|
|
318
|
+
--grid-item-row:1;
|
|
319
|
+
}
|
|
320
|
+
.eds-layout-template-portal:has(> .eds-layout-template-portal__status-bar) > .eds-layout-grid-item:has(.eds-layout-template-sidebar){
|
|
321
|
+
--grid-item-row:2;
|
|
322
|
+
}
|
|
323
|
+
.eds-layout-template-portal:has(> .eds-layout-template-portal__status-bar) > .eds-layout-template-portal__main{
|
|
324
|
+
--grid-item-row:2;
|
|
325
|
+
}
|
|
193
326
|
|
|
194
327
|
.eds-layout-template-portal__main{
|
|
195
328
|
padding:1rem;
|
|
@@ -61,5 +61,7 @@ export type FlexOwnProps = {
|
|
|
61
61
|
};
|
|
62
62
|
export type FlexProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, FlexOwnProps>;
|
|
63
63
|
declare const defaultElement = "div";
|
|
64
|
-
export declare const Flex:
|
|
64
|
+
export declare const Flex: React.ForwardRefExoticComponent<Omit<FlexOwnProps & {
|
|
65
|
+
as?: React.ElementType<any> | undefined;
|
|
66
|
+
} & Omit<Omit<any, "ref">, keyof FlexOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
65
67
|
export {};
|
|
@@ -42,5 +42,7 @@ export type GridOwnProps = {
|
|
|
42
42
|
};
|
|
43
43
|
export type GridProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, GridOwnProps>;
|
|
44
44
|
declare const defaultElement = "div";
|
|
45
|
-
export declare const Grid:
|
|
45
|
+
export declare const Grid: React.ForwardRefExoticComponent<Omit<GridOwnProps & {
|
|
46
|
+
as?: React.ElementType<any> | undefined;
|
|
47
|
+
} & Omit<Omit<any, "ref">, keyof GridOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
46
48
|
export {};
|
|
@@ -24,5 +24,7 @@ export type GridItemOwnProps = {
|
|
|
24
24
|
};
|
|
25
25
|
export type GridItemProps<T extends React.ElementType = typeof defaultElement> = PolymorphicComponentProps<T, GridItemOwnProps>;
|
|
26
26
|
declare const defaultElement = "div";
|
|
27
|
-
export declare const GridItem:
|
|
27
|
+
export declare const GridItem: React.ForwardRefExoticComponent<Omit<GridItemOwnProps & {
|
|
28
|
+
as?: React.ElementType<any> | undefined;
|
|
29
|
+
} & Omit<Omit<any, "ref">, keyof GridItemOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
28
30
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Grid, GridItem } from './Grid';
|
|
2
2
|
export { LayoutWrapper, useLayoutValues } from './LayoutWrapper';
|
|
3
3
|
export { Flex, FlexSpacer } from './Flex';
|
|
4
|
-
export { Template } from './templates';
|
|
4
|
+
export { Template, useSidebarCollapsed } from './templates';
|
|
5
5
|
export type { GridProps, GridOwnProps, GridItemProps, GridItemOwnProps, GridSpacingValue, ResponsiveValue, } from './Grid';
|
|
6
6
|
export type { FlexProps, FlexOwnProps, FlexSpacingValue, FlexSpacerProps, FlexSpacerOwnProps, } from './Flex';
|
|
7
|
-
export type { PortalComponent, PortalMainProps, PortalProps, SidebarComponent, SidebarProps, SidebarSectionProps, TemplateComponent, } from './templates';
|
|
7
|
+
export type { PortalComponent, PortalMainProps, PortalProps, PortalStatusBarProps, SidebarComponent, SidebarProps, SidebarSectionProps, TemplateComponent, } from './templates';
|
|
@@ -1,15 +1,53 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
2
|
+
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
+
type SidebarOwnProps = {
|
|
3
4
|
/** Toggle contrast styling for the sidebar */
|
|
4
5
|
contrast?: boolean;
|
|
6
|
+
/** Enable collapse functionality */
|
|
7
|
+
collapsible?: boolean;
|
|
8
|
+
/** Controlled collapsed state */
|
|
9
|
+
collapsed?: boolean;
|
|
10
|
+
/** Callback when the sidebar is toggled */
|
|
11
|
+
onCollapseToggle?: (collapsed: boolean) => void;
|
|
12
|
+
/** aria-label for the toggle button when the sidebar is collapsed
|
|
13
|
+
* @default 'Åpne sidemeny'
|
|
14
|
+
*/
|
|
15
|
+
openSidebarAriaLabel?: string;
|
|
16
|
+
/** aria-label for the toggle button when the sidebar is expanded
|
|
17
|
+
* @default 'Lukk sidemeny'
|
|
18
|
+
*/
|
|
19
|
+
closeSidebarAriaLabel?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
children?: React.ReactNode;
|
|
5
23
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
declare const
|
|
12
|
-
declare const
|
|
24
|
+
type SidebarSectionOwnProps = {
|
|
25
|
+
className?: string;
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
};
|
|
29
|
+
declare const defaultSidebarElement = "aside";
|
|
30
|
+
declare const defaultSectionElement = "div";
|
|
31
|
+
export type SidebarProps<T extends React.ElementType = typeof defaultSidebarElement> = PolymorphicComponentProps<T, SidebarOwnProps>;
|
|
32
|
+
export type SidebarSectionProps<T extends React.ElementType = typeof defaultSectionElement> = PolymorphicComponentProps<T, SidebarSectionOwnProps>;
|
|
33
|
+
declare const SidebarLogo: React.ForwardRefExoticComponent<Omit<SidebarSectionOwnProps & {
|
|
34
|
+
as?: React.ElementType<any> | undefined;
|
|
35
|
+
} & Omit<Omit<any, "ref">, "as" | keyof SidebarSectionOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
36
|
+
declare const SidebarUser: React.ForwardRefExoticComponent<Omit<SidebarSectionOwnProps & {
|
|
37
|
+
as?: React.ElementType<any> | undefined;
|
|
38
|
+
} & Omit<Omit<any, "ref">, "as" | keyof SidebarSectionOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
39
|
+
declare const SidebarData: React.ForwardRefExoticComponent<Omit<SidebarSectionOwnProps & {
|
|
40
|
+
as?: React.ElementType<any> | undefined;
|
|
41
|
+
} & Omit<Omit<any, "ref">, "as" | keyof SidebarSectionOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
42
|
+
declare const SidebarNavigation: React.ForwardRefExoticComponent<Omit<SidebarSectionOwnProps & {
|
|
43
|
+
as?: React.ElementType<any> | undefined;
|
|
44
|
+
} & Omit<Omit<any, "ref">, "as" | keyof SidebarSectionOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
45
|
+
declare const SidebarFooter: React.ForwardRefExoticComponent<Omit<SidebarSectionOwnProps & {
|
|
46
|
+
as?: React.ElementType<any> | undefined;
|
|
47
|
+
} & Omit<Omit<any, "ref">, "as" | keyof SidebarSectionOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
48
|
+
declare const SidebarRoot: React.ForwardRefExoticComponent<Omit<SidebarOwnProps & {
|
|
49
|
+
as?: React.ElementType<any> | undefined;
|
|
50
|
+
} & Omit<Omit<any, "ref">, "as" | keyof SidebarOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
13
51
|
export type SidebarComponent = typeof SidebarRoot & {
|
|
14
52
|
Logo: typeof SidebarLogo;
|
|
15
53
|
User: typeof SidebarUser;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const SidebarContext: React.Context<{
|
|
3
|
+
isCollapsed: boolean;
|
|
4
|
+
}>;
|
|
5
|
+
/** Hook to read the collapsed state of the nearest `Template.Portal.Sidebar`.
|
|
6
|
+
* Returns `{ isCollapsed: false }` when used outside a collapsible sidebar. */
|
|
7
|
+
export declare const useSidebarCollapsed: () => {
|
|
8
|
+
isCollapsed: boolean;
|
|
9
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PortalComponent, PortalMainProps, PortalProps } from './portal';
|
|
1
|
+
import { PortalComponent, PortalMainProps, PortalProps, PortalStatusBarProps } from './portal';
|
|
2
2
|
import { SidebarComponent, SidebarProps, SidebarSectionProps } from './Sidebar';
|
|
3
|
+
export { useSidebarCollapsed } from './SidebarContext';
|
|
3
4
|
export type TemplateComponent = {
|
|
4
5
|
Portal: PortalComponent;
|
|
5
6
|
};
|
|
6
7
|
export declare const Template: TemplateComponent;
|
|
7
|
-
export type { PortalComponent, PortalMainProps, PortalProps, SidebarComponent, SidebarProps, SidebarSectionProps, };
|
|
8
|
+
export type { PortalComponent, PortalMainProps, PortalProps, PortalStatusBarProps, SidebarComponent, SidebarProps, SidebarSectionProps, };
|
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { PolymorphicComponentProps } from '@entur/utils';
|
|
3
|
+
import { Grid } from '../../Grid';
|
|
2
4
|
import { SidebarComponent } from '../Sidebar';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type PortalOwnProps = {
|
|
6
|
+
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
type PortalStatusBarOwnProps = {
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
type PortalMainOwnProps = {
|
|
16
|
+
className?: string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
declare const defaultStatusBarElement = "div";
|
|
21
|
+
declare const defaultPortalMainElement = "main";
|
|
22
|
+
export type PortalProps<T extends React.ElementType = typeof Grid> = PolymorphicComponentProps<T, PortalOwnProps>;
|
|
23
|
+
export type PortalStatusBarProps<T extends React.ElementType = typeof defaultStatusBarElement> = PolymorphicComponentProps<T, PortalStatusBarOwnProps>;
|
|
24
|
+
export type PortalMainProps<T extends React.ElementType = typeof defaultPortalMainElement> = PolymorphicComponentProps<T, PortalMainOwnProps>;
|
|
25
|
+
declare const PortalRoot: React.ForwardRefExoticComponent<Omit<PortalOwnProps & {
|
|
26
|
+
as?: React.ElementType<any> | undefined;
|
|
27
|
+
} & Omit<Omit<any, "ref">, "as" | keyof PortalOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
28
|
+
declare const PortalStatusBar: React.ForwardRefExoticComponent<Omit<PortalStatusBarOwnProps & {
|
|
29
|
+
as?: React.ElementType<any> | undefined;
|
|
30
|
+
} & Omit<Omit<any, "ref">, "as" | keyof PortalStatusBarOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
31
|
+
declare const PortalMain: React.ForwardRefExoticComponent<Omit<PortalMainOwnProps & {
|
|
32
|
+
as?: React.ElementType<any> | undefined;
|
|
33
|
+
} & Omit<Omit<any, "ref">, "as" | keyof PortalMainOwnProps>, "ref"> & React.RefAttributes<Element>>;
|
|
7
34
|
export type PortalComponent = typeof PortalRoot & {
|
|
35
|
+
StatusBar: typeof PortalStatusBar;
|
|
8
36
|
Sidebar: SidebarComponent;
|
|
9
37
|
Main: typeof PortalMain;
|
|
10
38
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Portal } from './Portal';
|
|
2
|
-
export type { PortalComponent, PortalMainProps, PortalProps } from './Portal';
|
|
2
|
+
export type { PortalComponent, PortalMainProps, PortalProps, PortalStatusBarProps, } from './Portal';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entur/layout",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"main": "dist/layout.cjs.js",
|
|
6
6
|
"module": "dist/layout.esm.js",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"react-dom": ">=16.8.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@entur/icons": "^8.4.
|
|
55
|
-
"@entur/tokens": "^3.22.
|
|
56
|
-
"@entur/typography": "^2.1.
|
|
57
|
-
"@entur/utils": "^0.13.
|
|
54
|
+
"@entur/icons": "^8.4.4",
|
|
55
|
+
"@entur/tokens": "^3.22.3",
|
|
56
|
+
"@entur/typography": "^2.1.5",
|
|
57
|
+
"@entur/utils": "^0.13.2",
|
|
58
58
|
"classnames": "^2.5.1"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"vite": "^7.1.3",
|
|
71
71
|
"vite-plugin-dts": "^4.5.4"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9ac8be0952badd4043470e47e50992369ada2c11"
|
|
74
74
|
}
|