@jobber/components 9.14.2 → 9.14.3
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.
|
@@ -5,16 +5,22 @@ tokens.
|
|
|
5
5
|
|
|
6
6
|
## Design & usage guidelines
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Web and mobile both expose Atlantis theme context, but the runtime ownership is
|
|
9
|
+
slightly different across platforms.
|
|
10
10
|
|
|
11
11
|
Each platform provides a `useAtlantisTheme` hook that you may use to access the
|
|
12
|
-
|
|
12
|
+
current theme information and design tokens in your components.
|
|
13
13
|
|
|
14
|
-
On mobile,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
On mobile, the hook returns:
|
|
15
|
+
|
|
16
|
+
* `theme`: the selected theme preference (`"system" | "light" | "dark"`)
|
|
17
|
+
* `effectiveTheme`: the resolved theme Atlantis uses for tokens
|
|
18
|
+
(`"light" | "dark"`)
|
|
19
|
+
* `tokens`
|
|
20
|
+
* `setTheme`
|
|
21
|
+
|
|
22
|
+
Typically there will only be a single provider at the root, and the consuming
|
|
23
|
+
app will control `theme` and persist that preference outside Atlantis.
|
|
18
24
|
|
|
19
25
|
On web, you'll need to import the `updateTheme` function and call it with the
|
|
20
26
|
new theme. This is a separate function because it synchronizes the theme update
|
|
@@ -86,7 +92,7 @@ function App() {
|
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
function ThemedComponent() {
|
|
89
|
-
const { theme, tokens, setTheme } = useAtlantisTheme();
|
|
95
|
+
const { theme, effectiveTheme, tokens, setTheme } = useAtlantisTheme();
|
|
90
96
|
return (
|
|
91
97
|
<Content>
|
|
92
98
|
<View
|
|
@@ -96,11 +102,16 @@ function ThemedComponent() {
|
|
|
96
102
|
}}
|
|
97
103
|
>
|
|
98
104
|
<Content>
|
|
99
|
-
<Text>The
|
|
105
|
+
<Text>The selected theme is: {theme}.</Text>
|
|
106
|
+
<Text>The effective theme is: {effectiveTheme}.</Text>
|
|
100
107
|
<Text>
|
|
101
108
|
The javascript tokens can be accessed via the tokens object.
|
|
102
109
|
</Text>
|
|
103
110
|
<Text>The theme can be changed using `setTheme`</Text>
|
|
111
|
+
<Button
|
|
112
|
+
onPress={() => setTheme("system")}
|
|
113
|
+
label="The theme can be changed to system"
|
|
114
|
+
/>
|
|
104
115
|
<Button
|
|
105
116
|
onPress={() => setTheme("light")}
|
|
106
117
|
label="The theme can be changed to light"
|
|
@@ -163,6 +174,10 @@ regardless of the main application theme. This can be done by setting the
|
|
|
163
174
|
`dangerouslyOverrideTheme` prop to `<themeToSet>` on the
|
|
164
175
|
`AtlantisThemeContextProvider`.
|
|
165
176
|
|
|
177
|
+
On mobile, forcing a theme changes the rendered tokens for that subtree, but it
|
|
178
|
+
does not replace the selected theme preference semantics from the nearest
|
|
179
|
+
non-forced provider.
|
|
180
|
+
|
|
166
181
|
Note: If you're using `buildThemedStyles`, any `useStyles` calls must be done
|
|
167
182
|
within a *child component* of the `AtlantisThemeContextProvider`, not in the
|
|
168
183
|
same component that renders the provider. Same goes for `useAtlantisTheme`.
|
package/dist/docs/Icon/Icon.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "9.14.
|
|
3
|
+
"version": "9.14.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -495,7 +495,7 @@
|
|
|
495
495
|
"devDependencies": {
|
|
496
496
|
"@apollo/client": "^3.7.10",
|
|
497
497
|
"@csstools/postcss-global-data": "^1.0.3",
|
|
498
|
-
"@jobber/design": "0.
|
|
498
|
+
"@jobber/design": "0.115.0",
|
|
499
499
|
"@jobber/hooks": "2.21.1",
|
|
500
500
|
"@rollup/plugin-alias": "^5.1.0",
|
|
501
501
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
@@ -547,5 +547,5 @@
|
|
|
547
547
|
"> 1%",
|
|
548
548
|
"IE 10"
|
|
549
549
|
],
|
|
550
|
-
"gitHead": "
|
|
550
|
+
"gitHead": "b38e35f5b813caa27834c947d6f3340e6762d297"
|
|
551
551
|
}
|