cozy-ui 124.2.0 → 125.0.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/CHANGELOG.md +15 -0
- package/dist/cozy-ui.min.css +1 -1
- package/package.json +1 -1
- package/react/AppTitle/index.jsx +2 -2
- package/react/CozyDialogs/useCozyDialog.js +7 -0
- package/react/Layout/Layout.jsx +89 -26
- package/react/Layout/styles.styl +5 -8
- package/react/Sidebar/Readme.md +3 -1
- package/react/Sidebar/index.jsx +1 -5
- package/stylus/objects/layouts.styl +74 -87
- package/stylus/objects/sidebar.styl +9 -4
- package/transpiled/react/AppTitle/index.js +2 -2
- package/transpiled/react/CozyDialogs/useCozyDialog.js +6 -1
- package/transpiled/react/Layout/Layout.d.ts +5 -31
- package/transpiled/react/Layout/Layout.js +78 -50
- package/transpiled/react/Sidebar/index.js +2 -3
- package/transpiled/react/stylesheet.css +1 -1
package/package.json
CHANGED
package/react/AppTitle/index.jsx
CHANGED
|
@@ -16,10 +16,10 @@ import NotesIcon from '../Icons/Notes'
|
|
|
16
16
|
import NotesTextIcon from '../Icons/NotesText'
|
|
17
17
|
import PassIcon from '../Icons/Pass'
|
|
18
18
|
import PassTextIcon from '../Icons/PassText'
|
|
19
|
-
import StoreIcon from '../Icons/Store'
|
|
20
|
-
import StoreTextIcon from '../Icons/StoreText'
|
|
21
19
|
import PhotosIcon from '../Icons/Photos'
|
|
22
20
|
import PhotosTextIcon from '../Icons/PhotosText'
|
|
21
|
+
import StoreIcon from '../Icons/Store'
|
|
22
|
+
import StoreTextIcon from '../Icons/StoreText'
|
|
23
23
|
import TwakeTextIcon from '../Icons/TwakeText'
|
|
24
24
|
import TwakeWorkplaceIcon from '../Icons/TwakeWorkplace'
|
|
25
25
|
import WorkplaceTextIcon from '../Icons/WorkplaceText'
|
|
@@ -56,6 +56,13 @@ const useCozyDialog = props => {
|
|
|
56
56
|
}`,
|
|
57
57
|
scrollPaper: scrollPaperClassName
|
|
58
58
|
},
|
|
59
|
+
BackdropProps: {
|
|
60
|
+
style: {
|
|
61
|
+
transitionDelay: 50,
|
|
62
|
+
...otherProps?.BackdropProps?.style
|
|
63
|
+
},
|
|
64
|
+
...otherProps.BackdropProps
|
|
65
|
+
},
|
|
59
66
|
TransitionProps: {
|
|
60
67
|
fullScreen,
|
|
61
68
|
...otherProps.TransitionProps
|
package/react/Layout/Layout.jsx
CHANGED
|
@@ -1,45 +1,108 @@
|
|
|
1
1
|
import cx from 'classnames'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { createContext, forwardRef, useContext, useMemo } from 'react'
|
|
4
4
|
|
|
5
5
|
import styles from './styles.styl'
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
export const LayoutContext = createContext()
|
|
8
|
+
|
|
9
|
+
export const useLayout = () => {
|
|
10
|
+
const context = useContext(LayoutContext)
|
|
11
|
+
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('useLayout must be used within a LayoutContext')
|
|
14
|
+
}
|
|
15
|
+
return context
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const LayoutProvider = React.memo(({ monoColumn, withTopBar, children }) => {
|
|
19
|
+
const value = useMemo(
|
|
20
|
+
() => ({
|
|
21
|
+
monoColumn,
|
|
22
|
+
withTopBar
|
|
23
|
+
}),
|
|
24
|
+
[monoColumn, withTopBar]
|
|
25
|
+
)
|
|
26
|
+
|
|
14
27
|
return (
|
|
15
|
-
<
|
|
28
|
+
<LayoutContext.Provider value={value}>{children}</LayoutContext.Provider>
|
|
29
|
+
)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
LayoutProvider.displayName = 'LayoutProvider'
|
|
33
|
+
|
|
34
|
+
export const Layout = forwardRef(
|
|
35
|
+
({ children, className, monoColumn, withTopBar, ...props }, ref) => {
|
|
36
|
+
const variant = monoColumn ? 'monocolumn' : '2panes'
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<LayoutProvider monoColumn={monoColumn} withTopBar={withTopBar}>
|
|
40
|
+
<div
|
|
41
|
+
ref={ref}
|
|
42
|
+
className={cx(
|
|
43
|
+
className,
|
|
44
|
+
styles['o-layout'],
|
|
45
|
+
styles[`o-layout-${variant}`],
|
|
46
|
+
{
|
|
47
|
+
[styles[`o-layout-topbar`]]: withTopBar
|
|
48
|
+
}
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</div>
|
|
54
|
+
</LayoutProvider>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
Layout.displayName = 'Layout'
|
|
60
|
+
|
|
61
|
+
export const Main = forwardRef(({ className, children, ...props }, ref) => {
|
|
62
|
+
const { monoColumn, withTopBar } = useLayout()
|
|
63
|
+
const variant = monoColumn ? 'monocolumn' : '2panes'
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<main
|
|
67
|
+
ref={ref}
|
|
16
68
|
className={cx(
|
|
17
|
-
monoColumn ? styles['o-layout'] : styles['o-layout-2panes'],
|
|
18
69
|
className,
|
|
70
|
+
styles['o-layout-main'],
|
|
71
|
+
styles[`o-layout-main-${variant}`],
|
|
19
72
|
{
|
|
20
|
-
[styles[`o-layout
|
|
21
|
-
withTopBar
|
|
73
|
+
[styles[`o-layout-main-${variant}--topbar`]]: withTopBar
|
|
22
74
|
}
|
|
23
75
|
)}
|
|
24
|
-
{...
|
|
76
|
+
{...props}
|
|
25
77
|
>
|
|
26
78
|
{children}
|
|
27
|
-
</
|
|
79
|
+
</main>
|
|
28
80
|
)
|
|
29
|
-
}
|
|
81
|
+
})
|
|
30
82
|
|
|
31
|
-
|
|
83
|
+
Main.displayName = 'Main'
|
|
32
84
|
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
85
|
+
export const Content = forwardRef(({ className, children, ...props }, ref) => {
|
|
86
|
+
const { monoColumn } = useLayout()
|
|
87
|
+
const variant = monoColumn ? 'monocolumn' : '2panes'
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<div
|
|
91
|
+
role="main"
|
|
92
|
+
ref={ref}
|
|
93
|
+
className={cx(
|
|
94
|
+
className,
|
|
95
|
+
styles['o-layout-content'],
|
|
96
|
+
styles[`o-layout-content-${variant}`]
|
|
97
|
+
)}
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
{children}
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
Content.displayName = 'Content'
|
|
43
106
|
|
|
44
107
|
Layout.propTypes = {
|
|
45
108
|
children: PropTypes.node,
|
package/react/Layout/styles.styl
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
@require '../../stylus/objects/layouts'
|
|
2
2
|
|
|
3
3
|
.o-layout
|
|
4
|
-
@extend $app
|
|
4
|
+
@extend $app-layout
|
|
5
5
|
|
|
6
|
-
.o-layout
|
|
7
|
-
@extend $app
|
|
6
|
+
.o-layout-main
|
|
7
|
+
@extend $app-main
|
|
8
8
|
|
|
9
|
-
.o-layout-
|
|
10
|
-
@extend $app-
|
|
11
|
-
|
|
12
|
-
.o-layout-2panes--withTopBar
|
|
13
|
-
@extend $app-2panes--withTopBar
|
|
9
|
+
.o-layout-content
|
|
10
|
+
@extend $app-content
|
package/react/Sidebar/Readme.md
CHANGED
|
@@ -29,11 +29,13 @@ const NavLink = genNavLink(
|
|
|
29
29
|
<a className={cx(className, active ? activeClassName : null)}>{children}</a>
|
|
30
30
|
)
|
|
31
31
|
)
|
|
32
|
+
|
|
33
|
+
const demoStyle = { position: "initial" }
|
|
32
34
|
// -->
|
|
33
35
|
|
|
34
36
|
;
|
|
35
37
|
|
|
36
|
-
<Sidebar id='sidebar'>
|
|
38
|
+
<Sidebar id='sidebar' style={demoStyle}>
|
|
37
39
|
<Nav>
|
|
38
40
|
<NavItem id='nav-item'>
|
|
39
41
|
<NavLink to="/warn" active>
|
package/react/Sidebar/index.jsx
CHANGED
|
@@ -25,11 +25,7 @@ const Sidebar = ({ children, className, ...restProps }) => {
|
|
|
25
25
|
return (
|
|
26
26
|
<aside
|
|
27
27
|
id="sidebar"
|
|
28
|
-
className={cx(
|
|
29
|
-
styles['o-sidebar'],
|
|
30
|
-
[styles['o-sidebar--large']],
|
|
31
|
-
className
|
|
32
|
-
)}
|
|
28
|
+
className={cx(styles['o-sidebar'], className)}
|
|
33
29
|
{...restProps}
|
|
34
30
|
>
|
|
35
31
|
{children}
|
|
@@ -50,8 +50,7 @@ $elastic-content
|
|
|
50
50
|
$elastic-bar
|
|
51
51
|
flex 0 0 auto
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
$app
|
|
53
|
+
$app-layout
|
|
55
54
|
box-sizing border-box
|
|
56
55
|
display flex
|
|
57
56
|
max-width 100%
|
|
@@ -60,102 +59,90 @@ $app
|
|
|
60
59
|
background-color var(--paperBackgroundColor)
|
|
61
60
|
color var(--primaryTextColor)
|
|
62
61
|
|
|
63
|
-
main
|
|
64
|
-
display flex
|
|
65
|
-
flex-direction column
|
|
66
|
-
flex 0 0 auto
|
|
67
|
-
|
|
68
|
-
main,
|
|
69
|
-
main > [role=contentinfo], // Deprecated
|
|
70
|
-
main > [role=main]
|
|
71
|
-
position relative
|
|
72
|
-
display flex
|
|
73
|
-
flex-direction column
|
|
74
|
-
flex 1 1 auto
|
|
75
|
-
box-sizing border-box
|
|
76
|
-
height 100%
|
|
77
|
-
overflow-x hidden
|
|
78
|
-
overflow-y auto
|
|
79
|
-
|
|
80
62
|
+medium-screen() // mobile + tablet
|
|
81
63
|
display block
|
|
82
64
|
|
|
65
|
+
&-topbar
|
|
66
|
+
+medium-screen() // mobile + tablet
|
|
67
|
+
// this pseudo-element is "ghost" element replacing bar
|
|
68
|
+
&:before
|
|
69
|
+
content ''
|
|
70
|
+
display block
|
|
71
|
+
height barHeight
|
|
72
|
+
|
|
73
|
+
// When you want a sidebar
|
|
74
|
+
&-2panes
|
|
75
|
+
flex 0 0 100%
|
|
76
|
+
align-items stretch
|
|
77
|
+
|
|
78
|
+
+medium-screen() // mobile + tablet
|
|
79
|
+
// this pseudo-element is "ghost" element replacing nav
|
|
80
|
+
&:after
|
|
81
|
+
content ''
|
|
82
|
+
display block
|
|
83
|
+
height navHeight
|
|
84
|
+
|
|
85
|
+
$app-main
|
|
86
|
+
display flex
|
|
87
|
+
flex-direction column
|
|
88
|
+
position relative
|
|
89
|
+
flex 1 1 auto
|
|
90
|
+
box-sizing border-box
|
|
91
|
+
overflow-x hidden
|
|
92
|
+
overflow-y auto
|
|
93
|
+
|
|
94
|
+
+medium-screen() // mobile + tablet
|
|
95
|
+
display block
|
|
96
|
+
overflow visible
|
|
83
97
|
// iPhone X environment tweak
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
padding-bottom env(safe-area-inset-bottom)
|
|
88
|
-
min-height 100vh
|
|
98
|
+
padding-left env(safe-area-inset-left)
|
|
99
|
+
padding-right env(safe-area-inset-right)
|
|
100
|
+
padding-bottom env(safe-area-inset-bottom)
|
|
89
101
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
main > [role=main]
|
|
93
|
-
display block
|
|
94
|
-
overflow visible
|
|
102
|
+
&-monocolumn
|
|
103
|
+
height 100%
|
|
95
104
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
main
|
|
99
|
-
min-height 'calc(100vh - %s)' % barHeight
|
|
100
|
-
|
|
101
|
-
// this pseudo-element is "ghost" element replacing bar
|
|
102
|
-
&:before
|
|
103
|
-
content ''
|
|
104
|
-
display block
|
|
105
|
-
height barHeight
|
|
106
|
-
|
|
107
|
-
// STICKY layout
|
|
108
|
-
// When you want a sidebar and you want it to act like a sticky footer on mobile
|
|
109
|
-
$app-2panes-sticky
|
|
110
|
-
@extend $app
|
|
111
|
-
flex 0 0 100%
|
|
112
|
-
align-items stretch
|
|
105
|
+
+medium-screen() // mobile + tablet
|
|
106
|
+
min-height 100vh
|
|
113
107
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
flex 0 0 auto
|
|
108
|
+
&--topbar
|
|
109
|
+
+medium-screen() // mobile + tablet
|
|
110
|
+
min-height 'calc(100vh - %s)' % barHeight
|
|
118
111
|
|
|
119
|
-
|
|
120
|
-
main > [role=contentinfo], // Deprecated
|
|
121
|
-
main > [role=main]
|
|
112
|
+
&-2panes
|
|
122
113
|
height auto
|
|
114
|
+
background-color var(--defaultBackgroundColor)
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
background-color var(--defaultBackgroundColor)
|
|
116
|
+
+medium-screen() // mobile + tablet
|
|
117
|
+
min-height calc(100vh - var(--sidebarHeight))
|
|
118
|
+
background-color transparent
|
|
128
119
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
background-color var(--paperBackgroundColor)
|
|
120
|
+
&--topbar
|
|
121
|
+
+medium-screen() // mobile + tablet
|
|
122
|
+
min-height 'calc(100vh - var(--sidebarHeight) - %s)' % barHeight
|
|
133
123
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
$app-content
|
|
125
|
+
position relative
|
|
126
|
+
display flex
|
|
127
|
+
flex-direction column
|
|
128
|
+
flex 1 1 auto
|
|
129
|
+
box-sizing border-box
|
|
130
|
+
overflow-x hidden
|
|
131
|
+
overflow-y auto
|
|
132
|
+
background-color var(--paperBackgroundColor)
|
|
137
133
|
|
|
138
|
-
// this pseudo-element is "ghost" element replacing nav
|
|
139
|
-
&:after
|
|
140
|
-
content ''
|
|
141
|
-
display block
|
|
142
|
-
height navHeight
|
|
143
|
-
|
|
144
|
-
> aside
|
|
145
|
-
position fixed
|
|
146
|
-
bottom 0
|
|
147
|
-
left 0
|
|
148
|
-
display block
|
|
149
|
-
z-index var(--zIndex-nav)
|
|
150
|
-
width 100%
|
|
151
|
-
|
|
152
|
-
$app-2panes--withTopBar
|
|
153
134
|
+medium-screen() // mobile + tablet
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
135
|
+
display block
|
|
136
|
+
overflow visible
|
|
137
|
+
|
|
138
|
+
&-monocolumn
|
|
139
|
+
height 100%
|
|
140
|
+
|
|
141
|
+
&-2panes
|
|
142
|
+
height auto
|
|
143
|
+
margin 1rem 1rem 1rem 0
|
|
144
|
+
border-radius 1rem
|
|
145
|
+
|
|
146
|
+
+medium-screen() // mobile + tablet
|
|
147
|
+
margin 0
|
|
148
|
+
border-radius 0
|
|
@@ -9,22 +9,27 @@
|
|
|
9
9
|
--sidebarHeight: rem(52)
|
|
10
10
|
|
|
11
11
|
$sidebar
|
|
12
|
-
width rem(
|
|
12
|
+
width rem(236)
|
|
13
13
|
background-color var(--defaultBackgroundColor)
|
|
14
14
|
overflow-y auto
|
|
15
15
|
overflow-x hidden
|
|
16
|
+
display flex
|
|
17
|
+
flex-direction column
|
|
18
|
+
flex 0 0 auto
|
|
16
19
|
|
|
17
20
|
&--border
|
|
18
21
|
border-right rem(1) solid var(--dividerColor)
|
|
19
22
|
|
|
20
|
-
&--large
|
|
21
|
-
width rem(236)
|
|
22
|
-
|
|
23
23
|
+medium-screen()
|
|
24
24
|
justify-content space-between
|
|
25
25
|
border 0
|
|
26
26
|
border-top rem(1) solid var(--dividerColor)
|
|
27
27
|
height var(--sidebarHeight)
|
|
28
28
|
width 100%
|
|
29
|
+
position fixed
|
|
30
|
+
bottom 0
|
|
31
|
+
left 0
|
|
32
|
+
display block
|
|
33
|
+
z-index var(--zIndex-nav)
|
|
29
34
|
// iPhone X environment tweak
|
|
30
35
|
padding-bottom env(safe-area-inset-bottom)
|
|
@@ -24,10 +24,10 @@ import NotesIcon from "cozy-ui/transpiled/react/Icons/Notes";
|
|
|
24
24
|
import NotesTextIcon from "cozy-ui/transpiled/react/Icons/NotesText";
|
|
25
25
|
import PassIcon from "cozy-ui/transpiled/react/Icons/Pass";
|
|
26
26
|
import PassTextIcon from "cozy-ui/transpiled/react/Icons/PassText";
|
|
27
|
-
import StoreIcon from "cozy-ui/transpiled/react/Icons/Store";
|
|
28
|
-
import StoreTextIcon from "cozy-ui/transpiled/react/Icons/StoreText";
|
|
29
27
|
import PhotosIcon from "cozy-ui/transpiled/react/Icons/Photos";
|
|
30
28
|
import PhotosTextIcon from "cozy-ui/transpiled/react/Icons/PhotosText";
|
|
29
|
+
import StoreIcon from "cozy-ui/transpiled/react/Icons/Store";
|
|
30
|
+
import StoreTextIcon from "cozy-ui/transpiled/react/Icons/StoreText";
|
|
31
31
|
import TwakeTextIcon from "cozy-ui/transpiled/react/Icons/TwakeText";
|
|
32
32
|
import TwakeWorkplaceIcon from "cozy-ui/transpiled/react/Icons/TwakeWorkplace";
|
|
33
33
|
import WorkplaceTextIcon from "cozy-ui/transpiled/react/Icons/WorkplaceText";
|
|
@@ -24,7 +24,7 @@ var useStyles = makeStyles({
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
var useCozyDialog = function useCozyDialog(props) {
|
|
27
|
-
var _componentsProps$dial, _componentsProps$dial2, _componentsProps$dial3;
|
|
27
|
+
var _otherProps$BackdropP, _componentsProps$dial, _componentsProps$dial2, _componentsProps$dial3;
|
|
28
28
|
|
|
29
29
|
var size = props.size,
|
|
30
30
|
actions = props.actions,
|
|
@@ -70,6 +70,11 @@ var useCozyDialog = function useCozyDialog(props) {
|
|
|
70
70
|
paper: "".concat(paperClassName, " ").concat(styles.paper, " ").concat(otherProps.classes ? otherProps.classes.paper : ''),
|
|
71
71
|
scrollPaper: scrollPaperClassName
|
|
72
72
|
}),
|
|
73
|
+
BackdropProps: _objectSpread({
|
|
74
|
+
style: _objectSpread({
|
|
75
|
+
transitionDelay: 50
|
|
76
|
+
}, otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$BackdropP = otherProps.BackdropProps) === null || _otherProps$BackdropP === void 0 ? void 0 : _otherProps$BackdropP.style)
|
|
77
|
+
}, otherProps.BackdropProps),
|
|
73
78
|
TransitionProps: _objectSpread({
|
|
74
79
|
fullScreen: fullScreen
|
|
75
80
|
}, otherProps.TransitionProps)
|
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
withTopBar: any;
|
|
7
|
-
}): JSX.Element;
|
|
8
|
-
export namespace Layout {
|
|
9
|
-
namespace propTypes {
|
|
10
|
-
const children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
11
|
-
const className: PropTypes.Requireable<string>;
|
|
12
|
-
const withTopBar: PropTypes.Requireable<boolean>;
|
|
13
|
-
const monoColumn: PropTypes.Requireable<boolean>;
|
|
14
|
-
}
|
|
15
|
-
namespace defaultProps {
|
|
16
|
-
const withTopBar_1: boolean;
|
|
17
|
-
export { withTopBar_1 as withTopBar };
|
|
18
|
-
const monoColumn_1: boolean;
|
|
19
|
-
export { monoColumn_1 as monoColumn };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function Main({ children, ...rest }: {
|
|
23
|
-
[x: string]: any;
|
|
24
|
-
children: any;
|
|
25
|
-
}): JSX.Element;
|
|
26
|
-
export class Content extends React.Component<any, any, any> {
|
|
27
|
-
constructor(props: Readonly<any>);
|
|
28
|
-
constructor(props: any, context?: any);
|
|
29
|
-
render(): JSX.Element;
|
|
30
|
-
}
|
|
31
|
-
import PropTypes from "prop-types";
|
|
1
|
+
export const LayoutContext: React.Context<any>;
|
|
2
|
+
export function useLayout(): any;
|
|
3
|
+
export const Layout: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
4
|
+
export const Main: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
5
|
+
export const Content: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
32
6
|
import React from "react";
|
|
@@ -1,71 +1,99 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
7
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
9
4
|
var _excluded = ["children", "className", "monoColumn", "withTopBar"],
|
|
10
|
-
_excluded2 = ["children"],
|
|
11
|
-
_excluded3 = ["children"];
|
|
12
|
-
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
-
|
|
5
|
+
_excluded2 = ["className", "children"],
|
|
6
|
+
_excluded3 = ["className", "children"];
|
|
17
7
|
import cx from 'classnames';
|
|
18
8
|
import PropTypes from 'prop-types';
|
|
19
|
-
import React, {
|
|
9
|
+
import React, { createContext, forwardRef, useContext, useMemo } from 'react';
|
|
20
10
|
var styles = {
|
|
21
11
|
"o-layout": "styles__o-layout___3TSz9",
|
|
12
|
+
"o-layout-topbar": "styles__o-layout-topbar___2SHWi",
|
|
22
13
|
"o-layout-2panes": "styles__o-layout-2panes___1CDQw",
|
|
23
|
-
"o-layout
|
|
24
|
-
"o-layout-
|
|
14
|
+
"o-layout-main": "styles__o-layout-main___3mPxz",
|
|
15
|
+
"o-layout-main-monocolumn": "styles__o-layout-main-monocolumn___2a7vz",
|
|
16
|
+
"o-layout-main-monocolumn--topbar": "styles__o-layout-main-monocolumn--topbar___9_4Xd",
|
|
17
|
+
"o-layout-main-2panes": "styles__o-layout-main-2panes___3ickD",
|
|
18
|
+
"o-layout-main-2panes--topbar": "styles__o-layout-main-2panes--topbar___cGi-H",
|
|
19
|
+
"o-layout-content": "styles__o-layout-content___3D5gN",
|
|
20
|
+
"o-layout-content-monocolumn": "styles__o-layout-content-monocolumn___1rpxp",
|
|
21
|
+
"o-layout-content-2panes": "styles__o-layout-content-2panes___2Hotr"
|
|
25
22
|
};
|
|
26
|
-
export var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
monoColumn = _ref.monoColumn,
|
|
30
|
-
withTopBar = _ref.withTopBar,
|
|
31
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
export var LayoutContext = /*#__PURE__*/createContext();
|
|
24
|
+
export var useLayout = function useLayout() {
|
|
25
|
+
var context = useContext(LayoutContext);
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export var Main = function Main(_ref2) {
|
|
38
|
-
var children = _ref2.children,
|
|
39
|
-
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error('useLayout must be used within a LayoutContext');
|
|
29
|
+
}
|
|
40
30
|
|
|
41
|
-
return
|
|
31
|
+
return context;
|
|
42
32
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
var LayoutProvider = /*#__PURE__*/React.memo(function (_ref) {
|
|
34
|
+
var monoColumn = _ref.monoColumn,
|
|
35
|
+
withTopBar = _ref.withTopBar,
|
|
36
|
+
children = _ref.children;
|
|
37
|
+
var value = useMemo(function () {
|
|
38
|
+
return {
|
|
39
|
+
monoColumn: monoColumn,
|
|
40
|
+
withTopBar: withTopBar
|
|
41
|
+
};
|
|
42
|
+
}, [monoColumn, withTopBar]);
|
|
43
|
+
return /*#__PURE__*/React.createElement(LayoutContext.Provider, {
|
|
44
|
+
value: value
|
|
45
|
+
}, children);
|
|
46
|
+
});
|
|
47
|
+
LayoutProvider.displayName = 'LayoutProvider';
|
|
48
|
+
export var Layout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
49
|
+
var children = _ref2.children,
|
|
50
|
+
className = _ref2.className,
|
|
51
|
+
monoColumn = _ref2.monoColumn,
|
|
52
|
+
withTopBar = _ref2.withTopBar,
|
|
53
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
var variant = monoColumn ? 'monocolumn' : '2panes';
|
|
56
|
+
return /*#__PURE__*/React.createElement(LayoutProvider, {
|
|
57
|
+
monoColumn: monoColumn,
|
|
58
|
+
withTopBar: withTopBar
|
|
59
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
60
|
+
ref: ref,
|
|
61
|
+
className: cx(className, styles['o-layout'], styles["o-layout-".concat(variant)], _defineProperty({}, styles["o-layout-topbar"], withTopBar))
|
|
62
|
+
}, props), children));
|
|
63
|
+
});
|
|
64
|
+
Layout.displayName = 'Layout';
|
|
65
|
+
export var Main = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
66
|
+
var className = _ref3.className,
|
|
67
|
+
children = _ref3.children,
|
|
68
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
50
69
|
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
var _useLayout = useLayout(),
|
|
71
|
+
monoColumn = _useLayout.monoColumn,
|
|
72
|
+
withTopBar = _useLayout.withTopBar;
|
|
53
73
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
74
|
+
var variant = monoColumn ? 'monocolumn' : '2panes';
|
|
75
|
+
return /*#__PURE__*/React.createElement("main", _extends({
|
|
76
|
+
ref: ref,
|
|
77
|
+
className: cx(className, styles['o-layout-main'], styles["o-layout-main-".concat(variant)], _defineProperty({}, styles["o-layout-main-".concat(variant, "--topbar")], withTopBar))
|
|
78
|
+
}, props), children);
|
|
79
|
+
});
|
|
80
|
+
Main.displayName = 'Main';
|
|
81
|
+
export var Content = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
|
82
|
+
var className = _ref4.className,
|
|
83
|
+
children = _ref4.children,
|
|
84
|
+
props = _objectWithoutProperties(_ref4, _excluded3);
|
|
60
85
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, rest), children);
|
|
64
|
-
}
|
|
65
|
-
}]);
|
|
86
|
+
var _useLayout2 = useLayout(),
|
|
87
|
+
monoColumn = _useLayout2.monoColumn;
|
|
66
88
|
|
|
67
|
-
|
|
68
|
-
|
|
89
|
+
var variant = monoColumn ? 'monocolumn' : '2panes';
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
91
|
+
role: "main",
|
|
92
|
+
ref: ref,
|
|
93
|
+
className: cx(className, styles['o-layout-content'], styles["o-layout-content-".concat(variant)])
|
|
94
|
+
}, props), children);
|
|
95
|
+
});
|
|
96
|
+
Content.displayName = 'Content';
|
|
69
97
|
Layout.propTypes = {
|
|
70
98
|
children: PropTypes.node,
|
|
71
99
|
className: PropTypes.string,
|