cozy-ui 107.4.0 → 108.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 CHANGED
@@ -1,3 +1,23 @@
1
+ # [108.0.0](https://github.com/cozy/cozy-ui/compare/v107.4.1...v108.0.0) (2024-06-06)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add flag to activate dark mode ([5df55a8](https://github.com/cozy/cozy-ui/commit/5df55a8))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * you can now use safely `<meta name="color-scheme" content="light dark" />` in your app, and so replace `<meta name="color-scheme" content="only light" />` if necessary.
12
+ The light mode is forced by an other way, you can use `ui.darkmode.enabled` flag to enable the dark mode if you want.
13
+
14
+ ## [107.4.1](https://github.com/cozy/cozy-ui/compare/v107.4.0...v107.4.1) (2024-06-05)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **AppsSection:** Change only ISP wording ([8542e61](https://github.com/cozy/cozy-ui/commit/8542e61))
20
+
1
21
  # [107.4.0](https://github.com/cozy/cozy-ui/compare/v107.3.0...v107.4.0) (2024-06-05)
2
22
 
3
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "107.4.0",
3
+ "version": "108.0.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -217,6 +217,7 @@ exports[`AppsSection component should be rendered correctly with apps list, subt
217
217
  Object {
218
218
  "categories": Array [
219
219
  "isp",
220
+ "telecom",
220
221
  ],
221
222
  "developer": Object {
222
223
  "name": "Cozy",
@@ -249,6 +250,45 @@ exports[`AppsSection component should be rendered correctly with apps list, subt
249
250
  </SectionSubSubtitle>
250
251
  }
251
252
  />
253
+ <AppsSection
254
+ appsList={
255
+ Array [
256
+ Object {
257
+ "categories": Array [
258
+ "isp",
259
+ "telecom",
260
+ ],
261
+ "developer": Object {
262
+ "name": "Cozy",
263
+ },
264
+ "icon": "<svg></svg>",
265
+ "isInRegistry": true,
266
+ "name": "Bouilligue",
267
+ "slug": "konnector-bouilligue",
268
+ "type": "konnector",
269
+ "uninstallable": true,
270
+ "versions": Object {
271
+ "beta": Array [
272
+ "0.1.0",
273
+ ],
274
+ "dev": Array [
275
+ "0.1.0",
276
+ ],
277
+ "stable": Array [
278
+ "0.1.0",
279
+ ],
280
+ },
281
+ },
282
+ ]
283
+ }
284
+ displaySpecificMaintenanceStyle={false}
285
+ onAppClick={[MockFunction]}
286
+ subtitle={
287
+ <SectionSubSubtitle>
288
+ Telecom
289
+ </SectionSubSubtitle>
290
+ }
291
+ />
252
292
  <AppsSection
253
293
  appsList={
254
294
  Array [
@@ -518,6 +558,7 @@ exports[`AppsSection component should not render dropdown filter on mobile if na
518
558
  Object {
519
559
  "categories": Array [
520
560
  "isp",
561
+ "telecom",
521
562
  ],
522
563
  "developer": Object {
523
564
  "name": "Cozy",
@@ -550,6 +591,45 @@ exports[`AppsSection component should not render dropdown filter on mobile if na
550
591
  </SectionSubSubtitle>
551
592
  }
552
593
  />
594
+ <AppsSection
595
+ appsList={
596
+ Array [
597
+ Object {
598
+ "categories": Array [
599
+ "isp",
600
+ "telecom",
601
+ ],
602
+ "developer": Object {
603
+ "name": "Cozy",
604
+ },
605
+ "icon": "<svg></svg>",
606
+ "isInRegistry": true,
607
+ "name": "Bouilligue",
608
+ "slug": "konnector-bouilligue",
609
+ "type": "konnector",
610
+ "uninstallable": true,
611
+ "versions": Object {
612
+ "beta": Array [
613
+ "0.1.0",
614
+ ],
615
+ "dev": Array [
616
+ "0.1.0",
617
+ ],
618
+ "stable": Array [
619
+ "0.1.0",
620
+ ],
621
+ },
622
+ },
623
+ ]
624
+ }
625
+ displaySpecificMaintenanceStyle={false}
626
+ onAppClick={[MockFunction]}
627
+ subtitle={
628
+ <SectionSubSubtitle>
629
+ Telecom
630
+ </SectionSubSubtitle>
631
+ }
632
+ />
553
633
  <AppsSection
554
634
  appsList={
555
635
  Array [
@@ -822,6 +902,7 @@ exports[`AppsSection component should not render dropdown filter on tablet if na
822
902
  Object {
823
903
  "categories": Array [
824
904
  "isp",
905
+ "telecom",
825
906
  ],
826
907
  "developer": Object {
827
908
  "name": "Cozy",
@@ -854,6 +935,45 @@ exports[`AppsSection component should not render dropdown filter on tablet if na
854
935
  </SectionSubSubtitle>
855
936
  }
856
937
  />
938
+ <AppsSection
939
+ appsList={
940
+ Array [
941
+ Object {
942
+ "categories": Array [
943
+ "isp",
944
+ "telecom",
945
+ ],
946
+ "developer": Object {
947
+ "name": "Cozy",
948
+ },
949
+ "icon": "<svg></svg>",
950
+ "isInRegistry": true,
951
+ "name": "Bouilligue",
952
+ "slug": "konnector-bouilligue",
953
+ "type": "konnector",
954
+ "uninstallable": true,
955
+ "versions": Object {
956
+ "beta": Array [
957
+ "0.1.0",
958
+ ],
959
+ "dev": Array [
960
+ "0.1.0",
961
+ ],
962
+ "stable": Array [
963
+ "0.1.0",
964
+ ],
965
+ },
966
+ },
967
+ ]
968
+ }
969
+ displaySpecificMaintenanceStyle={false}
970
+ onAppClick={[MockFunction]}
971
+ subtitle={
972
+ <SectionSubSubtitle>
973
+ Telecom
974
+ </SectionSubSubtitle>
975
+ }
976
+ />
857
977
  <AppsSection
858
978
  appsList={
859
979
  Array [
@@ -966,6 +1086,12 @@ exports[`AppsSection component should render dropdown filter on mobile if no nav
966
1086
  "type": "konnector",
967
1087
  "value": "isp",
968
1088
  },
1089
+ Object {
1090
+ "label": "Telecom",
1091
+ "secondary": true,
1092
+ "type": "konnector",
1093
+ "value": "telecom",
1094
+ },
969
1095
  Object {
970
1096
  "label": "Transportation",
971
1097
  "secondary": true,
@@ -1185,6 +1311,7 @@ exports[`AppsSection component should render dropdown filter on mobile if no nav
1185
1311
  Object {
1186
1312
  "categories": Array [
1187
1313
  "isp",
1314
+ "telecom",
1188
1315
  ],
1189
1316
  "developer": Object {
1190
1317
  "name": "Cozy",
@@ -1217,6 +1344,45 @@ exports[`AppsSection component should render dropdown filter on mobile if no nav
1217
1344
  </SectionSubSubtitle>
1218
1345
  }
1219
1346
  />
1347
+ <AppsSection
1348
+ appsList={
1349
+ Array [
1350
+ Object {
1351
+ "categories": Array [
1352
+ "isp",
1353
+ "telecom",
1354
+ ],
1355
+ "developer": Object {
1356
+ "name": "Cozy",
1357
+ },
1358
+ "icon": "<svg></svg>",
1359
+ "isInRegistry": true,
1360
+ "name": "Bouilligue",
1361
+ "slug": "konnector-bouilligue",
1362
+ "type": "konnector",
1363
+ "uninstallable": true,
1364
+ "versions": Object {
1365
+ "beta": Array [
1366
+ "0.1.0",
1367
+ ],
1368
+ "dev": Array [
1369
+ "0.1.0",
1370
+ ],
1371
+ "stable": Array [
1372
+ "0.1.0",
1373
+ ],
1374
+ },
1375
+ },
1376
+ ]
1377
+ }
1378
+ displaySpecificMaintenanceStyle={false}
1379
+ onAppClick={[MockFunction]}
1380
+ subtitle={
1381
+ <SectionSubSubtitle>
1382
+ Telecom
1383
+ </SectionSubSubtitle>
1384
+ }
1385
+ />
1220
1386
  <AppsSection
1221
1387
  appsList={
1222
1388
  Array [
@@ -1321,6 +1487,12 @@ exports[`AppsSection component should render dropdown filter on tablet if no nav
1321
1487
  "type": "konnector",
1322
1488
  "value": "isp",
1323
1489
  },
1490
+ Object {
1491
+ "label": "Telecom",
1492
+ "secondary": true,
1493
+ "type": "konnector",
1494
+ "value": "telecom",
1495
+ },
1324
1496
  Object {
1325
1497
  "label": "Transportation",
1326
1498
  "secondary": true,
@@ -1543,6 +1715,7 @@ exports[`AppsSection component should render dropdown filter on tablet if no nav
1543
1715
  Object {
1544
1716
  "categories": Array [
1545
1717
  "isp",
1718
+ "telecom",
1546
1719
  ],
1547
1720
  "developer": Object {
1548
1721
  "name": "Cozy",
@@ -1575,6 +1748,45 @@ exports[`AppsSection component should render dropdown filter on tablet if no nav
1575
1748
  </SectionSubSubtitle>
1576
1749
  }
1577
1750
  />
1751
+ <AppsSection
1752
+ appsList={
1753
+ Array [
1754
+ Object {
1755
+ "categories": Array [
1756
+ "isp",
1757
+ "telecom",
1758
+ ],
1759
+ "developer": Object {
1760
+ "name": "Cozy",
1761
+ },
1762
+ "icon": "<svg></svg>",
1763
+ "isInRegistry": true,
1764
+ "name": "Bouilligue",
1765
+ "slug": "konnector-bouilligue",
1766
+ "type": "konnector",
1767
+ "uninstallable": true,
1768
+ "versions": Object {
1769
+ "beta": Array [
1770
+ "0.1.0",
1771
+ ],
1772
+ "dev": Array [
1773
+ "0.1.0",
1774
+ ],
1775
+ "stable": Array [
1776
+ "0.1.0",
1777
+ ],
1778
+ },
1779
+ },
1780
+ ]
1781
+ }
1782
+ displaySpecificMaintenanceStyle={false}
1783
+ onAppClick={[MockFunction]}
1784
+ subtitle={
1785
+ <SectionSubSubtitle>
1786
+ Telecom
1787
+ </SectionSubSubtitle>
1788
+ }
1789
+ />
1578
1790
  <AppsSection
1579
1791
  appsList={
1580
1792
  Array [
@@ -623,6 +623,7 @@ Array [
623
623
  Object {
624
624
  "categories": Array [
625
625
  "isp",
626
+ "telecom",
626
627
  ],
627
628
  "developer": Object {
628
629
  "name": "Cozy",
@@ -848,6 +849,7 @@ Array [
848
849
  Object {
849
850
  "categories": Array [
850
851
  "isp",
852
+ "telecom",
851
853
  ],
852
854
  "developer": Object {
853
855
  "name": "Cozy",
@@ -76,7 +76,7 @@ export const apps = [
76
76
  icon: '<svg></svg>',
77
77
  developer: { name: 'Cozy' },
78
78
  type: 'konnector',
79
- categories: ['isp'],
79
+ categories: ['isp', 'telecom'],
80
80
  versions: {
81
81
  stable: ['0.1.0'],
82
82
  beta: ['0.1.0'],
@@ -23,6 +23,7 @@ describe('groupApps', () => {
23
23
  isp: ['konnector-bouilligue'],
24
24
  others: ['devonly'],
25
25
  partners: ['tasky'],
26
+ telecom: ['konnector-bouilligue'],
26
27
  transport: ['konnector-trinlane']
27
28
  })
28
29
  })
@@ -44,6 +45,7 @@ describe('sorter', () => {
44
45
  'cozy',
45
46
  'isp',
46
47
  'all',
48
+ 'telecom',
47
49
  'others',
48
50
  'banking'
49
51
  ])
@@ -52,16 +54,24 @@ describe('sorter', () => {
52
54
  'cozy',
53
55
  'banking',
54
56
  'isp',
57
+ 'telecom',
55
58
  'others'
56
59
  ])
57
60
  })
58
61
 
59
62
  it('should test with all and others at the border', () => {
60
- const catList2 = prepareCategories(['all', 'banking', 'cozy', 'others'])
63
+ const catList2 = prepareCategories([
64
+ 'all',
65
+ 'telecom',
66
+ 'banking',
67
+ 'cozy',
68
+ 'others'
69
+ ])
61
70
  expect(catList2.sort(catUtils.sorter).map(x => x.value)).toEqual([
62
71
  'all',
63
72
  'cozy',
64
73
  'banking',
74
+ 'telecom',
65
75
  'others'
66
76
  ])
67
77
  })
@@ -105,6 +115,12 @@ describe('generateOptionsFromApps', () => {
105
115
  type: 'konnector',
106
116
  value: 'isp'
107
117
  },
118
+ {
119
+ label: 'Telecom',
120
+ secondary: true,
121
+ type: 'konnector',
122
+ value: 'telecom'
123
+ },
108
124
  {
109
125
  label: 'Transportation',
110
126
  secondary: true,
@@ -151,6 +167,12 @@ describe('generateOptionsFromApps', () => {
151
167
  type: 'konnector',
152
168
  value: 'isp'
153
169
  },
170
+ {
171
+ label: 'Telecom',
172
+ secondary: true,
173
+ type: 'konnector',
174
+ value: 'telecom'
175
+ },
154
176
  {
155
177
  label: 'Transportation',
156
178
  secondary: true,
@@ -21,6 +21,7 @@
21
21
  "public_service": "Public services",
22
22
  "shopping": "Shopping",
23
23
  "social": "Social",
24
+ "telecom": "Telecom",
24
25
  "transport": "Transportation",
25
26
  "pro": "Work"
26
27
  },
@@ -21,6 +21,7 @@
21
21
  "public_service": "Services publics",
22
22
  "shopping": "Shopping",
23
23
  "social": "Social",
24
+ "telecom": "Mobile",
24
25
  "transport": "Voyage et transport",
25
26
  "pro": "Travail"
26
27
  },
@@ -75,7 +75,7 @@ export const apps = [
75
75
  icon: '<svg></svg>',
76
76
  developer: { name: 'Cozy' },
77
77
  type: 'konnector',
78
- categories: ['isp'],
78
+ categories: ['isp', 'telecom'],
79
79
  versions: {
80
80
  stable: ['0.1.0'],
81
81
  beta: ['0.1.0'],
@@ -1,15 +1,12 @@
1
- import React, { createContext, useContext, useEffect } from 'react'
1
+ import React, { createContext, useContext } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import cx from 'classnames'
4
+ import flag from 'cozy-flags'
4
5
 
5
6
  import log from 'cozy-logger'
6
7
 
7
8
  import useMediaQuery from '../../hooks/useMediaQuery'
8
9
  import MuiCozyTheme from '../../MuiCozyTheme'
9
- import {
10
- createOrUpdateColorSchemeMetaTag,
11
- getColorSchemeMetaTagContent
12
- } from './helpers'
13
10
 
14
11
  export const CozyThemeContext = createContext()
15
12
 
@@ -32,21 +29,16 @@ const CozyTheme = ({ variant, className, ignoreItself, children }) => {
32
29
  const uiThemeType = localStorage.getItem('ui-theme-type') // use only for cozy-ui documentation and argos screenshots
33
30
  const uiThemeVariant = localStorage.getItem('ui-theme-variant') // use only for cozy-ui documentation and argos screenshots
34
31
 
32
+ const isOnlyLight = !!flag('ui.darkmode.enabled') // should be remove when dark mode is validated on all apps
35
33
  const deviceThemeType = useMediaQuery('(prefers-color-scheme: dark)')
36
- ? 'dark'
34
+ ? isOnlyLight
35
+ ? 'dark'
36
+ : 'light'
37
37
  : 'light'
38
- const isOnlyLight = getColorSchemeMetaTagContent() === 'only light'
39
- const forcedThemeType = uiThemeType || deviceThemeType
40
38
 
41
- const selfThemeType = isOnlyLight ? 'light' : forcedThemeType
39
+ const selfThemeType = uiThemeType || deviceThemeType
42
40
  const selfThemeVariant = uiThemeVariant || variant
43
41
 
44
- useEffect(() => {
45
- if (!isOnlyLight) {
46
- createOrUpdateColorSchemeMetaTag(forcedThemeType)
47
- }
48
- }, [isOnlyLight, forcedThemeType])
49
-
50
42
  return (
51
43
  <CozyThemeContext.Provider
52
44
  value={{ type: selfThemeType, variant: selfThemeVariant }}
@@ -48,6 +48,7 @@ var en = {
48
48
  public_service: "Public services",
49
49
  shopping: "Shopping",
50
50
  social: "Social",
51
+ telecom: "Telecom",
51
52
  transport: "Transportation",
52
53
  pro: "Work"
53
54
  },
@@ -79,6 +80,7 @@ var fr = {
79
80
  public_service: "Services publics",
80
81
  shopping: "Shopping",
81
82
  social: "Social",
83
+ telecom: "Mobile",
82
84
  transport: "Voyage et transport",
83
85
  pro: "Travail"
84
86
  },
@@ -80,7 +80,7 @@ export var apps = [{
80
80
  name: 'Cozy'
81
81
  },
82
82
  type: 'konnector',
83
- categories: ['isp'],
83
+ categories: ['isp', 'telecom'],
84
84
  versions: {
85
85
  stable: ['0.1.0'],
86
86
  beta: ['0.1.0'],
@@ -79,7 +79,7 @@ export var apps = [{
79
79
  name: 'Cozy'
80
80
  },
81
81
  type: 'konnector',
82
- categories: ['isp'],
82
+ categories: ['isp', 'telecom'],
83
83
  versions: {
84
84
  stable: ['0.1.0'],
85
85
  beta: ['0.1.0'],
@@ -1,11 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React, { createContext, useContext, useEffect } from 'react';
2
+ import React, { createContext, useContext } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import cx from 'classnames';
5
+ import flag from 'cozy-flags';
5
6
  import log from 'cozy-logger';
6
7
  import useMediaQuery from "cozy-ui/transpiled/react/hooks/useMediaQuery";
7
8
  import MuiCozyTheme from "cozy-ui/transpiled/react/MuiCozyTheme";
8
- import { createOrUpdateColorSchemeMetaTag, getColorSchemeMetaTagContent } from "cozy-ui/transpiled/react/providers/CozyTheme/helpers";
9
9
  export var CozyThemeContext = /*#__PURE__*/createContext();
10
10
  export var useCozyTheme = function useCozyTheme() {
11
11
  var context = useContext(CozyThemeContext);
@@ -32,16 +32,11 @@ var CozyTheme = function CozyTheme(_ref) {
32
32
 
33
33
  var uiThemeVariant = localStorage.getItem('ui-theme-variant'); // use only for cozy-ui documentation and argos screenshots
34
34
 
35
- var deviceThemeType = useMediaQuery('(prefers-color-scheme: dark)') ? 'dark' : 'light';
36
- var isOnlyLight = getColorSchemeMetaTagContent() === 'only light';
37
- var forcedThemeType = uiThemeType || deviceThemeType;
38
- var selfThemeType = isOnlyLight ? 'light' : forcedThemeType;
35
+ var isOnlyLight = !!flag('ui.darkmode.enabled'); // should be remove when dark mode is validated on all apps
36
+
37
+ var deviceThemeType = useMediaQuery('(prefers-color-scheme: dark)') ? isOnlyLight ? 'dark' : 'light' : 'light';
38
+ var selfThemeType = uiThemeType || deviceThemeType;
39
39
  var selfThemeVariant = uiThemeVariant || variant;
40
- useEffect(function () {
41
- if (!isOnlyLight) {
42
- createOrUpdateColorSchemeMetaTag(forcedThemeType);
43
- }
44
- }, [isOnlyLight, forcedThemeType]);
45
40
  return /*#__PURE__*/React.createElement(CozyThemeContext.Provider, {
46
41
  value: {
47
42
  type: selfThemeType,
@@ -1,28 +0,0 @@
1
- const getColorSchemeMetaTag = () =>
2
- document.querySelector('meta[name="color-scheme"]')
3
-
4
- export const getColorSchemeMetaTagContent = () =>
5
- getColorSchemeMetaTag()?.content
6
-
7
- const updateColorSchemeMetaTagContent = content => {
8
- const colorSchemeMetaTag = getColorSchemeMetaTag()
9
- colorSchemeMetaTag.content = content
10
- }
11
-
12
- const createColorSchemeMetaTag = content => {
13
- const meta = document.createElement('meta')
14
- meta.name = 'color-scheme'
15
- meta.content = content
16
-
17
- document.head.prepend(meta)
18
- }
19
-
20
- export const createOrUpdateColorSchemeMetaTag = content => {
21
- const colorSchemeMetaTag = getColorSchemeMetaTag()
22
-
23
- if (!colorSchemeMetaTag) {
24
- createColorSchemeMetaTag(content)
25
- } else {
26
- updateColorSchemeMetaTagContent(content)
27
- }
28
- }
@@ -1,31 +0,0 @@
1
- var getColorSchemeMetaTag = function getColorSchemeMetaTag() {
2
- return document.querySelector('meta[name="color-scheme"]');
3
- };
4
-
5
- export var getColorSchemeMetaTagContent = function getColorSchemeMetaTagContent() {
6
- var _getColorSchemeMetaTa;
7
-
8
- return (_getColorSchemeMetaTa = getColorSchemeMetaTag()) === null || _getColorSchemeMetaTa === void 0 ? void 0 : _getColorSchemeMetaTa.content;
9
- };
10
-
11
- var updateColorSchemeMetaTagContent = function updateColorSchemeMetaTagContent(content) {
12
- var colorSchemeMetaTag = getColorSchemeMetaTag();
13
- colorSchemeMetaTag.content = content;
14
- };
15
-
16
- var createColorSchemeMetaTag = function createColorSchemeMetaTag(content) {
17
- var meta = document.createElement('meta');
18
- meta.name = 'color-scheme';
19
- meta.content = content;
20
- document.head.prepend(meta);
21
- };
22
-
23
- export var createOrUpdateColorSchemeMetaTag = function createOrUpdateColorSchemeMetaTag(content) {
24
- var colorSchemeMetaTag = getColorSchemeMetaTag();
25
-
26
- if (!colorSchemeMetaTag) {
27
- createColorSchemeMetaTag(content);
28
- } else {
29
- updateColorSchemeMetaTagContent(content);
30
- }
31
- };