@draftbit/core 46.10.1-bdc763.2 → 46.10.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.
Files changed (64) hide show
  1. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +17 -2
  2. package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
  3. package/lib/commonjs/components/Checkbox/context.js +1 -1
  4. package/lib/commonjs/components/CircleImage.js +15 -1
  5. package/lib/commonjs/components/CircularProgress.js +26 -8
  6. package/lib/commonjs/components/Container.js +15 -4
  7. package/lib/commonjs/components/Picker/Picker.js +13 -3
  8. package/lib/commonjs/components/Picker/PickerComponent.android.js +20 -3
  9. package/lib/commonjs/components/Pressable.js +15 -2
  10. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +23 -5
  11. package/lib/commonjs/components/RadioButton/context.js +1 -1
  12. package/lib/commonjs/components/Slider.js +21 -4
  13. package/lib/commonjs/components/TabView/TabView.js +13 -7
  14. package/lib/commonjs/constants.js +1 -1
  15. package/lib/commonjs/index.js +0 -19
  16. package/lib/commonjs/mappings/StarRating.js +6 -2
  17. package/lib/module/components/DeckSwiper/DeckSwiper.js +0 -3
  18. package/lib/module/components/Picker/Picker.js +13 -3
  19. package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
  20. package/lib/module/index.js +0 -1
  21. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  22. package/lib/typescript/src/index.d.ts +0 -1
  23. package/lib/typescript/src/index.d.ts.map +1 -1
  24. package/package.json +3 -3
  25. package/src/components/Picker/Picker.js +12 -3
  26. package/src/components/Picker/Picker.tsx +12 -3
  27. package/src/index.js +0 -1
  28. package/src/index.tsx +0 -2
  29. package/lib/commonjs/components/Table/Table.js +0 -123
  30. package/lib/commonjs/components/Table/TableCell.js +0 -49
  31. package/lib/commonjs/components/Table/TableCommon.js +0 -30
  32. package/lib/commonjs/components/Table/TableRow.js +0 -61
  33. package/lib/commonjs/components/Table/index.js +0 -27
  34. package/lib/commonjs/mappings/Table.js +0 -140
  35. package/lib/module/components/Table/Table.js +0 -114
  36. package/lib/module/components/Table/TableCell.js +0 -41
  37. package/lib/module/components/Table/TableCommon.js +0 -21
  38. package/lib/module/components/Table/TableRow.js +0 -53
  39. package/lib/module/components/Table/index.js +0 -3
  40. package/lib/module/mappings/Table.js +0 -133
  41. package/lib/typescript/src/components/Table/Table.d.ts +0 -19
  42. package/lib/typescript/src/components/Table/Table.d.ts.map +0 -1
  43. package/lib/typescript/src/components/Table/TableCell.d.ts +0 -9
  44. package/lib/typescript/src/components/Table/TableCell.d.ts.map +0 -1
  45. package/lib/typescript/src/components/Table/TableCommon.d.ts +0 -20
  46. package/lib/typescript/src/components/Table/TableCommon.d.ts.map +0 -1
  47. package/lib/typescript/src/components/Table/TableRow.d.ts +0 -14
  48. package/lib/typescript/src/components/Table/TableRow.d.ts.map +0 -1
  49. package/lib/typescript/src/components/Table/index.d.ts +0 -4
  50. package/lib/typescript/src/components/Table/index.d.ts.map +0 -1
  51. package/lib/typescript/src/mappings/Table.d.ts +0 -337
  52. package/lib/typescript/src/mappings/Table.d.ts.map +0 -1
  53. package/src/components/Table/Table.js +0 -93
  54. package/src/components/Table/Table.tsx +0 -176
  55. package/src/components/Table/TableCell.js +0 -31
  56. package/src/components/Table/TableCell.tsx +0 -63
  57. package/src/components/Table/TableCommon.js +0 -12
  58. package/src/components/Table/TableCommon.ts +0 -40
  59. package/src/components/Table/TableRow.js +0 -37
  60. package/src/components/Table/TableRow.tsx +0 -77
  61. package/src/components/Table/index.js +0 -3
  62. package/src/components/Table/index.tsx +0 -3
  63. package/src/mappings/Table.js +0 -150
  64. package/src/mappings/Table.ts +0 -170
