atlas-design-system 1.16.0 → 1.17.1

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.
@@ -53,16 +53,23 @@ function SelectInput({ caption, label, options = [], onChange, error, renderOpti
53
53
  setBorderColor(sheetOpen
54
54
  ? styles.itemContainerFocused.borderColor
55
55
  : styles.itemContainer.borderColor);
56
- }, [error, sheetOpen]);
56
+ }, [
57
+ error,
58
+ sheetOpen,
59
+ styles.itemContainerFocused.borderColor,
60
+ styles.itemContainer.borderColor,
61
+ ]);
57
62
  (0, react_1.useEffect)(() => {
58
- animatedValue.value = value ? 1 : 0;
63
+ animatedValue.value = (0, react_native_reanimated_1.withTiming)(value ? 1 : 0, { duration: 250 });
59
64
  }, [value]);
60
65
  const animatedLabelStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
61
66
  return {
62
67
  transform: [
63
- { translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8]) },
68
+ {
69
+ translateY: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [1, -8], react_native_reanimated_1.Extrapolation.CLAMP),
70
+ },
64
71
  ],
65
- fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10]),
72
+ fontSize: (0, react_native_reanimated_1.interpolate)(animatedValue.value, [0, 1], [14, 10], react_native_reanimated_1.Extrapolation.CLAMP),
66
73
  };
67
74
  }, []);
68
75
  const animatedValueStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ export type SwitchToggleProps = {
4
+ label: string;
5
+ value?: boolean;
6
+ caption?: string;
7
+ testId?: string;
8
+ onChange?: (value: boolean) => void;
9
+ touchableStyle?: StyleProp<ViewStyle>;
10
+ containerStyle?: StyleProp<ViewStyle>;
11
+ error?: string;
12
+ };
13
+ export declare const SwitchToggle: ({ testId, onChange, value, caption, label, touchableStyle, error, containerStyle, }: SwitchToggleProps) => React.JSX.Element;
14
+ export default SwitchToggle;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.SwitchToggle = void 0;
30
+ const react_1 = __importStar(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const react_native_reanimated_1 = __importDefault(require("react-native-reanimated"));
33
+ const Text_1 = __importDefault(require("../Text"));
34
+ const MenuItemDescription_1 = require("../MenuItemDescription");
35
+ const index_1 = require("../../shared/styles/index");
36
+ const FieldError_1 = require("../FieldError/FieldError");
37
+ const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
38
+ const SwitchToggle = ({ testId, onChange, value, caption, label, touchableStyle, error, containerStyle, }) => {
39
+ const { styles, theme } = (0, index_1.useMenuItemStyles)();
40
+ const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
41
+ (0, react_1.useEffect)(() => {
42
+ setBorderColor(error ? theme.colors.foregroundNegative : styles.itemContainer.borderColor);
43
+ }, [
44
+ error,
45
+ theme.colors.foregroundNegative,
46
+ styles.itemContainer.borderColor,
47
+ ]);
48
+ return (<react_native_1.View style={[styles.container, containerStyle]}>
49
+ <react_native_1.TouchableOpacity testID={testId} style={touchableStyle}>
50
+ <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedBorderStyle]}>
51
+ <Text_1.default numberOfLines={1}>{label}</Text_1.default>
52
+ <react_native_1.Switch onValueChange={onChange} value={value}/>
53
+ </react_native_reanimated_1.default.View>
54
+ </react_native_1.TouchableOpacity>
55
+ {!!error && <FieldError_1.FieldError error={error}/>}
56
+ {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
57
+ </react_native_1.View>);
58
+ };
59
+ exports.SwitchToggle = SwitchToggle;
60
+ exports.default = exports.SwitchToggle;
@@ -1,14 +1,2 @@
1
- import React from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
- export type SwitchToggleProps = {
4
- label: string;
5
- value?: boolean;
6
- caption?: string;
7
- testId?: string;
8
- onChange?: (value: boolean) => void;
9
- touchableStyle?: StyleProp<ViewStyle>;
10
- containerStyle?: StyleProp<ViewStyle>;
11
- error?: string;
12
- };
13
- export declare const SwitchToggle: ({ testId, onChange, value, caption, label, touchableStyle, error, containerStyle, }: SwitchToggleProps) => React.JSX.Element;
14
- export default SwitchToggle;
1
+ export { default as SwitchToggle } from "./SwitchToggle";
2
+ export * from "./SwitchToggle";
@@ -10,47 +10,14 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
24
15
  };
