atlas-design-system 1.10.1 → 1.11.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.
@@ -68,7 +68,7 @@ const BottomSheet = ({ open, children, height, setOpen }) => {
68
68
  return (<react_native_1.Modal transparent visible>
69
69
  <react_native_1.Pressable onPress={() => {
70
70
  setOpen(false);
71
- }} style={styles.wrapper}></react_native_1.Pressable>
71
+ }} style={styles.wrapper}/>
72
72
  <react_native_reanimated_1.default.View style={[styles.sheet, animatedStyle]}>
73
73
  {children}
74
74
  </react_native_reanimated_1.default.View>
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ import { Option } from "../SelectInput/types";
4
+ type CheckboxOptionInputProps<T> = {
5
+ caption?: string;
6
+ label: string;
7
+ options: Option<T>[];
8
+ onChange: (newValues: T[]) => void;
9
+ renderOption?: (option: Option<T>, onPress: (option: Option<T>) => void) => React.ReactNode;
10
+ renderValues?: (option?: Option<T>[]) => React.ReactNode;
11
+ containerStyle?: StyleProp<ViewStyle>;
12
+ placeholder?: string;
13
+ };
14
+ export declare function CheckboxOptionInput<T>({ caption, label, options, onChange, renderOption, renderValues, containerStyle, placeholder, }: CheckboxOptionInputProps<T>): React.JSX.Element;
15
+ export default CheckboxOptionInput;
@@ -0,0 +1,90 @@
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.CheckboxOptionInput = CheckboxOptionInput;
30
+ const react_1 = __importStar(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const hooks_1 = require("../../hooks");
33
+ const Sheet_1 = __importDefault(require("../Sheet"));
34
+ const Text_1 = __importDefault(require("../Text"));
35
+ const Chevron_1 = __importDefault(require("../Chevron"));
36
+ const MenuItemDescription_1 = require("../MenuItemDescription");
37
+ const CheckboxOptionItem_1 = __importDefault(require("../CheckboxOptionItem"));
38
+ const Button_1 = __importDefault(require("../Button"));
39
+ function CheckboxOptionInput({ caption, label, options = [], onChange, renderOption, renderValues, containerStyle = {}, placeholder = "No Option selected", }) {
40
+ const styles = useStyles().styles;
41
+ const [sheetOpen, setSheetOpen] = react_1.default.useState(false);
42
+ const selectedOptions = (0, react_1.useMemo)(() => {
43
+ if (!options)
44
+ return [];
45
+ return options.filter((v) => v.selected);
46
+ }, [options]);
47
+ const [values, setValues] = react_1.default.useState(selectedOptions.map((v) => v.value));
48
+ const handleOptionPress = (0, react_1.useCallback)((option) => {
49
+ if (values.find((v) => v === option.value)) {
50
+ setValues(values.filter((v) => v !== option.value));
51
+ }
52
+ else {
53
+ setValues([...values, option.value]);
54
+ }
55
+ }, [values]);
56
+ const handleSave = (0, react_1.useCallback)(() => {
57
+ onChange(values);
58
+ setSheetOpen(false);
59
+ }, [values]);
60
+ (0, react_1.useEffect)(() => {
61
+ setValues(selectedOptions.map((v) => v.value));
62
+ }, [sheetOpen]);
63
+ return (<>
64
+ <react_native_1.View style={[styles.container, containerStyle]}>
65
+ <Text_1.default>{label}</Text_1.default>
66
+ <react_native_1.TouchableOpacity onPress={() => setSheetOpen(true)} style={styles.valueDisplayContainer}>
67
+ {!renderValues && selectedOptions.length === 0 && (<Text_1.default contrast="low">{placeholder}</Text_1.default>)}
68
+ {!renderValues && selectedOptions.length > 0 && (<Text_1.default>{selectedOptions.map((v) => v.label).join(", ")}</Text_1.default>)}
69
+ {renderValues && renderValues(selectedOptions)}
70
+ <Chevron_1.default direction={sheetOpen ? "up" : "down"}/>
71
+ </react_native_1.TouchableOpacity>
72
+ {!!caption && <MenuItemDescription_1.MenuItemDescription description={caption}/>}
73
+ </react_native_1.View>
74
+ <Sheet_1.default header={label} open={sheetOpen} setOpen={setSheetOpen} footer={<Button_1.default text="Save" onPress={handleSave}/>}>
75
+ {options.map((option) => {
76
+ return renderOption ? (renderOption(option, handleOptionPress)) : (<CheckboxOptionItem_1.default option={Object.assign(Object.assign({}, option), { selected: !!values.find((v) => v === option.value) })} onPress={() => handleOptionPress(option)} key={option.label}/>);
77
+ })}
78
+ </Sheet_1.default>
79
+ </>);
80
+ }
81
+ const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
82
+ container: {},
83
+ valueDisplayContainer: {
84
+ marginTop: t.size.baseSize * 1,
85
+ flexDirection: "row",
86
+ alignItems: "center",
87
+ gap: t.size.baseSize * 2,
88
+ },
89
+ }), []));
90
+ exports.default = CheckboxOptionInput;
@@ -0,0 +1,2 @@
1
+ export { default } from "./CheckboxOptionInput";
2
+ export * from "./CheckboxOptionInput";
@@ -0,0 +1,23 @@
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 __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);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ var CheckboxOptionInput_1 = require("./CheckboxOptionInput");
22
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CheckboxOptionInput_1).default; } });
23
+ __exportStar(require("./CheckboxOptionInput"), exports);
@@ -0,0 +1,9 @@
1
+ import { Option } from "../SelectInput/types";
2
+ type CheckboxOptionItemProps<T> = {
3
+ option: Option<T>;
4
+ disabled?: boolean;
5
+ onPress?: (value: T) => void;
6
+ renderItem?: (option: Option<T>) => React.ReactNode;
7
+ };
8
+ export default function CheckboxOptionItem<T>({ option, onPress, renderItem, disabled, }: CheckboxOptionItemProps<T>): import("react").JSX.Element;
9
+ export {};
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = CheckboxOptionItem;
4
+ const react_1 = require("react");
5
+ const react_native_1 = require("react-native");
6
+ const hooks_1 = require("../../hooks");
7
+ const Text_1 = require("../Text");
8
+ function CheckboxOptionItem({ option, onPress, renderItem, disabled, }) {
9
+ const { label, selected } = option;
10
+ const styles = useStyles(selected).styles;
11
+ return (<react_native_1.Pressable onPress={() => onPress === null || onPress === void 0 ? void 0 : onPress(option.value)} style={styles.itemContainer} disabled={disabled}>
12
+ <react_native_1.View style={styles.itemContent}>
13
+ <react_native_1.View style={styles.checkboxContainer}>
14
+ {selected && <react_native_1.View style={styles.checkbox}/>}
15
+ </react_native_1.View>
16
+ {!renderItem && <Text_1.Text>{label}</Text_1.Text>}
17
+ {renderItem && renderItem(option)}
18
+ </react_native_1.View>
19
+ </react_native_1.Pressable>);
20
+ }
21
+ const useStyles = (selected) => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
22
+ itemContainer: {
23
+ paddingVertical: t.size.baseSize * 2,
24
+ paddingHorizontal: t.size.baseSize * 4,
25
+ },
26
+ itemContent: {
27
+ flexDirection: "row",
28
+ alignItems: "center",
29
+ gap: t.size.baseSize * 2,
30
+ },
31
+ checkboxContainer: {
32
+ width: t.size.baseSize * 4,
33
+ height: t.size.baseSize * 4,
34
+ borderRadius: t.size.baseSize * 1,
35
+ borderWidth: t.size.baseSize / 2,
36
+ borderColor: selected ? t.colors.primary : t.colors.border,
37
+ justifyContent: "center",
38
+ alignItems: "center",
39
+ },
40
+ checkbox: {
41
+ width: t.size.baseSize * 2,
42
+ height: t.size.baseSize * 2,
43
+ backgroundColor: selected ? t.colors.primary : undefined,
44
+ },
45
+ }), [selected]));
@@ -0,0 +1,2 @@
1
+ export { default } from "./CheckboxOptionItem";
2
+ export * from "./CheckboxOptionItem";
@@ -0,0 +1,23 @@
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 __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);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ var CheckboxOptionItem_1 = require("./CheckboxOptionItem");
22
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CheckboxOptionItem_1).default; } });
23
+ __exportStar(require("./CheckboxOptionItem"), exports);
@@ -57,19 +57,13 @@ function RadioOptionInput({ caption, label, options = [], onChange, renderOption
57
57
  </react_native_1.View>
58
58
  <Sheet_1.default header={label} open={sheetOpen} setOpen={setSheetOpen}>
59
59
  {options.map((option) => {
60
- return renderOption ? (renderOption(option, onChange)) : (<RadioOptionItem_1.default option={option} onPress={() => handleOptionPress(option)} key={option.value}/>);
60
+ return renderOption ? (renderOption(option, handleOptionPress)) : (<RadioOptionItem_1.default option={option} onPress={() => handleOptionPress(option)} key={option.value}/>);
61
61
  })}
62
62
  </Sheet_1.default>
63
63
  </>);
64
64
  }