@@ -49,7 +49,7 @@ const Picker = _ref => {
49
49
  defaultValue,
50
50
  Icon,
51
51
  style,
52
- placeholder,
52
+ placeholder = "Select an option",
53
53
  value,
54
54
  disabled = false,
55
55
  assistiveText,
@@ -90,7 +90,14 @@ const Picker = _ref => {
90
90
  Keyboard.dismiss();
91
91
  }
92
92
  }, [pickerVisible, autoDismissKeyboard]);
93
- const pickerOptions = normalizeOptions(options);
93
+ const normalizedOptions = normalizeOptions(options);
94
+
95
+ //Underlying Picker component defaults selection to first element when value is not provided (or undefined)
96
+ //Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
97
+ const pickerOptions = placeholder ? [{
98
+ label: placeholder,
99
+ value: placeholder
100
+ }, ...normalizedOptions] : normalizedOptions;
94
101
  const {
95
102
  viewStyles,
96
103
  textStyles
@@ -190,9 +197,12 @@ const Picker = _ref => {
190
197
  } : {})
191
198
  };
192
199
  const handleValueChange = (newValue, itemIndex) => {
193
- if (newValue !== "") {
200
+ if (newValue !== "" && newValue !== placeholder) {
194
201
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
195
202
  setInternalValue(newValue);
203
+ } else if (newValue === placeholder) {
204
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
205
+ setInternalValue(undefined);
196
206
  }
197
207
  };
198
208
  return (
@@ -1,4 +1,3 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
1
  import * as React from "react";
3
2
  import { View, StyleSheet } from "react-native";
4
3
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -11,7 +10,6 @@ import TextField from "../TextField";
11
10
  import Touchable from "../Touchable";
12
11
  import { extractStyles } from "../../utilities";
13
12
  const Picker = _ref => {
14
- var _options$find$label, _options$find;
15
13
  let {
16
14
  Icon,
17
15
  style,
@@ -25,6 +23,7 @@ const Picker = _ref => {
25
23
  },
26
24
  ...props
27
25
  } = _ref;
26
+ var _a, _b;
28
27
  const {
29
28
  viewStyles: {
30
29
  borderRadius,
@@ -65,26 +64,24 @@ const Picker = _ref => {
65
64
  };
66
65
 
67
66
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
68
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
67
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
69
68
  return /*#__PURE__*/React.createElement(View, {
70
69
  style: [styles.container, viewStyles]
71
70
  }, /*#__PURE__*/React.createElement(Touchable, {
72
71
  disabled: disabled,
73
72
  onPress: toggleVisibility
74
- }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
73
+ }, /*#__PURE__*/React.createElement(TextField, {
74
+ ...props,
75
75
  value: String(selectedLabel),
76
- placeholder: placeholder
76
+ placeholder: placeholder,
77
77
  // @ts-ignore
78
- ,
79
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
80
- ,
78
+ ref: textField,
81
79
  disabled: disabled,
82
- pointerEvents: "none"
80
+ pointerEvents: "none",
83
81
  // @ts-expect-error
84
- ,
85
82
  style: stylesWithoutMargin,
86
83
  Icon: Icon
87
- }))), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
84
+ })), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
88
85
  style: [styles.picker, {
89
86
  backgroundColor: colors.divider
90
87
  }]
@@ -128,4 +125,32 @@ const styles = StyleSheet.create({
128
125
  alignSelf: "flex-end"
129
126
  }
130
127
  });
