@draftbit/core 46.4.4-9a666e.2 → 46.4.4-b0ea41.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/DatePicker/DatePicker.js +18 -8
- package/lib/commonjs/components/Text.js +6 -2
- package/lib/commonjs/components/TextField.js +5 -1
- package/lib/commonjs/mappings/DatePicker.js +13 -0
- package/lib/commonjs/mappings/TextField.js +1 -1
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +17 -8
- package/lib/module/components/Text.js +6 -2
- package/lib/module/components/TextField.js +5 -1
- package/lib/module/mappings/DatePicker.js +14 -1
- package/lib/module/mappings/TextField.js +1 -1
- package/lib/module/mappings/TextInput.js +1 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +4 -0
- package/lib/typescript/src/components/Text.d.ts +2 -1
- package/lib/typescript/src/components/TextField.d.ts +2 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +42 -0
- package/lib/typescript/src/mappings/TextField.d.ts +2 -2
- package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
- package/package.json +3 -4
- package/src/components/DatePicker/DatePicker.js +14 -8
- package/src/components/DatePicker/DatePicker.tsx +23 -7
- package/src/components/Text.js +8 -2
- package/src/components/Text.tsx +6 -1
- package/src/components/TextField.js +6 -1
- package/src/components/TextField.tsx +7 -1
- package/src/mappings/DatePicker.js +21 -1
- package/src/mappings/DatePicker.ts +23 -0
- package/src/mappings/TextField.js +1 -1
- package/src/mappings/TextField.ts +1 -1
- package/src/mappings/TextInput.js +1 -1
- package/src/mappings/TextInput.ts +1 -1
- package/lib/commonjs/mappings/Elements.js +0 -129
- package/lib/module/mappings/Elements.js +0 -121
- package/lib/typescript/src/mappings/Elements.d.ts +0 -49
- package/src/mappings/Elements.js +0 -143
- package/src/mappings/Elements.ts +0 -152
|
@@ -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
|
|
@@ -24,10 +24,14 @@ class Text extends React.Component {
|
|
|
24
24
|
super(...arguments);
|
|
25
25
|
|
|
26
26
|
_defineProperty(this, "_root", void 0);
|
|
27
|
+
|
|
28
|
+
_defineProperty(this, "state", {
|
|
29
|
+
nativeProps: {}
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
setNativeProps(args) {
|
|
30
|
-
|
|
34
|
+
this.state.nativeProps = args || {};
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
render() {
|
|
@@ -36,7 +40,7 @@ class Text extends React.Component {
|
|
|
36
40
|
...rest
|
|
37
41
|
} = this.props;
|
|
38
42
|
const writingDirection = _reactNative.I18nManager.isRTL ? "rtl" : "ltr";
|
|
39
|
-
return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({}, rest, {
|
|
43
|
+
return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({}, rest, this.state.nativeProps, {
|
|
40
44
|
ref: c => {
|
|
41
45
|
this._root = c;
|
|
42
46
|
},
|
|
@@ -32,6 +32,7 @@ class TextField extends React.Component {
|
|
|
32
32
|
super(...arguments);
|
|
33
33
|
|
|
34
34
|
_defineProperty(this, "state", {
|
|
35
|
+
nativeProps: {},
|
|
35
36
|
labeled: new _reactNative.Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
36
37
|
focused: false,
|
|
37
38
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -162,7 +163,9 @@ class TextField extends React.Component {
|
|
|
162
163
|
* @internal
|
|
163
164
|
*/
|
|
164
165
|
setNativeProps(args) {
|
|
165
|
-
|
|
166
|
+
this.setState(state => ({ ...state,
|
|
167
|
+
nativeState: args || {}
|
|
168
|
+
}));
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
isFocused() {
|
|
@@ -444,6 +447,7 @@ class TextField extends React.Component {
|
|
|
444
447
|
underlineColorAndroid: "transparent",
|
|
445
448
|
style: inputStyles,
|
|
446
449
|
...rest,
|
|
450
|
+
...this.state.nativeProps,
|
|
447
451
|
value: this.state.value
|
|
448
452
|
})), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
449
453
|
name: rightIconName,
|
|
@@ -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",
|
|
@@ -24,7 +24,7 @@ const SEED_DATA_PROPS = {
|
|
|
24
24
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
25
25
|
editable: true,
|
|
26
26
|
required: false,
|
|
27
|
-
defaultValue:
|
|
27
|
+
defaultValue: "none",
|
|
28
28
|
options: ["none", "sentences", "words", "characters"],
|
|
29
29
|
formType: _types.FORM_TYPES.flatArray,
|
|
30
30
|
propType: _types.PROP_TYPES.STRING
|
|
@@ -103,7 +103,7 @@ const SEED_DATA = [{
|
|
|
103
103
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
104
104
|
editable: true,
|
|
105
105
|
required: false,
|
|
106
|
-
defaultValue:
|
|
106
|
+
defaultValue: "none",
|
|
107
107
|
options: ["none", "sentences", "words", "characters"],
|
|
108
108
|
formType: _types.FORM_TYPES.flatArray,
|
|
109
109
|
propType: _types.PROP_TYPES.STRING
|
|
@@ -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
|
|
@@ -11,10 +11,14 @@ class Text extends React.Component {
|
|
|
11
11
|
super(...arguments);
|
|
12
12
|
|
|
13
13
|
_defineProperty(this, "_root", void 0);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "state", {
|
|
16
|
+
nativeProps: {}
|
|
17
|
+
});
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
setNativeProps(args) {
|
|
17
|
-
|
|
21
|
+
this.state.nativeProps = args || {};
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
render() {
|
|
@@ -23,7 +27,7 @@ class Text extends React.Component {
|
|
|
23
27
|
...rest
|
|
24
28
|
} = this.props;
|
|
25
29
|
const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
|
|
26
|
-
return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, {
|
|
30
|
+
return /*#__PURE__*/React.createElement(NativeText, _extends({}, rest, this.state.nativeProps, {
|
|
27
31
|
ref: c => {
|
|
28
32
|
this._root = c;
|
|
29
33
|
},
|
|
@@ -16,6 +16,7 @@ class TextField extends React.Component {
|
|
|
16
16
|
super(...arguments);
|
|
17
17
|
|
|
18
18
|
_defineProperty(this, "state", {
|
|
19
|
+
nativeProps: {},
|
|
19
20
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
20
21
|
focused: false,
|
|
21
22
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -146,7 +147,9 @@ class TextField extends React.Component {
|
|
|
146
147
|
* @internal
|
|
147
148
|
*/
|
|
148
149
|
setNativeProps(args) {
|
|
149
|
-
|
|
150
|
+
this.setState(state => ({ ...state,
|
|
151
|
+
nativeState: args || {}
|
|
152
|
+
}));
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
isFocused() {
|
|
@@ -426,6 +429,7 @@ class TextField extends React.Component {
|
|
|
426
429
|
underlineColorAndroid: "transparent",
|
|
427
430
|
style: inputStyles,
|
|
428
431
|
...rest,
|
|
432
|
+
...this.state.nativeProps,
|
|
429
433
|
value: this.state.value
|
|
430
434
|
})), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
431
435
|
name: rightIconName,
|
|
@@ -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",
|
|
@@ -16,7 +16,7 @@ const SEED_DATA_PROPS = {
|
|
|
16
16
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
17
17
|
editable: true,
|
|
18
18
|
required: false,
|
|
19
|
-
defaultValue:
|
|
19
|
+
defaultValue: "none",
|
|
20
20
|
options: ["none", "sentences", "words", "characters"],
|
|
21
21
|
formType: FORM_TYPES.flatArray,
|
|
22
22
|
propType: PROP_TYPES.STRING
|
|
@@ -94,7 +94,7 @@ export const SEED_DATA = [{
|
|
|
94
94
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
95
95
|
editable: true,
|
|
96
96
|
required: false,
|
|
97
|
-
defaultValue:
|
|
97
|
+
defaultValue: "none",
|
|
98
98
|
options: ["none", "sentences", "words", "characters"],
|
|
99
99
|
formType: FORM_TYPES.flatArray,
|
|
100
100
|
propType: PROP_TYPES.STRING
|
|
@@ -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;
|
|
@@ -6,7 +6,8 @@ declare type Props = {
|
|
|
6
6
|
} & TextProps;
|
|
7
7
|
declare class Text extends React.Component<Props> {
|
|
8
8
|
_root: any;
|
|
9
|
-
|
|
9
|
+
state: any;
|
|
10
|
+
setNativeProps(args: TextProps): void;
|
|
10
11
|
render(): JSX.Element;
|
|
11
12
|
}
|
|
12
13
|
export declare const BaseLink: ({ style, theme, title, ...props }: any) => JSX.Element;
|
|
@@ -27,6 +27,7 @@ export declare type Props = {
|
|
|
27
27
|
}) => React.ReactNode;
|
|
28
28
|
} & TextInputProps & IconSlot;
|
|
29
29
|
interface State {
|
|
30
|
+
nativeProps: any;
|
|
30
31
|
labeled: Animated.Value;
|
|
31
32
|
focused?: boolean;
|
|
32
33
|
placeholder?: string | undefined;
|
|
@@ -57,7 +58,7 @@ declare class TextField extends React.Component<Props, State> {
|
|
|
57
58
|
/**
|
|
58
59
|
* @internal
|
|
59
60
|
*/
|
|
60
|
-
setNativeProps(args: Props): void
|
|
61
|
+
setNativeProps(args: Props): void;
|
|
61
62
|
isFocused(): boolean | undefined;
|
|
62
63
|
clear(): void | undefined;
|
|
63
64
|
focus(): void | undefined;
|
|
@@ -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;
|
|
@@ -64,7 +64,7 @@ export declare const SEED_DATA: ({
|
|
|
64
64
|
description: string;
|
|
65
65
|
editable: boolean;
|
|
66
66
|
required: boolean;
|
|
67
|
-
defaultValue:
|
|
67
|
+
defaultValue: string;
|
|
68
68
|
options: string[];
|
|
69
69
|
formType: string;
|
|
70
70
|
propType: string;
|
|
@@ -371,7 +371,7 @@ export declare const SEED_DATA: ({
|
|
|
371
371
|
description: string;
|
|
372
372
|
editable: boolean;
|
|
373
373
|
required: boolean;
|
|
374
|
-
defaultValue:
|
|
374
|
+
defaultValue: string;
|
|
375
375
|
options: string[];
|
|
376
376
|
formType: string;
|
|
377
377
|
propType: 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-b0ea41.2+b0ea41d",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,8 +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-
|
|
45
|
-
"@expo/html-elements": "^0.2.0",
|
|
44
|
+
"@draftbit/types": "^46.4.4-b0ea41.2+b0ea41d",
|
|
46
45
|
"@material-ui/core": "^4.11.0",
|
|
47
46
|
"@material-ui/pickers": "^3.2.10",
|
|
48
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -82,5 +81,5 @@
|
|
|
82
81
|
]
|
|
83
82
|
]
|
|
84
83
|
},
|
|
85
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "b0ea41d429e4cf53d2c6e344789e11c79c488833"
|
|
86
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,
|