cozy-ui 96.1.0 → 96.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 +15 -0
- package/package.json +1 -1
- package/react/MuiCozyTheme/makeOverrides.js +4 -2
- package/react/NestedSelect/BottomSheet.jsx +2 -0
- package/react/NestedSelect/Modal.jsx +3 -0
- package/react/NestedSelect/NestedSelect.jsx +9 -2
- package/react/NestedSelect/NestedSelect.md +20 -6
- package/transpiled/react/MuiCozyTheme/makeOverrides.js +2 -2
- package/transpiled/react/NestedSelect/BottomSheet.js +1 -0
- package/transpiled/react/NestedSelect/Modal.js +1 -0
- package/transpiled/react/NestedSelect/NestedSelect.js +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [96.2.0](https://github.com/cozy/cozy-ui/compare/v96.1.1...v96.2.0) (2023-11-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **NestedSelect:** Add `header` and `childrenHeader` props on `options` ([bf31c73](https://github.com/cozy/cozy-ui/commit/bf31c73))
|
|
7
|
+
* **NestedSelect:** Title is no longer required ([6a776cf](https://github.com/cozy/cozy-ui/commit/6a776cf))
|
|
8
|
+
|
|
9
|
+
## [96.1.1](https://github.com/cozy/cozy-ui/compare/v96.1.0...v96.1.1) (2023-11-27)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* Improve IllustrationDialog layout in native ([2946e9d](https://github.com/cozy/cozy-ui/commit/2946e9d))
|
|
15
|
+
|
|
1
16
|
# [96.1.0](https://github.com/cozy/cozy-ui/compare/v96.0.0...v96.1.0) (2023-11-24)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -506,11 +506,13 @@ export const makeOverrides = theme => ({
|
|
|
506
506
|
'& .dialogContentWrapper': {
|
|
507
507
|
flexGrow: 1,
|
|
508
508
|
'&:not(.withActions)': {
|
|
509
|
-
paddingBottom:
|
|
509
|
+
paddingBottom:
|
|
510
|
+
'calc(env(safe-area-inset-bottom) + var(--flagship-bottom-height) + 16px)'
|
|
510
511
|
}
|
|
511
512
|
},
|
|
512
513
|
'& .cozyDialogActions': {
|
|
513
|
-
paddingBottom:
|
|
514
|
+
paddingBottom:
|
|
515
|
+
'calc(env(safe-area-inset-bottom) + var(--flagship-bottom-height) + 16px)'
|
|
514
516
|
}
|
|
515
517
|
}
|
|
516
518
|
},
|
|
@@ -90,16 +90,18 @@ class NestedSelect extends Component {
|
|
|
90
90
|
transformParentItem,
|
|
91
91
|
radioPosition,
|
|
92
92
|
ellipsis,
|
|
93
|
+
options,
|
|
94
|
+
searchOptions,
|
|
93
95
|
noDivider
|
|
94
96
|
} = this.props
|
|
95
97
|
const { history, searchValue, searchResult } = this.state
|
|
98
|
+
|
|
96
99
|
const current = history[0]
|
|
97
100
|
const children = current.children || []
|
|
98
101
|
const level = history.length - 1
|
|
99
102
|
const isSelectedWithLevel = item => isSelected(item, level)
|
|
100
103
|
const parentItem = transformParentItem(omit(current, 'children'))
|
|
101
104
|
|
|
102
|
-
const searchOptions = this.props.searchOptions
|
|
103
105
|
const hasSearchResult = searchValue.length > 0
|
|
104
106
|
|
|
105
107
|
const onChange = ev => {
|
|
@@ -120,6 +122,7 @@ class NestedSelect extends Component {
|
|
|
120
122
|
onClickBack={this.handleBack}
|
|
121
123
|
/>
|
|
122
124
|
) : null}
|
|
125
|
+
{level > 0 ? options.childrenHeader : options.header}
|
|
123
126
|
<ContentComponent>
|
|
124
127
|
{canSelectParent && level > 0 ? (
|
|
125
128
|
<ItemRow
|
|
@@ -195,7 +198,7 @@ const ItemPropType = PropTypes.shape({
|
|
|
195
198
|
/** Key used for the item, if not passed, title is used */
|
|
196
199
|
key: PropTypes.string,
|
|
197
200
|
/** Label used for the item */
|
|
198
|
-
title: PropTypes.node
|
|
201
|
+
title: PropTypes.node,
|
|
199
202
|
/** Description of the item */
|
|
200
203
|
description: PropTypes.node,
|
|
201
204
|
/** Options below the current one */
|
|
@@ -214,6 +217,10 @@ NestedSelect.propTypes = {
|
|
|
214
217
|
|
|
215
218
|
/** Options that will be rendered as nested lists of choices */
|
|
216
219
|
options: PropTypes.shape({
|
|
220
|
+
/** Header shown above options list */
|
|
221
|
+
header: PropTypes.node,
|
|
222
|
+
/** Header shown above options list inside a children */
|
|
223
|
+
childrenHeader: PropTypes.node,
|
|
217
224
|
children: PropTypes.arrayOf(ItemPropType)
|
|
218
225
|
}),
|
|
219
226
|
|
|
@@ -17,6 +17,7 @@ import Checkbox from 'cozy-ui/transpiled/react/Checkbox'
|
|
|
17
17
|
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
18
18
|
import palette from 'cozy-ui/transpiled/react/palette'
|
|
19
19
|
import Typography from 'cozy-ui/transpiled/react/Typography'
|
|
20
|
+
import Alert from 'cozy-ui/transpiled/react/Alert'
|
|
20
21
|
|
|
21
22
|
const Image = ({ letter }) => (
|
|
22
23
|
<Circle backgroundColor={palette.melon}>
|
|
@@ -42,7 +43,13 @@ const SettingAction = ({ item, onClick }) => {
|
|
|
42
43
|
)
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
const
|
|
46
|
+
const makeOptions = withHeaders => ({
|
|
47
|
+
header: withHeaders ?
|
|
48
|
+
<Alert className="u-mt-1 u-mh-1" serverity="info" icon={false}>This is a header for options</Alert>
|
|
49
|
+
: undefined,
|
|
50
|
+
childrenHeader: withHeaders ?
|
|
51
|
+
<Alert className="u-mt-1 u-mh-1" serverity="info">This is specific option header for children</Alert>
|
|
52
|
+
: undefined,
|
|
46
53
|
children: [
|
|
47
54
|
{
|
|
48
55
|
...letterOption('A', 'is for Apple'),
|
|
@@ -78,7 +85,7 @@ const options = {
|
|
|
78
85
|
letterOption('M'),
|
|
79
86
|
letterOption('N'),
|
|
80
87
|
]
|
|
81
|
-
}
|
|
88
|
+
})
|
|
82
89
|
|
|
83
90
|
const transformParentItem = item => ({
|
|
84
91
|
...item,
|
|
@@ -95,7 +102,7 @@ const StaticExample = () => {
|
|
|
95
102
|
onSelect={x => x}
|
|
96
103
|
dismissAction={x => x}
|
|
97
104
|
isSelected={x => x.title === 'C'}
|
|
98
|
-
options={
|
|
105
|
+
options={makeOptions()}
|
|
99
106
|
title="Please select letter"
|
|
100
107
|
transformParentItem={transformParentItem}
|
|
101
108
|
componentsProps={{ bottomsheet: { skipAnimation: isTesting() } }}
|
|
@@ -151,7 +158,14 @@ const InteractiveExample = () => {
|
|
|
151
158
|
}, RADIO_BUTTON_ANIM_DURATION)
|
|
152
159
|
}
|
|
153
160
|
|
|
154
|
-
const initialVariants = [{
|
|
161
|
+
const initialVariants = [{
|
|
162
|
+
noTitle: false,
|
|
163
|
+
noDivider: false,
|
|
164
|
+
leftRadio: false,
|
|
165
|
+
withSearch: false,
|
|
166
|
+
withEllipsis: true,
|
|
167
|
+
withHeaders: false
|
|
168
|
+
}]
|
|
155
169
|
|
|
156
170
|
return (
|
|
157
171
|
<Variants initialVariants={initialVariants} screenshotAllVariants>
|
|
@@ -167,9 +181,9 @@ const InteractiveExample = () => {
|
|
|
167
181
|
onSelect={handleSelect}
|
|
168
182
|
onClose={hideModal}
|
|
169
183
|
isSelected={isSelected}
|
|
170
|
-
options={
|
|
184
|
+
options={makeOptions(variant.withHeaders)}
|
|
171
185
|
radioPosition={variant.leftRadio ? 'left' : 'right'}
|
|
172
|
-
title="Please select letter"
|
|
186
|
+
title={variant.noTitle ? undefined : "Please select letter"}
|
|
173
187
|
transformParentItem={transformParentItem}
|
|
174
188
|
searchOptions={variant.withSearch ? searchOptions : undefined}
|
|
175
189
|
ellipsis={variant.withEllipsis}
|
|
@@ -471,11 +471,11 @@ export var makeOverrides = function makeOverrides(theme) {
|
|
|
471
471
|
'& .dialogContentWrapper': {
|
|
472
472
|
flexGrow: 1,
|
|
473
473
|
'&:not(.withActions)': {
|
|
474
|
-
paddingBottom: '16px'
|
|
474
|
+
paddingBottom: 'calc(env(safe-area-inset-bottom) + var(--flagship-bottom-height) + 16px)'
|
|
475
475
|
}
|
|
476
476
|
},
|
|
477
477
|
'& .cozyDialogActions': {
|
|
478
|
-
paddingBottom: '16px'
|
|
478
|
+
paddingBottom: 'calc(env(safe-area-inset-bottom) + var(--flagship-bottom-height) + 16px)'
|
|
479
479
|
}
|
|
480
480
|
}),
|
|
481
481
|
'& .dialogTitleFluidContainer': _defineProperty({
|
|
@@ -14,6 +14,7 @@ var HeaderComponent = function HeaderComponent(_ref) {
|
|
|
14
14
|
var title = _ref.title,
|
|
15
15
|
showBack = _ref.showBack,
|
|
16
16
|
onClickBack = _ref.onClickBack;
|
|
17
|
+
if (!title) return null;
|
|
17
18
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BottomSheetHeader, {
|
|
18
19
|
className: cx('u-h-3', {
|
|
19
20
|
'u-pl-half u-pr-3': showBack
|
|
@@ -22,6 +22,7 @@ var NestedSelectDialogHeader = function NestedSelectDialogHeader(_ref) {
|
|
|
22
22
|
}),
|
|
23
23
|
dialogTitleProps = _useCozyDialog.dialogTitleProps;
|
|
24
24
|
|
|
25
|
+
if (!title) return null;
|
|
25
26
|
return /*#__PURE__*/React.createElement(DialogTitle, dialogTitleProps, /*#__PURE__*/React.createElement(Media, null, showBack && /*#__PURE__*/React.createElement(Img, {
|
|
26
27
|
className: styles.Modal__back
|
|
27
28
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
@@ -129,6 +129,8 @@ var NestedSelect = /*#__PURE__*/function (_Component) {
|
|
|
129
129
|
transformParentItem = _this$props.transformParentItem,
|
|
130
130
|
radioPosition = _this$props.radioPosition,
|
|
131
131
|
ellipsis = _this$props.ellipsis,
|
|
132
|
+
options = _this$props.options,
|
|
133
|
+
searchOptions = _this$props.searchOptions,
|
|
132
134
|
noDivider = _this$props.noDivider;
|
|
133
135
|
var _this$state = this.state,
|
|
134
136
|
history = _this$state.history,
|
|
@@ -143,7 +145,6 @@ var NestedSelect = /*#__PURE__*/function (_Component) {
|
|
|
143
145
|
};
|
|
144
146
|
|
|
145
147
|
var parentItem = transformParentItem(omit(current, 'children'));
|
|
146
|
-
var searchOptions = this.props.searchOptions;
|
|
147
148
|
var hasSearchResult = searchValue.length > 0;
|
|
148
149
|
|
|
149
150
|
var onChange = function onChange(ev) {
|
|
@@ -167,7 +168,7 @@ var NestedSelect = /*#__PURE__*/function (_Component) {
|
|
|
167
168
|
title: current.title || title,
|
|
168
169
|
showBack: history.length > 1,
|
|
169
170
|
onClickBack: this.handleBack
|
|
170
|
-
}) : null, /*#__PURE__*/React.createElement(ContentComponent, null, canSelectParent && level > 0 ? /*#__PURE__*/React.createElement(ItemRow, {
|
|
171
|
+
}) : null, level > 0 ? options.childrenHeader : options.header, /*#__PURE__*/React.createElement(ContentComponent, null, canSelectParent && level > 0 ? /*#__PURE__*/React.createElement(ItemRow, {
|
|
171
172
|
radioPosition: radioPosition,
|
|
172
173
|
item: parentItem,
|
|
173
174
|
onClick: this.handleClickItem,
|
|
@@ -227,7 +228,7 @@ var ItemPropType = PropTypes.shape({
|
|
|
227
228
|
key: PropTypes.string,
|
|
228
229
|
|
|
229
230
|
/** Label used for the item */
|
|
230
|
-
title: PropTypes.node
|
|
231
|
+
title: PropTypes.node,
|
|
231
232
|
|
|
232
233
|
/** Description of the item */
|
|
233
234
|
description: PropTypes.node,
|
|
@@ -247,6 +248,11 @@ NestedSelect.propTypes = {
|
|
|
247
248
|
|
|
248
249
|
/** Options that will be rendered as nested lists of choices */
|
|
249
250
|
options: PropTypes.shape({
|
|
251
|
+
/** Header shown above options list */
|
|
252
|
+
header: PropTypes.node,
|
|
253
|
+
|
|
254
|
+
/** Header shown above options list inside a children */
|
|
255
|
+
childrenHeader: PropTypes.node,
|
|
250
256
|
children: PropTypes.arrayOf(ItemPropType)
|
|
251
257
|
}),
|
|
252
258
|
|