cozy-ui 124.1.0 → 124.2.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 +14 -0
- package/assets/icons/ui/cloud2.svg +1 -1
- package/dist/cozy-ui.min.css +1 -1
- package/package.json +1 -1
- package/react/Icons/Cloud2.jsx +1 -1
- package/react/Layout/Layout.jsx +15 -2
- package/react/Layout/Layout.md +23 -54
- package/react/Layout/styles.styl +6 -0
- package/stylus/objects/layouts.styl +37 -18
- package/transpiled/react/Icon/icons-sprite.d.ts +1 -1
- package/transpiled/react/Icon/icons-sprite.js +1 -1
- package/transpiled/react/Icons/Cloud2.js +2 -1
- package/transpiled/react/Layout/Layout.d.ts +5 -1
- package/transpiled/react/Layout/Layout.js +12 -4
- package/transpiled/react/stylesheet.css +1 -1
package/package.json
CHANGED
package/react/Icons/Cloud2.jsx
CHANGED
package/react/Layout/Layout.jsx
CHANGED
|
@@ -4,13 +4,22 @@ import React, { Component } from 'react'
|
|
|
4
4
|
|
|
5
5
|
import styles from './styles.styl'
|
|
6
6
|
|
|
7
|
-
export const Layout = ({
|
|
7
|
+
export const Layout = ({
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
monoColumn,
|
|
11
|
+
withTopBar,
|
|
12
|
+
...rest
|
|
13
|
+
}) => {
|
|
8
14
|
return (
|
|
9
15
|
<div
|
|
10
16
|
className={cx(
|
|
11
17
|
monoColumn ? styles['o-layout'] : styles['o-layout-2panes'],
|
|
12
18
|
className,
|
|
13
|
-
|
|
19
|
+
{
|
|
20
|
+
[styles[`o-layout${monoColumn ? '' : '-2panes'}--withTopBar`]]:
|
|
21
|
+
withTopBar
|
|
22
|
+
}
|
|
14
23
|
)}
|
|
15
24
|
{...rest}
|
|
16
25
|
>
|
|
@@ -35,9 +44,13 @@ export class Content extends Component {
|
|
|
35
44
|
Layout.propTypes = {
|
|
36
45
|
children: PropTypes.node,
|
|
37
46
|
className: PropTypes.string,
|
|
47
|
+
/** Used to add/remove top spacing when using with or without a topbar */
|
|
48
|
+
withTopBar: PropTypes.bool,
|
|
49
|
+
/** Should be true if no sidebar in the app */
|
|
38
50
|
monoColumn: PropTypes.bool
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
Layout.defaultProps = {
|
|
54
|
+
withTopBar: true,
|
|
42
55
|
monoColumn: false
|
|
43
56
|
}
|
package/react/Layout/Layout.md
CHANGED
|
@@ -34,6 +34,7 @@ import CheckIcon from 'cozy-ui/transpiled/react/Icons/Check'
|
|
|
34
34
|
import DownloadIcon from 'cozy-ui/transpiled/react/Icons/Download'
|
|
35
35
|
import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
|
|
36
36
|
import { makeStyles } from 'cozy-ui/transpiled/react/styles'
|
|
37
|
+
import Variants from 'cozy-ui/docs/components/Variants'
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* In a normal app, ExampleRouterNavLink is from react-router
|
|
@@ -50,13 +51,6 @@ const ExampleRouterNavLink = ({ children, className, active, activeClassName, on
|
|
|
50
51
|
const NavLink = genNavLink(ExampleRouterNavLink)
|
|
51
52
|
|
|
52
53
|
// Not necessary in a normal app
|
|
53
|
-
const styles = {
|
|
54
|
-
layout: {
|
|
55
|
-
position: 'relative',
|
|
56
|
-
transform: 'translateZ(0)'
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
54
|
const useStyles = makeStyles({
|
|
61
55
|
layout: {
|
|
62
56
|
position: 'relative',
|
|
@@ -67,12 +61,13 @@ const useStyles = makeStyles({
|
|
|
67
61
|
}
|
|
68
62
|
})
|
|
69
63
|
|
|
70
|
-
|
|
64
|
+
const initialVariants = [{ monoColumn: false, withTopBar: true }]
|
|
65
|
+
const [active, setActive] = useState(['Section 1', 'Subsection 1'])
|
|
66
|
+
const styles = useStyles()
|
|
71
67
|
|
|
72
|
-
|
|
73
|
-
const [active, setActive] = useState(['Section 1', 'Subsection 1'])
|
|
74
|
-
const styles = useStyles()
|
|
68
|
+
;
|
|
75
69
|
|
|
70
|
+
const SideBar = ({ variant }) => {
|
|
76
71
|
// makeProps is not necessary in a normal app since react-router sets active
|
|
77
72
|
// and onClick by itself
|
|
78
73
|
const makeProps = route => {
|
|
@@ -80,7 +75,7 @@ const Example = () => {
|
|
|
80
75
|
return { onClick: () => setActive(route), active: routeIsMatching }
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
return
|
|
78
|
+
return (
|
|
84
79
|
<Sidebar>
|
|
85
80
|
<Nav>
|
|
86
81
|
<NavItem>
|
|
@@ -114,53 +109,27 @@ const Example = () => {
|
|
|
114
109
|
</NavItem>
|
|
115
110
|
</Nav>
|
|
116
111
|
</Sidebar>
|
|
117
|
-
|
|
118
|
-
<Content className='u-p-1'>
|
|
119
|
-
<h2 className='u-mt-0'>{ active.join(' / ') }</h2>
|
|
120
|
-
{ content.ada.short }
|
|
121
|
-
</Content>
|
|
122
|
-
</Main>
|
|
123
|
-
</Layout>
|
|
112
|
+
)
|
|
124
113
|
}
|
|
125
114
|
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
import { makeStyles } from 'cozy-ui/transpiled/react/styles'
|
|
137
|
-
|
|
138
|
-
// Not necessary in a normal app
|
|
139
|
-
const useStyles = makeStyles({
|
|
140
|
-
layout: {
|
|
141
|
-
'& > main': {
|
|
142
|
-
minHeight: 'unset'
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
const Example = () => {
|
|
148
|
-
const styles = useStyles()
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<Layout className={styles.layout} monoColumn>
|
|
115
|
+
<Variants initialVariants={initialVariants} screenshotAllVariants>
|
|
116
|
+
{variant => (
|
|
117
|
+
<DemoProvider>
|
|
118
|
+
<Layout
|
|
119
|
+
className={styles.layout}
|
|
120
|
+
withTopBar={variant.withTopBar}
|
|
121
|
+
monoColumn={variant.monoColumn}
|
|
122
|
+
>
|
|
123
|
+
{!variant.monoColumn && <SideBar variant={variant} />}
|
|
124
|
+
{variant.withTopBar && <div className="u-flex-m u-dn u-flex-items-center u-pos-absolute u-top-0 u-w-100" style={{ height: '48px', backgroundColor: 'var(--defaultBackgroundColor)' }}>Fake TopBar</div>}
|
|
152
125
|
<Main>
|
|
153
126
|
<Content className='u-p-1'>
|
|
127
|
+
<h2 className='u-mt-0'>{ active.join(' / ') }</h2>
|
|
154
128
|
{ content.ada.short }
|
|
155
129
|
</Content>
|
|
156
130
|
</Main>
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
;
|
|
162
|
-
|
|
163
|
-
<DemoProvider>
|
|
164
|
-
<Example />
|
|
165
|
-
</DemoProvider>
|
|
131
|
+
</Layout>
|
|
132
|
+
</DemoProvider>
|
|
133
|
+
)}
|
|
134
|
+
</Variants>
|
|
166
135
|
```
|
package/react/Layout/styles.styl
CHANGED
|
@@ -77,16 +77,6 @@ $app
|
|
|
77
77
|
overflow-x hidden
|
|
78
78
|
overflow-y auto
|
|
79
79
|
|
|
80
|
-
&--rounded
|
|
81
|
-
+medium-screen('min') // desktop only
|
|
82
|
-
main
|
|
83
|
-
background-color var(--defaultBackgroundColor)
|
|
84
|
-
|
|
85
|
-
& > [role=main]
|
|
86
|
-
margin 1rem 1rem 1rem 0
|
|
87
|
-
border-radius 1rem
|
|
88
|
-
background-color var(--paperBackgroundColor)
|
|
89
|
-
|
|
90
80
|
+medium-screen() // mobile + tablet
|
|
91
81
|
display block
|
|
92
82
|
|
|
@@ -95,7 +85,7 @@ $app
|
|
|
95
85
|
padding-left env(safe-area-inset-left)
|
|
96
86
|
padding-right env(safe-area-inset-right)
|
|
97
87
|
padding-bottom env(safe-area-inset-bottom)
|
|
98
|
-
min-height
|
|
88
|
+
min-height 100vh
|
|
99
89
|
|
|
100
90
|
main,
|
|
101
91
|
main > [role=contentinfo], // Deprecated
|
|
@@ -103,18 +93,17 @@ $app
|
|
|
103
93
|
display block
|
|
104
94
|
overflow visible
|
|
105
95
|
|
|
106
|
-
|
|
96
|
+
$app--withTopBar
|
|
97
|
+
+medium-screen() // mobile + tablet
|
|
98
|
+
main
|
|
99
|
+
min-height 'calc(100vh - %s)' % barHeight
|
|
100
|
+
|
|
101
|
+
// this pseudo-element is "ghost" element replacing bar
|
|
107
102
|
&:before
|
|
108
|
-
&:after
|
|
109
103
|
content ''
|
|
110
104
|
display block
|
|
111
|
-
|
|
112
|
-
&:before
|
|
113
105
|
height barHeight
|
|
114
106
|
|
|
115
|
-
&:after
|
|
116
|
-
height navHeight
|
|
117
|
-
|
|
118
107
|
// STICKY layout
|
|
119
108
|
// When you want a sidebar and you want it to act like a sticky footer on mobile
|
|
120
109
|
$app-2panes-sticky
|
|
@@ -132,7 +121,26 @@ $app-2panes-sticky
|
|
|
132
121
|
main > [role=main]
|
|
133
122
|
height auto
|
|
134
123
|
|
|
124
|
+
// rounded effect
|
|
125
|
+
+medium-screen('min') // desktop only
|
|
126
|
+
main
|
|
127
|
+
background-color var(--defaultBackgroundColor)
|
|
128
|
+
|
|
129
|
+
& > [role=main]
|
|
130
|
+
margin 1rem 1rem 1rem 0
|
|
131
|
+
border-radius 1rem
|
|
132
|
+
background-color var(--paperBackgroundColor)
|
|
133
|
+
|
|
135
134
|
+medium-screen() // mobile + tablet
|
|
135
|
+
main
|
|
136
|
+
min-height calc(100vh - var(--sidebarHeight))
|
|
137
|
+
|
|
138
|
+
// this pseudo-element is "ghost" element replacing nav
|
|
139
|
+
&:after
|
|
140
|
+
content ''
|
|
141
|
+
display block
|
|
142
|
+
height navHeight
|
|
143
|
+
|
|
136
144
|
> aside
|
|
137
145
|
position fixed
|
|
138
146
|
bottom 0
|
|
@@ -140,3 +148,14 @@ $app-2panes-sticky
|
|
|
140
148
|
display block
|
|
141
149
|
z-index var(--zIndex-nav)
|
|
142
150
|
width 100%
|
|
151
|
+
|
|
152
|
+
$app-2panes--withTopBar
|
|
153
|
+
+medium-screen() // mobile + tablet
|
|
154
|
+
main
|
|
155
|
+
min-height 'calc(100vh - var(--sidebarHeight) - %s)' % barHeight
|
|
156
|
+
|
|
157
|
+
// this pseudo-element is "ghost" element replacing bar
|
|
158
|
+
&:before
|
|
159
|
+
content ''
|
|
160
|
+
display block
|
|
161
|
+
height barHeight
|