@draftbit/core 46.4.4-b0ea41.2 → 46.4.4-c1367a.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 +8 -18
- package/lib/commonjs/mappings/DatePicker.js +0 -13
- package/lib/commonjs/mappings/TextField.js +1 -1
- package/lib/commonjs/mappings/TextInput.js +1 -1
- package/lib/module/components/DatePicker/DatePicker.js +8 -17
- package/lib/module/mappings/DatePicker.js +1 -14
- 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 +0 -4
- package/lib/typescript/src/mappings/DatePicker.d.ts +0 -42
- package/lib/typescript/src/mappings/TextField.d.ts +2 -2
- package/lib/typescript/src/mappings/TextInput.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/DatePicker/DatePicker.js +8 -14
- package/src/components/DatePicker/DatePicker.tsx +7 -23
- package/src/mappings/DatePicker.js +1 -21
- package/src/mappings/DatePicker.ts +0 -23
- 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
|
@@ -21,8 +21,6 @@ var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
|
21
21
|
|
|
22
22
|
var _DatePickerComponent = _interopRequireDefault(require("./DatePickerComponent"));
|
|
23
23
|
|
|
24
|
-
var _utilities = require("../../utilities");
|
|
25
|
-
|
|
26
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
25
|
|
|
28
26
|
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); }
|
|
@@ -59,11 +57,7 @@ const DatePicker = _ref => {
|
|
|
59
57
|
rightIconName,
|
|
60
58
|
leftIconMode = "inset",
|
|
61
59
|
label,
|
|
62
|
-
labelSize,
|
|
63
|
-
labelColor,
|
|
64
60
|
placeholder,
|
|
65
|
-
borderColor: inputBorderColor,
|
|
66
|
-
borderColorActive: inputBorderColorActive,
|
|
67
61
|
...props
|
|
68
62
|
} = _ref;
|
|
69
63
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -80,9 +74,6 @@ const DatePicker = _ref => {
|
|
|
80
74
|
measured: false,
|
|
81
75
|
width: 0
|
|
82
76
|
});
|
|
83
|
-
const {
|
|
84
|
-
textStyles
|
|
85
|
-
} = (0, _utilities.extractStyles)(style);
|
|
86
77
|
|
|
87
78
|
const getValidDate = () => {
|
|
88
79
|
if (!value) {
|
|
@@ -184,8 +175,8 @@ const DatePicker = _ref => {
|
|
|
184
175
|
|
|
185
176
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
186
177
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
187
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
188
|
-
const MINIMIZED_LABEL_FONT_SIZE =
|
|
178
|
+
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
179
|
+
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
189
180
|
const hasActiveOutline = focused;
|
|
190
181
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
191
182
|
inputTextColor = colors.strong;
|
|
@@ -197,9 +188,9 @@ const DatePicker = _ref => {
|
|
|
197
188
|
underlineColor = "transparent";
|
|
198
189
|
backgroundColor = colors.divider;
|
|
199
190
|
} else {
|
|
200
|
-
activeColor =
|
|
201
|
-
placeholderColor = borderColor =
|
|
202
|
-
underlineColor =
|
|
191
|
+
activeColor = colors.primary;
|
|
192
|
+
placeholderColor = borderColor = colors.light;
|
|
193
|
+
underlineColor = colors.light;
|
|
203
194
|
backgroundColor = colors.background;
|
|
204
195
|
}
|
|
205
196
|
|
|
@@ -259,7 +250,6 @@ const DatePicker = _ref => {
|
|
|
259
250
|
};
|
|
260
251
|
const labelStyle = { ...typography.subtitle1,
|
|
261
252
|
top: type === "solid" ? 16 : 0,
|
|
262
|
-
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
263
253
|
left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
|
|
264
254
|
transform: [{
|
|
265
255
|
// Move label to top
|
|
@@ -283,7 +273,7 @@ const DatePicker = _ref => {
|
|
|
283
273
|
};
|
|
284
274
|
const inputStyles = [styles.input, inputStyle, type === "solid" ? {
|
|
285
275
|
marginHorizontal: 12
|
|
286
|
-
} : {}
|
|
276
|
+
} : {}]; // const render = (props) => <NativeTextInput {...props} />;
|
|
287
277
|
|
|
288
278
|
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
289
279
|
style: [styles.container, style]
|
|
@@ -329,7 +319,7 @@ const DatePicker = _ref => {
|
|
|
329
319
|
style: [styles.placeholder, type === "solid" ? {
|
|
330
320
|
paddingHorizontal: 12
|
|
331
321
|
} : {}, labelStyle, {
|
|
332
|
-
color:
|
|
322
|
+
color: colors.light,
|
|
333
323
|
opacity: labeled.interpolate({
|
|
334
324
|
inputRange: [0, 1],
|
|
335
325
|
outputRange: [hasActiveOutline ? 1 : 0, 0]
|
|
@@ -340,7 +330,7 @@ const DatePicker = _ref => {
|
|
|
340
330
|
style: [styles.placeholder, type === "solid" ? {
|
|
341
331
|
paddingHorizontal: 12
|
|
342
332
|
} : {}, labelStyle, {
|
|
343
|
-
color:
|
|
333
|
+
color: placeholderColor,
|
|
344
334
|
opacity: hasActiveOutline ? labeled : 1
|
|
345
335
|
}],
|
|
346
336
|
numberOfLines: 1
|
|
@@ -18,12 +18,6 @@ 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
|
-
}),
|
|
27
21
|
mode: {
|
|
28
22
|
label: "Mode",
|
|
29
23
|
description: "Choose between date, time and datetime",
|
|
@@ -35,12 +29,6 @@ const SEED_DATA_PROPS = {
|
|
|
35
29
|
options: ["date", "time", "datetime"],
|
|
36
30
|
group: _types.GROUPS.basic
|
|
37
31
|
},
|
|
38
|
-
borderColor: (0, _types.createColorProp)({
|
|
39
|
-
label: "Border Color"
|
|
40
|
-
}),
|
|
41
|
-
borderColorActive: (0, _types.createColorProp)({
|
|
42
|
-
label: "Border Color"
|
|
43
|
-
}),
|
|
44
32
|
format: {
|
|
45
33
|
label: "Format",
|
|
46
34
|
description: "Create an output format for the date.",
|
|
@@ -157,7 +145,6 @@ const SEED_DATA = [{
|
|
|
157
145
|
category: _types.COMPONENT_TYPES.input,
|
|
158
146
|
layout: null,
|
|
159
147
|
triggers: [_types.Triggers.OnDateChange],
|
|
160
|
-
StylesPanelSections: [_types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Size, _types.StylesPanelSections.Typography],
|
|
161
148
|
props: { ...SEED_DATA_PROPS,
|
|
162
149
|
type: {
|
|
163
150
|
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: null,
|
|
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: null,
|
|
107
107
|
options: ["none", "sentences", "words", "characters"],
|
|
108
108
|
formType: _types.FORM_TYPES.flatArray,
|
|
109
109
|
propType: _types.PROP_TYPES.STRING
|
|
@@ -8,7 +8,6 @@ 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";
|
|
12
11
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
13
12
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
14
13
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -36,11 +35,7 @@ const DatePicker = _ref => {
|
|
|
36
35
|
rightIconName,
|
|
37
36
|
leftIconMode = "inset",
|
|
38
37
|
label,
|
|
39
|
-
labelSize,
|
|
40
|
-
labelColor,
|
|
41
38
|
placeholder,
|
|
42
|
-
borderColor: inputBorderColor,
|
|
43
|
-
borderColorActive: inputBorderColorActive,
|
|
44
39
|
...props
|
|
45
40
|
} = _ref;
|
|
46
41
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -57,9 +52,6 @@ const DatePicker = _ref => {
|
|
|
57
52
|
measured: false,
|
|
58
53
|
width: 0
|
|
59
54
|
});
|
|
60
|
-
const {
|
|
61
|
-
textStyles
|
|
62
|
-
} = extractStyles(style);
|
|
63
55
|
|
|
64
56
|
const getValidDate = () => {
|
|
65
57
|
if (!value) {
|
|
@@ -161,8 +153,8 @@ const DatePicker = _ref => {
|
|
|
161
153
|
|
|
162
154
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
163
155
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
164
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
165
|
-
const MINIMIZED_LABEL_FONT_SIZE =
|
|
156
|
+
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
157
|
+
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
166
158
|
const hasActiveOutline = focused;
|
|
167
159
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
168
160
|
inputTextColor = colors.strong;
|
|
@@ -174,9 +166,9 @@ const DatePicker = _ref => {
|
|
|
174
166
|
underlineColor = "transparent";
|
|
175
167
|
backgroundColor = colors.divider;
|
|
176
168
|
} else {
|
|
177
|
-
activeColor =
|
|
178
|
-
placeholderColor = borderColor =
|
|
179
|
-
underlineColor =
|
|
169
|
+
activeColor = colors.primary;
|
|
170
|
+
placeholderColor = borderColor = colors.light;
|
|
171
|
+
underlineColor = colors.light;
|
|
180
172
|
backgroundColor = colors.background;
|
|
181
173
|
}
|
|
182
174
|
|
|
@@ -236,7 +228,6 @@ const DatePicker = _ref => {
|
|
|
236
228
|
};
|
|
237
229
|
const labelStyle = { ...typography.subtitle1,
|
|
238
230
|
top: type === "solid" ? 16 : 0,
|
|
239
|
-
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
240
231
|
left: leftIconName && leftIconMode === "inset" ? ICON_SIZE + (type === "solid" ? 16 : 12) : 0,
|
|
241
232
|
transform: [{
|
|
242
233
|
// Move label to top
|
|
@@ -260,7 +251,7 @@ const DatePicker = _ref => {
|
|
|
260
251
|
};
|
|
261
252
|
const inputStyles = [styles.input, inputStyle, type === "solid" ? {
|
|
262
253
|
marginHorizontal: 12
|
|
263
|
-
} : {}
|
|
254
|
+
} : {}]; // const render = (props) => <NativeTextInput {...props} />;
|
|
264
255
|
|
|
265
256
|
return /*#__PURE__*/React.createElement(View, {
|
|
266
257
|
style: [styles.container, style]
|
|
@@ -306,7 +297,7 @@ const DatePicker = _ref => {
|
|
|
306
297
|
style: [styles.placeholder, type === "solid" ? {
|
|
307
298
|
paddingHorizontal: 12
|
|
308
299
|
} : {}, labelStyle, {
|
|
309
|
-
color:
|
|
300
|
+
color: colors.light,
|
|
310
301
|
opacity: labeled.interpolate({
|
|
311
302
|
inputRange: [0, 1],
|
|
312
303
|
outputRange: [hasActiveOutline ? 1 : 0, 0]
|
|
@@ -317,7 +308,7 @@ const DatePicker = _ref => {
|
|
|
317
308
|
style: [styles.placeholder, type === "solid" ? {
|
|
318
309
|
paddingHorizontal: 12
|
|
319
310
|
} : {}, labelStyle, {
|
|
320
|
-
color:
|
|
311
|
+
color: placeholderColor,
|
|
321
312
|
opacity: hasActiveOutline ? labeled : 1
|
|
322
313
|
}],
|
|
323
314
|
numberOfLines: 1
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -10,12 +10,6 @@ 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
|
-
}),
|
|
19
13
|
mode: {
|
|
20
14
|
label: "Mode",
|
|
21
15
|
description: "Choose between date, time and datetime",
|
|
@@ -27,12 +21,6 @@ const SEED_DATA_PROPS = {
|
|
|
27
21
|
options: ["date", "time", "datetime"],
|
|
28
22
|
group: GROUPS.basic
|
|
29
23
|
},
|
|
30
|
-
borderColor: createColorProp({
|
|
31
|
-
label: "Border Color"
|
|
32
|
-
}),
|
|
33
|
-
borderColorActive: createColorProp({
|
|
34
|
-
label: "Border Color"
|
|
35
|
-
}),
|
|
36
24
|
format: {
|
|
37
25
|
label: "Format",
|
|
38
26
|
description: "Create an output format for the date.",
|
|
@@ -149,7 +137,6 @@ export const SEED_DATA = [{
|
|
|
149
137
|
category: COMPONENT_TYPES.input,
|
|
150
138
|
layout: null,
|
|
151
139
|
triggers: [Triggers.OnDateChange],
|
|
152
|
-
StylesPanelSections: [StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Size, StylesPanelSections.Typography],
|
|
153
140
|
props: { ...SEED_DATA_PROPS,
|
|
154
141
|
type: {
|
|
155
142
|
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: null,
|
|
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: null,
|
|
98
98
|
options: ["none", "sentences", "words", "characters"],
|
|
99
99
|
formType: FORM_TYPES.flatArray,
|
|
100
100
|
propType: PROP_TYPES.STRING
|
|
@@ -15,14 +15,10 @@ declare type Props = {
|
|
|
15
15
|
mode?: "date" | "time" | "datetime";
|
|
16
16
|
type?: "solid" | "underline";
|
|
17
17
|
label?: string;
|
|
18
|
-
labelSize?: number;
|
|
19
|
-
labelColor: string;
|
|
20
18
|
placeholder?: string;
|
|
21
19
|
leftIconName?: string;
|
|
22
20
|
leftIconMode?: "outset" | "inset";
|
|
23
21
|
rightIconName?: string;
|
|
24
|
-
borderColor?: string;
|
|
25
|
-
borderColorActive?: string;
|
|
26
22
|
} & IconSlot & TextInputProps;
|
|
27
23
|
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
|
|
28
24
|
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
@@ -5,7 +5,6 @@ export declare const SEED_DATA: {
|
|
|
5
5
|
category: string;
|
|
6
6
|
layout: null;
|
|
7
7
|
triggers: string[];
|
|
8
|
-
StylesPanelSections: string[];
|
|
9
8
|
props: {
|
|
10
9
|
type: {
|
|
11
10
|
label: string;
|
|
@@ -28,27 +27,6 @@ export declare const SEED_DATA: {
|
|
|
28
27
|
required: boolean;
|
|
29
28
|
group: string;
|
|
30
29
|
};
|
|
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
|
-
};
|
|
52
30
|
mode: {
|
|
53
31
|
label: string;
|
|
54
32
|
description: string;
|
|
@@ -60,26 +38,6 @@ export declare const SEED_DATA: {
|
|
|
60
38
|
options: string[];
|
|
61
39
|
group: string;
|
|
62
40
|
};
|
|
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
|
-
};
|
|
83
41
|
format: {
|
|
84
42
|
label: string;
|
|
85
43
|
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: null;
|
|
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: null;
|
|
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-c1367a.2+c1367a9",
|
|
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-c1367a.2+c1367a9",
|
|
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",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
]
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "c1367a942e231a529a36a27e7fefb251a58c4910"
|
|
85
85
|
}
|
|
@@ -6,7 +6,6 @@ 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";
|
|
10
9
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
11
10
|
const FOCUS_ANIMATION_DURATION = 150;
|
|
12
11
|
const BLUR_ANIMATION_DURATION = 180;
|
|
@@ -25,7 +24,7 @@ const MONTHS = [
|
|
|
25
24
|
"November",
|
|
26
25
|
"December",
|
|
27
26
|
];
|
|
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,
|
|
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 }) => {
|
|
29
28
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
30
29
|
React.useEffect(() => {
|
|
31
30
|
if (defaultValue != null) {
|
|
@@ -37,7 +36,6 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
37
36
|
const [placeholder1, setPlaceholder1] = React.useState("");
|
|
38
37
|
const [focused, setFocused] = React.useState(false);
|
|
39
38
|
const [labelLayout, setLabelLayout] = React.useState({ measured: false, width: 0 });
|
|
40
|
-
const { textStyles } = extractStyles(style);
|
|
41
39
|
const getValidDate = () => {
|
|
42
40
|
if (!value) {
|
|
43
41
|
return new Date();
|
|
@@ -127,10 +125,8 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
127
125
|
};
|
|
128
126
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
129
127
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
130
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
131
|
-
const MINIMIZED_LABEL_FONT_SIZE =
|
|
132
|
-
? labelSize
|
|
133
|
-
: typography.caption.fontSize;
|
|
128
|
+
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
129
|
+
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
134
130
|
const hasActiveOutline = focused;
|
|
135
131
|
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
136
132
|
inputTextColor = colors.strong;
|
|
@@ -142,9 +138,9 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
142
138
|
backgroundColor = colors.divider;
|
|
143
139
|
}
|
|
144
140
|
else {
|
|
145
|
-
activeColor =
|
|
146
|
-
placeholderColor = borderColor =
|
|
147
|
-
underlineColor =
|
|
141
|
+
activeColor = colors.primary;
|
|
142
|
+
placeholderColor = borderColor = colors.light;
|
|
143
|
+
underlineColor = colors.light;
|
|
148
144
|
backgroundColor = colors.background;
|
|
149
145
|
}
|
|
150
146
|
const { lineHeight, ...subtitle1 } = typography.subtitle1;
|
|
@@ -206,7 +202,6 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
206
202
|
const labelStyle = {
|
|
207
203
|
...typography.subtitle1,
|
|
208
204
|
top: type === "solid" ? 16 : 0,
|
|
209
|
-
fontFamily: textStyles === null || textStyles === void 0 ? void 0 : textStyles.fontFamily,
|
|
210
205
|
left: leftIconName && leftIconMode === "inset"
|
|
211
206
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
212
207
|
: 0,
|
|
@@ -250,7 +245,6 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
250
245
|
styles.input,
|
|
251
246
|
inputStyle,
|
|
252
247
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
253
|
-
textStyles,
|
|
254
248
|
];
|
|
255
249
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
256
250
|
return (React.createElement(View, { style: [styles.container, style] },
|
|
@@ -288,7 +282,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
288
282
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
289
283
|
labelStyle,
|
|
290
284
|
{
|
|
291
|
-
color:
|
|
285
|
+
color: colors.light,
|
|
292
286
|
opacity: labeled.interpolate({
|
|
293
287
|
inputRange: [0, 1],
|
|
294
288
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -300,7 +294,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
300
294
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
301
295
|
labelStyle,
|
|
302
296
|
{
|
|
303
|
-
color:
|
|
297
|
+
color: placeholderColor,
|
|
304
298
|
opacity: hasActiveOutline ? labeled : 1,
|
|
305
299
|
},
|
|
306
300
|
], numberOfLines: 1 }, label))) : null,
|
|
@@ -23,7 +23,6 @@ import DateTimePicker from "./DatePickerComponent";
|
|
|
23
23
|
|
|
24
24
|
import type { Theme } from "../../styles/DefaultTheme";
|
|
25
25
|
import type { IconSlot } from "../../interfaces/Icon";
|
|
26
|
-
import { extractStyles } from "../../utilities";
|
|
27
26
|
|
|
28
27
|
const AnimatedText = Animated.createAnimatedComponent(Text);
|
|
29
28
|
|
|
@@ -48,14 +47,10 @@ type Props = {
|
|
|
48
47
|
mode?: "date" | "time" | "datetime";
|
|
49
48
|
type?: "solid" | "underline";
|
|
50
49
|
label?: string;
|
|
51
|
-
labelSize?: number;
|
|
52
|
-
labelColor: string;
|
|
53
50
|
placeholder?: string;
|
|
54
51
|
leftIconName?: string;
|
|
55
52
|
leftIconMode?: "outset" | "inset";
|
|
56
53
|
rightIconName?: string;
|
|
57
|
-
borderColor?: string;
|
|
58
|
-
borderColorActive?: string;
|
|
59
54
|
} & IconSlot &
|
|
60
55
|
TextInputProps;
|
|
61
56
|
|
|
@@ -89,11 +84,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
89
84
|
rightIconName,
|
|
90
85
|
leftIconMode = "inset",
|
|
91
86
|
label,
|
|
92
|
-
labelSize,
|
|
93
|
-
labelColor,
|
|
94
87
|
placeholder,
|
|
95
|
-
borderColor: inputBorderColor,
|
|
96
|
-
borderColorActive: inputBorderColorActive,
|
|
97
88
|
...props
|
|
98
89
|
}) => {
|
|
99
90
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -115,8 +106,6 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
115
106
|
width: number;
|
|
116
107
|
}>({ measured: false, width: 0 });
|
|
117
108
|
|
|
118
|
-
const { textStyles } = extractStyles(style);
|
|
119
|
-
|
|
120
109
|
const getValidDate = (): Date => {
|
|
121
110
|
if (!value) {
|
|
122
111
|
return new Date();
|
|
@@ -222,11 +211,8 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
222
211
|
|
|
223
212
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
224
213
|
const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -(16 * 0.5 + 4);
|
|
225
|
-
const MAXIMIZED_LABEL_FONT_SIZE =
|
|
226
|
-
|
|
227
|
-
const MINIMIZED_LABEL_FONT_SIZE = labelSize
|
|
228
|
-
? labelSize
|
|
229
|
-
: typography.caption.fontSize;
|
|
214
|
+
const MAXIMIZED_LABEL_FONT_SIZE = typography.subtitle1.fontSize;
|
|
215
|
+
const MINIMIZED_LABEL_FONT_SIZE = typography.caption.fontSize;
|
|
230
216
|
|
|
231
217
|
const hasActiveOutline = focused;
|
|
232
218
|
|
|
@@ -247,9 +233,9 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
247
233
|
underlineColor = "transparent";
|
|
248
234
|
backgroundColor = colors.divider;
|
|
249
235
|
} else {
|
|
250
|
-
activeColor =
|
|
251
|
-
placeholderColor = borderColor =
|
|
252
|
-
underlineColor =
|
|
236
|
+
activeColor = colors.primary;
|
|
237
|
+
placeholderColor = borderColor = colors.light;
|
|
238
|
+
underlineColor = colors.light;
|
|
253
239
|
backgroundColor = colors.background;
|
|
254
240
|
}
|
|
255
241
|
|
|
@@ -320,7 +306,6 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
320
306
|
const labelStyle = {
|
|
321
307
|
...typography.subtitle1,
|
|
322
308
|
top: type === "solid" ? 16 : 0,
|
|
323
|
-
fontFamily: textStyles?.fontFamily,
|
|
324
309
|
left:
|
|
325
310
|
leftIconName && leftIconMode === "inset"
|
|
326
311
|
? ICON_SIZE + (type === "solid" ? 16 : 12)
|
|
@@ -366,7 +351,6 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
366
351
|
styles.input,
|
|
367
352
|
inputStyle,
|
|
368
353
|
type === "solid" ? { marginHorizontal: 12 } : {},
|
|
369
|
-
textStyles,
|
|
370
354
|
];
|
|
371
355
|
|
|
372
356
|
// const render = (props) => <NativeTextInput {...props} />;
|
|
@@ -422,7 +406,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
422
406
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
423
407
|
labelStyle,
|
|
424
408
|
{
|
|
425
|
-
color:
|
|
409
|
+
color: colors.light,
|
|
426
410
|
opacity: labeled.interpolate({
|
|
427
411
|
inputRange: [0, 1],
|
|
428
412
|
outputRange: [hasActiveOutline ? 1 : 0, 0],
|
|
@@ -439,7 +423,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
439
423
|
type === "solid" ? { paddingHorizontal: 12 } : {},
|
|
440
424
|
labelStyle,
|
|
441
425
|
{
|
|
442
|
-
color:
|
|
426
|
+
color: placeholderColor,
|
|
443
427
|
opacity: hasActiveOutline ? labeled : 1,
|
|
444
428
|
},
|
|
445
429
|
]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers,
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
label: "Label",
|
|
@@ -10,12 +10,6 @@ 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
|
-
}),
|
|
19
13
|
mode: {
|
|
20
14
|
label: "Mode",
|
|
21
15
|
description: "Choose between date, time and datetime",
|
|
@@ -27,12 +21,6 @@ const SEED_DATA_PROPS = {
|
|
|
27
21
|
options: ["date", "time", "datetime"],
|
|
28
22
|
group: GROUPS.basic,
|
|
29
23
|
},
|
|
30
|
-
borderColor: createColorProp({
|
|
31
|
-
label: "Border Color",
|
|
32
|
-
}),
|
|
33
|
-
borderColorActive: createColorProp({
|
|
34
|
-
label: "Border Color",
|
|
35
|
-
}),
|
|
36
24
|
format: {
|
|
37
25
|
label: "Format",
|
|
38
26
|
description: "Create an output format for the date.",
|
|
@@ -151,14 +139,6 @@ export const SEED_DATA = [
|
|
|
151
139
|
category: COMPONENT_TYPES.input,
|
|
152
140
|
layout: null,
|
|
153
141
|
triggers: [Triggers.OnDateChange],
|
|
154
|
-
StylesPanelSections: [
|
|
155
|
-
StylesPanelSections.Background,
|
|
156
|
-
StylesPanelSections.Borders,
|
|
157
|
-
StylesPanelSections.MarginsAndPaddings,
|
|
158
|
-
StylesPanelSections.Position,
|
|
159
|
-
StylesPanelSections.Size,
|
|
160
|
-
StylesPanelSections.Typography,
|
|
161
|
-
],
|
|
162
142
|
props: {
|
|
163
143
|
...SEED_DATA_PROPS,
|
|
164
144
|
type: {
|
|
@@ -5,9 +5,6 @@ import {
|
|
|
5
5
|
FIELD_NAME,
|
|
6
6
|
GROUPS,
|
|
7
7
|
Triggers,
|
|
8
|
-
StylesPanelSections,
|
|
9
|
-
createNumberProp,
|
|
10
|
-
createColorProp,
|
|
11
8
|
} from "@draftbit/types";
|
|
12
9
|
|
|
13
10
|
const SEED_DATA_PROPS = {
|
|
@@ -21,12 +18,6 @@ const SEED_DATA_PROPS = {
|
|
|
21
18
|
required: true,
|
|
22
19
|
group: GROUPS.data,
|
|
23
20
|
},
|
|
24
|
-
labelSize: createNumberProp({
|
|
25
|
-
label: "Label Size",
|
|
26
|
-
}),
|
|
27
|
-
labelColor: createColorProp({
|
|
28
|
-
label: "Label Color",
|
|
29
|
-
}),
|
|
30
21
|
mode: {
|
|
31
22
|
label: "Mode",
|
|
32
23
|
description: "Choose between date, time and datetime",
|
|
@@ -38,12 +29,6 @@ const SEED_DATA_PROPS = {
|
|
|
38
29
|
options: ["date", "time", "datetime"],
|
|
39
30
|
group: GROUPS.basic,
|
|
40
31
|
},
|
|
41
|
-
borderColor: createColorProp({
|
|
42
|
-
label: "Border Color",
|
|
43
|
-
}),
|
|
44
|
-
borderColorActive: createColorProp({
|
|
45
|
-
label: "Border Color",
|
|
46
|
-
}),
|
|
47
32
|
format: {
|
|
48
33
|
label: "Format",
|
|
49
34
|
description: "Create an output format for the date.",
|
|
@@ -165,14 +150,6 @@ export const SEED_DATA = [
|
|
|
165
150
|
category: COMPONENT_TYPES.input,
|
|
166
151
|
layout: null,
|
|
167
152
|
triggers: [Triggers.OnDateChange],
|
|
168
|
-
StylesPanelSections: [
|
|
169
|
-
StylesPanelSections.Background,
|
|
170
|
-
StylesPanelSections.Borders,
|
|
171
|
-
StylesPanelSections.MarginsAndPaddings,
|
|
172
|
-
StylesPanelSections.Position,
|
|
173
|
-
StylesPanelSections.Size,
|
|
174
|
-
StylesPanelSections.Typography,
|
|
175
|
-
],
|
|
176
153
|
props: {
|
|
177
154
|
...SEED_DATA_PROPS,
|
|
178
155
|
type: {
|
|
@@ -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: null,
|
|
20
20
|
options: ["none", "sentences", "words", "characters"],
|
|
21
21
|
formType: FORM_TYPES.flatArray,
|
|
22
22
|
propType: PROP_TYPES.STRING,
|
|
@@ -30,7 +30,7 @@ const SEED_DATA_PROPS = {
|
|
|
30
30
|
"Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
31
31
|
editable: true,
|
|
32
32
|
required: false,
|
|
33
|
-
defaultValue:
|
|
33
|
+
defaultValue: null,
|
|
34
34
|
options: ["none", "sentences", "words", "characters"],
|
|
35
35
|
formType: FORM_TYPES.flatArray,
|
|
36
36
|
propType: PROP_TYPES.STRING,
|
|
@@ -104,7 +104,7 @@ export const SEED_DATA = [
|
|
|
104
104
|
description: "Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
105
105
|
editable: true,
|
|
106
106
|
required: false,
|
|
107
|
-
defaultValue:
|
|
107
|
+
defaultValue: null,
|
|
108
108
|
options: ["none", "sentences", "words", "characters"],
|
|
109
109
|
formType: FORM_TYPES.flatArray,
|
|
110
110
|
propType: PROP_TYPES.STRING,
|
|
@@ -121,7 +121,7 @@ export const SEED_DATA = [
|
|
|
121
121
|
"Can automatically capitalize sentences, words, and characters (Default: none).",
|
|
122
122
|
editable: true,
|
|
123
123
|
required: false,
|
|
124
|
-
defaultValue:
|
|
124
|
+
defaultValue: null,
|
|
125
125
|
options: ["none", "sentences", "words", "characters"],
|
|
126
126
|
formType: FORM_TYPES.flatArray,
|
|
127
127
|
propType: PROP_TYPES.STRING,
|