@jobber/components-native 0.114.1 → 0.114.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.
@@ -521,6 +521,7 @@ export function IconSizesExample() {
521
521
  | | `partlySunny` |
522
522
  | | `snow` |
523
523
  | | `thunderLightening` |
524
+ | | `windy` |
524
525
 
525
526
  ### Legacy
526
527
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.114.1",
3
+ "version": "0.114.3",
4
4
  "license": "MIT",
5
5
  "description": "React Native implementation of Atlantis",
6
6
  "repository": {
@@ -73,7 +73,7 @@
73
73
  "devDependencies": {
74
74
  "@babel/runtime": "^7.29.2",
75
75
  "@gorhom/bottom-sheet": "^5.2.8",
76
- "@jobber/design": "0.114.0",
76
+ "@jobber/design": "0.115.0",
77
77
  "@jobber/hooks": "2.21.1",
78
78
  "@react-native-community/datetimepicker": "^8.4.5",
79
79
  "@react-native/babel-preset": "^0.82.1",
@@ -123,5 +123,5 @@
123
123
  "react-native-screens": ">=4.18.0",
124
124
  "react-native-svg": ">=12.0.0"
125
125
  },
126
- "gitHead": "4a36de673236ab322545979a34a08007ca49e1cc"
126
+ "gitHead": "b38e35f5b813caa27834c947d6f3340e6762d297"
127
127
  }
@@ -53,7 +53,7 @@ function CheckboxInternal({ label, checked, defaultChecked, indeterminate = fals
53
53
  {
54
54
  backgroundColor,
55
55
  },
56
- ] }, (internalValue || indeterminate) && (React.createElement(Icon, { name: iconName, color: "white" }))))));
56
+ ] }, (internalValue || indeterminate) && (React.createElement(Icon, { name: iconName, color: "surface" }))))));
57
57
  }