65
65
  const useStyles = () => (0, hooks_1.useThemedStyle)((0, react_1.useCallback)((t) => react_native_1.StyleSheet.create({
66
- container: {
67
- // paddingVertical: t.size.baseSize * 4,
68
- },
69
- chevron: {
70
- paddingRight: t.size.baseSize * 2,
71
- color: t.colors.foreground,
72
- },
66
+ container: {},
73
67
  valueDisplayContainer: {
74
68
  marginTop: t.size.baseSize * 1,
75
69
  flexDirection: "row",
@@ -0,0 +1,15 @@
1
+ import React, { Dispatch, SetStateAction } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ type Props = {
4
+ open: boolean;
5
+ setOpen: Dispatch<SetStateAction<boolean>>;
6
+ children?: React.ReactNode;
7
+ containerStyle?: StyleProp<ViewStyle>;
8
+ defaultMargins?: boolean;
9
+ header?: string;
10
+ transparent?: boolean;
11
+ disableScroll?: boolean;
12
+ footer?: React.ReactNode;
13
+ };
14
+ export declare const Sheet: ({ open, setOpen, children, containerStyle, defaultMargins, header, transparent, disableScroll, footer, }: Props) => React.JSX.Element | null;
15
+ export default Sheet;
@@ -0,0 +1,159 @@
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.Sheet = void 0;
30
+ const react_1 = __importStar(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
33
+ const react_native_safe_area_context_1 = require("react-native-safe-area-context");
34
+ const useThemedStyle_1 = require("../../hooks/useThemedStyle");
35
+ const Text_1 = __importDefault(require("../Text"));
36
+ const BACKGROUND_OPACITY = 0.6;
37
+ const Sheet = ({ open, setOpen, children, containerStyle, defaultMargins = true, header, transparent = false, disableScroll = false, footer, }) => {
38
+ const [footerHeight, setFooterHeight] = (0, react_1.useState)(0);
39
+ const styles = useStyles(defaultMargins, footerHeight).styles;
40
+ const [visible, setVisible] = (0, react_1.useState)(open);
41
+ const opacity = (0, react_native_reanimated_1.useSharedValue)(0);
42
+ (0, react_1.useEffect)(() => {
43
+ if (!open) {
44
+ setVisible(false);
45
+ return;
46
+ }
47
+ setVisible(true);
48
+ }, [open]);
49
+ (0, react_1.useEffect)(() => {
50
+ if (!visible) {
51
+ opacity.value = (0, react_native_reanimated_1.withTiming)(0, {
52
+ duration: 200,
53
+ easing: react_native_reanimated_1.Easing.bezier(0.5, 0, 0, 0.75),
54
+ }, () => {
55
+ (0, react_native_reanimated_1.runOnJS)(setOpen)(false);
56
+ });
57
+ return;
58
+ }
59
+ opacity.value = (0, react_native_reanimated_1.withTiming)(BACKGROUND_OPACITY, {
60
+ duration: 250,
61
+ easing: react_native_reanimated_1.Easing.bezier(0.5, 0, 0, 0.75),
62
+ });
63
+ }, [visible]);
64
+ const animatedModalBackgroundStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
65
+ opacity: opacity.value,
66
+ }));
67
+ const content = (<>
68
+ {!transparent && (<react_native_1.Pressable style={styles.modalPressable} onPress={() => {
69
+ setVisible(false);
70
+ }}>
71
+ <react_native_reanimated_1.default.View style={[styles.modalBackground, animatedModalBackgroundStyles]}/>
72
+ </react_native_1.Pressable>)}
73
+ {visible && (<react_native_reanimated_1.default.View entering={react_native_reanimated_1.SlideInDown} exiting={react_native_reanimated_1.SlideOutDown} style={[styles.sheet, containerStyle]}>
74
+ {!!header && (<react_native_1.View style={styles.headerContainer}>
75
+ <Text_1.default>{header}</Text_1.default>
76
+ </react_native_1.View>)}
77
+ <react_native_1.ScrollView scrollEnabled={!disableScroll} contentContainerStyle={[
78
+ styles.contentContainer,
79
+ !!footer && styles.containerWithFooter,
80
+ ]}>
81
+ {children}
82
+ </react_native_1.ScrollView>
83
+ {!!footer && (<react_native_1.View onLayout={(e) => {
84
+ setFooterHeight(e.nativeEvent.layout.height);
85
+ }} style={styles.footer}>
86
+ {footer}
87
+ </react_native_1.View>)}
88
+ </react_native_reanimated_1.default.View>)}
89
+ </>);
90
+ // // Don't render anything if it's not visible
91
+ if (!visible && !open) {
92
+ return null;
93
+ }
94
+ return (<react_native_1.Modal transparent visible>
95
+ <react_native_1.View style={styles.wrapper}>{content}</react_native_1.View>
96
+ </react_native_1.Modal>);
97
+ };
98
+ exports.Sheet = Sheet;
99
+ exports.default = exports.Sheet;
100
+ const useStyles = (defaultMargins, footerHeight) => {
101
+ const { bottom: bottomInset } = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
102
+ return (0, useThemedStyle_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
103
+ wrapper: {
104
+ flex: 1,
105
+ justifyContent: "flex-end",
106
+ },
107
+ headerContainer: {
108
+ paddingVertical: theme.size.baseSize * 3,
109
+ justifyContent: "center",
110
+ alignItems: "center",
111
+ borderBottomWidth: theme.borderWidth / 2,
112
+ borderColor: theme.colors.border,
113
+ },
114
+ modalPressable: {
115
+ position: "absolute",
116
+ top: 0,
117
+ bottom: 0,
118
+ right: 0,
119
+ left: 0,
120
+ },
121
+ modalBackground: {
122
+ backgroundColor: "#000000",
123
+ position: "absolute",
124
+ top: 0,
125
+ bottom: 0,
126
+ right: 0,
127
+ left: 0,
128
+ },
129
+ sheet: {
130
+ alignSelf: "center",
131
+ display: "flex",
132
+ width: "100%",
133
+ maxWidth: 600,
134
+ maxHeight: "80%",
135
+ backgroundColor: theme.colors.backgroundPrimary,
136
+ },
137
+ contentContainer: {
138
+ padding: defaultMargins ? theme.size.baseSize * 4 : 0,
139
+ paddingBottom: defaultMargins
140
+ ? theme.size.baseSize * 4 + bottomInset
141
+ : bottomInset,
142
+ },
143
+ containerWithFooter: {
144
+ paddingBottom: defaultMargins
145
+ ? theme.size.baseSize * 4 + footerHeight
146
+ : footerHeight,
147
+ },
148
+ footer: {
149
+ position: "absolute",
150
+ bottom: 0,
151
+ left: 0,
152
+ right: 0,
153
+ paddingHorizontal: defaultMargins ? theme.size.baseSize * 4 : 0,
154
+ paddingBottom: defaultMargins
155
+ ? theme.size.baseSize * 2 + bottomInset
156
+ : bottomInset,
157
+ },
158
+ }), [bottomInset, footerHeight, defaultMargins]));
159
+ };
@@ -1,14 +1,2 @@
1
- import React, { Dispatch, SetStateAction } from "react";
2
- import { StyleProp, ViewStyle } from "react-native";
3
- type Props = {
4
- open: boolean;
5
- setOpen: Dispatch<SetStateAction<boolean>>;
6
- children?: React.ReactNode;
7
- containerStyle?: StyleProp<ViewStyle>;
8
- defaultMargins?: boolean;
9
- header?: string;
10
- transparent?: boolean;
11
- disableScroll?: boolean;
12
- };
13
- export declare const Sheet: ({ open, setOpen, children, containerStyle, defaultMargins, header, transparent, disableScroll }: Props) => React.JSX.Element | null;
14
- export default Sheet;
1
+ export * from "./Sheet";
2
+ export { default } from "./Sheet";
@@ -10,126 +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
- exports.Sheet = void 0;
30
- const react_1 = __importStar(require("react"));
31
- const react_native_1 = require("react-native");
32
- const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
33
- const react_native_safe_area_context_1 = require("react-native-safe-area-context");
34
- const useThemedStyle_1 = require("../../hooks/useThemedStyle");
35
- const Text_1 = __importDefault(require("../Text"));
36
- const BACKGROUND_OPACITY = 0.6;
37
- const Sheet = ({ open, setOpen, children, containerStyle, defaultMargins = true, header, transparent = false, disableScroll = false }) => {
38
- const styles = useStyles(defaultMargins).styles;
39
- const [visible, setVisible] = (0, react_1.useState)(open);
40
- const opacity = (0, react_native_reanimated_1.useSharedValue)(0);
41
- (0, react_1.useEffect)(() => {
42
- if (!open) {
43
- setVisible(false);
44
- return;
45
- }
46
- setVisible(true);
47
- }, [open]);
48
- (0, react_1.useEffect)(() => {
49
- if (!visible) {
50
- opacity.value = (0, react_native_reanimated_1.withTiming)(0, {
51
- duration: 200,
52
- easing: react_native_reanimated_1.Easing.bezier(0.5, 0, 0, 0.75),
53
- }, () => {
54
- (0, react_native_reanimated_1.runOnJS)(setOpen)(false);
55
- });
56
- return;
57
- }
58
- opacity.value = (0, react_native_reanimated_1.withTiming)(BACKGROUND_OPACITY, {
59
- duration: 250,
60
- easing: react_native_reanimated_1.Easing.bezier(0.5, 0, 0, 0.75),
61
- });
62
- }, [visible]);
63
- const animatedModalBackgroundStyles = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
64
- opacity: opacity.value,
65
- }));
66
- const content = (<>
67
- {!transparent && (<react_native_1.Pressable style={styles.modalPressable} onPress={() => {
68
- setVisible(false);
69
- }}>
70
- <react_native_reanimated_1.default.View style={[styles.modalBackground, animatedModalBackgroundStyles]}/>
71
- </react_native_1.Pressable>)}
72
- {visible && (<react_native_reanimated_1.default.View entering={react_native_reanimated_1.SlideInDown} exiting={react_native_reanimated_1.SlideOutDown} style={[styles.sheet, containerStyle]}>
73
- {!!header && (<react_native_1.View style={styles.headerContainer}>
74
- <Text_1.default>{header}</Text_1.default>
75
- </react_native_1.View>)}
76
- <react_native_1.ScrollView scrollEnabled={!disableScroll} contentContainerStyle={styles.contentContainer}>
77
- {children}
78
- </react_native_1.ScrollView>
79
- </react_native_reanimated_1.default.View>)}
80
- </>);
81
- // // Don't render anything if it's not visible
82
- if (!visible && !open) {
83
- return null;
84
- }
85
- return (<react_native_1.Modal transparent visible>
86
- <react_native_1.View style={styles.wrapper}>{content}</react_native_1.View>
87
- </react_native_1.Modal>);
88
- };
89
- exports.Sheet = Sheet;
90
- exports.default = exports.Sheet;
91
- const useStyles = (defaultMargins) => {
92
- const { bottom: bottomInset } = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
93
- return (0, useThemedStyle_1.useThemedStyle)((0, react_1.useCallback)((theme) => react_native_1.StyleSheet.create({
94
- wrapper: {
95
- flex: 1,
96
- justifyContent: "flex-end",
97
- },
98
- headerContainer: {
99
- paddingVertical: theme.size.baseSize * 3,
100
- justifyContent: "center",
101
- alignItems: "center",
102
- borderBottomWidth: theme.borderWidth / 2,
103
- borderColor: theme.colors.border,
104
- },
105
- modalPressable: {
106
- position: "absolute",
107
- top: 0,
108
- bottom: 0,
109
- right: 0,
110
- left: 0,
111
- },
112
- modalBackground: {
113
- backgroundColor: "#000000",
114
- position: "absolute",
115
- top: 0,
116
- bottom: 0,
117
- right: 0,
118
- left: 0,
119
- },
120
- sheet: {
121
- alignSelf: "center",
122
- display: "flex",
123
- width: "100%",
124
- maxWidth: 600,
125
- maxHeight: "80%",
126
- backgroundColor: theme.colors.backgroundPrimary,
127
- },
128
- contentContainer: {
129
- padding: defaultMargins ? theme.size.baseSize * 4 : 0,
130
- paddingBottom: defaultMargins
131
- ? theme.size.baseSize * 4 + bottomInset
132
- : bottomInset,
133
- },
134
- }), [bottomInset]));
135
- };
20
+ exports.default = void 0;
21
+ __exportStar(require("./Sheet"), exports);
22
+ var Sheet_1 = require("./Sheet");
23
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Sheet_1).default; } });
@@ -14,4 +14,5 @@ export * from "./SegmentedControl";
14
14
  export * from "./RadioOptionItem";