25
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
18
  };
28
19
  Object.defineProperty(exports, "__esModule", { value: true });
29
20
  exports.SwitchToggle = void 0;
30
- const react_1 = __importStar(require("react"));
31
- const react_native_1 = require("react-native");
32
- const react_native_reanimated_1 = __importDefault(require("react-native-reanimated"));
33
- const Text_1 = __importDefault(require("../Text"));
34
- const MenuItemDescription_1 = require("../MenuItemDescription");
35
- const index_1 = require("../../shared/styles/index");
36
- const FieldError_1 = require("../FieldError/FieldError");
37
- const useInputFieldAnimatedBorder_1 = require("../../hooks/useInputFieldAnimatedBorder");
38
- const SwitchToggle = ({ testId, onChange, value, caption, label, touchableStyle, error, containerStyle, }) => {
39
- const { styles, theme } = (0, index_1.useMenuItemStyles)();
40
- const { animatedBorderStyle, setBorderColor } = (0, useInputFieldAnimatedBorder_1.useInputFieldAnimatedBorder)(styles.itemContainer.borderColor);
41
- (0, react_1.useEffect)(() => {
42
- setBorderColor(error ? theme.colors.foregroundNegative : styles.itemContainer.borderColor);
43
- }, [error]);
44
- return (<react_native_1.View style={[styles.container, containerStyle]}>
45
- <react_native_1.TouchableOpacity testID={testId} style={touchableStyle}>
46
- <react_native_reanimated_1.default.View style={[styles.itemContainer, animatedBorderStyle]}>
47
- <Text_1.default numberOfLines={1}>{label}</Text_1.default>
48
- <react_native_1.Switch onValueChange={onChange} value={value}/>
49
- </react_native_reanimated_1.default.View>
50
- </react_native_1.TouchableOpacity>
51
- {!!error && <FieldError_1.FieldError error={error}/>}
52
- {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
53
- </react_native_1.View>);
54
- };
55
- exports.SwitchToggle = SwitchToggle;
56
- exports.default = exports.SwitchToggle;
21
+ var SwitchToggle_1 = require("./SwitchToggle");
22
+ Object.defineProperty(exports, "SwitchToggle", { enumerable: true, get: function () { return __importDefault(SwitchToggle_1).default; } });
23
+ __exportStar(require("./SwitchToggle"), exports);
@@ -9,11 +9,9 @@ const useInputFieldAnimatedBorder = (initialColor) => {
9
9
  const setBorderColor = (0, react_1.useCallback)((color) => {
10
10
  inputBorderColor.value = (0, react_native_reanimated_1.withTiming)(color, animations_1.DEFAULT_TIMING_CONFIG);
11
11
  }, []);
12
- const borderStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
13
- return {
14
- borderColor: inputBorderColor.value,
15
- };
16
- }, []);
12
+ const borderStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
13
+ borderColor: inputBorderColor.value,
14
+ }), []);
17
15
  return {
18
16
  animatedBorderStyle: borderStyle,
19
17
  setBorderColor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.16.0",
3
+ "version": "1.17.1",
4
4
  "description": "A react native design system for the Atlas workout app",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "minor": "npm version minor",
22
22
  "watch": "tsc --watch",
23
23
  "publish:dryrun": "npm publish --dry-run",
24
- "publish": "yarn build && npm publish"
24
+ "publish:real": "yarn build && npm publish"
25
25
  },
26
26
  "keywords": [
27
27
  "react-native",