58
58
  function getBackgroundColor(checked, disabled, indeterminate) {
59
59
  const { tokens } = useAtlantisTheme();
@@ -5,7 +5,9 @@ import { shineWidth, useStyles } from "./Glimmer.style";
5
5
  import { useSizeStyles } from "./Glimmer.size.style";
6
6
  import { useShapeStyles } from "./Glimmer.shape.style";
7
7
  import { tokens } from "../utils/design";
8
+ import { useAtlantisTheme } from "../AtlantisThemeContext";
8
9
  export const GLIMMER_TEST_ID = "ATL-Glimmer";
10
+ export const GLIMMER_BACKGROUND_TEST_ID = "ATL-Glimmer-Background";
9
11
  export const GLIMMER_SHINE_TEST_ID = "ATL-Glimmer-Shine";
10
12
  export function Glimmer({ width, shape = "rectangle", size = "base", timing = "base", }) {
11
13
  const leftPosition = useRef(new Animated.Value(-shineWidth)).current;
@@ -25,19 +27,22 @@ export function Glimmer({ width, shape = "rectangle", size = "base", timing = "b
25
27
  const styles = useStyles();
26
28
  const sizeStyles = useSizeStyles();
27
29
  const shapeStyles = useShapeStyles();
30
+ const { effectiveTheme, tokens: themeTokens } = useAtlantisTheme();
31
+ const shineOpacity = effectiveTheme === "dark" ? 0.2 : 0.75;
28
32
  return (React.createElement(View, { style: [
29
33
  styles.container,
30
34
  sizeStyles[size],
31
35
  shapeStyles[shape],
32
36
  { width },
33
37
  ], onLayout: getWidth, testID: GLIMMER_TEST_ID },
38
+ React.createElement(View, { style: styles.background, testID: GLIMMER_BACKGROUND_TEST_ID }),
34
39
  React.createElement(Animated.View, { style: [styles.shine, { transform: [{ translateX: leftPosition }] }], testID: GLIMMER_SHINE_TEST_ID },
35
40
  React.createElement(Svg, null,
36
41
  React.createElement(Defs, null,
37
42
  React.createElement(LinearGradient, { id: "gradientShine", x1: 0, y1: 0.5, x2: 1, y2: 0.5 },
38
- React.createElement(Stop, { offset: "0%", stopColor: "rgba(255,255,255,0)", stopOpacity: "0" }),
39
- React.createElement(Stop, { offset: "50%", stopColor: "rgba(255,255,255,1)", stopOpacity: "1" }),
40
- React.createElement(Stop, { offset: "100%", stopColor: "rgba(255,255,255,0)", stopOpacity: "0" }))),
43
+ React.createElement(Stop, { offset: "0%", stopColor: themeTokens["color-white"], stopOpacity: "0" }),
44
+ React.createElement(Stop, { offset: "50%", stopColor: themeTokens["color-white"], stopOpacity: shineOpacity }),
45
+ React.createElement(Stop, { offset: "100%", stopColor: themeTokens["color-white"], stopOpacity: "0" }))),
41
46
  React.createElement(Rect, { fill: "url(#gradientShine)", height: "100%", width: "100%" })))));
42
47
  function getWidth(event) {
43
48
  setParentWidth(event.nativeEvent.layout.width);
@@ -4,13 +4,21 @@ export const shineWidth = staticTokens["space-largest"];
4
4
  export const useStyles = buildThemedStyles(tokens => {
5
5
  return {
6
6
  container: {
7
- backgroundColor: "rgba(0, 0, 0, 0.05)",
8
7
  overflow: "hidden",
9
8
  position: "relative",
10
9
  width: "100%",
11
10
  height: tokens["space-base"],
12
11
  borderRadius: tokens["radius-base"],
13
12
  },
13
+ background: {
14
+ position: "absolute",
15
+ top: 0,
16
+ left: 0,
17
+ width: "100%",
18
+ height: "100%",
19
+ backgroundColor: tokens["color-surface--reverse"],
20
+ opacity: 0.075,
21
+ },
14
22
  shine: {
15
23
  position: "absolute",
16
24
  top: 0,
@@ -10,7 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import React from "react";
11
11
  import { act, fireEvent, render as renderComponent, } from "@testing-library/react-native";
12
12
  import { Animated } from "react-native";
13
- import { GLIMMER_SHINE_TEST_ID, GLIMMER_TEST_ID, Glimmer } from "./Glimmer";
13
+ import { Stop } from "react-native-svg";
14
+ import { androidTokens, darkTokens } from "@jobber/design";
15
+ import { GLIMMER_BACKGROUND_TEST_ID, GLIMMER_SHINE_TEST_ID, GLIMMER_TEST_ID, Glimmer, } from "./Glimmer";
16
+ import { AtlantisThemeContextProvider } from "../AtlantisThemeContext";
14
17
  let screen;
15
18
  function render(...params) {
16
19
  screen = renderComponent(...params);
@@ -25,6 +28,19 @@ describe("Glimmer", () => {
25
28
  expect.objectContaining({ width: "100%" }),
26
29
  ]));
27
30
  });
31
+ it("uses a theme token for its dark-mode shine", () => {
32
+ const rendered = render(React.createElement(AtlantisThemeContextProvider, { dangerouslyOverrideTheme: "dark" },
33
+ React.createElement(Glimmer, null)));
34
+ expect(rendered.getByTestId(GLIMMER_BACKGROUND_TEST_ID).props.style).toEqual(expect.objectContaining({
35
+ backgroundColor: darkTokens["color-surface--reverse"],
36
+ opacity: 0.075,
37
+ }));
38
+ const shineStops = rendered.UNSAFE_root.findAllByType(Stop);
39
+ expect(shineStops[1].props).toEqual(expect.objectContaining({
40
+ stopColor: androidTokens["color-white"],
41
+ stopOpacity: 0.2,
42
+ }));
43
+ });
28
44
  it("renders a Glimmer with custom width", () => {
29
45
  render(React.createElement(Glimmer, { width: 50 }));
30
46
  const element = screen.getByTestId(GLIMMER_TEST_ID);