@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,78 +1,164 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const utils = require("@entur/utils");
|
|
4
6
|
const classNames = require("classnames");
|
|
7
|
+
const icons = require("@entur/icons");
|
|
5
8
|
const Contrast = require("../Contrast.cjs");
|
|
6
9
|
const index$1 = require("../Flex/index.cjs");
|
|
7
10
|
const index = require("../Grid/index.cjs");
|
|
11
|
+
const SidebarContext = require("./SidebarContext.cjs");
|
|
8
12
|
;/* empty css */
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
const
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
13
|
+
const defaultSidebarElement = "aside";
|
|
14
|
+
const defaultSectionElement = "div";
|
|
15
|
+
const defaultNavigationElement = "nav";
|
|
16
|
+
const defaultFooterElement = "footer";
|
|
17
|
+
const SidebarLogo = React.forwardRef(
|
|
18
|
+
({ children, as, ...rest }, ref) => {
|
|
19
|
+
const Element = as || defaultSectionElement;
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Element, { ref, ...rest, children });
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
const SidebarUser = React.forwardRef(
|
|
24
|
+
({ children, as, ...rest }, ref) => {
|
|
25
|
+
const Element = as || defaultSectionElement;
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Element, { ref, ...rest, children });
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const SidebarData = React.forwardRef(
|
|
30
|
+
({ children, as, ...rest }, ref) => {
|
|
31
|
+
const Element = as || defaultSectionElement;
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Element, { ref, ...rest, children });
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
const SidebarNavigation = React.forwardRef(
|
|
36
|
+
({ children, className, as, ...rest }, ref) => {
|
|
37
|
+
const Element = as || defaultNavigationElement;
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
39
|
+
Element,
|
|
40
|
+
{
|
|
41
|
+
ref,
|
|
42
|
+
className: classNames(
|
|
43
|
+
"eds-layout-template-sidebar__navigation",
|
|
44
|
+
className
|
|
45
|
+
),
|
|
46
|
+
...rest,
|
|
47
|
+
children
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
const SidebarFooter = React.forwardRef(
|
|
53
|
+
({ children, className, as, ...rest }, ref) => {
|
|
54
|
+
const Element = as || defaultFooterElement;
|
|
55
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
56
|
+
Element,
|
|
57
|
+
{
|
|
58
|
+
ref,
|
|
59
|
+
className: classNames("eds-layout-template-sidebar__footer", className),
|
|
60
|
+
...rest,
|
|
61
|
+
children
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
const CollapseToggle = ({ isCollapsed, onToggle, openLabel, closeLabel }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
className: "eds-layout-template-sidebar__collapse-toggle",
|
|
71
|
+
onClick: onToggle,
|
|
72
|
+
"aria-expanded": !isCollapsed,
|
|
73
|
+
"aria-label": isCollapsed ? openLabel : closeLabel,
|
|
74
|
+
children: isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx(icons.RightArrowIcon, { size: 16 }) : /* @__PURE__ */ jsxRuntime.jsx(icons.LeftArrowIcon, { size: 16 })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
const SidebarRoot = React.forwardRef(
|
|
78
|
+
({
|
|
79
|
+
children,
|
|
80
|
+
className,
|
|
81
|
+
style,
|
|
82
|
+
contrast = true,
|
|
83
|
+
collapsible = false,
|
|
84
|
+
collapsed,
|
|
85
|
+
onCollapseToggle,
|
|
86
|
+
openSidebarAriaLabel = "Åpne sidemeny",
|
|
87
|
+
closeSidebarAriaLabel = "Lukk sidemeny",
|
|
88
|
+
as,
|
|
89
|
+
...rest
|
|
90
|
+
}, ref) => {
|
|
91
|
+
const handleCollapseToggle = (value) => {
|
|
92
|
+
if (value === void 0 || !onCollapseToggle) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
onCollapseToggle(value);
|
|
96
|
+
};
|
|
97
|
+
const [isCollapsed, setIsCollapsed] = utils.useControllableProp({
|
|
98
|
+
prop: collapsible ? collapsed : void 0,
|
|
99
|
+
defaultValue: false,
|
|
100
|
+
updater: handleCollapseToggle
|
|
101
|
+
});
|
|
102
|
+
const WrapperElement = contrast ? Contrast.Contrast : "div";
|
|
103
|
+
const sidebarClassNames = classNames(
|
|
104
|
+
"eds-layout-template-sidebar",
|
|
105
|
+
{
|
|
106
|
+
"eds-layout-template-sidebar--plain": !contrast,
|
|
107
|
+
"eds-layout-template-sidebar--collapsible": collapsible,
|
|
108
|
+
"eds-layout-template-sidebar--collapsed": collapsible && isCollapsed
|
|
109
|
+
},
|
|
110
|
+
className
|
|
111
|
+
);
|
|
112
|
+
if (!collapsible) {
|
|
113
|
+
return /* @__PURE__ */ jsxRuntime.jsx(index.Grid.Item, { as: WrapperElement, colSpan: "1 / 2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
|
+
index$1.Flex,
|
|
65
115
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
116
|
+
ref,
|
|
117
|
+
as: as || defaultSidebarElement,
|
|
118
|
+
direction: "column",
|
|
119
|
+
gap: "m",
|
|
120
|
+
className: sidebarClassNames,
|
|
121
|
+
style,
|
|
122
|
+
...rest,
|
|
123
|
+
children
|
|
124
|
+
}
|
|
125
|
+
) });
|
|
73
126
|
}
|
|
74
|
-
|
|
75
|
-
|
|
127
|
+
const collapsedStyle = isCollapsed ? { ...style, "--eds-sidebar-width": "2rem" } : style;
|
|
128
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
129
|
+
index.Grid.Item,
|
|
130
|
+
{
|
|
131
|
+
as: WrapperElement,
|
|
132
|
+
colSpan: "1 / 2",
|
|
133
|
+
className: "eds-layout-template-sidebar-wrapper",
|
|
134
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(SidebarContext.SidebarContext.Provider, { value: { isCollapsed }, children: [
|
|
135
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
136
|
+
index$1.Flex,
|
|
137
|
+
{
|
|
138
|
+
ref,
|
|
139
|
+
as: as || defaultSidebarElement,
|
|
140
|
+
direction: "column",
|
|
141
|
+
gap: "m",
|
|
142
|
+
className: sidebarClassNames,
|
|
143
|
+
style: collapsedStyle,
|
|
144
|
+
...rest,
|
|
145
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "eds-layout-template-sidebar__content", children })
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
149
|
+
CollapseToggle,
|
|
150
|
+
{
|
|
151
|
+
isCollapsed,
|
|
152
|
+
onToggle: () => setIsCollapsed(!isCollapsed),
|
|
153
|
+
openLabel: openSidebarAriaLabel,
|
|
154
|
+
closeLabel: closeSidebarAriaLabel
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
] })
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
76
162
|
const Sidebar = Object.assign(SidebarRoot, {
|
|
77
163
|
Logo: SidebarLogo,
|
|
78
164
|
User: SidebarUser,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.cjs","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":["jsx","Contrast","Grid","Flex"],"mappings":";;;;;;;;AAcA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AAA,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.cjs","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":["jsx","RightArrowIcon","LeftArrowIcon","useControllableProp","Contrast","Grid","Flex","SidebarContext"],"mappings":";;;;;;;;;;;;AAuCA,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,2BAA2B;AACjC,MAAM,uBAAuB;AAU7B,MAAM,cAAc,MAAM;AAAA,EACxB,CACE,EAAE,UAAU,IAAI,GAAG,KAAA,GACnB,QACG;AACH,UAAM,UAA6B,MAAM;AACzC,WACEA,2BAAAA,IAAC,SAAA,EAAQ,KAAW,GAAG,MACpB,UACH;AAAA,EAEJ;AACF;AAEA,MAAM,cAAc,MAAM;AAAA,EACxB,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BAAAA;AAAAA,YAACM,QAAAA;AAAAA,YAAA;AAAA,cACC;AAAA,cACA,IAAI,MAAM;AAAA,cACV,WAAU;AAAA,cACV,KAAI;AAAA,cACJ,WAAW;AAAA,cACX,OAAO;AAAA,cACN,GAAG;AAAA,cAEJ,UAAAN,2BAAAA,IAAC,OAAA,EAAI,WAAU,wCACZ,SAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,UAEFA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC;AAAA,cACA,UAAU,MAAM,eAAe,CAAC,WAAW;AAAA,cAC3C,WAAW;AAAA,cACX,YAAY;AAAA,YAAA;AAAA,UAAA;AAAA,QACd,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;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,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const SidebarContext = React.createContext({
|
|
5
|
+
isCollapsed: false
|
|
6
|
+
});
|
|
7
|
+
const useSidebarCollapsed = () => React.useContext(SidebarContext);
|
|
8
|
+
exports.SidebarContext = SidebarContext;
|
|
9
|
+
exports.useSidebarCollapsed = useSidebarCollapsed;
|
|
10
|
+
//# sourceMappingURL=SidebarContext.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SidebarContext.cjs","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.cjs","sources":["../../../../src/beta/templates/index.ts"],"sourcesContent":["import { Portal } from './portal';\nimport type {
|
|
1
|
+
{"version":3,"file":"index.cjs","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":["Portal"],"mappings":";;;AAmBO,MAAM,WAA8B;AAAA,EAAA,QACzCA,OAAAA;AACF;;"}
|
|
@@ -1,51 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const React = require("react");
|
|
4
5
|
const classNames = require("classnames");
|
|
5
6
|
const index = require("../../Grid/index.cjs");
|
|
6
7
|
const Sidebar = require("../Sidebar.cjs");
|
|
7
8
|
;/* empty css */
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
style,
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
9
|
+
const defaultStatusBarElement = "div";
|
|
10
|
+
const defaultPortalMainElement = "main";
|
|
11
|
+
const PortalRoot = React.forwardRef(
|
|
12
|
+
({ children, className, style, as, ...rest }, ref) => {
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
+
index.Grid,
|
|
15
|
+
{
|
|
16
|
+
ref,
|
|
17
|
+
as,
|
|
18
|
+
templateColumns: "var(--eds-sidebar-width, min-content) minmax(0, 1fr)",
|
|
19
|
+
gap: "none",
|
|
20
|
+
columnGap: "m",
|
|
21
|
+
className: classNames("eds-layout-template-portal", className),
|
|
22
|
+
style,
|
|
23
|
+
...rest,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const PortalStatusBar = React.forwardRef(
|
|
30
|
+
({ children, className, as, ...rest }, ref) => {
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
index.Grid.Item,
|
|
33
|
+
{
|
|
34
|
+
ref,
|
|
35
|
+
as: as || defaultStatusBarElement,
|
|
36
|
+
className: classNames(
|
|
37
|
+
"eds-layout-template-portal__status-bar",
|
|
38
|
+
className
|
|
39
|
+
),
|
|
40
|
+
...rest,
|
|
41
|
+
children
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
const PortalMain = React.forwardRef(
|
|
47
|
+
({ children, className, style, as, ...rest }, ref) => {
|
|
48
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
+
index.Grid.Item,
|
|
50
|
+
{
|
|
51
|
+
ref,
|
|
52
|
+
as: as || defaultPortalMainElement,
|
|
53
|
+
colSpan: "2 / -1",
|
|
54
|
+
className: classNames("eds-layout-template-portal__main", className),
|
|
55
|
+
style,
|
|
56
|
+
...rest,
|
|
57
|
+
children
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
);
|
|
44
62
|
const Portal = Object.assign(PortalRoot, {
|
|
63
|
+
StatusBar: PortalStatusBar,
|
|
45
64
|
Sidebar: Sidebar.Sidebar,
|
|
46
65
|
Main: PortalMain
|
|
47
66
|
});
|
|
48
67
|
Portal.displayName = "Template.Portal";
|
|
68
|
+
Portal.StatusBar.displayName = "Template.Portal.StatusBar";
|
|
49
69
|
Portal.Main.displayName = "Template.Portal.Main";
|
|
50
70
|
exports.Portal = Portal;
|
|
51
71
|
//# sourceMappingURL=Portal.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.cjs","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.cjs","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":["jsx","Grid","Sidebar"],"mappings":";;;;;;;;AAyBA,MAAM,0BAA0B;AAChC,MAAM,2BAA2B;AAajC,MAAM,aAAa,MAAM;AAAA,EACvB,CACE,EAAE,UAAU,WAAW,OAAO,IAAI,GAAG,KAAA,GACrC,QACG;AACH,WACEA,2BAAAA;AAAAA,MAACC,MAAAA;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,WACED,2BAAAA;AAAAA,MAACC,MAAAA,KAAK;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,WACED,2BAAAA;AAAAA,MAACC,MAAAA,KAAK;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,EAAA,SACXC,QAAAA;AAAAA,EACA,MAAM;AACR,CAAC;AAED,OAAO,cAAc;AACrB,OAAO,UAAU,cAAc;AAC/B,OAAO,KAAK,cAAc;;"}
|
|
@@ -1,110 +1,114 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
2
3
|
import classNames from "classnames";
|
|
3
4
|
import { getSpacingValue } from "../LayoutWrapper/utils.mjs";
|
|
4
5
|
import { useResponsiveValue } from "../LayoutWrapper/useResponsiveValue.mjs";
|
|
5
6
|
/* empty css */
|
|
6
7
|
const defaultElement = "div";
|
|
7
|
-
const Flex = (
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
8
|
+
const Flex = React.forwardRef(
|
|
9
|
+
({
|
|
10
|
+
direction,
|
|
11
|
+
wrap,
|
|
12
|
+
align,
|
|
13
|
+
justify,
|
|
14
|
+
alignContent,
|
|
15
|
+
gap,
|
|
16
|
+
rowGap,
|
|
17
|
+
columnGap,
|
|
18
|
+
flex,
|
|
19
|
+
grow,
|
|
20
|
+
shrink,
|
|
21
|
+
basis,
|
|
22
|
+
width,
|
|
23
|
+
height,
|
|
24
|
+
minWidth,
|
|
25
|
+
minHeight,
|
|
26
|
+
maxWidth,
|
|
27
|
+
maxHeight,
|
|
28
|
+
as,
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
style,
|
|
32
|
+
...rest
|
|
33
|
+
}, ref) => {
|
|
34
|
+
const Element = as || defaultElement;
|
|
35
|
+
const resolvedDirection = useResponsiveValue(direction);
|
|
36
|
+
const resolvedWrap = useResponsiveValue(wrap);
|
|
37
|
+
const resolvedAlign = useResponsiveValue(align);
|
|
38
|
+
const resolvedJustify = useResponsiveValue(justify);
|
|
39
|
+
const resolvedAlignContent = useResponsiveValue(alignContent);
|
|
40
|
+
const resolvedGap = useResponsiveValue(gap);
|
|
41
|
+
const resolvedRowGap = useResponsiveValue(rowGap);
|
|
42
|
+
const resolvedColumnGap = useResponsiveValue(columnGap);
|
|
43
|
+
const flexStyle = {
|
|
44
|
+
...resolvedDirection && {
|
|
45
|
+
"--flex-direction": resolvedDirection
|
|
46
|
+
},
|
|
47
|
+
...resolvedWrap && {
|
|
48
|
+
"--flex-wrap": resolvedWrap
|
|
49
|
+
},
|
|
50
|
+
...resolvedAlign && {
|
|
51
|
+
"--flex-align-items": resolvedAlign
|
|
52
|
+
},
|
|
53
|
+
...resolvedJustify && {
|
|
54
|
+
"--flex-justify-content": resolvedJustify
|
|
55
|
+
},
|
|
56
|
+
...resolvedAlignContent && {
|
|
57
|
+
"--flex-align-content": resolvedAlignContent
|
|
58
|
+
},
|
|
59
|
+
...resolvedGap && {
|
|
60
|
+
"--flex-gap": getSpacingValue(resolvedGap, "Flex")
|
|
61
|
+
},
|
|
62
|
+
...resolvedRowGap && {
|
|
63
|
+
"--flex-row-gap": getSpacingValue(resolvedRowGap, "Flex")
|
|
64
|
+
},
|
|
65
|
+
...resolvedColumnGap && {
|
|
66
|
+
"--flex-column-gap": getSpacingValue(resolvedColumnGap, "Flex")
|
|
67
|
+
},
|
|
68
|
+
...flex !== void 0 && {
|
|
69
|
+
"--flex": flex
|
|
70
|
+
},
|
|
71
|
+
...grow !== void 0 && {
|
|
72
|
+
"--flex-grow": grow
|
|
73
|
+
},
|
|
74
|
+
...shrink !== void 0 && {
|
|
75
|
+
"--flex-shrink": shrink
|
|
76
|
+
},
|
|
77
|
+
...basis !== void 0 && {
|
|
78
|
+
"--flex-basis": basis
|
|
79
|
+
},
|
|
80
|
+
...width && {
|
|
81
|
+
"--flex-width": width
|
|
82
|
+
},
|
|
83
|
+
...height && {
|
|
84
|
+
"--flex-height": height
|
|
85
|
+
},
|
|
86
|
+
...minWidth && {
|
|
87
|
+
"--flex-min-width": minWidth
|
|
88
|
+
},
|
|
89
|
+
...minHeight && {
|
|
90
|
+
"--flex-min-height": minHeight
|
|
91
|
+
},
|
|
92
|
+
...maxWidth && {
|
|
93
|
+
"--flex-max-width": maxWidth
|
|
94
|
+
},
|
|
95
|
+
...maxHeight && {
|
|
96
|
+
"--flex-max-height": maxHeight
|
|
97
|
+
},
|
|
98
|
+
...style
|
|
99
|
+
};
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
Element,
|
|
102
|
+
{
|
|
103
|
+
ref,
|
|
104
|
+
className: classNames("eds-layout-flex", className),
|
|
105
|
+
style: flexStyle,
|
|
106
|
+
...rest,
|
|
107
|
+
children
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
);
|
|
108
112
|
export {
|
|
109
113
|
Flex
|
|
110
114
|
};
|