@draftbit/core 46.10.1-bdc763.2 → 46.10.2-30afd1.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.
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +6 -23
- package/lib/commonjs/components/Checkbox/context.js +1 -1
- package/lib/commonjs/components/Picker/Picker.js +13 -3
- package/lib/commonjs/index.js +0 -19
- package/lib/module/components/Accordion/AccordionItem.js +25 -4
- package/lib/module/components/Picker/Picker.js +13 -3
- package/lib/module/index.js +0 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Picker/Picker.js +12 -3
- package/src/components/Picker/Picker.tsx +12 -3
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/lib/commonjs/components/Table/Table.js +0 -123
- package/lib/commonjs/components/Table/TableCell.js +0 -49
- package/lib/commonjs/components/Table/TableCommon.js +0 -30
- package/lib/commonjs/components/Table/TableRow.js +0 -61
- package/lib/commonjs/components/Table/index.js +0 -27
- package/lib/commonjs/mappings/Table.js +0 -140
- package/lib/module/components/Table/Table.js +0 -114
- package/lib/module/components/Table/TableCell.js +0 -41
- package/lib/module/components/Table/TableCommon.js +0 -21
- package/lib/module/components/Table/TableRow.js +0 -53
- package/lib/module/components/Table/index.js +0 -3
- package/lib/module/mappings/Table.js +0 -133
- package/lib/typescript/src/components/Table/Table.d.ts +0 -19
- package/lib/typescript/src/components/Table/Table.d.ts.map +0 -1
- package/lib/typescript/src/components/Table/TableCell.d.ts +0 -9
- package/lib/typescript/src/components/Table/TableCell.d.ts.map +0 -1
- package/lib/typescript/src/components/Table/TableCommon.d.ts +0 -20
- package/lib/typescript/src/components/Table/TableCommon.d.ts.map +0 -1
- package/lib/typescript/src/components/Table/TableRow.d.ts +0 -14
- package/lib/typescript/src/components/Table/TableRow.d.ts.map +0 -1
- package/lib/typescript/src/components/Table/index.d.ts +0 -4
- package/lib/typescript/src/components/Table/index.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Table.d.ts +0 -337
- package/lib/typescript/src/mappings/Table.d.ts.map +0 -1
- package/src/components/Table/Table.js +0 -93
- package/src/components/Table/Table.tsx +0 -176
- package/src/components/Table/TableCell.js +0 -31
- package/src/components/Table/TableCell.tsx +0 -63
- package/src/components/Table/TableCommon.js +0 -12
- package/src/components/Table/TableCommon.ts +0 -40
- package/src/components/Table/TableRow.js +0 -37
- package/src/components/Table/TableRow.tsx +0 -77
- package/src/components/Table/index.js +0 -3
- package/src/components/Table/index.tsx +0 -3
- package/src/mappings/Table.js +0 -150
- package/src/mappings/Table.ts +0 -170
|
@@ -14,7 +14,8 @@ var _Checkbox = _interopRequireDefault(require("./Checkbox"));
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
var
|
|
17
|
+
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); }
|
|
18
|
+
let Direction;
|
|
18
19
|
exports.Direction = Direction;
|
|
19
20
|
(function (Direction) {
|
|
20
21
|
Direction["Row"] = "row";
|
|
@@ -57,6 +58,7 @@ const CheckboxRow = _ref => {
|
|
|
57
58
|
setInternalValue(status);
|
|
58
59
|
}
|
|
59
60
|
}, [status]);
|
|
61
|
+
|
|
60
62
|
// This special logic is to handle weird APIs like Airtable that return
|
|
61
63
|
// true or undefined for a boolean
|
|
62
64
|
const previousDefaultValue = (0, _hooks.usePrevious)(defaultValue);
|
|
@@ -80,14 +82,13 @@ const CheckboxRow = _ref => {
|
|
|
80
82
|
textStyles,
|
|
81
83
|
viewStyles
|
|
82
84
|
} = (0, _utilities.extractStyles)(style);
|
|
83
|
-
return /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
85
|
+
return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
|
|
84
86
|
onPress: handlePress,
|
|
85
87
|
style: [viewStyles, styles.mainParent, {
|
|
86
88
|
flexDirection: direction
|
|
87
89
|
}],
|
|
88
|
-
disabled: disabled
|
|
89
|
-
|
|
90
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
90
|
+
disabled: disabled
|
|
91
|
+
}, rest), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
91
92
|
style: [styles.label, {
|
|
92
93
|
alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
|
|
93
94
|
}, labelContainerStyle]
|
|
@@ -124,22 +125,4 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
124
125
|
}
|
|
125
126
|
});
|
|
126
127
|
var _default = CheckboxRow;
|
|
127
|
-
exports.default = _default;ems: "center",
|
|
128
|
-
justifyContent: "space-around",
|
|
129
|
-
paddingStart: 20,
|
|
130
|
-
minHeight: 50,
|
|
131
|
-
paddingEnd: 20,
|
|
132
|
-
display: "flex",
|
|
133
|
-
..._reactNative.Platform.select({
|
|
134
|
-
web: {
|
|
135
|
-
cursor: "pointer",
|
|
136
|
-
userSelect: "none"
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
},
|
|
140
|
-
label: {
|
|
141
|
-
flex: 3
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
var _default = CheckboxRow;
|
|
145
128
|
exports.default = _default;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.checkboxGroupContext = exports.Direction = void 0;
|
|
7
7
|
exports.useCheckboxGroupContext = useCheckboxGroupContext;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
|
|
9
|
+
let Direction;
|
|
10
10
|
exports.Direction = Direction;
|
|
11
11
|
(function (Direction) {
|
|
12
12
|
Direction["Horizontal"] = "horizontal";
|
|
@@ -58,7 +58,7 @@ const Picker = _ref => {
|
|
|
58
58
|
defaultValue,
|
|
59
59
|
Icon,
|
|
60
60
|
style,
|
|
61
|
-
placeholder,
|
|
61
|
+
placeholder = "Select an option",
|
|
62
62
|
value,
|
|
63
63
|
disabled = false,
|
|
64
64
|
assistiveText,
|
|
@@ -99,7 +99,14 @@ const Picker = _ref => {
|
|
|
99
99
|
_reactNative.Keyboard.dismiss();
|
|
100
100
|
}
|
|
101
101
|
}, [pickerVisible, autoDismissKeyboard]);
|
|
102
|
-
const
|
|
102
|
+
const normalizedOptions = normalizeOptions(options);
|
|
103
|
+
|
|
104
|
+
//Underlying Picker component defaults selection to first element when value is not provided (or undefined)
|
|
105
|
+
//Placholder must be the 1st option in order to allow selection of the 'actual' 1st option
|
|
106
|
+
const pickerOptions = placeholder ? [{
|
|
107
|
+
label: placeholder,
|
|
108
|
+
value: placeholder
|
|
109
|
+
}, ...normalizedOptions] : normalizedOptions;
|
|
103
110
|
const {
|
|
104
111
|
viewStyles,
|
|
105
112
|
textStyles
|
|
@@ -199,9 +206,12 @@ const Picker = _ref => {
|
|
|
199
206
|
} : {})
|
|
200
207
|
};
|
|
201
208
|
const handleValueChange = (newValue, itemIndex) => {
|
|
202
|
-
if (newValue !== "") {
|
|
209
|
+
if (newValue !== "" && newValue !== placeholder) {
|
|
203
210
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue, itemIndex);
|
|
204
211
|
setInternalValue(newValue);
|
|
212
|
+
} else if (newValue === placeholder) {
|
|
213
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange("", 0);
|
|
214
|
+
setInternalValue(undefined);
|
|
205
215
|
}
|
|
206
216
|
};
|
|
207
217
|
return (
|
package/lib/commonjs/index.js
CHANGED
|
@@ -369,24 +369,6 @@ Object.defineProperty(exports, "TabViewItem", {
|
|
|
369
369
|
return _TabView.TabViewItem;
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
|
-
Object.defineProperty(exports, "Table", {
|
|
373
|
-
enumerable: true,
|
|
374
|
-
get: function () {
|
|
375
|
-
return _Table.Table;
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
Object.defineProperty(exports, "TableCell", {
|
|
379
|
-
enumerable: true,
|
|
380
|
-
get: function () {
|
|
381
|
-
return _Table.TableCell;
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
Object.defineProperty(exports, "TableRow", {
|
|
385
|
-
enumerable: true,
|
|
386
|
-
get: function () {
|
|
387
|
-
return _Table.TableRow;
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
372
|
Object.defineProperty(exports, "TextField", {
|
|
391
373
|
enumerable: true,
|
|
392
374
|
get: function () {
|
|
@@ -473,7 +455,6 @@ var _TabView = require("./components/TabView");
|
|
|
473
455
|
var _Markdown = _interopRequireDefault(require("./components/Markdown"));
|
|
474
456
|
var _BottomSheet = require("./components/BottomSheet");
|
|
475
457
|
var _YotubePlayer = _interopRequireDefault(require("./components/YotubePlayer"));
|
|
476
|
-
var _Table = require("./components/Table");
|
|
477
458
|
var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
|
|
478
459
|
var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
|
|
479
460
|
var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
|
|
@@ -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 { Pressable, StyleSheet, View } from "react-native";
|
|
4
3
|
import Text from "../Text";
|
|
@@ -18,9 +17,10 @@ const AccordionItem = _ref => {
|
|
|
18
17
|
textStyles,
|
|
19
18
|
viewStyles
|
|
20
19
|
} = extractStyles(style);
|
|
21
|
-
return /*#__PURE__*/React.createElement(Pressable,
|
|
22
|
-
style: [styles.container, viewStyles]
|
|
23
|
-
|
|
20
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
21
|
+
style: [styles.container, viewStyles],
|
|
22
|
+
...rest
|
|
23
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
24
24
|
style: styles.row
|
|
25
25
|
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
26
26
|
name: icon,
|
|
@@ -51,4 +51,25 @@ const styles = StyleSheet.create({
|
|
|
51
51
|
justifyContent: "center"
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
+
export default withTheme(AccordionItem);xtStyles
|
|
55
|
+
}, label))));
|
|
56
|
+
};
|
|
57
|
+
const styles = StyleSheet.create({
|
|
58
|
+
container: {
|
|
59
|
+
padding: 8
|
|
60
|
+
},
|
|
61
|
+
row: {
|
|
62
|
+
flexDirection: "row",
|
|
63
|
+
alignItems: "center",
|
|
64
|
+
paddingLeft: 8
|
|
65
|
+
},
|
|
66
|
+
item: {
|
|
67
|
+
marginVertical: 6,
|
|
68
|
+
paddingLeft: 8
|
|
69
|
+
},
|
|
70
|
+
content: {
|
|
71
|
+
flex: 1,
|
|
72
|
+
justifyContent: "center"
|
|
73
|
+
}
|
|
74
|
+
});
|
|
54
75
|
export default withTheme(AccordionItem);
|
|
@@ -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
|
|
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 (
|
package/lib/module/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
|
|
|
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;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;IAC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,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,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAu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,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;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.
|
|
3
|
+
"version": "46.10.2-30afd1.2+30afd11",
|
|
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.
|
|
44
|
+
"@draftbit/types": "^46.10.2-30afd1.2+30afd11",
|
|
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": "
|
|
103
|
+
"gitHead": "30afd1158e7425e7a7d383e64c1803fb8b4aa190"
|
|
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
|
|
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
|
|
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;
|