128
+ export default withTheme(Picker);nValueChange
129
+ }, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
130
+ label: o.label,
131
+ value: o.value,
132
+ key: o.value
133
+ })))))));
134
+ };
135
+ const styles = StyleSheet.create({
136
+ container: {
137
+ alignSelf: "stretch"
138
+ },
139
+ picker: {
140
+ position: "absolute",
141
+ bottom: 0,
142
+ left: 0,
143
+ right: 0,
144
+ flexDirection: "row",
145
+ justifyContent: "center"
146
+ },
147
+ pickerContainer: {
148
+ backgroundColor: "white",
149
+ flexDirection: "column",
150
+ width: "100%"
151
+ },
152
+ closeButton: {
153
+ alignSelf: "flex-end"
154
+ }
155
+ });
131
156
  export default withTheme(Picker);
@@ -37,7 +37,6 @@ export { TabView, TabViewItem } from "./components/TabView";
37
37
  export { default as Markdown } from "./components/Markdown";
38
38
  export { BottomSheet } from "./components/BottomSheet";
39
39
  export { default as YoutubePlayer } from "./components/YotubePlayer";
40
- export { Table, TableRow, TableCell } from "./components/Table";
41
40
 
42
41
  /* Deprecated: Fix or Delete! */
43
42
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;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M,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AAkbF,wBAAiC"}
@@ -37,7 +37,6 @@ export { TabView, TabViewItem } from "./components/TabView";
37
37
  export { default as Markdown } from "./components/Markdown";
38
38
  export { BottomSheet } from "./components/BottomSheet";
39
39
  export { default as YoutubePlayer } from "./components/YotubePlayer";
40
- export { Table, TableRow, TableCell } from "./components/Table";
41
40
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
42
41
  export { default as Picker } from "./components/Picker/Picker";
43
42
  export { default as ProgressBar } from "./components/ProgressBar";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EA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AAC;AACpF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.10.1-bdc763.2+bdc7637",
3
+ "version": "46.10.1",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^46.10.1-bdc763.2+bdc7637",
44
+ "@draftbit/types": "46.10.1",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.3",
@@ -100,5 +100,5 @@
100
100
  ]
101
101
  ]
102
102
  },
103
- "gitHead": "bdc7637246268644abe7720bf76599eaf1e8e438"
103
+ "gitHead": "c0490f94c9794128f3d318f17319ee7411797fb4"
104
104
  }
@@ -38,7 +38,7 @@ const disabledColor = "rgb(240, 240, 240)";
38
38
  const errorColor = "rgba(255, 69, 100, 1)";
39
39
  //Empty string for 'value' is treated as a non-value
40
40
  //reason: Draftbit uses empty string as initial value for string state*/
41
- const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
41
+ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder = "Select an option", value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
42
42
  var _a, _b;
43
43
  const androidPickerRef = React.useRef(undefined);
44
44
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
@@ -67,7 +67,12 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
67
67
  Keyboard.dismiss();
68
68
  }
69
69
  }, [pickerVisible, autoDismissKeyboard]);
70
- const pickerOptions = normalizeOptions(options);
70
+ const normalizedOptions = normalizeOptions(options);
71
+ //Underlying Picker component defaults selection to first element when value is not provided (or undefined)
72
+ //Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
73
+ const pickerOptions = placeholder
74
+ ? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
75
+ : normalizedOptions;
71
76
  const { viewStyles, textStyles } = extractStyles(style);
72
77
  const additionalBorderStyles = ["backgroundColor"];
73
78
  const additionalMarginStyles = [
@@ -162,10 +167,14 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
162
167
  ...(disabled ? { color: unstyledColor } : {}),
163
168
  };
