@dropi/react-native-design-system 0.3.0 → 0.3.2

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.
@@ -32,7 +32,7 @@ const TitleDescription = ({
32
32
  style: [isActive ? styles.selectedOption : styles.option, {
33
33
  opacity: isDisabled ? 0.5 : 1
34
34
  }],
35
- disabled: isDisabled,
35
+ disabled: isActive || isDisabled,
36
36
  ...rest,
37
37
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(OptionSelector, {
38
38
  isActive: isActive
@@ -13,6 +13,7 @@ type SelectProps = {
13
13
  errorMessage?: string;
14
14
  title?: string;
15
15
  disabled?: boolean;
16
+ onRestablish?: () => void;
16
17
  };
17
- export declare const Select: ({ options, value, onChange, label, placeholder, helper, hasError, errorMessage, title, disabled, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const Select: ({ options, value, onChange, label, placeholder, helper, hasError, errorMessage, title, disabled, onRestablish, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
18
19
  export {};
@@ -23,7 +23,8 @@ const Select = ({
23
23
  hasError = false,
24
24
  errorMessage,
25
25
  title,
26
- disabled = false
26
+ disabled = false,
27
+ onRestablish
27
28
  }) => {
28
29
  const bottomSheetRef = (0, _react.useRef)(null);
29
30
  const [isFocus, setIsFocus] = (0, _react.useState)(false);
@@ -58,6 +59,13 @@ const Select = ({
58
59
  setIsFocus(false);
59
60
  setDraftSelection(null);
60
61
  }, []);
62
+ const handleRestablish = (0, _react.useCallback)(() => {
63
+ if (onRestablish) {
64
+ onRestablish();
65
+ bottomSheetRef.current?.dismiss();
66
+ setIsFocus(false);
67
+ }
68
+ }, [onRestablish]);
61
69
  const renderOption = (0, _react.useCallback)(({
62
70
  item
63
71
  }) => {
@@ -68,13 +76,23 @@ const Select = ({
68
76
  onPress: () => handleDraftSelect(item)
69
77
  });
70
78
  }, [draftSelection, handleDraftSelect]);
71
- const footer = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.DefaultButton, {
72
- label: "Guardar",
73
- variant: "primary",
74
- size: "large",
75
- onPress: handleSave,
76
- disabled: !hasChanges
77
- }), [handleSave, hasChanges]);
79
+ const footer = (0, _react.useMemo)(() => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
80
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.DefaultButton, {
81
+ label: "Guardar",
82
+ variant: "primary",
83
+ size: "large",
84
+ onPress: handleSave,
85
+ disabled: !hasChanges
86
+ }), onRestablish && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
87
+ style: styles.footerSecondaryButton,
88
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.DefaultButton, {
89
+ label: "Restablecer",
90
+ variant: "secondary",
91
+ size: "large",
92
+ onPress: handleRestablish
93
+ })
94
+ })]
95
+ }), [handleSave, hasChanges, onRestablish, handleRestablish]);
78
96
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
79
97
  style: styles.fieldContainer,
80
98
  children: [label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_atoms.Body, {
@@ -178,5 +196,8 @@ const styles = _reactNative.StyleSheet.create({
178
196
  },
179
197
  optionsList: {
180
198
  paddingHorizontal: _constants.spacing['size-5']
199
+ },
200
+ footerSecondaryButton: {
201
+ marginTop: _constants.spacing['size-4']
181
202
  }
182
203
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropi/react-native-design-system",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "A React Native package built from scratch",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",