15
15
  export * from "./RadioOptionInput";
16
16
  export * from "./Chevron";
17
+ export * from "./CheckboxOptionInput";
17
18
  export * from "./Forms";
@@ -30,5 +30,6 @@ __exportStar(require("./SegmentedControl"), exports);
30
30
  __exportStar(require("./RadioOptionItem"), exports);
31
31
  __exportStar(require("./RadioOptionInput"), exports);
32
32
  __exportStar(require("./Chevron"), exports);
33
+ __exportStar(require("./CheckboxOptionInput"), exports);
33
34
  // Forms
34
35
  __exportStar(require("./Forms"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atlas-design-system",
3
- "version": "1.10.1",
3
+ "version": "1.11.0",
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",
@@ -13,22 +13,23 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "lint": "eslint 'src/**/*.{ts,tsx}' && tsc --noEmit",
16
+ "lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
16
17
  "test": "test",
17
18
  "example": "yarn --cwd example",
18
19
  "build": "tsc",
19
20
  "patch": "npm version patch",
20
21
  "minor": "npm version minor",
21
22
  "watch": "tsc --watch",
22
- "publish:dryrun": "npm publish --dry-run"
23
+ "publish:dryrun": "npm publish --dry-run",
24
+ "publish": "yarn build && npm publish"
23
25
  },
24
26
  "keywords": [
25
27
  "react-native",
26
28
  "native"
27
29
  ],
28
- "dependencies": {},
29
30
  "peerDependencies": {
30
- "informed": ">=4.0.0",
31
31
  "@react-native-community/datetimepicker": ">=8.0.0",
32
+ "informed": ">=4.0.0",
32
33
  "moment": ">=2.24.0",
33
34
  "react": ">=17.0.1",
34
35
  "react-native": ">=0.64.1",
@@ -43,8 +44,10 @@
43
44
  "@typescript-eslint/eslint-plugin": "^8.4.0",
44
45
  "@typescript-eslint/parser": "^8.4.0",
45
46
  "eslint": "^8.19.0",
47
+ "eslint-plugin-import": "^2.31.0",
46
48
  "eslint-plugin-react": "^7.35.2",
47
49
  "eslint-plugin-react-native": "^4.1.0",
50
+ "eslint-plugin-unused-imports": "^4.1.4",
48
51
  "informed": "^4.60.3",
49
52
  "moment": "^2.29.0",
50
53
  "react": "^18.2.0",