@pagopa/io-app-design-system 6.1.0 → 7.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.
@@ -13,7 +13,7 @@ const IOThemes = exports.IOThemes = {
13
13
  dark: _IOColors.IOThemeDark
14
14
  };
15
15
  const IOThemeContext = exports.IOThemeContext = /*#__PURE__*/(0, _react.createContext)({
16
- themeType: _reactNative.Appearance.getColorScheme(),
16
+ themeType: _reactNative.Appearance.getColorScheme() ?? "unspecified",
17
17
  theme: _reactNative.Appearance.getColorScheme() === "dark" ? IOThemes.dark : IOThemes.light,
18
18
  setTheme: () => void 0
19
19
  });
@@ -25,14 +25,15 @@ const IOThemeContextProvider = ({
25
25
  children,
26
26
  theme
27
27
  }) => {
28
- const [currentTheme, setCurrentTheme] = (0, _react.useState)(theme ?? _reactNative.Appearance.getColorScheme());
28
+ const [currentTheme, setCurrentTheme] = (0, _react.useState)(theme ?? "unspecified");
29
+ const resolvedTheme = currentTheme === "unspecified" ? _reactNative.Appearance.getColorScheme() ?? "light" : currentTheme;
29
30
  const handleThemeChange = (0, _react.useCallback)(newTheme => {
30
31
  setCurrentTheme(newTheme);
31
32
  }, []);
32
33
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(IOThemeContext.Provider, {
33
34
  value: {
34
35
  themeType: currentTheme,
35
- theme: IOThemes[currentTheme ?? "light"],
36
+ theme: resolvedTheme === "dark" ? IOThemes.dark : IOThemes.light,
36
37
  setTheme: handleThemeChange
37
38
  },
38
39
  children: children
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_IOColors","_jsxRuntime","IOThemes","exports","light","IOThemeLight","dark","IOThemeDark","IOThemeContext","createContext","themeType","Appearance","getColorScheme","theme","setTheme","useIOThemeContext","useContext","useIOTheme","IOThemeContextProvider","children","currentTheme","setCurrentTheme","useState","handleThemeChange","useCallback","newTheme","jsx","Provider","value"],"sourceRoot":"../../../src","sources":["context/IOThemeContextProvider.tsx"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P,KAAK,EAAEX,QAAQ,CAACkB,YAAY,IAAI,OAAO,CAAC;MACxCN,QAAQ,EAAES;IACZ,CAAE;IAAAJ,QAAA,EAEDA;EAAQ,CACc,CAAC;AAE9B,CAAC;AAAChB,OAAA,CAAAe,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","_IOColors","_jsxRuntime","IOThemes","exports","light","IOThemeLight","dark","IOThemeDark","IOThemeContext","createContext","themeType","Appearance","getColorScheme","theme","setTheme","useIOThemeContext","useContext","useIOTheme","IOThemeContextProvider","children","currentTheme","setCurrentTheme","useState","resolvedTheme","handleThemeChange","useCallback","newTheme","jsx","Provider","value"],"sourceRoot":"../../../src","sources":["context/IOThemeContextProvider.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAAsE,IAAAG,WAAA,GAAAH,OAAA;AAE/D,MAAMI,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACtBE,KAAK,EAAEC,sBAAY;EACnBC,IAAI,EAAEC;AACR,CAAC;AAQM,MAAMC,cAA2C,GAAAL,OAAA,CAAAK,cAAA,gBACtD,IAAAC,oBAAa,EAAqB;EAChCC,SAAS,EAAEC,uBAAU,CAACC,cAAc,CAAC,CAAC,IAAI,aAAa;EACvDC,KAAK,EACHF,uBAAU,CAACC,cAAc,CAAC,CAAC,KAAK,MAAM,GAAGV,QAAQ,CAACI,IAAI,GAAGJ,QAAQ,CAACE,KAAK;EACzEU,QAAQ,EAAEA,CAAA,KAAM,KAAK;AACvB,CAAC,CAAC;AAEG,MAAMC,iBAAiB,GAAGA,CAAA,KAAM,IAAAC,iBAAU,EAACR,cAAc,CAAC;AAACL,OAAA,CAAAY,iBAAA,GAAAA,iBAAA;AAE3D,MAAME,UAAU,GAAGA,CAAA,KAAMF,iBAAiB,CAAC,CAAC,CAACF,KAAK;AAACV,OAAA,CAAAc,UAAA,GAAAA,UAAA;AAMnD,MAAMC,sBAAsB,GAAGA,CAAC;EACrCC,QAAQ;EACRN;AAC8C,CAAC,KAAK;EACpD,MAAM,CAACO,YAAY,EAAEC,eAAe,CAAC,GAAG,IAAAC,eAAQ,EAC9CT,KAAK,IAAI,aACX,CAAC;EAED,MAAMU,aAAa,GACjBH,YAAY,KAAK,aAAa,GAC1BT,uBAAU,CAACC,cAAc,CAAC,CAAC,IAAI,OAAO,GACtCQ,YAAY;EAElB,MAAMI,iBAAiB,GAAG,IAAAC,kBAAW,EAAEC,QAAyB,IAAK;IACnEL,eAAe,CAACK,QAAQ,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,oBACE,IAAAzB,WAAA,CAAA0B,GAAA,EAACnB,cAAc,CAACoB,QAAQ;IACtBC,KAAK,EAAE;MACLnB,SAAS,EAAEU,YAAY;MACvBP,KAAK,EAAEU,aAAa,KAAK,MAAM,GAAGrB,QAAQ,CAACI,IAAI,GAAGJ,QAAQ,CAACE,KAAK;MAChEU,QAAQ,EAAEU;IACZ,CAAE;IAAAL,QAAA,EAEDA;EAAQ,CACc,CAAC;AAE9B,CAAC;AAAChB,OAAA,CAAAe,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -9,7 +9,7 @@ export const IOThemes = {
9
9
  dark: IOThemeDark
10
10
  };
11
11
  export const IOThemeContext = /*#__PURE__*/createContext({
12
- themeType: Appearance.getColorScheme(),
12
+ themeType: Appearance.getColorScheme() ?? "unspecified",
13
13
  theme: Appearance.getColorScheme() === "dark" ? IOThemes.dark : IOThemes.light,
14
14
  setTheme: () => void 0
15
15
  });
@@ -19,14 +19,15 @@ export const IOThemeContextProvider = ({
19
19
  children,
20
20
  theme
21
21
  }) => {
22
- const [currentTheme, setCurrentTheme] = useState(theme ?? Appearance.getColorScheme());
22
+ const [currentTheme, setCurrentTheme] = useState(theme ?? "unspecified");
23
+ const resolvedTheme = currentTheme === "unspecified" ? Appearance.getColorScheme() ?? "light" : currentTheme;
23
24
  const handleThemeChange = useCallback(newTheme => {
24
25
  setCurrentTheme(newTheme);
25
26
  }, []);
26
27
  return /*#__PURE__*/_jsx(IOThemeContext.Provider, {
27
28
  value: {
28
29
  themeType: currentTheme,
29
- theme: IOThemes[currentTheme ?? "light"],
30
+ theme: resolvedTheme === "dark" ? IOThemes.dark : IOThemes.light,
30
31
  setTheme: handleThemeChange
31
32
  },
32
33
  children: children
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useCallback","useContext","useState","Appearance","IOThemeDark","IOThemeLight","jsx","_jsx","IOThemes","light","dark","IOThemeContext","themeType","getColorScheme","theme","setTheme","useIOThemeContext","useIOTheme","IOThemeContextProvider","children","currentTheme","setCurrentTheme","handleThemeChange","newTheme","Provider","value"],"sourceRoot":"../../../src","sources":["context/IOThemeContextProvider.tsx"],"mappings":";;AAAA,SAEEA,aAAa,EAEbC,WAAW,EACXC,UAAU,EACVC,QAAQ,QACH,OAAO;AACd,SAASC,UAAU,QAAyB,cAAc;AAC1D,SAAkBC,WAAW,EAAEC,YAAY,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtE,OAAO,MAAMC,QAAQ,GAAG;EAAEC,KAAK,EAAEJ,YAAY;EAAEK,IAAI,EAAEN;AAAY,CAAC;AAQlE,OAAO,MAAMO,cAA2C,gBACtDZ,aAAa,CAAqB;EAChCa,SAAS,EAAET,UAAU,CAACU,cAAc,CAAC,CAAC;EACtCC,KAAK,EACHX,UAAU,CAACU,cAAc,CAAC,CAAC,KAAK,MAAM,GAAGL,QAAQ,CAACE,IAAI,GAAGF,QAAQ,CAACC,KAAK;EACzEM,QAAQ,EAAEA,CAAA,KAAM,KAAK;AACvB,CAAC,CAAC;AAEJ,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAAMf,UAAU,CAACU,cAAc,CAAC;AAEjE,OAAO,MAAMM,UAAU,GAAGA,CAAA,KAAMD,iBAAiB,CAAC,CAAC,CAACF,KAAK;AAMzD,OAAO,MAAMI,sBAAsB,GAAGA,CAAC;EACrCC,QAAQ;EACRL;AAC8C,CAAC,KAAK;EACpD,MAAM,CAACM,YAAY,EAAEC,eAAe,CAAC,GAAGnB,QAAQ,CAC9CY,KAAK,IAAIX,UAAU,CAACU,cAAc,CAAC,CACrC,CAAC;EAED,MAAMS,iBAAiB,GAAGtB,WAAW,CAAEuB,QAAyB,IAAK;IACnEF,eAAe,CAACE,QAAQ,CAAC;EAC3B,CAAC,EAAE,EAAE,CAAC;EAEN,oBACEhB,IAAA,CAACI,cAAc,CAACa,QAAQ;IACtBC,KAAK,EAAE;MACLb,SAAS,EAAEQ,YAAY;MACvBN,KAAK,EAAEN,QAAQ,CAACY,YAAY,IAAI,OAAO,CAAC;MACxCL,QAAQ,EAAEO;IACZ,CAAE;IAAAH,QAAA,EAEDA;EAAQ,CACc,CAAC;AAE9B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useCallback","useContext","useState","Appearance","IOThemeDark","IOThemeLight","jsx","_jsx","IOThemes","light","dark","IOThemeContext","themeType","getColorScheme","theme","setTheme","useIOThemeContext","useIOTheme","IOThemeContextProvider","children","currentTheme","setCurrentTheme","resolvedTheme","handleThemeChange","newTheme","Provider","value"],"sourceRoot":"../../../src","sources":["context/IOThemeContextProvider.tsx"],"mappings":";;AAAA,SAEEA,aAAa,EAEbC,WAAW,EACXC,UAAU,EACVC,QAAQ,QACH,OAAO;AACd,SAASC,UAAU,QAAyB,cAAc;AAC1D,SAAkBC,WAAW,EAAEC,YAAY,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEtE,OAAO,MAAMC,QAAQ,GAAG;EACtBC,KAAK,EAAEJ,YAAY;EACnBK,IAAI,EAAEN;AACR,CAAC;AAQD,OAAO,MAAMO,cAA2C,gBACtDZ,aAAa,CAAqB;EAChCa,SAAS,EAAET,UAAU,CAACU,cAAc,CAAC,CAAC,IAAI,aAAa;EACvDC,KAAK,EACH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AM,sBAAsB,GAAI,qBAGpC,iBAAiB,CAAC,2BAA2B,CAAC,4CAyBhD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-app-design-system",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "description": "The library defining the core components of the design system of @pagopa/io-app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -63,13 +63,14 @@
63
63
  "@react-native-community/eslint-config": "^3.0.2",
64
64
  "@react-native/babel-preset": "^0.82.1",
65
65
  "@release-it/conventional-changelog": "^5.0.0",
66
+ "@stylistic/eslint-plugin": "^2.12.1",
66
67
  "@svgr/core": "^8.1.0",
67
68
  "@svgr/plugin-jsx": "^8.1.0",
68
69
  "@svgr/plugin-svgo": "^8.1.0",
69
70
  "@testing-library/react-native": "^13.2.0",
70
71
  "@types/jest": "^29.5.14",
71
72
  "@types/markdown-it": "^14.1.2",
72
- "@types/react": "^19.1.0",
73
+ "@types/react": "^19.2.0",
73
74
  "@types/react-test-renderer": "19.1.0",
74
75
  "babel-jest": "^29.7.0",
75
76
  "babel-plugin-module-resolver": "^5.0.2",
@@ -86,10 +87,10 @@
86
87
  "jest": "^29.6.3",
87
88
  "pod-install": "^0.1.0",
88
89
  "prettier": "^2.0.5",
89
- "react": "19.1.0",
90
- "react-native": "0.81.5",
90
+ "react": "19.2.0",
91
+ "react-native": "0.83.4",
91
92
  "react-native-builder-bob": "^0.38.0",
92
- "react-test-renderer": "19.1.0",
93
+ "react-test-renderer": "19.2.0",
93
94
  "release-it": "^15.0.0",
94
95
  "svgo": "^3.0.2",
95
96
  "typescript": "^5.8.3"
@@ -9,7 +9,10 @@ import {
9
9
  import { Appearance, ColorSchemeName } from "react-native";
10
10
  import { IOTheme, IOThemeDark, IOThemeLight } from "../core/IOColors";
11
11
 
12
- export const IOThemes = { light: IOThemeLight, dark: IOThemeDark };
12
+ export const IOThemes = {
13
+ light: IOThemeLight,
14
+ dark: IOThemeDark
15
+ };
13
16
 
14
17
  type IOThemeContextType = {
15
18
  themeType: ColorSchemeName;
@@ -19,7 +22,7 @@ type IOThemeContextType = {
19
22
 
20
23
  export const IOThemeContext: Context<IOThemeContextType> =
21
24
  createContext<IOThemeContextType>({
22
- themeType: Appearance.getColorScheme(),
25
+ themeType: Appearance.getColorScheme() ?? "unspecified",
23
26
  theme:
24
27
  Appearance.getColorScheme() === "dark" ? IOThemes.dark : IOThemes.light,
25
28
  setTheme: () => void 0
@@ -38,9 +41,14 @@ export const IOThemeContextProvider = ({
38
41
  theme
39
42
  }: PropsWithChildren<IOThemeContextProviderProps>) => {
40
43
  const [currentTheme, setCurrentTheme] = useState<ColorSchemeName>(
41
- theme ?? Appearance.getColorScheme()
44
+ theme ?? "unspecified"
42
45
  );
43
46
 
47
+ const resolvedTheme =
48
+ currentTheme === "unspecified"
49
+ ? Appearance.getColorScheme() ?? "light"
50
+ : currentTheme;
51
+
44
52
  const handleThemeChange = useCallback((newTheme: ColorSchemeName) => {
45
53
  setCurrentTheme(newTheme);
46
54
  }, []);
@@ -49,7 +57,7 @@ export const IOThemeContextProvider = ({
49
57
  <IOThemeContext.Provider
50
58
  value={{
51
59
  themeType: currentTheme,
52
- theme: IOThemes[currentTheme ?? "light"],
60
+ theme: resolvedTheme === "dark" ? IOThemes.dark : IOThemes.light,
53
61
  setTheme: handleThemeChange
54
62
  }}
55
63
  >