cozy-ui 111.15.0 → 111.15.2
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/package.json +1 -1
- package/react/AppSections/__snapshots__/index.spec.jsx.snap +0 -10
- package/react/AppSections/categories.js +5 -2
- package/react/AppSections/categories.spec.js +94 -7
- package/react/BottomSheet/helpers.js +5 -1
- package/react/BottomSheet/helpers.spec.js +14 -14
- package/react/CozyDialogs/Readme.md +13 -0
- package/transpiled/react/AppSections/categories.js +4 -2
- package/transpiled/react/BottomSheet/helpers.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [111.15.2](https://github.com/cozy/cozy-ui/compare/v111.15.1...v111.15.2) (2024-10-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **BottomSheet:** Add safe area and flagship app height to compute toolbar height ([f452eca](https://github.com/cozy/cozy-ui/commit/f452eca))
|
|
7
|
+
|
|
8
|
+
## [111.15.1](https://github.com/cozy/cozy-ui/compare/v111.15.0...v111.15.1) (2024-10-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Show additional apps only when there ones ([64c6c5e](https://github.com/cozy/cozy-ui/commit/64c6c5e))
|
|
14
|
+
|
|
1
15
|
# [111.15.0](https://github.com/cozy/cozy-ui/compare/v111.14.0...v111.15.0) (2024-10-09)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1075,11 +1075,6 @@ exports[`AppsSection component should render dropdown filter on mobile if no nav
|
|
|
1075
1075
|
"type": "webapp",
|
|
1076
1076
|
"value": "partners",
|
|
1077
1077
|
},
|
|
1078
|
-
Object {
|
|
1079
|
-
"label": "Additional apps",
|
|
1080
|
-
"secondary": false,
|
|
1081
|
-
"value": "shortcuts",
|
|
1082
|
-
},
|
|
1083
1078
|
Object {
|
|
1084
1079
|
"label": "Services",
|
|
1085
1080
|
"secondary": false,
|
|
@@ -1481,11 +1476,6 @@ exports[`AppsSection component should render dropdown filter on tablet if no nav
|
|
|
1481
1476
|
"type": "webapp",
|
|
1482
1477
|
"value": "partners",
|
|
1483
1478
|
},
|
|
1484
|
-
Object {
|
|
1485
|
-
"label": "Additional apps",
|
|
1486
|
-
"secondary": false,
|
|
1487
|
-
"value": "shortcuts",
|
|
1488
|
-
},
|
|
1489
1479
|
Object {
|
|
1490
1480
|
"label": "Services",
|
|
1491
1481
|
"secondary": false,
|
|
@@ -109,7 +109,9 @@ export const generateOptionsFromApps = (apps, options = {}) => {
|
|
|
109
109
|
})
|
|
110
110
|
)
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
|
|
113
|
+
const categories = Object.keys(catApps)
|
|
114
|
+
if (type === APP_TYPE.FILE && categories.length > 0) {
|
|
113
115
|
allCategoryOptions.push(
|
|
114
116
|
addLabel({
|
|
115
117
|
value: 'shortcuts',
|
|
@@ -117,7 +119,8 @@ export const generateOptionsFromApps = (apps, options = {}) => {
|
|
|
117
119
|
})
|
|
118
120
|
)
|
|
119
121
|
}
|
|
120
|
-
|
|
122
|
+
|
|
123
|
+
const categoryOptions = categories.map(cat => {
|
|
121
124
|
return addLabel({
|
|
122
125
|
value: cat,
|
|
123
126
|
type: type,
|
|
@@ -10,7 +10,14 @@ import { I18nContext } from '../jestLib/I18n'
|
|
|
10
10
|
import mockApps from '../mocks/apps'
|
|
11
11
|
|
|
12
12
|
const i18nContext = I18nContext({
|
|
13
|
-
locale:
|
|
13
|
+
locale: {
|
|
14
|
+
...en,
|
|
15
|
+
app_categories: {
|
|
16
|
+
...en.app_categories,
|
|
17
|
+
foo: 'Foo',
|
|
18
|
+
bar: 'Bar'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
14
21
|
})
|
|
15
22
|
const tMock = i18nContext.t
|
|
16
23
|
|
|
@@ -104,7 +111,6 @@ describe('generateOptionsFromApps', () => {
|
|
|
104
111
|
type: 'webapp',
|
|
105
112
|
value: 'others'
|
|
106
113
|
},
|
|
107
|
-
{ label: 'Additional apps', secondary: false, value: 'shortcuts' },
|
|
108
114
|
{
|
|
109
115
|
label: 'Services',
|
|
110
116
|
secondary: false,
|
|
@@ -157,11 +163,6 @@ describe('generateOptionsFromApps', () => {
|
|
|
157
163
|
type: 'webapp',
|
|
158
164
|
value: 'others'
|
|
159
165
|
},
|
|
160
|
-
{
|
|
161
|
-
label: 'Additional apps',
|
|
162
|
-
secondary: false,
|
|
163
|
-
value: 'shortcuts'
|
|
164
|
-
},
|
|
165
166
|
{
|
|
166
167
|
label: 'Services',
|
|
167
168
|
secondary: false,
|
|
@@ -199,4 +200,90 @@ describe('generateOptionsFromApps', () => {
|
|
|
199
200
|
catUtils.generateOptionsFromApps(null, { includeAll: false, addLabel })
|
|
200
201
|
).toEqual([])
|
|
201
202
|
})
|
|
203
|
+
|
|
204
|
+
it('should return additional apps categories when there more than one', () => {
|
|
205
|
+
const appsWithAdditionlOnes = [
|
|
206
|
+
...mockApps,
|
|
207
|
+
{
|
|
208
|
+
_id: 'shortcutA',
|
|
209
|
+
name: 'Shortcut A',
|
|
210
|
+
categories: ['foo'],
|
|
211
|
+
type: 'file',
|
|
212
|
+
_type: 'io.cozy.files'
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
_id: 'shortcutB',
|
|
216
|
+
name: 'Shortcut B',
|
|
217
|
+
categories: ['bar'],
|
|
218
|
+
type: 'file',
|
|
219
|
+
_type: 'io.cozy.files'
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
|
|
223
|
+
expect(
|
|
224
|
+
catUtils.generateOptionsFromApps(appsWithAdditionlOnes, {
|
|
225
|
+
includeAll: false,
|
|
226
|
+
addLabel
|
|
227
|
+
})
|
|
228
|
+
).toEqual([
|
|
229
|
+
{
|
|
230
|
+
label: 'The essentials',
|
|
231
|
+
secondary: false,
|
|
232
|
+
type: 'webapp',
|
|
233
|
+
value: 'cozy'
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
label: 'Partners',
|
|
237
|
+
secondary: false,
|
|
238
|
+
type: 'webapp',
|
|
239
|
+
value: 'partners'
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
label: 'Others',
|
|
243
|
+
secondary: false,
|
|
244
|
+
type: 'webapp',
|
|
245
|
+
value: 'others'
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
label: 'Additional apps',
|
|
249
|
+
secondary: false,
|
|
250
|
+
value: 'shortcuts'
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
label: 'Bar',
|
|
254
|
+
secondary: true,
|
|
255
|
+
type: 'file',
|
|
256
|
+
value: 'bar'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
label: 'Foo',
|
|
260
|
+
secondary: true,
|
|
261
|
+
type: 'file',
|
|
262
|
+
value: 'foo'
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
label: 'Services',
|
|
266
|
+
secondary: false,
|
|
267
|
+
value: 'konnectors'
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
label: 'Mobile and Internet',
|
|
271
|
+
secondary: true,
|
|
272
|
+
type: 'konnector',
|
|
273
|
+
value: 'isp'
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
label: 'Telecom',
|
|
277
|
+
secondary: true,
|
|
278
|
+
type: 'konnector',
|
|
279
|
+
value: 'telecom'
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
label: 'Transportation',
|
|
283
|
+
secondary: true,
|
|
284
|
+
type: 'konnector',
|
|
285
|
+
value: 'transport'
|
|
286
|
+
}
|
|
287
|
+
])
|
|
288
|
+
})
|
|
202
289
|
})
|
|
@@ -14,7 +14,11 @@ export const computeToolbarHeight = (toolbarProps = {}) => {
|
|
|
14
14
|
computedToolbarHeight = ref.current.offsetHeight
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
return
|
|
17
|
+
return (
|
|
18
|
+
computedToolbarHeight +
|
|
19
|
+
(getFlagshipMetadata().statusBarHeight || 0) +
|
|
20
|
+
getSafeAreaValue('top')
|
|
21
|
+
)
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export const computeMaxHeight = toolbarProps => {
|
|
@@ -22,19 +22,19 @@ describe('computeMaxHeight', () => {
|
|
|
22
22
|
it('should return correct value if no arg', () => {
|
|
23
23
|
const res = computeMaxHeight({})
|
|
24
24
|
|
|
25
|
-
expect(res).toBe(
|
|
25
|
+
expect(res).toBe(784)
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
it('should return correct value with height arg', () => {
|
|
29
29
|
const res = computeMaxHeight({ height: 50 })
|
|
30
30
|
|
|
31
|
-
expect(res).toBe(
|
|
31
|
+
expect(res).toBe(735)
|
|
32
32
|
})
|
|
33
33
|
|
|
34
34
|
it('should return correct value with ref arg', () => {
|
|
35
35
|
const res = computeMaxHeight({ ref: { current: { offsetHeight: 50 } } })
|
|
36
36
|
|
|
37
|
-
expect(res).toBe(
|
|
37
|
+
expect(res).toBe(735)
|
|
38
38
|
})
|
|
39
39
|
})
|
|
40
40
|
|
|
@@ -397,7 +397,7 @@ describe('computeBottomSpacer', () => {
|
|
|
397
397
|
offset: 0
|
|
398
398
|
})
|
|
399
399
|
|
|
400
|
-
expect(res).toBe(
|
|
400
|
+
expect(res).toBe(16)
|
|
401
401
|
})
|
|
402
402
|
|
|
403
403
|
it('should return the toolbar height', () => {
|
|
@@ -409,7 +409,7 @@ describe('computeBottomSpacer', () => {
|
|
|
409
409
|
offset: 0
|
|
410
410
|
})
|
|
411
411
|
|
|
412
|
-
expect(res).toBe(
|
|
412
|
+
expect(res).toBe(65)
|
|
413
413
|
})
|
|
414
414
|
|
|
415
415
|
it('should return the offset value and border', () => {
|
|
@@ -420,7 +420,7 @@ describe('computeBottomSpacer', () => {
|
|
|
420
420
|
offset: 48
|
|
421
421
|
})
|
|
422
422
|
|
|
423
|
-
expect(res).toBe(
|
|
423
|
+
expect(res).toBe(64)
|
|
424
424
|
})
|
|
425
425
|
|
|
426
426
|
it('should return the offset value and border and toolbar height', () => {
|
|
@@ -432,7 +432,7 @@ describe('computeBottomSpacer', () => {
|
|
|
432
432
|
offset: 48
|
|
433
433
|
})
|
|
434
434
|
|
|
435
|
-
expect(res).toBe(
|
|
435
|
+
expect(res).toBe(113)
|
|
436
436
|
})
|
|
437
437
|
})
|
|
438
438
|
})
|
|
@@ -495,7 +495,7 @@ describe('computeBottomSpacer', () => {
|
|
|
495
495
|
offset: 0
|
|
496
496
|
})
|
|
497
497
|
|
|
498
|
-
expect(res).toBe(
|
|
498
|
+
expect(res).toBe(16)
|
|
499
499
|
})
|
|
500
500
|
|
|
501
501
|
it('should return the toolbar height', () => {
|
|
@@ -507,7 +507,7 @@ describe('computeBottomSpacer', () => {
|
|
|
507
507
|
offset: 0
|
|
508
508
|
})
|
|
509
509
|
|
|
510
|
-
expect(res).toBe(
|
|
510
|
+
expect(res).toBe(65)
|
|
511
511
|
})
|
|
512
512
|
|
|
513
513
|
it('should return the offset value', () => {
|
|
@@ -518,7 +518,7 @@ describe('computeBottomSpacer', () => {
|
|
|
518
518
|
offset: 48
|
|
519
519
|
})
|
|
520
520
|
|
|
521
|
-
expect(res).toBe(
|
|
521
|
+
expect(res).toBe(64)
|
|
522
522
|
})
|
|
523
523
|
|
|
524
524
|
it('should return the offset value and toolbar height', () => {
|
|
@@ -530,7 +530,7 @@ describe('computeBottomSpacer', () => {
|
|
|
530
530
|
offset: 48
|
|
531
531
|
})
|
|
532
532
|
|
|
533
|
-
expect(res).toBe(
|
|
533
|
+
expect(res).toBe(113)
|
|
534
534
|
})
|
|
535
535
|
})
|
|
536
536
|
})
|
|
@@ -540,18 +540,18 @@ describe('computeToolbarHeight', () => {
|
|
|
540
540
|
it('should return the height prop', () => {
|
|
541
541
|
const res = computeToolbarHeight({ height: 50 })
|
|
542
542
|
|
|
543
|
-
expect(res).toBe(
|
|
543
|
+
expect(res).toBe(65)
|
|
544
544
|
})
|
|
545
545
|
|
|
546
546
|
it('should return the height from ref', () => {
|
|
547
547
|
const res = computeToolbarHeight({ ref: { current: { offsetHeight: 50 } } })
|
|
548
548
|
|
|
549
|
-
expect(res).toBe(
|
|
549
|
+
expect(res).toBe(65)
|
|
550
550
|
})
|
|
551
551
|
|
|
552
552
|
it('should return default value', () => {
|
|
553
553
|
const res = computeToolbarHeight()
|
|
554
554
|
|
|
555
|
-
expect(res).toBe(
|
|
555
|
+
expect(res).toBe(16)
|
|
556
556
|
})
|
|
557
557
|
})
|
|
@@ -92,6 +92,8 @@ const hideBottomSheet = () => setState({ bottomSheetOpened: false })
|
|
|
92
92
|
const showBottomSheet = () => setState({ bottomSheetOpened: true })
|
|
93
93
|
const hideSecondConfirmDialog = () => setState({ secondConfirmDialogOpened: false })
|
|
94
94
|
const showSecondConfirmDialog = () => setState({ secondConfirmDialogOpened: true })
|
|
95
|
+
const hideSecondDialog = () => setState({ secondDialogOpened: false })
|
|
96
|
+
const showSecondDialog = () => setState({ secondDialogOpened: true })
|
|
95
97
|
const hideBSConfirmDialog = () => setState({ BSConfirmDialogOpened: false })
|
|
96
98
|
const showBSConfirmDialog = () => setState({ BSConfirmDialogOpened: true })
|
|
97
99
|
|
|
@@ -188,6 +190,7 @@ initialState = {
|
|
|
188
190
|
modalOpened: isTesting(),
|
|
189
191
|
bottomSheetOpened: false,
|
|
190
192
|
secondConfirmDialogOpened: false,
|
|
193
|
+
secondDialogOpened: false,
|
|
191
194
|
BSConfirmDialogOpened: false,
|
|
192
195
|
modal: Dialog,
|
|
193
196
|
size: 'medium',
|
|
@@ -323,6 +326,9 @@ const initialVariants = [{
|
|
|
323
326
|
<div>
|
|
324
327
|
<Button label="Show inner confirm dialog" onClick={showSecondConfirmDialog}/>
|
|
325
328
|
</div>
|
|
329
|
+
<div>
|
|
330
|
+
<Button label="Show inner dialog" onClick={showSecondDialog}/>
|
|
331
|
+
</div>
|
|
326
332
|
</Stack>
|
|
327
333
|
</Typography>
|
|
328
334
|
|
|
@@ -333,6 +339,13 @@ const initialVariants = [{
|
|
|
333
339
|
/>
|
|
334
340
|
)}
|
|
335
341
|
|
|
342
|
+
{state.secondDialogOpened && (
|
|
343
|
+
<Dialog open onClose={hideSecondDialog}
|
|
344
|
+
title="This is a simple title"
|
|
345
|
+
content="This is a simple content"
|
|
346
|
+
/>
|
|
347
|
+
)}
|
|
348
|
+
|
|
336
349
|
{state.bottomSheetOpened && (
|
|
337
350
|
<BottomSheet backdrop onClose={hideBottomSheet}>
|
|
338
351
|
<BottomSheetItem>
|
|
@@ -141,14 +141,16 @@ export var generateOptionsFromApps = function generateOptionsFromApps(apps) {
|
|
|
141
141
|
}));
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
var categories = Object.keys(catApps);
|
|
145
|
+
|
|
146
|
+
if (type === APP_TYPE.FILE && categories.length > 0) {
|
|
145
147
|
allCategoryOptions.push(addLabel({
|
|
146
148
|
value: 'shortcuts',
|
|
147
149
|
secondary: false
|
|
148
150
|
}));
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
var categoryOptions =
|
|
153
|
+
var categoryOptions = categories.map(function (cat) {
|
|
152
154
|
return addLabel({
|
|
153
155
|
value: cat,
|
|
154
156
|
type: type,
|
|
@@ -14,7 +14,7 @@ export var computeToolbarHeight = function computeToolbarHeight() {
|
|
|
14
14
|
computedToolbarHeight = ref.current.offsetHeight;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
return computedToolbarHeight;
|
|
17
|
+
return computedToolbarHeight + (getFlagshipMetadata().statusBarHeight || 0) + getSafeAreaValue('top');
|
|
18
18
|
};
|
|
19
19
|
export var computeMaxHeight = function computeMaxHeight(toolbarProps) {
|
|
20
20
|
var toolbarHeight = computeToolbarHeight(toolbarProps);
|