cozy-ui 79.2.2 → 79.3.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/CODEOWNERS +1 -1
- package/package.json +1 -1
- package/react/AppSections/__snapshots__/search.spec.js.snap +226 -0
- package/react/AppSections/search.js +1 -1
- package/react/AppSections/search.spec.js +5 -0
- package/react/BottomSheet/BottomSheet.jsx +9 -1
- package/react/Snackbar/Readme.md +0 -1
- package/transpiled/react/AppSections/search.js +3 -1
- package/transpiled/react/BottomSheet/BottomSheet.js +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [79.3.0](https://github.com/cozy/cozy-ui/compare/v79.2.3...v79.3.0) (2023-01-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* adapt BottomSheet to flagship app ([18e93f8](https://github.com/cozy/cozy-ui/commit/18e93f8))
|
|
7
|
+
|
|
8
|
+
## [79.2.3](https://github.com/cozy/cozy-ui/compare/v79.2.2...v79.2.3) (2023-01-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **AppSections:** MakeMatcherFromSearch now accept unsupported filter ([1652d1c](https://github.com/cozy/cozy-ui/commit/1652d1c))
|
|
14
|
+
|
|
1
15
|
## [79.2.2](https://github.com/cozy/cozy-ui/compare/v79.2.1...v79.2.2) (2022-12-23)
|
|
2
16
|
|
|
3
17
|
|
package/CODEOWNERS
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# General code owners
|
|
2
|
-
* @JF-Cozy @Merkur39 @Ldoppea
|
|
2
|
+
* @JF-Cozy @Merkur39 @Ldoppea @zatteo
|
package/package.json
CHANGED
|
@@ -744,3 +744,229 @@ Array [
|
|
|
744
744
|
},
|
|
745
745
|
]
|
|
746
746
|
`;
|
|
747
|
+
|
|
748
|
+
exports[`makeMatcherFromSearch should work even for an unsupported filter 1`] = `
|
|
749
|
+
Array [
|
|
750
|
+
Object {
|
|
751
|
+
"categories": Array [
|
|
752
|
+
"cozy",
|
|
753
|
+
],
|
|
754
|
+
"developer": Object {
|
|
755
|
+
"name": "Cozy",
|
|
756
|
+
},
|
|
757
|
+
"editor": "Cozy",
|
|
758
|
+
"icon": "<svg></svg>",
|
|
759
|
+
"installed": true,
|
|
760
|
+
"isInRegistry": true,
|
|
761
|
+
"label": 1,
|
|
762
|
+
"name": "Collect",
|
|
763
|
+
"name_prefix": "Cozy",
|
|
764
|
+
"permissions": Object {
|
|
765
|
+
"mock": Object {
|
|
766
|
+
"type": "io.mock.doctype",
|
|
767
|
+
},
|
|
768
|
+
"mock2": Object {
|
|
769
|
+
"type": "io.mock.doctype2",
|
|
770
|
+
},
|
|
771
|
+
},
|
|
772
|
+
"related": "http://collect.cozy.mock/",
|
|
773
|
+
"slug": "collect",
|
|
774
|
+
"tags": Array [
|
|
775
|
+
"konnector",
|
|
776
|
+
"collect",
|
|
777
|
+
"bills",
|
|
778
|
+
"providers",
|
|
779
|
+
"files",
|
|
780
|
+
],
|
|
781
|
+
"type": "webapp",
|
|
782
|
+
"uninstallable": false,
|
|
783
|
+
"version": "3.0.0",
|
|
784
|
+
"versions": Object {
|
|
785
|
+
"beta": Array [
|
|
786
|
+
"3.0.0",
|
|
787
|
+
],
|
|
788
|
+
"dev": Array [
|
|
789
|
+
"3.0.0",
|
|
790
|
+
],
|
|
791
|
+
"stable": Array [
|
|
792
|
+
"3.0.0",
|
|
793
|
+
],
|
|
794
|
+
},
|
|
795
|
+
},
|
|
796
|
+
Object {
|
|
797
|
+
"categories": Array [
|
|
798
|
+
"others",
|
|
799
|
+
],
|
|
800
|
+
"developer": Object {
|
|
801
|
+
"name": "Cozy",
|
|
802
|
+
},
|
|
803
|
+
"editor": "Cozy",
|
|
804
|
+
"icon": "<svg></svg>",
|
|
805
|
+
"isInRegistry": true,
|
|
806
|
+
"locales": Object {
|
|
807
|
+
"name": "For Dev Only",
|
|
808
|
+
},
|
|
809
|
+
"name": "DevOnly",
|
|
810
|
+
"slug": "devonly",
|
|
811
|
+
"type": "webapp",
|
|
812
|
+
"uninstallable": true,
|
|
813
|
+
"versions": Object {
|
|
814
|
+
"beta": Array [],
|
|
815
|
+
"dev": Array [
|
|
816
|
+
"1.0.0-betaojdkehy989ekhflldh",
|
|
817
|
+
],
|
|
818
|
+
"stable": Array [],
|
|
819
|
+
},
|
|
820
|
+
},
|
|
821
|
+
Object {
|
|
822
|
+
"categories": Array [
|
|
823
|
+
"cozy",
|
|
824
|
+
],
|
|
825
|
+
"developer": Object {
|
|
826
|
+
"name": "Cozy",
|
|
827
|
+
},
|
|
828
|
+
"editor": "Cozy",
|
|
829
|
+
"icon": "<svg></svg>",
|
|
830
|
+
"installed": true,
|
|
831
|
+
"name": "Drive",
|
|
832
|
+
"name_prefix": "Cozy",
|
|
833
|
+
"permissions": Object {
|
|
834
|
+
"mock2": Object {
|
|
835
|
+
"type": "io.mock.doctype2",
|
|
836
|
+
},
|
|
837
|
+
},
|
|
838
|
+
"related": "http://drive.cozy.mock/",
|
|
839
|
+
"slug": "drive",
|
|
840
|
+
"tags": Array [
|
|
841
|
+
"search",
|
|
842
|
+
"files",
|
|
843
|
+
"folders",
|
|
844
|
+
],
|
|
845
|
+
"type": "webapp",
|
|
846
|
+
"uninstallable": false,
|
|
847
|
+
"version": "3.0.0-beta89bnhj3993",
|
|
848
|
+
},
|
|
849
|
+
Object {
|
|
850
|
+
"categories": Array [
|
|
851
|
+
"isp",
|
|
852
|
+
"telecom",
|
|
853
|
+
],
|
|
854
|
+
"developer": Object {
|
|
855
|
+
"name": "Cozy",
|
|
856
|
+
},
|
|
857
|
+
"icon": "<svg></svg>",
|
|
858
|
+
"isInRegistry": true,
|
|
859
|
+
"name": "Bouilligue",
|
|
860
|
+
"slug": "konnector-bouilligue",
|
|
861
|
+
"type": "konnector",
|
|
862
|
+
"uninstallable": true,
|
|
863
|
+
"versions": Object {
|
|
864
|
+
"beta": Array [
|
|
865
|
+
"0.1.0",
|
|
866
|
+
],
|
|
867
|
+
"dev": Array [
|
|
868
|
+
"0.1.0",
|
|
869
|
+
],
|
|
870
|
+
"stable": Array [
|
|
871
|
+
"0.1.0",
|
|
872
|
+
],
|
|
873
|
+
},
|
|
874
|
+
},
|
|
875
|
+
Object {
|
|
876
|
+
"categories": Array [
|
|
877
|
+
"transport",
|
|
878
|
+
],
|
|
879
|
+
"developer": Object {
|
|
880
|
+
"name": "Cozy",
|
|
881
|
+
},
|
|
882
|
+
"icon": "<svg></svg>",
|
|
883
|
+
"installed": true,
|
|
884
|
+
"isInRegistry": true,
|
|
885
|
+
"name": "Trinlane",
|
|
886
|
+
"permissions": Object {
|
|
887
|
+
"mock": Object {
|
|
888
|
+
"type": "io.mock.doctype",
|
|
889
|
+
},
|
|
890
|
+
},
|
|
891
|
+
"slug": "konnector-trinlane",
|
|
892
|
+
"tags": Array [
|
|
893
|
+
"transport",
|
|
894
|
+
"files",
|
|
895
|
+
"bills",
|
|
896
|
+
],
|
|
897
|
+
"type": "konnector",
|
|
898
|
+
"uninstallable": true,
|
|
899
|
+
"version": "0.1.0",
|
|
900
|
+
"versions": Object {
|
|
901
|
+
"beta": Array [
|
|
902
|
+
"0.1.0",
|
|
903
|
+
],
|
|
904
|
+
"dev": Array [
|
|
905
|
+
"0.1.0",
|
|
906
|
+
],
|
|
907
|
+
"stable": Array [
|
|
908
|
+
"0.1.0",
|
|
909
|
+
],
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
Object {
|
|
913
|
+
"categories": Array [
|
|
914
|
+
"cozy",
|
|
915
|
+
],
|
|
916
|
+
"developer": Object {
|
|
917
|
+
"name": "Cozy",
|
|
918
|
+
},
|
|
919
|
+
"editor": "Cozy",
|
|
920
|
+
"icon": "<svg></svg>",
|
|
921
|
+
"isInRegistry": true,
|
|
922
|
+
"locales": Object {
|
|
923
|
+
"en": Object {
|
|
924
|
+
"long_description": "A long description finally short",
|
|
925
|
+
},
|
|
926
|
+
},
|
|
927
|
+
"name": "Photos",
|
|
928
|
+
"name_prefix": "Cozy",
|
|
929
|
+
"slug": "photos",
|
|
930
|
+
"type": "webapp",
|
|
931
|
+
"uninstallable": true,
|
|
932
|
+
"versions": Object {
|
|
933
|
+
"beta": Array [
|
|
934
|
+
"3.0.0",
|
|
935
|
+
],
|
|
936
|
+
"dev": Array [
|
|
937
|
+
"3.0.0",
|
|
938
|
+
],
|
|
939
|
+
"stable": Array [
|
|
940
|
+
"3.0.0",
|
|
941
|
+
],
|
|
942
|
+
},
|
|
943
|
+
},
|
|
944
|
+
Object {
|
|
945
|
+
"availableVersion": "3.0.0",
|
|
946
|
+
"categories": Array [
|
|
947
|
+
"partners",
|
|
948
|
+
],
|
|
949
|
+
"icon": "<svg></svg>",
|
|
950
|
+
"installed": true,
|
|
951
|
+
"isInRegistry": true,
|
|
952
|
+
"name": "Tasky",
|
|
953
|
+
"slug": "tasky",
|
|
954
|
+
"type": "webapp",
|
|
955
|
+
"uninstallable": true,
|
|
956
|
+
"versions": Object {
|
|
957
|
+
"beta": Array [
|
|
958
|
+
"3.0.0",
|
|
959
|
+
"1.0.0",
|
|
960
|
+
],
|
|
961
|
+
"dev": Array [
|
|
962
|
+
"3.0.0",
|
|
963
|
+
"1.0.0",
|
|
964
|
+
],
|
|
965
|
+
"stable": Array [
|
|
966
|
+
"3.0.0",
|
|
967
|
+
"1.0.0",
|
|
968
|
+
],
|
|
969
|
+
},
|
|
970
|
+
},
|
|
971
|
+
]
|
|
972
|
+
`;
|
|
@@ -52,7 +52,7 @@ export const makeMatcherFromSearch = (search = {}) => {
|
|
|
52
52
|
// Create all predicates from the search object
|
|
53
53
|
const predicates = Object.values(
|
|
54
54
|
mapValues(search, (value, name) => {
|
|
55
|
-
return searchAttrToMatcher[name](value)
|
|
55
|
+
return searchAttrToMatcher[name]?.(value)
|
|
56
56
|
})
|
|
57
57
|
)
|
|
58
58
|
// Return a function returning true if all predicates pass
|
|
@@ -150,4 +150,9 @@ describe('makeMatcherFromSearch', () => {
|
|
|
150
150
|
const matcher = makeMatcherFromSearch({ category: 'cozy' })
|
|
151
151
|
expect([appWithoutCategories].filter(matcher)).toMatchSnapshot()
|
|
152
152
|
})
|
|
153
|
+
|
|
154
|
+
it('should work even for an unsupported filter', () => {
|
|
155
|
+
const matcher = makeMatcherFromSearch({ unsupportedKey: 'omg' })
|
|
156
|
+
expect(mockApps.filter(matcher)).toMatchSnapshot()
|
|
157
|
+
})
|
|
153
158
|
})
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
computeBottomSpacer
|
|
31
31
|
} from './helpers'
|
|
32
32
|
import { ANIMATION_DURATION } from './constants'
|
|
33
|
+
import { useSetFlagshipUI } from '../hooks/useSetFlagshipUi/useSetFlagshipUI'
|
|
33
34
|
|
|
34
35
|
const createContainerWrapperStyles = () => ({
|
|
35
36
|
container: {
|
|
@@ -258,6 +259,12 @@ const BottomSheet = memo(
|
|
|
258
259
|
children // to recompute data if content changes
|
|
259
260
|
])
|
|
260
261
|
|
|
262
|
+
useSetFlagshipUI(
|
|
263
|
+
{ bottomTheme: 'dark' },
|
|
264
|
+
{ bottomTheme: getFlagshipMetadata().immersive ? 'light' : 'dark' },
|
|
265
|
+
'cozy-ui/BottomSheet'
|
|
266
|
+
)
|
|
267
|
+
|
|
261
268
|
return (
|
|
262
269
|
<ContainerWrapper showBackdrop={showBackdrop}>
|
|
263
270
|
{getFlagshipMetadata().immersive && (
|
|
@@ -338,7 +345,8 @@ BottomSheet.defaultProps = {
|
|
|
338
345
|
classes: {},
|
|
339
346
|
toolbarProps: {},
|
|
340
347
|
backdrop: false,
|
|
341
|
-
offset:
|
|
348
|
+
offset:
|
|
349
|
+
(getFlagshipMetadata().immersive && getFlagshipMetadata().navbarHeight) ?? 0
|
|
342
350
|
}
|
|
343
351
|
|
|
344
352
|
BottomSheet.propTypes = {
|
package/react/Snackbar/Readme.md
CHANGED
|
@@ -55,7 +55,6 @@ initialState = { open: isTesting() }
|
|
|
55
55
|
|
|
56
56
|
const handleToggle = () => {setState(state => ({ open: !state.open }))}
|
|
57
57
|
|
|
58
|
-
const colors = ['primary', 'secondary', 'success', 'error', 'warning', 'info']
|
|
59
58
|
const initialVariants = [{ primary: true, secondary: true, success: false, error: false, warning: false, info: false }]
|
|
60
59
|
|
|
61
60
|
;
|
|
@@ -73,7 +73,9 @@ export var makeMatcherFromSearch = function makeMatcherFromSearch() {
|
|
|
73
73
|
var search = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
74
74
|
// Create all predicates from the search object
|
|
75
75
|
var predicates = Object.values(mapValues(search, function (value, name) {
|
|
76
|
-
|
|
76
|
+
var _searchAttrToMatcher$;
|
|
77
|
+
|
|
78
|
+
return (_searchAttrToMatcher$ = searchAttrToMatcher[name]) === null || _searchAttrToMatcher$ === void 0 ? void 0 : _searchAttrToMatcher$.call(searchAttrToMatcher, value);
|
|
77
79
|
})); // Return a function returning true if all predicates pass
|
|
78
80
|
|
|
79
81
|
return overEvery(predicates);
|
|
@@ -5,6 +5,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
var _excluded = ["portalProps"];
|
|
7
7
|
|
|
8
|
+
var _ref4;
|
|
9
|
+
|
|
8
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
11
|
|
|
10
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -22,6 +24,7 @@ import Paper from "cozy-ui/transpiled/react/Paper";
|
|
|
22
24
|
import BackdropOrFragment from "cozy-ui/transpiled/react/BottomSheet/BackdropOrFragment";
|
|
23
25
|
import { computeMaxHeight, computeMediumHeight, computeMinHeight, makeOverridenChildren, setTopPosition, setBottomPosition, minimizeAndClose, computeBottomSpacer } from "cozy-ui/transpiled/react/BottomSheet/helpers";
|
|
24
26
|
import { ANIMATION_DURATION } from "cozy-ui/transpiled/react/BottomSheet/constants";
|
|
27
|
+
import { useSetFlagshipUI } from "cozy-ui/transpiled/react/hooks/useSetFlagshipUi/useSetFlagshipUI";
|
|
25
28
|
|
|
26
29
|
var createContainerWrapperStyles = function createContainerWrapperStyles() {
|
|
27
30
|
return {
|
|
@@ -258,6 +261,11 @@ var BottomSheet = /*#__PURE__*/memo(function (_ref3) {
|
|
|
258
261
|
setBottomSpacerHeight(bottomSpacerHeight);
|
|
259
262
|
}, [innerContentRef, toolbarProps, mediumHeightRatio, mediumHeight, showBackdrop, backdrop, isClosable, offset, children // to recompute data if content changes
|
|
260
263
|
]);
|
|
264
|
+
useSetFlagshipUI({
|
|
265
|
+
bottomTheme: 'dark'
|
|
266
|
+
}, {
|
|
267
|
+
bottomTheme: getFlagshipMetadata().immersive ? 'light' : 'dark'
|
|
268
|
+
}, 'cozy-ui/BottomSheet');
|
|
261
269
|
return /*#__PURE__*/React.createElement(ContainerWrapper, {
|
|
262
270
|
showBackdrop: showBackdrop
|
|
263
271
|
}, getFlagshipMetadata().immersive && /*#__PURE__*/React.createElement("span", {
|
|
@@ -330,7 +338,7 @@ BottomSheet.defaultProps = {
|
|
|
330
338
|
classes: {},
|
|
331
339
|
toolbarProps: {},
|
|
332
340
|
backdrop: false,
|
|
333
|
-
offset: 0
|
|
341
|
+
offset: (_ref4 = getFlagshipMetadata().immersive && getFlagshipMetadata().navbarHeight) !== null && _ref4 !== void 0 ? _ref4 : 0
|
|
334
342
|
};
|
|
335
343
|
BottomSheet.propTypes = {
|
|
336
344
|
/** Toolbar properties */
|
|
@@ -363,9 +371,9 @@ BottomSheet.propTypes = {
|
|
|
363
371
|
/** To totally close the BottomSheet by swaping it down */
|
|
364
372
|
onClose: PropTypes.func
|
|
365
373
|
};
|
|
366
|
-
var BottomSheetPortal = /*#__PURE__*/forwardRef(function (
|
|
367
|
-
var portalProps =
|
|
368
|
-
props = _objectWithoutProperties(
|
|
374
|
+
var BottomSheetPortal = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
|
375
|
+
var portalProps = _ref5.portalProps,
|
|
376
|
+
props = _objectWithoutProperties(_ref5, _excluded);
|
|
369
377
|
|
|
370
378
|
var cozyTheme = useCozyTheme();
|
|
371
379
|
var CozyThemeWrapper = portalProps !== null && portalProps !== void 0 && portalProps.disablePortal ? Fragment : CozyTheme;
|