@draftbit/core 46.4.4-d93fe1.2 → 46.4.4-dc9728.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/Container.js +5 -17
- package/lib/commonjs/components/DatePicker/DatePicker.js +18 -8
- package/lib/commonjs/components/ProgressBar.js +7 -23
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/mappings/DatePicker.js +13 -0
- package/lib/module/components/DatePicker/DatePicker.js +17 -8
- package/lib/module/components/ToggleButton.js +3 -17
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/DatePicker.js +14 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
- package/package.json +4 -6
- package/src/components/DatePicker/DatePicker.js +14 -8
- package/src/components/DatePicker/DatePicker.tsx +23 -7
- package/src/index.js +0 -1
- package/src/index.tsx +0 -1
- package/src/mappings/DatePicker.js +21 -1
- package/src/mappings/DatePicker.ts +23 -0
- package/lib/commonjs/components/TabView/TabView.js +0 -102
- package/lib/commonjs/components/TabView/TabViewItem.js +0 -26
- package/lib/commonjs/components/TabView/index.js +0 -23
- package/lib/commonjs/mappings/TabView.js +0 -79
- package/lib/module/components/TabView/TabView.js +0 -87
- package/lib/module/components/TabView/TabViewItem.js +0 -18
- package/lib/module/components/TabView/index.js +0 -2
- package/lib/module/mappings/TabView.js +0 -70
- package/lib/typescript/src/components/TabView/TabView.d.ts +0 -19
- package/lib/typescript/src/components/TabView/TabViewItem.d.ts +0 -10
- package/lib/typescript/src/components/TabView/index.d.ts +0 -2
- package/lib/typescript/src/mappings/TabView.d.ts +0 -111
- package/src/components/TabView/TabView.js +0 -34
- package/src/components/TabView/TabView.tsx +0 -97
- package/src/components/TabView/TabViewItem.js +0 -5
- package/src/components/TabView/TabViewItem.tsx +0 -21
- package/src/components/TabView/index.js +0 -2
- package/src/components/TabView/index.tsx +0 -2
- package/src/mappings/TabView.js +0 -73
- package/src/mappings/TabView.ts +0 -80
|
@@ -19,6 +19,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
19
|
|
|
20
20
|
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; }
|
|
21
21
|
|
|
22
|
+
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); }
|
|
23
|
+
|
|
22
24
|
const Container = _ref => {
|
|
23
25
|
let {
|
|
24
26
|
useThemeGutterPadding,
|
|
@@ -80,10 +82,9 @@ const Container = _ref => {
|
|
|
80
82
|
};
|
|
81
83
|
const Wrap = elevation ? _Elevation.default : _reactNative.View;
|
|
82
84
|
if (elevation) containerStyle.elevation = elevation;
|
|
83
|
-
return /*#__PURE__*/React.createElement(Wrap, {
|
|
84
|
-
style: [containerStyle, style]
|
|
85
|
-
|
|
86
|
-
}, backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
|
|
85
|
+
return /*#__PURE__*/React.createElement(Wrap, _extends({
|
|
86
|
+
style: [containerStyle, style]
|
|
87
|
+
}, rest), backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
|
|
87
88
|
source: typeof backgroundImage === "string" ? {
|
|
88
89
|
uri: backgroundImage
|
|
89
90
|
} : backgroundImage,
|
|
@@ -100,17 +101,4 @@ const Container = _ref => {
|
|
|
100
101
|
|
|
101
102
|
var _default = (0, _theming.withTheme)(Container);
|
|
102
103
|
|
|
103
|
-
exports.default = _default;izeMode: backgroundImageResizeMode,
|
|
104
|
-
style: {
|
|
105
|
-
flex: 1
|
|
106
|
-
}
|
|
107
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
108
|
-
style: innerStyle
|
|
109
|
-
}, children)) : /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
110
|
-
style: innerStyle
|
|
111
|
-
}, children));
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
var _default = (0, _theming.withTheme)(Container);
|
|
115
|
-
|
|
116
104
|
exports.default = _default;
|
|
@@ -21,6 +21,8 @@ var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
|
21
21
|
|
|
22
22
|
var _DatePickerComponent = _interopRequireDefault(require("./DatePickerComponent"));
|
|
23
23
|
|
|
24
|
+
var _utilities = require("../../utilities");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
28
|
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); }
|
|
@@ -57,7 +59,11 @@ const DatePicker = _ref => {
|
|
|
57
59
|
rightIconName,
|
|
58
60
|
leftIconMode = "inset",
|
|
59
61
|
label,
|
|
62
|
+
labelSize,
|
|
63
|
+
labelColor,
|
|
60
64
|
placeholder,
|
|
65
|
+
borderColor: inputBorderColor,
|
|
66
|
+
borderColorActive: inputBorderColorActive,
|
|
61
67
|
...props
|
|
62
68
|
} = _ref;
|
|
63
69
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -74,6 +80,9 @@ const DatePicker = _ref => {
|
|
|
74
80
|
measured: false,
|
|
75
81
|
width: 0
|
|
76
82
|
});
|
|
83
|
+
const {
|
|
84
|
+
textStyles
|
|
85
|
+
} = (0, _utilities.extractStyles)(style);
|
|
77
86
|
|
|
78
87
|
const getValidDate = () => {
|
|
79
88
|
if (!value) {
|
|
@@ -175,8 +184,8 @@ const DatePicker = _ref => {
|
|
|
175
184
|
|
|
176
185
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
177
186
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
178
|
-
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
179
|
-
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
187
|
+
const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
|
|
188
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
180
189
|
const hasActiveOutline = focused;
|
|
181
190
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
182
191
|
inputTextColor = colors.strong;
|
|
@@ -188,9 +197,9 @@ const DatePicker = _ref => {
|
|
|
188
197
|
underlineColor = "transparent";
|
|
189
198
|
backgroundColor = colors.divider;
|
|
190
199
|
} else {
|
|
191
|
-
activeColor = colors.primary;
|
|
192
|
-
placeholderColor = borderColor = colors.light;
|
|
193
|
-
underlineColor = colors.light;
|
|
200
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
201
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
202
|
+
underlineColor = inputBorderColor || colors.light;
|
|
194
203
|
backgroundColor = colors.background;
|
|
195
204
|
}
|
|
196
205
|
|
|
@@ -250,6 +259,7 @@ const DatePicker = _ref => {
|
|
|
250
259
|
};
|
|
251
260
|
const labelStyle = { ...typography.subtitle1,
|
|
252
261
|
top: type === "solid" ? 16 : 0,
|
|
262
|
+
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
253
263
|
left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
|
|
254
264
|
transform: [{
|
|
255
265
|
// Move label to top
|
|
@@ -273,7 +283,7 @@ const DatePicker = _ref => {
|
|
|
273
283
|
};
|
|
274
284
|
const inputStyles = [styles.input, inputStyle, type === "solid" ? {
|
|
275
285
|
marginHorizontal: 12
|
|
276
|
-
} : {}]; // const render = (props) => <NativeTextInput {...props} />;
|
|
286
|
+
} : {}, textStyles]; // const render = (props) => <NativeTextInput {...props} />;
|
|
277
287
|
|
|
278
288
|
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
279
289
|
style: [styles.container, style]
|
|
@@ -319,7 +329,7 @@ const DatePicker = _ref => {
|
|
|
319
329
|
style: [styles.placeholder, type === "solid" ? {
|
|
320
330
|
paddingHorizontal: 12
|
|
321
331
|
} : {}, labelStyle, {
|
|
322
|
-
color: colors.light,
|
|
332
|
+
color: labelColor || colors.light,
|
|
323
333
|
opacity: labeled.interpolate({
|
|
324
334
|
inputRange: [0, 1],
|
|
325
335
|
outputRange: [hasActiveOutline ? 1 : 0, 0]
|
|
@@ -330,7 +340,7 @@ const DatePicker = _ref => {
|
|
|
330
340
|
style: [styles.placeholder, type === "solid" ? {
|
|
331
341
|
paddingHorizontal: 12
|
|
332
342
|
} : {}, labelStyle, {
|
|
333
|
-
color:
|
|
343
|
+
color: labelColor || placeholder,
|
|
334
344
|
opacity: hasActiveOutline ? labeled : 1
|
|
335
345
|
}],
|
|
336
346
|
numberOfLines: 1
|
|
@@ -13,6 +13,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
13
13
|
|
|
14
14
|
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; }
|
|
15
15
|
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
|
|
16
20
|
const INDETERMINATE_WIDTH_FACTOR = 0.3;
|
|
17
21
|
const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_WIDTH_FACTOR);
|
|
18
22
|
|
|
@@ -20,7 +24,7 @@ class ProgressBar extends _react.Component {
|
|
|
20
24
|
constructor(props) {
|
|
21
25
|
super(props);
|
|
22
26
|
|
|
23
|
-
this
|
|
27
|
+
_defineProperty(this, "handleLayout", event => {
|
|
24
28
|
const {
|
|
25
29
|
width = 150,
|
|
26
30
|
onLayout
|
|
@@ -35,7 +39,7 @@ class ProgressBar extends _react.Component {
|
|
|
35
39
|
if (onLayout) {
|
|
36
40
|
onLayout(event);
|
|
37
41
|
}
|
|
38
|
-
};
|
|
42
|
+
});
|
|
39
43
|
|
|
40
44
|
const {
|
|
41
45
|
progress: progressP = 0,
|
|
@@ -89,6 +93,7 @@ class ProgressBar extends _react.Component {
|
|
|
89
93
|
_reactNative.Animated[animationType](this.state.progress, { ...animationConfig,
|
|
90
94
|
toValue: progress,
|
|
91
95
|
velocity: 0,
|
|
96
|
+
//adjust this value if animation fails - velocity is required
|
|
92
97
|
useNativeDriver
|
|
93
98
|
}).start();
|
|
94
99
|
} else {
|
|
@@ -160,27 +165,6 @@ class ProgressBar extends _react.Component {
|
|
|
160
165
|
})
|
|
161
166
|
}]
|
|
162
167
|
};
|
|
163
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
164
|
-
style: [containerStyle, style],
|
|
165
|
-
onLayout: this.handleLayout,
|
|
166
|
-
...restProps
|
|
167
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
|
|
168
|
-
style: progressStyle
|
|
169
|
-
}), children);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
exports.default = ProgressBar;h / (_reactNative.I18nManager.isRTL ? 2 : -2), 0]
|
|
175
|
-
})
|
|
176
|
-
}, {
|
|
177
|
-
// Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
|
|
178
|
-
scaleX: this.state.progress.interpolate({
|
|
179
|
-
inputRange: [0, 1],
|
|
180
|
-
outputRange: [0.0001, 1]
|
|
181
|
-
})
|
|
182
|
-
}]
|
|
183
|
-
};
|
|
184
168
|
return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
|
|
185
169
|
style: [containerStyle, style],
|
|
186
170
|
onLayout: this.handleLayout
|
package/lib/commonjs/index.js
CHANGED
|
@@ -369,18 +369,6 @@ Object.defineProperty(exports, "SwitchRow", {
|
|
|
369
369
|
return _Switch.SwitchRow;
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
|
-
Object.defineProperty(exports, "TabView", {
|
|
373
|
-
enumerable: true,
|
|
374
|
-
get: function () {
|
|
375
|
-
return _TabView.TabView;
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
Object.defineProperty(exports, "TabViewItem", {
|
|
379
|
-
enumerable: true,
|
|
380
|
-
get: function () {
|
|
381
|
-
return _TabView.TabViewItem;
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
372
|
Object.defineProperty(exports, "TextField", {
|
|
385
373
|
enumerable: true,
|
|
386
374
|
get: function () {
|
|
@@ -484,8 +472,6 @@ var _ActionSheet = require("./components/ActionSheet");
|
|
|
484
472
|
|
|
485
473
|
var _Swiper = require("./components/Swiper");
|
|
486
474
|
|
|
487
|
-
var _TabView = require("./components/TabView");
|
|
488
|
-
|
|
489
475
|
var _Layout = require("./components/Layout");
|
|
490
476
|
|
|
491
477
|
var _index = require("./components/RadioButton/index");
|
|
@@ -18,6 +18,12 @@ const SEED_DATA_PROPS = {
|
|
|
18
18
|
required: true,
|
|
19
19
|
group: _types.GROUPS.data
|
|
20
20
|
},
|
|
21
|
+
labelSize: (0, _types.createNumberProp)({
|
|
22
|
+
label: "Label Size"
|
|
23
|
+
}),
|
|
24
|
+
labelColor: (0, _types.createColorProp)({
|
|
25
|
+
label: "Label Color"
|
|
26
|
+
}),
|
|
21
27
|
mode: {
|
|
22
28
|
label: "Mode",
|
|
23
29
|
description: "Choose between date, time and datetime",
|
|
@@ -29,6 +35,12 @@ const SEED_DATA_PROPS = {
|
|
|
29
35
|
options: ["date", "time", "datetime"],
|
|
30
36
|
group: _types.GROUPS.basic
|
|
31
37
|
},
|
|
38
|
+
borderColor: (0, _types.createColorProp)({
|
|
39
|
+
label: "Border Color"
|
|
40
|
+
}),
|
|
41
|
+
borderColorActive: (0, _types.createColorProp)({
|
|
42
|
+
label: "Border Color"
|
|
43
|
+
}),
|
|
32
44
|
format: {
|
|
33
45
|
label: "Format",
|
|
34
46
|
description: "Create an output format for the date.",
|
|
@@ -145,6 +157,7 @@ const SEED_DATA = [{
|
|
|
145
157
|
category: _types.COMPONENT_TYPES.input,
|
|
146
158
|
layout: null,
|
|
147
159
|
triggers: [_types.Triggers.OnDateChange],
|
|
160
|
+
StylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Size, _types.StylesPanelSections.Typography],
|
|
148
161
|
props: { ...SEED_DATA_PROPS,
|
|
149
162
|
type: {
|
|
150
163
|
label: "Appearance",
|
|
@@ -8,6 +8,7 @@ import { withTheme } from "../../theming";
|
|
|
8
8
|
import Portal from "../Portal/Portal";
|
|
9
9
|
import Touchable from "../Touchable";
|
|
10
10
|
import DateTimePicker from "./DatePickerComponent";
|
|
11
|
+
import { extractStyles } from "../../utilities";
|
|
11
12
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
12
13
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
13
14
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -35,7 +36,11 @@ const DatePicker = _ref => {
|
|
|
35
36
|
rightIconName,
|
|
36
37
|
leftIconMode = "inset",
|
|
37
38
|
label,
|
|
39
|
+
labelSize,
|
|
40
|
+
labelColor,
|
|
38
41
|
placeholder,
|
|
42
|
+
borderColor: inputBorderColor,
|
|
43
|
+
borderColorActive: inputBorderColorActive,
|
|
39
44
|
...props
|
|
40
45
|
} = _ref;
|
|
41
46
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -52,6 +57,9 @@ const DatePicker = _ref => {
|
|
|
52
57
|
measured: false,
|
|
53
58
|
width: 0
|
|
54
59
|
});
|
|
60
|
+
const {
|
|
61
|
+
textStyles
|
|
62
|
+
} = extractStyles(style);
|
|
55
63
|
|
|
56
64
|
const getValidDate = () => {
|
|
57
65
|
if (!value) {
|
|
@@ -153,8 +161,8 @@ const DatePicker = _ref => {
|
|
|
153
161
|
|
|
154
162
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
155
163
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
156
|
-
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
157
|
-
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
164
|
+
const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
|
|
165
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
158
166
|
const hasActiveOutline = focused;
|
|
159
167
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
160
168
|
inputTextColor = colors.strong;
|
|
@@ -166,9 +174,9 @@ const DatePicker = _ref => {
|
|
|
166
174
|
underlineColor = "transparent";
|
|
167
175
|
backgroundColor = colors.divider;
|
|
168
176
|
} else {
|
|
169
|
-
activeColor = colors.primary;
|
|
170
|
-
placeholderColor = borderColor = colors.light;
|
|
171
|
-
underlineColor = colors.light;
|
|
177
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
178
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
179
|
+
underlineColor = inputBorderColor || colors.light;
|
|
172
180
|
backgroundColor = colors.background;
|
|
173
181
|
}
|
|
174
182
|
|
|
@@ -228,6 +236,7 @@ const DatePicker = _ref => {
|
|
|
228
236
|
};
|
|
229
237
|
const labelStyle = { ...typography.subtitle1,
|
|
230
238
|
top: type === "solid" ? 16 : 0,
|
|
239
|
+
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
231
240
|
left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
|
|
232
241
|
transform: [{
|
|
233
242
|
// Move label to top
|
|
@@ -251,7 +260,7 @@ const DatePicker = _ref => {
|
|
|
251
260
|
};
|
|
252
261
|
const inputStyles = [styles.input, inputStyle, type === "solid" ? {
|
|
253
262
|
marginHorizontal: 12
|
|
254
|
-
} : {}]; // const render = (props) => <NativeTextInput {...props} />;
|
|
263
|
+
} : {}, textStyles]; // const render = (props) => <NativeTextInput {...props} />;
|
|
255
264
|
|
|
256
265
|
return /*#__PURE__*/React.createElement(View, {
|
|
257
266
|
style: [styles.container, style]
|
|
@@ -297,7 +306,7 @@ const DatePicker = _ref => {
|
|
|
297
306
|
style: [styles.placeholder, type === "solid" ? {
|
|
298
307
|
paddingHorizontal: 12
|
|
299
308
|
} : {}, labelStyle, {
|
|
300
|
-
color: colors.light,
|
|
309
|
+
color: labelColor || colors.light,
|
|
301
310
|
opacity: labeled.interpolate({
|
|
302
311
|
inputRange: [0, 1],
|
|
303
312
|
outputRange: [hasActiveOutline ? 1 : 0, 0]
|
|
@@ -308,7 +317,7 @@ const DatePicker = _ref => {
|
|
|
308
317
|
style: [styles.placeholder, type === "solid" ? {
|
|
309
318
|
paddingHorizontal: 12
|
|
310
319
|
} : {}, labelStyle, {
|
|
311
|
-
color:
|
|
320
|
+
color: labelColor || placeholder,
|
|
312
321
|
opacity: hasActiveOutline ? labeled : 1
|
|
313
322
|
}],
|
|
314
323
|
numberOfLines: 1
|
|
@@ -1,3 +1,5 @@
|
|
|
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
3
|
import * as React from "react";
|
|
2
4
|
import { withTheme } from "../theming";
|
|
3
5
|
import { StyleSheet } from "react-native";
|
|
@@ -40,29 +42,13 @@ const ToggleButton = _ref => {
|
|
|
40
42
|
onPress(!internalValue);
|
|
41
43
|
};
|
|
42
44
|
|
|
43
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
45
|
+
return /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
44
46
|
Icon: Icon,
|
|
45
47
|
icon: icon,
|
|
46
48
|
size: iconSize,
|
|
47
49
|
color: internalValue ? colors[color] : colors[colorSecondary],
|
|
48
50
|
onPress: handlePress,
|
|
49
51
|
disabled: disabled,
|
|
50
|
-
style: [styles.mainContainer, {
|
|
51
|
-
width,
|
|
52
|
-
height,
|
|
53
|
-
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
54
|
-
borderColor: colors[borderColor]
|
|
55
|
-
}, style],
|
|
56
|
-
...rest
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const styles = StyleSheet.create({
|
|
61
|
-
mainContainer: {
|
|
62
|
-
borderWidth: 1
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
export default withTheme(ToggleButton);: disabled,
|
|
66
52
|
style: [styles.mainContainer, {
|
|
67
53
|
width,
|
|
68
54
|
height,
|
package/lib/module/index.js
CHANGED
|
@@ -29,7 +29,6 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
29
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
-
export { TabView, TabViewItem } from "./components/TabView";
|
|
33
32
|
export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
|
|
34
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
|
|
35
34
|
/* Deprecated: Fix or Delete! */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -10,6 +10,12 @@ const SEED_DATA_PROPS = {
|
|
|
10
10
|
required: true,
|
|
11
11
|
group: GROUPS.data
|
|
12
12
|
},
|
|
13
|
+
labelSize: createNumberProp({
|
|
14
|
+
label: "Label Size"
|
|
15
|
+
}),
|
|
16
|
+
labelColor: createColorProp({
|
|
17
|
+
label: "Label Color"
|
|
18
|
+
}),
|
|
13
19
|
mode: {
|
|
14
20
|
label: "Mode",
|
|
15
21
|
description: "Choose between date, time and datetime",
|
|
@@ -21,6 +27,12 @@ const SEED_DATA_PROPS = {
|
|
|
21
27
|
options: ["date", "time", "datetime"],
|
|
22
28
|
group: GROUPS.basic
|
|
23
29
|
},
|
|
30
|
+
borderColor: createColorProp({
|
|
31
|
+
label: "Border Color"
|
|
32
|
+
}),
|
|
33
|
+
borderColorActive: createColorProp({
|
|
34
|
+
label: "Border Color"
|
|
35
|
+
}),
|
|
24
36
|
format: {
|
|
25
37
|
label: "Format",
|
|
26
38
|
description: "Create an output format for the date.",
|
|
@@ -137,6 +149,7 @@ export const SEED_DATA = [{
|
|
|
137
149
|
category: COMPONENT_TYPES.input,
|
|
138
150
|
layout: null,
|
|
139
151
|
triggers: [Triggers.OnDateChange],
|
|
152
|
+
StylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Size, StylesPanelSections.Typography],
|
|
140
153
|
props: { ...SEED_DATA_PROPS,
|
|
141
154
|
type: {
|
|
142
155
|
label: "Appearance",
|
|
@@ -15,10 +15,14 @@ declare type Props = {
|
|
|
15
15
|
mode?: "date" | "time" | "datetime";
|
|
16
16
|
type?: "solid" | "underline";
|
|
17
17
|
label?: string;
|
|
18
|
+
labelSize?: number;
|
|
19
|
+
labelColor: string;
|
|
18
20
|
placeholder?: string;
|
|
19
21
|
leftIconName?: string;
|
|
20
22
|
leftIconMode?: "outset" | "inset";
|
|
21
23
|
rightIconName?: string;
|
|
24
|
+
borderColor?: string;
|
|
25
|
+
borderColorActive?: string;
|
|
22
26
|
} & IconSlot & TextInputProps;
|
|
23
27
|
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
|
|
24
28
|
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
@@ -29,7 +29,6 @@ export { default as Touchable } from "./components/Touchable";
|
|
|
29
29
|
export { AccordionGroup, AccordionItem } from "./components/Accordion";
|
|
30
30
|
export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/ActionSheet";
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
|
-
export { TabView, TabViewItem } from "./components/TabView";
|
|
33
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
34
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
35
34
|
export { default as CardBlock } from "./components/CardBlock";
|
|
@@ -5,6 +5,7 @@ export declare const SEED_DATA: {
|
|
|
5
5
|
category: string;
|
|
6
6
|
layout: null;
|
|
7
7
|
triggers: string[];
|
|
8
|
+
StylesPanelSections: string[];
|
|
8
9
|
props: {
|
|
9
10
|
type: {
|
|
10
11
|
label: string;
|
|
@@ -27,6 +28,27 @@ export declare const SEED_DATA: {
|
|
|
27
28
|
required: boolean;
|
|
28
29
|
group: string;
|
|
29
30
|
};
|
|
31
|
+
labelSize: {
|
|
32
|
+
label: string;
|
|
33
|
+
description: string;
|
|
34
|
+
formType: string;
|
|
35
|
+
propType: string;
|
|
36
|
+
group: string;
|
|
37
|
+
defaultValue: null;
|
|
38
|
+
editable: boolean;
|
|
39
|
+
required: boolean;
|
|
40
|
+
step: number;
|
|
41
|
+
};
|
|
42
|
+
labelColor: {
|
|
43
|
+
group: string;
|
|
44
|
+
label: string;
|
|
45
|
+
description: string;
|
|
46
|
+
editable: boolean;
|
|
47
|
+
required: boolean;
|
|
48
|
+
defaultValue: null;
|
|
49
|
+
formType: string;
|
|
50
|
+
propType: string;
|
|
51
|
+
};
|
|
30
52
|
mode: {
|
|
31
53
|
label: string;
|
|
32
54
|
description: string;
|
|
@@ -38,6 +60,26 @@ export declare const SEED_DATA: {
|
|
|
38
60
|
options: string[];
|
|
39
61
|
group: string;
|
|
40
62
|
};
|
|
63
|
+
borderColor: {
|
|
64
|
+
group: string;
|
|
65
|
+
label: string;
|
|
66
|
+
description: string;
|
|
67
|
+
editable: boolean;
|
|
68
|
+
required: boolean;
|
|
69
|
+
defaultValue: null;
|
|
70
|
+
formType: string;
|
|
71
|
+
propType: string;
|
|
72
|
+
};
|
|
73
|
+
borderColorActive: {
|
|
74
|
+
group: string;
|
|
75
|
+
label: string;
|
|
76
|
+
description: string;
|
|
77
|
+
editable: boolean;
|
|
78
|
+
required: boolean;
|
|
79
|
+
defaultValue: null;
|
|
80
|
+
formType: string;
|
|
81
|
+
propType: string;
|
|
82
|
+
};
|
|
41
83
|
format: {
|
|
42
84
|
label: string;
|
|
43
85
|
description: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.4.4-
|
|
3
|
+
"version": "46.4.4-dc9728.2+dc9728c",
|
|
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.4.4-
|
|
44
|
+
"@draftbit/types": "^46.4.4-dc9728.2+dc9728c",
|
|
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",
|
|
@@ -54,9 +54,7 @@
|
|
|
54
54
|
"lodash.omit": "^4.5.0",
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
56
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
57
|
-
"react-native-
|
|
58
|
-
"react-native-svg": "^12.3.0",
|
|
59
|
-
"react-native-tab-view": "^3.0.0",
|
|
57
|
+
"react-native-svg": "12.3.0",
|
|
60
58
|
"react-native-typography": "^1.4.1",
|
|
61
59
|
"react-native-web-swiper": "^2.2.3"
|
|
62
60
|
},
|
|
@@ -83,5 +81,5 @@
|
|
|
83
81
|
]
|
|
84
82
|
]
|
|
85
83
|
},
|
|
86
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "dc9728c2090d6315a258345e71d4d61f903ce2a1"
|
|
87
85
|
}
|
|
@@ -6,6 +6,7 @@ import { withTheme } from "../../theming";
|
|
|
6
6
|
import Portal from "../Portal/Portal";
|
|
7
7
|
import Touchable from "../Touchable";
|
|
8
8
|
import DateTimePicker from "./DatePickerComponent";
|
|
9
|
+
import { extractStyles } from "../../utilities";
|
|
9
10
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
10
11
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
11
12
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -24,7 +25,7 @@ const MONTHS = [
|
|
|
24
25
|
"November",
|
|
25
26
|
"December",
|
|
26
27
|
];
|
|
27
|
-
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, placeholder, ...props }) => {
|
|
28
|
+
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, ...props }) => {
|
|
28
29
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
29
30
|
React.useEffect(() => {
|
|
30
31
|
if (defaultValue != null) {
|
|
@@ -36,6 +37,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
36
37
|
const [placeholder1, setPlaceholder1] = React.useState("");
|
|
37
38
|
const [focused, setFocused] = React.useState(false);
|
|
38
39
|
const [labelLayout, setLabelLayout] = React.useState({ measured: false, width: 0 });
|
|
40
|
+
const { textStyles } = extractStyles(style);
|
|
39
41
|
const getValidDate = () => {
|
|
40
42
|
if (!value) {
|
|
41
43
|
return new Date();
|
|
@@ -125,8 +127,10 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
125
127
|
};
|
|
126
128
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
127
129
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
128
|
-
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
129
|
-
const MINIMIZED_LABEL_FONT_SIZE =
|
|
130
|
+
const MAXIMIZED_LABEL_FONT_SIZE = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontSize) || typography.subtitle1.fontSize;
|
|
131
|
+
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
132
|
+
? labelSize
|
|
133
|
+
: typography.caption.fontSize;
|
|
130
134
|
const hasActiveOutline = focused;
|
|
131
135
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
132
136
|
inputTextColor = colors.strong;
|
|
@@ -138,9 +142,9 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
138
142
|
backgroundColor = colors.divider;
|
|
139
143
|
}
|
|
140
144
|
else {
|
|
141
|
-
activeColor = colors.primary;
|
|
142
|
-
placeholderColor = borderColor = colors.light;
|
|
143
|
-
underlineColor = colors.light;
|
|
145
|
+
activeColor = inputBorderColorActive || colors.primary;
|
|
146
|
+
placeholderColor = borderColor = inputBorderColor || colors.light;
|
|
147
|
+
underlineColor = inputBorderColor || colors.light;
|
|
144
148
|
backgroundColor = colors.background;
|
|
145
149
|
}
|
|
146
150
|
const { lineHeight, ...subtitle1 } = typography.subtitle1;
|
|
@@ -202,6 +206,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
202
206
|
const labelStyle = {
|
|
203
207
|
...typography.subtitle1,
|
|
204
208
|
top: type === "solid" ? 16 : 0,
|
|
209
|
+
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
205
210
|
left: leftIconName && leftIconMode === "inset"
|
|
206
211
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
207
212
|
: 0,
|
|
@@ -245,6 +250,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
245
250
|
styles.input,
|
|
246
251
|
inputStyle,
|
|
247
252
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
253
|
+
textStyles,
|
|
248
254
|
];
|
|
249
255
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
250
256
|
return (React.createElement(View, { style: [styles.container, style] },
|
|
@@ -282,7 +288,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
282
288
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
283
289
|
labelStyle,
|
|
284
290
|
{
|
|
285
|
-
color: colors.light,
|
|
291
|
+
color: labelColor || colors.light,
|
|
286
292
|
opacity: labeled.interpolate({
|
|
287
293
|
inputRange: [0, 1],
|
|
288
294
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -294,7 +300,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
294
300
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
295
301
|
labelStyle,
|
|
296
302
|
{
|
|
297
|
-
color:
|
|
303
|
+
color: labelColor || placeholder,
|
|
298
304
|
opacity: hasActiveOutline ? labeled : 1,
|
|
299
305
|
},
|
|
300
306
|
], numberOfLines: 1 }, label))) : null,
|