@dropi/react-native-design-system 0.3.1 → 0.3.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.
@@ -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.TextButton, {
89
+ label: "Restablecer",
90
+ variant: "primary",
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, {
@@ -95,6 +113,8 @@ const Select = ({
95
113
  color: currentValue ? _constants.colors['Gray-600'].light : _constants.colors['Gray-500'].light,
96
114
  flex: 1
97
115
  },
116
+ numberOfLines: 1,
117
+ ellipsizeMode: "tail",
98
118
  children: currentValue?.label ?? placeholder
99
119
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative2.default, {
100
120
  name: "dropdown-down",
@@ -178,5 +198,8 @@ const styles = _reactNative.StyleSheet.create({
178
198
  },
179
199
  optionsList: {
180
200
  paddingHorizontal: _constants.spacing['size-5']
201
+ },
202
+ footerSecondaryButton: {
203
+ marginTop: _constants.spacing['size-4']
181
204
  }
182
205
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropi/react-native-design-system",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "A React Native package built from scratch",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",