164
169
  const handleValueChange = (newValue, itemIndex) => {
165
- if (newValue !== "") {
170
+ if (newValue !== "" && newValue !== placeholder) {
166
171
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
167
172
  setInternalValue(newValue);
168
173
  }
174
+ else if (newValue === placeholder) {
175
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
176
+ setInternalValue(undefined);
177
+ }
169
178
  };
170
179
  return (
171
180
  /* marginsContainer */
@@ -101,7 +101,7 @@ const Picker: React.FC<PickerProps> = ({
101
101
  defaultValue,
102
102
  Icon,
103
103
  style,
104
- placeholder,
104
+ placeholder = "Select an option",
105
105
  value,
106
106
  disabled = false,
107
107
  assistiveText,
@@ -151,7 +151,13 @@ const Picker: React.FC<PickerProps> = ({
151
151
  }
152
152
  }, [pickerVisible, autoDismissKeyboard]);
153
153
 
154
- const pickerOptions = normalizeOptions(options);
154
+ const normalizedOptions = normalizeOptions(options);
155
+
156
+ //Underlying Picker component defaults selection to first element when value is not provided (or undefined)
157
+ //Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
158
+ const pickerOptions = placeholder
159
+ ? [{ label: placeholder, value: placeholder }, ...normalizedOptions]
160
+ : normalizedOptions;
155
161
 
156
162
  const { viewStyles, textStyles } = extractStyles(style);
157
163
 
@@ -302,9 +308,12 @@ const Picker: React.FC<PickerProps> = ({
302
308
  };
303
309
 
304
310
  const handleValueChange = (newValue: string, itemIndex: number) => {
305
- if (newValue !== "") {
311
+ if (newValue !== "" && newValue !== placeholder) {
306
312
  onValueChange?.(newValue, itemIndex);
307
313
  setInternalValue(newValue);
314
+ } else if (newValue === placeholder) {
315
+ onValueChange?.("", 0);
316
+ setInternalValue(undefined);
308
317
  }
309
318
  };
310
319
 
package/src/index.js CHANGED
@@ -37,7 +37,6 @@ export { TabView, TabViewItem } from "./components/TabView";
37
37
  export { default as Markdown } from "./components/Markdown";
38
38
  export { BottomSheet } from "./components/BottomSheet";
39
39
  export { default as YoutubePlayer } from "./components/YotubePlayer";
40
- export { Table, TableRow, TableCell } from "./components/Table";
41
40
  /* Deprecated: Fix or Delete! */
42
41
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
43
42
  export { default as Picker } from "./components/Picker/Picker";
package/src/index.tsx CHANGED
@@ -62,8 +62,6 @@ export { BottomSheet } from "./components/BottomSheet";
62
62
 
63
63
  export { default as YoutubePlayer } from "./components/YotubePlayer";
64
64
 
65
- export { Table, TableRow, TableCell } from "./components/Table";
66
-
67
65
  /* Deprecated: Fix or Delete! */
68
66
  export { default as DatePicker } from "./components/DatePicker/DatePicker";
69
67
  export { default as Picker } from "./components/Picker/Picker";
@@ -1,123 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _theming = require("../../theming");
10
- var _TableCommon = require("./TableCommon");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- const Table = _ref => {
13
- let {
14
- theme,
15
- borderWidth = 1,
16
- borderColor = theme.colors.divider,
17
- borderStyle = "solid",
18
- drawTopBorder = true,
19
- drawBottomBorder = false,
20
- drawStartBorder = false,
21
- drawEndBorder = false,
22
- cellVerticalPadding = 10,
23
- cellHorizontalPadding = 10,
24
- data,
25
- keyExtractor,
26
- renderItem,
27
- children: childrenProp,
28
- style,
29
- ...rest
30
- } = _ref;
31
- //Both 'renderItem' and 'data' are optional to allow direct children. But if one is included, both need to be included
32
- if (data && !renderItem || renderItem && !data) {
33
- throw new Error("'renderItem' and 'data' need to both be provided to render from 'data'. Either remove them entirley or include both");
34
- }
35
- if (data && renderItem && childrenProp) {
36
- console.warn("'children' of Table ignored due to usage of 'data' and 'renderItem'");
37
- }
38
- const isTableHeader = _react.default.useCallback(object => {
39
- return object.isTableHeader;
40
- }, []);
41
- const isRenderItem = data && renderItem;
42
-
43
- //Uses 'renderItem' and 'data' to create an array of children
44
- const dataAsChildren = _react.default.useMemo(() => {
45
- if (!isRenderItem) return [];
46
- return data.map((item, index) => {
47
- const component = renderItem({
48
- item,
49
- index
50
- });
51
- if (!component) {
52
- return null;
53
- }
54
- const key = keyExtractor ? keyExtractor(item, index) : index.toString();
55
- return /*#__PURE__*/_react.default.cloneElement(component, {
56
- key
57
- });
58
- });
59
- }, [data, renderItem, keyExtractor, isRenderItem]);
60
- const children = isRenderItem ? dataAsChildren : _react.default.Children.toArray(childrenProp);
61
- const validChildren = _react.default.useMemo(() => children.filter(item => /*#__PURE__*/_react.default.isValidElement(item)), [children]);
62
- const childrenWithoutHeader = _react.default.useMemo(() => {
63
- const flattenedWithoutNestedHeaders = validChildren.map(item => {
64
- const nestedChildren = _react.default.Children.toArray(item.props.children);
65
- //Header can be nested in React.Fragment when in renderItem
66
- const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
67
- if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
68
- //New element excluding header children
69
- return /*#__PURE__*/_react.default.cloneElement(item, {
70
- children: nestedChildren.filter(child => !isTableHeader(child.props))
71
- });
72
- }
73
- return item;
74
- });
75
- return flattenedWithoutNestedHeaders.filter(item => !isTableHeader(item.props));
76
- }, [validChildren, isTableHeader]);
77
- const header = _react.default.useMemo(() => {
78
- const flattenedPossibleHeaders = validChildren.map(item => {
79
- const nestedChildren = _react.default.Children.toArray(item.props.children);
80
- //Header can be nested in React.Fragment when in renderItem
81
- const nestedHeaders = nestedChildren.filter(child => isTableHeader(child.props));
82
- if (nestedHeaders !== null && nestedHeaders !== void 0 && nestedHeaders.length) {
83
- return nestedHeaders[0];
84
- }
85
- return item;
86
- });
87
- const allHeaders = flattenedPossibleHeaders.filter(item => isTableHeader(item.props));
88
- if (allHeaders.length) {
89
- return allHeaders[0]; //Only 1 header taken
90
- }
91
-
92
- return null;
93
- }, [validChildren, isTableHeader]);
94
- const contextValue = {
95
- borderColor,
96
- borderStyle,
97
- borderWidth,
98
- cellHorizontalPadding,
99
- cellVerticalPadding
100
- };
101
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
102
- borderColor,
103
- borderWidth,
104
- borderStyle,
105
- drawTopBorder,
106
- drawBottomBorder,
107
- drawStartBorder,
108
- drawEndBorder
109
- });
110
- return /*#__PURE__*/_react.default.createElement(_TableCommon.TableStyleContext.Provider, {
111
- value: contextValue
112
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
113
- style: [styles.container, borderViewStyle, style]
114
- }, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, header), /*#__PURE__*/_react.default.createElement(_reactNative.ScrollView, rest, childrenWithoutHeader)));
115
- };
116
- const styles = _reactNative.StyleSheet.create({
117
- container: {
118
- flex: 1
119
- }
120
- });
121
- var _default = (0, _theming.withTheme)(Table);
122
- exports.default = _default;
123
- exports.default = _default;
@@ -1,49 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _TableCommon = require("./TableCommon");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- const TableCell = _ref => {
12
- let {
13
- borderWidth,
14
- borderColor,
15
- borderStyle,
16
- drawTopBorder = false,
17
- drawBottomBorder = false,
18
- drawStartBorder = false,
19
- drawEndBorder = true,
20
- cellVerticalPadding,
21
- cellHorizontalPadding,
22
- children,
23
- style
24
- } = _ref;
25
- const parentContextValue = _react.default.useContext(_TableCommon.TableStyleContext);
26
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
27
- borderColor: borderColor || parentContextValue.borderColor,
28
- borderWidth: borderWidth || parentContextValue.borderWidth,
29
- borderStyle: borderStyle || parentContextValue.borderStyle,
30
- drawTopBorder,
31
- drawBottomBorder,
32
- drawStartBorder,
33
- drawEndBorder
34
- });
35
- return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
36
- style: [styles.cellContainer, borderViewStyle, {
37
- paddingVertical: cellVerticalPadding || parentContextValue.cellVerticalPadding,
38
- paddingHorizontal: cellHorizontalPadding || parentContextValue.cellHorizontalPadding
39
- }, style]
40
- }, children);
41
- };
42
- const styles = _reactNative.StyleSheet.create({
43
- cellContainer: {
44
- flex: 1,
45
- flexDirection: "row"
46
- }
47
- });
48
- var _default = TableCell;
49
- exports.default = _default;
@@ -1,30 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.TableStyleContext = void 0;
7
- exports.generateBorderStyles = generateBorderStyles;
8
- var _react = _interopRequireDefault(require("react"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- const TableStyleContext = /*#__PURE__*/_react.default.createContext({});
11
- exports.TableStyleContext = TableStyleContext;
12
- function generateBorderStyles(_ref) {
13
- let {
14
- borderColor,
15
- borderWidth,
16
- borderStyle,
17
- drawTopBorder,
18
- drawBottomBorder,
19
- drawStartBorder,
20
- drawEndBorder
21
- } = _ref;
22
- return {
23
- borderColor,
24
- borderStyle,
25
- borderTopWidth: drawTopBorder ? borderWidth : 0,
26
- borderBottomWidth: drawBottomBorder ? borderWidth : 0,
27
- borderStartWidth: drawStartBorder ? borderWidth : 0,
28
- borderEndWidth: drawEndBorder ? borderWidth : 0
29
- };
30
- }
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _TableCommon = require("./TableCommon");
10
- var _theming = require("../../theming");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- const TableRow = _ref => {
13
- let {
14
- borderWidth,
15
- borderColor,
16
- borderStyle,
17
- drawTopBorder = false,
18
- drawBottomBorder = true,
19
- drawStartBorder = true,
20
- drawEndBorder = false,
21
- cellVerticalPadding,
22
- cellHorizontalPadding,
23
- isTableHeader = false,
24
- children,
25
- style,
26
- theme
27
- } = _ref;
28
- const parentContextValue = _react.default.useContext(_TableCommon.TableStyleContext);
29
-
30
- //Create context to use and pass to children based on own props or fall back to parent provided context
31
- const contextValue = {
32
- borderColor: borderColor || parentContextValue.borderColor,
33
- borderStyle: borderStyle || parentContextValue.borderStyle,
34
- borderWidth: borderWidth || parentContextValue.borderWidth,
35
- cellHorizontalPadding: cellHorizontalPadding || parentContextValue.cellHorizontalPadding,
36
- cellVerticalPadding: cellVerticalPadding || parentContextValue.cellVerticalPadding
37
- };
38
- const borderViewStyle = (0, _TableCommon.generateBorderStyles)({
39
- borderColor: contextValue.borderColor,
40
- borderWidth: contextValue.borderWidth,
41
- borderStyle: contextValue.borderStyle,
42
- drawTopBorder,
43
- drawBottomBorder,
44
- drawStartBorder,
45
- drawEndBorder
46
- });
47
- return /*#__PURE__*/_react.default.createElement(_TableCommon.TableStyleContext.Provider, {
48
- value: contextValue
49
- }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
50
- style: [borderViewStyle, isTableHeader ? {
51
- backgroundColor: theme.colors.primary
52
- } : {}, style, styles.cellsContainer]
53
- }, children));
54
- };
55
- const styles = _reactNative.StyleSheet.create({
56
- cellsContainer: {
57
- flexDirection: "row"
58
- }
59
- });
60
- var _default = (0, _theming.withTheme)(TableRow);
61
- exports.default = _default;
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Table", {
7
- enumerable: true,
8
- get: function () {
9
- return _Table.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "TableCell", {
13
- enumerable: true,
14
- get: function () {
15
- return _TableCell.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "TableRow", {
19
- enumerable: true,
20
- get: function () {
21
- return _TableRow.default;
22
- }
23
- });
24
- var _Table = _interopRequireDefault(require("./Table"));
25
- var _TableRow = _interopRequireDefault(require("./TableRow"));
26
- var _TableCell = _interopRequireDefault(require("./TableCell"));
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }